@steedos-widgets/amis-lib 6.3.0-beta.16 → 6.3.0-beta.18
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +901 -348
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +901 -348
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +256 -244
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +9 -21
- package/dist/types/lib/converter/amis/fields/file.d.ts +82 -14
- package/dist/types/lib/converter/amis/header.d.ts +9 -21
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1156,6 +1156,29 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
|
|
1159
|
+
/*
|
|
1160
|
+
* @Author: baozhoutao@steedos.com
|
|
1161
|
+
* @Date: 2022-07-13 15:18:03
|
|
1162
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
1163
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
1164
|
+
* @Description:
|
|
1165
|
+
*/
|
|
1166
|
+
|
|
1167
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
1168
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
1169
|
+
const page = await fetchAPI(api);
|
|
1170
|
+
if (page && page.schema) {
|
|
1171
|
+
page.schema = JSON.parse(page.schema);
|
|
1172
|
+
if(page.schema.data){
|
|
1173
|
+
delete page.schema.data.recordId;
|
|
1174
|
+
delete page.schema.data.objectName;
|
|
1175
|
+
delete page.schema.data.context;
|
|
1176
|
+
delete page.schema.data.global;
|
|
1177
|
+
}
|
|
1178
|
+
return page;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1159
1182
|
/*
|
|
1160
1183
|
* @Author: baozhoutao@steedos.com
|
|
1161
1184
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -1179,9 +1202,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
|
|
|
1179
1202
|
return getAmisStaticFieldType(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
1180
1203
|
};
|
|
1181
1204
|
|
|
1182
|
-
|
|
1205
|
+
async function getLookupLinkOnClick(field, options) {
|
|
1206
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
1207
|
+
|
|
1208
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
1209
|
+
"recordId": "${value}",
|
|
1210
|
+
"data": {
|
|
1211
|
+
...recordPage.schema.data,
|
|
1212
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
1213
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
1214
|
+
"objectName": options.objectName,
|
|
1215
|
+
}
|
|
1216
|
+
}) : {
|
|
1217
|
+
"type": "steedos-record-detail",
|
|
1218
|
+
"objectApiName": options.objectName,
|
|
1219
|
+
"recordId": "${value}",
|
|
1220
|
+
"showBackButton": false,
|
|
1221
|
+
"showButtons": true,
|
|
1222
|
+
"data": {
|
|
1223
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
1224
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
return {
|
|
1228
|
+
"click": {
|
|
1229
|
+
"actions": [
|
|
1230
|
+
// {
|
|
1231
|
+
// "type": "custom",
|
|
1232
|
+
// "script": `
|
|
1233
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
1234
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
1235
|
+
// event.data.recordId = fileRecordId;
|
|
1236
|
+
// `,
|
|
1237
|
+
// },
|
|
1238
|
+
{
|
|
1239
|
+
"actionType": "drawer",
|
|
1240
|
+
"drawer": {
|
|
1241
|
+
"type": "drawer",
|
|
1242
|
+
"title": " ",
|
|
1243
|
+
"headerClassName": "hidden",
|
|
1244
|
+
"size": "lg",
|
|
1245
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
1246
|
+
"closeOnEsc": true,
|
|
1247
|
+
"closeOnOutside": true,
|
|
1248
|
+
"resizable": true,
|
|
1249
|
+
"actions": [],
|
|
1250
|
+
"body": [
|
|
1251
|
+
drawerRecordDetailSchema
|
|
1252
|
+
],
|
|
1253
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
1254
|
+
},
|
|
1255
|
+
"preventDefault": true
|
|
1256
|
+
}
|
|
1257
|
+
]
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx)=>{
|
|
1183
1263
|
const type = steedosField.type;
|
|
1264
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
1184
1265
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
1266
|
+
|
|
1267
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
1268
|
+
|
|
1269
|
+
if(window.innerWidth < 768){
|
|
1270
|
+
lookupATagClick = "";
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1185
1273
|
if(_.includes(['avatar','image'], type)){
|
|
1186
1274
|
return {
|
|
1187
1275
|
type: amisFieldType,
|
|
@@ -1216,13 +1304,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
1216
1304
|
}
|
|
1217
1305
|
}
|
|
1218
1306
|
} : {
|
|
1219
|
-
type: amisFieldType,
|
|
1220
|
-
tpl: `
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1307
|
+
// type: amisFieldType,
|
|
1308
|
+
// tpl: `
|
|
1309
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
1310
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
1311
|
+
// <% fileData.forEach(function(item) { %>
|
|
1312
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
1313
|
+
// <% });} %>`
|
|
1314
|
+
"type": "control",
|
|
1315
|
+
"body": {
|
|
1316
|
+
type: 'each',
|
|
1317
|
+
placeholder: "",
|
|
1318
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
1319
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
1320
|
+
items: {
|
|
1321
|
+
type: 'static',
|
|
1322
|
+
labelClassName: "hidden",
|
|
1323
|
+
label: false,
|
|
1324
|
+
className: 'm-0',
|
|
1325
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
|
|
1326
|
+
// tpl: "<%= item.name >",
|
|
1327
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
1328
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick(steedosField, {
|
|
1329
|
+
appId,
|
|
1330
|
+
objectName: "cfs_files_filerecord",
|
|
1331
|
+
formFactor
|
|
1332
|
+
})
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1226
1335
|
}
|
|
1227
1336
|
}
|
|
1228
1337
|
};
|
|
@@ -1284,8 +1393,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1284
1393
|
return convertData;
|
|
1285
1394
|
};
|
|
1286
1395
|
|
|
1287
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
1288
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
1396
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
1397
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
1289
1398
|
};
|
|
1290
1399
|
|
|
1291
1400
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -1680,29 +1789,6 @@ i18next
|
|
|
1680
1789
|
}
|
|
1681
1790
|
});
|
|
1682
1791
|
|
|
1683
|
-
/*
|
|
1684
|
-
* @Author: baozhoutao@steedos.com
|
|
1685
|
-
* @Date: 2022-07-13 15:18:03
|
|
1686
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
1687
|
-
* @LastEditTime: 2023-04-11 10:34:26
|
|
1688
|
-
* @Description:
|
|
1689
|
-
*/
|
|
1690
|
-
|
|
1691
|
-
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
1692
|
-
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
1693
|
-
const page = await fetchAPI(api);
|
|
1694
|
-
if (page && page.schema) {
|
|
1695
|
-
page.schema = JSON.parse(page.schema);
|
|
1696
|
-
if(page.schema.data){
|
|
1697
|
-
delete page.schema.data.recordId;
|
|
1698
|
-
delete page.schema.data.objectName;
|
|
1699
|
-
delete page.schema.data.context;
|
|
1700
|
-
delete page.schema.data.global;
|
|
1701
|
-
}
|
|
1702
|
-
return page;
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
1792
|
async function getQuickEditSchema(object, columnField, options){
|
|
1707
1793
|
let field = object.fields[columnField.name];
|
|
1708
1794
|
//判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
|
|
@@ -5707,21 +5793,16 @@ const getDropdown = (dropdownButtons)=>{
|
|
|
5707
5793
|
"hideCaret": true,
|
|
5708
5794
|
"className": "mr-0 steedos-mobile-header-drop-down",
|
|
5709
5795
|
"closeOnClick": true,
|
|
5710
|
-
"menuClassName": "buttons-drawer fixed
|
|
5796
|
+
"menuClassName": "buttons-drawer fixed bg-none border-0 shadow-none",
|
|
5711
5797
|
"align": "right",
|
|
5712
5798
|
"body": [
|
|
5713
5799
|
{
|
|
5714
5800
|
"type": "action",
|
|
5715
5801
|
"style": {
|
|
5716
|
-
"position": "fixed",
|
|
5717
|
-
"top": 0,
|
|
5718
|
-
"right": 0,
|
|
5719
|
-
"bottom": 0,
|
|
5720
|
-
"left": 0,
|
|
5721
5802
|
"z-index": 1,
|
|
5722
5803
|
"background": "var(--Drawer-overlay-bg)",
|
|
5723
|
-
"height": "
|
|
5724
|
-
"width": "
|
|
5804
|
+
"height": "100%",
|
|
5805
|
+
"width": "100%",
|
|
5725
5806
|
"padding": "0",
|
|
5726
5807
|
"margin": "0",
|
|
5727
5808
|
"border-radius": "0"
|
|
@@ -6515,103 +6596,785 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6515
6596
|
};
|
|
6516
6597
|
}
|
|
6517
6598
|
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
each(
|
|
6528
|
-
objectSchema.list_views,
|
|
6529
|
-
(listView, name) => {
|
|
6530
|
-
if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
|
|
6531
|
-
// 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
6532
|
-
return;
|
|
6533
|
-
}
|
|
6534
|
-
listViewButtonOptions.push({
|
|
6535
|
-
type: "button",
|
|
6536
|
-
label: listView.label,
|
|
6537
|
-
actionType: "link",
|
|
6538
|
-
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
6539
|
-
});
|
|
6540
|
-
}
|
|
6541
|
-
);
|
|
6542
|
-
|
|
6543
|
-
let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
|
|
6544
|
-
const reg = new RegExp('_', 'g');
|
|
6545
|
-
const standardIcon = icon && icon.replace(reg, '-');
|
|
6546
|
-
const standardNewButton = _.find(amisButtonsSchema, { name: "standard_new" });
|
|
6547
|
-
const buttonSchema = [{
|
|
6548
|
-
"type": "flex",
|
|
6549
|
-
"items": amisButtonsSchema,
|
|
6550
|
-
"visibleOn": "${display == 'split'?false:true}"
|
|
6551
|
-
}];
|
|
6552
|
-
if(ctx.formFactor !== 'SMALL'){
|
|
6553
|
-
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
6554
|
-
buttonSchema.push({
|
|
6555
|
-
"type": "flex",
|
|
6556
|
-
"items":[
|
|
6557
|
-
standardNewButton,
|
|
6558
|
-
(restButtons.length > 0) && {
|
|
6559
|
-
"type": "dropdown-button",
|
|
6560
|
-
"buttons": restButtons,
|
|
6561
|
-
"className": " ml-1",
|
|
6562
|
-
"menuClassName": "p-none split-dropdown-buttons",
|
|
6563
|
-
"align": "right",
|
|
6564
|
-
"size": "sm"
|
|
6565
|
-
}
|
|
6566
|
-
],
|
|
6567
|
-
"visibleOn": "${display == 'split'?true:false}"
|
|
6568
|
-
});
|
|
6569
|
-
}
|
|
6570
|
-
return {
|
|
6571
|
-
"type": "grid",
|
|
6572
|
-
"columns": [
|
|
6573
|
-
{
|
|
6574
|
-
"body": [
|
|
6575
|
-
{
|
|
6576
|
-
"type": "grid",
|
|
6577
|
-
"columns": [
|
|
6578
|
-
{
|
|
6579
|
-
"body": {
|
|
6580
|
-
"type": "tpl",
|
|
6581
|
-
"className": "block",
|
|
6582
|
-
"tpl":`<svg class="slds-icon slds-icon_container slds-icon-standard-${standardIcon} slds-page-header__icon" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
6583
|
-
},
|
|
6584
|
-
"md": "auto",
|
|
6585
|
-
"className": "",
|
|
6586
|
-
"columnClassName": "flex justify-center items-center",
|
|
6587
|
-
"valign": "middle",
|
|
6588
|
-
},
|
|
6599
|
+
const getNewListviewButtonSchema = ()=>{
|
|
6600
|
+
return {
|
|
6601
|
+
"type": "button",
|
|
6602
|
+
"label": i18next.t('frontend_listview_control_new_label'),
|
|
6603
|
+
"className": "steedos-listview-new-button",
|
|
6604
|
+
"onEvent": {
|
|
6605
|
+
"click": {
|
|
6606
|
+
"weight": 0,
|
|
6607
|
+
"actions": [
|
|
6589
6608
|
{
|
|
6590
|
-
"
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
"
|
|
6595
|
-
"
|
|
6596
|
-
"
|
|
6609
|
+
"dialog": {
|
|
6610
|
+
"type": "dialog",
|
|
6611
|
+
"title": i18next.t('frontend_listview_control_new_title'),
|
|
6612
|
+
"data": {
|
|
6613
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
6614
|
+
"all": "${uiSchema.list_views.all}",
|
|
6615
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
6616
|
+
"appId": "${appId}",
|
|
6617
|
+
"global": "${global}",
|
|
6618
|
+
"targetObjectName": "${objectName}",
|
|
6619
|
+
"context": "${context}"
|
|
6597
6620
|
},
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6621
|
+
"body": [
|
|
6622
|
+
{
|
|
6623
|
+
"type": "steedos-object-form",
|
|
6624
|
+
"label": "对象表单",
|
|
6625
|
+
"objectApiName": "object_listviews",
|
|
6626
|
+
"recordId": "",
|
|
6627
|
+
"mode": "edit",
|
|
6628
|
+
"layout": "normal",
|
|
6629
|
+
"defaultData": {
|
|
6630
|
+
"&": "${list_view}",
|
|
6631
|
+
"name":"",
|
|
6632
|
+
"label":"",
|
|
6633
|
+
"filters":"",
|
|
6634
|
+
"shared":false,
|
|
6635
|
+
"object_name": "${targetObjectName}",
|
|
6636
|
+
"_id":"",
|
|
6637
|
+
"shared_to": null,
|
|
6638
|
+
"shared_to_organizations": null,
|
|
6639
|
+
"locked": false,
|
|
6640
|
+
"owner": null,
|
|
6641
|
+
"company_id": null,
|
|
6642
|
+
"company_ids": null,
|
|
6643
|
+
"is_system": false
|
|
6644
|
+
},
|
|
6645
|
+
"fieldsExtend": fieldsExtend$5(),
|
|
6646
|
+
"fields": fields$1(),
|
|
6647
|
+
"onEvent": {
|
|
6648
|
+
"submitSucc": {
|
|
6649
|
+
"weight": 0,
|
|
6650
|
+
"actions": [
|
|
6651
|
+
{
|
|
6652
|
+
"args": {
|
|
6653
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
6654
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
6655
|
+
"blank": false
|
|
6656
|
+
},
|
|
6657
|
+
"actionType": "url",
|
|
6658
|
+
}
|
|
6659
|
+
]
|
|
6660
|
+
}
|
|
6661
|
+
},
|
|
6662
|
+
"messages": {
|
|
6663
|
+
"success": i18next.t('frontend_listview_control_new_message_success'),
|
|
6664
|
+
"failed": i18next.t('frontend_listview_control_new_message_failed')
|
|
6665
|
+
},
|
|
6666
|
+
}
|
|
6667
|
+
],
|
|
6668
|
+
"showCloseButton": true,
|
|
6669
|
+
"showErrorMsg": true,
|
|
6670
|
+
"showLoading": true,
|
|
6671
|
+
"closeOnEsc": false,
|
|
6672
|
+
"dataMapSwitch": false,
|
|
6673
|
+
"size": "lg"
|
|
6674
|
+
},
|
|
6675
|
+
"actionType": "dialog"
|
|
6612
6676
|
}
|
|
6613
|
-
]
|
|
6614
|
-
|
|
6677
|
+
]
|
|
6678
|
+
}
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
};
|
|
6682
|
+
|
|
6683
|
+
function fields$1(){
|
|
6684
|
+
return [
|
|
6685
|
+
"label",
|
|
6686
|
+
"name",
|
|
6687
|
+
"object_name",
|
|
6688
|
+
"filter_scope",
|
|
6689
|
+
"show_count",
|
|
6690
|
+
"columns",
|
|
6691
|
+
"sort",
|
|
6692
|
+
"filters",
|
|
6693
|
+
"mobile_columns",
|
|
6694
|
+
"searchable_fields",
|
|
6695
|
+
"is_system",
|
|
6696
|
+
"shared",
|
|
6697
|
+
"shared_to",
|
|
6698
|
+
"shared_to_organizations"
|
|
6699
|
+
]
|
|
6700
|
+
}
|
|
6701
|
+
|
|
6702
|
+
function fieldsExtend$5(){
|
|
6703
|
+
return {
|
|
6704
|
+
"group": "",
|
|
6705
|
+
"label": {
|
|
6706
|
+
"group": "",
|
|
6707
|
+
"is_wide": true
|
|
6708
|
+
},
|
|
6709
|
+
"name": {
|
|
6710
|
+
"group": "",
|
|
6711
|
+
"amis": {
|
|
6712
|
+
"hidden": true,
|
|
6713
|
+
"required": false
|
|
6714
|
+
}
|
|
6715
|
+
},
|
|
6716
|
+
"object_name": {
|
|
6717
|
+
"group": "",
|
|
6718
|
+
"amis": {
|
|
6719
|
+
"hidden": true
|
|
6720
|
+
}
|
|
6721
|
+
},
|
|
6722
|
+
"filter_scope": {
|
|
6723
|
+
"group": "",
|
|
6724
|
+
"amis": {
|
|
6725
|
+
"hidden": true,
|
|
6726
|
+
"required": false
|
|
6727
|
+
}
|
|
6728
|
+
},
|
|
6729
|
+
"columns": {
|
|
6730
|
+
"group": "",
|
|
6731
|
+
"amis": {
|
|
6732
|
+
"hidden": true,
|
|
6733
|
+
"required": false
|
|
6734
|
+
}
|
|
6735
|
+
},
|
|
6736
|
+
"mobile_columns":{
|
|
6737
|
+
"group": "",
|
|
6738
|
+
"amis": {
|
|
6739
|
+
"hidden": true,
|
|
6740
|
+
"required": false
|
|
6741
|
+
}
|
|
6742
|
+
},
|
|
6743
|
+
"searchable_fields":{
|
|
6744
|
+
"group": "",
|
|
6745
|
+
"amis": {
|
|
6746
|
+
"hidden": true,
|
|
6747
|
+
"required": false
|
|
6748
|
+
}
|
|
6749
|
+
},
|
|
6750
|
+
"filter_fields": {
|
|
6751
|
+
"group": "",
|
|
6752
|
+
"amis": {
|
|
6753
|
+
"hidden": true,
|
|
6754
|
+
"required": false
|
|
6755
|
+
}
|
|
6756
|
+
},
|
|
6757
|
+
"scrolling_mode": {
|
|
6758
|
+
"group": "",
|
|
6759
|
+
"amis": {
|
|
6760
|
+
"hidden": true,
|
|
6761
|
+
"required": false
|
|
6762
|
+
}
|
|
6763
|
+
},
|
|
6764
|
+
"sort": {
|
|
6765
|
+
"group": "",
|
|
6766
|
+
"amis": {
|
|
6767
|
+
"hidden": true,
|
|
6768
|
+
"required": false
|
|
6769
|
+
}
|
|
6770
|
+
},
|
|
6771
|
+
"show_count": {
|
|
6772
|
+
"group": "",
|
|
6773
|
+
"amis": {
|
|
6774
|
+
"hidden": true,
|
|
6775
|
+
"required": false
|
|
6776
|
+
}
|
|
6777
|
+
},
|
|
6778
|
+
"type": {
|
|
6779
|
+
"group": "",
|
|
6780
|
+
"amis": {
|
|
6781
|
+
"hidden": true,
|
|
6782
|
+
"required": false
|
|
6783
|
+
}
|
|
6784
|
+
},
|
|
6785
|
+
"shared": {
|
|
6786
|
+
"group": "",
|
|
6787
|
+
"amis": {
|
|
6788
|
+
"visibleOn": "${false}"
|
|
6789
|
+
}
|
|
6790
|
+
},
|
|
6791
|
+
"shared_to": {
|
|
6792
|
+
"group": "",
|
|
6793
|
+
"amis":{
|
|
6794
|
+
"type": "radios",
|
|
6795
|
+
"inline": false
|
|
6796
|
+
}
|
|
6797
|
+
},
|
|
6798
|
+
"shared_to_organizations": {
|
|
6799
|
+
"group": ""
|
|
6800
|
+
},
|
|
6801
|
+
"filters": {
|
|
6802
|
+
"group": "",
|
|
6803
|
+
"amis": {
|
|
6804
|
+
"hidden": true
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6810
|
+
/**
|
|
6811
|
+
* 列表视图顶部第一行amisSchema
|
|
6812
|
+
* @param {*} objectSchema 对象UISchema
|
|
6813
|
+
* @returns amisSchema
|
|
6814
|
+
*/
|
|
6815
|
+
function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
6816
|
+
const { icon, label } = objectSchema;
|
|
6817
|
+
const disabled_list_views = objectSchema.permissions.disabled_list_views;
|
|
6818
|
+
const listViewButtonOptions = [];
|
|
6819
|
+
const initApiAdaptor = `
|
|
6820
|
+
var data;
|
|
6821
|
+
if (recordId) {
|
|
6822
|
+
data = payload.data || { _filters_type_controller: 'conditions' };
|
|
6823
|
+
//数据格式转换
|
|
6824
|
+
if (data) {
|
|
6825
|
+
data.sort = lodash.map(data.sort, (item) => {
|
|
6826
|
+
return item.field_name + ":" + item.order;
|
|
6827
|
+
});
|
|
6828
|
+
data.searchable_fields = lodash.map(data.searchable_fields, 'field');
|
|
6829
|
+
|
|
6830
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
6831
|
+
try {
|
|
6832
|
+
data.filters = JSON.parse(data.filters);
|
|
6833
|
+
} catch (e) { }
|
|
6834
|
+
}
|
|
6835
|
+
|
|
6836
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
6837
|
+
data._filters_type_controller = 'function';
|
|
6838
|
+
} else {
|
|
6839
|
+
data._filters_type_controller = 'conditions'
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
if (data._filters_type_controller === 'conditions') {
|
|
6843
|
+
data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);
|
|
6844
|
+
} else {
|
|
6845
|
+
data._filters_function = data.filters;
|
|
6846
|
+
}
|
|
6847
|
+
}
|
|
6848
|
+
} else {
|
|
6849
|
+
const uiSchema = api.body.uiSchema;
|
|
6850
|
+
const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;
|
|
6851
|
+
let defaultValues = {};
|
|
6852
|
+
_.each(uiSchema && uiSchema.fields, function (field) {
|
|
6853
|
+
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
6854
|
+
if (!_.isNil(value)) {
|
|
6855
|
+
defaultValues[field.name] = value;
|
|
6856
|
+
}
|
|
6857
|
+
});
|
|
6858
|
+
if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {
|
|
6859
|
+
data = Object.assign({}, defaultValues, defaultData);
|
|
6860
|
+
}else{data = Object.assign({}, defaultValues) }
|
|
6861
|
+
}
|
|
6862
|
+
for (key in data) {
|
|
6863
|
+
if (data[key] === null) {
|
|
6864
|
+
delete data[key];
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6867
|
+
payload.data = data;
|
|
6868
|
+
delete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };
|
|
6869
|
+
return payload;
|
|
6870
|
+
`;
|
|
6871
|
+
const apiRequestAdaptor = `
|
|
6872
|
+
delete formData.created;
|
|
6873
|
+
delete formData.created_by;
|
|
6874
|
+
delete formData.modified;
|
|
6875
|
+
delete formData.modified_by;
|
|
6876
|
+
delete formData._display;
|
|
6877
|
+
|
|
6878
|
+
//数据格式转换
|
|
6879
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
6880
|
+
const arr = item.split(':');
|
|
6881
|
+
return { field_name: arr[0], order: arr[1] };
|
|
6882
|
+
});
|
|
6883
|
+
|
|
6884
|
+
formData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {
|
|
6885
|
+
return { field: item };
|
|
6886
|
+
});
|
|
6887
|
+
|
|
6888
|
+
if (!formData._filters_type_controller) {
|
|
6889
|
+
formData._filters_type_controller = 'conditions';
|
|
6890
|
+
}
|
|
6891
|
+
|
|
6892
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
6893
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);
|
|
6894
|
+
// formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);
|
|
6895
|
+
} else {
|
|
6896
|
+
formData.filters = formData._filters_function || null;
|
|
6897
|
+
}
|
|
6898
|
+
|
|
6899
|
+
delete formData._filters_type_controller;
|
|
6900
|
+
delete formData._filters_conditions;
|
|
6901
|
+
delete formData._filters_function;
|
|
6902
|
+
|
|
6903
|
+
query = \`mutation{record: object_listviews__insert(doc: {__saveData}){_id}}\`;
|
|
6904
|
+
if (formData.recordId) {
|
|
6905
|
+
query = \`mutation{record: object_listviews__update(id: "\` + formData._id + \`", doc: {__saveData}){_id}}\`;
|
|
6906
|
+
};
|
|
6907
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
6908
|
+
|
|
6909
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
6910
|
+
return api;
|
|
6911
|
+
`;
|
|
6912
|
+
each(
|
|
6913
|
+
objectSchema.list_views,
|
|
6914
|
+
(listView, name) => {
|
|
6915
|
+
if(name === "lookup" || (disabled_list_views && disabled_list_views.indexOf(listView._id)>-1)){
|
|
6916
|
+
// 内置lookup为弹出选择专用视图,根据用户权限被禁用的视图,不显示在列表切换区域
|
|
6917
|
+
return;
|
|
6918
|
+
}
|
|
6919
|
+
listViewButtonOptions.push({
|
|
6920
|
+
type: "button",
|
|
6921
|
+
label: listView.label,
|
|
6922
|
+
body: [
|
|
6923
|
+
{
|
|
6924
|
+
"type": "flex",
|
|
6925
|
+
"alignItems": "center",
|
|
6926
|
+
"justify": "space-between",
|
|
6927
|
+
"items": [
|
|
6928
|
+
{
|
|
6929
|
+
"type": "tpl",
|
|
6930
|
+
"tpl": listView.label
|
|
6931
|
+
},
|
|
6932
|
+
{
|
|
6933
|
+
"type": "button",
|
|
6934
|
+
"className": "steedos-listview-edit-button",
|
|
6935
|
+
"icon": "fa fa-edit",
|
|
6936
|
+
"actionType": "dialog",
|
|
6937
|
+
"hiddenOn": `!((global.user.is_space_admin || global.userId == '${listView.owner || ""}') && !!'${listView.owner || ""}')`,
|
|
6938
|
+
"dialog": {
|
|
6939
|
+
"type": "dialog",
|
|
6940
|
+
"title": "编辑 列表视图",
|
|
6941
|
+
"data": {
|
|
6942
|
+
"object_name": "${objectName}",
|
|
6943
|
+
"recordId": listView._id,
|
|
6944
|
+
"listName": "${listName}",
|
|
6945
|
+
"appId": "${appId}",
|
|
6946
|
+
"context": "${context}",
|
|
6947
|
+
"global": "${global}",
|
|
6948
|
+
"_id": listView._id
|
|
6949
|
+
},
|
|
6950
|
+
"body": [
|
|
6951
|
+
{
|
|
6952
|
+
"type": "steedos-object-form",
|
|
6953
|
+
"label": "对象表单",
|
|
6954
|
+
"objectApiName": "object_listviews",
|
|
6955
|
+
"recordId": "${recordId}",
|
|
6956
|
+
"className": "sm:rounded sm:border-gray-300 bg-white",
|
|
6957
|
+
"layout": "horizontal",
|
|
6958
|
+
"form": {
|
|
6959
|
+
"id": "form_object_listviews"
|
|
6960
|
+
},
|
|
6961
|
+
"mode": "edit",
|
|
6962
|
+
"enableTabs": true,
|
|
6963
|
+
"fields": [
|
|
6964
|
+
"label",
|
|
6965
|
+
"sort_no",
|
|
6966
|
+
"crud_mode",
|
|
6967
|
+
"shared",
|
|
6968
|
+
"shared_to",
|
|
6969
|
+
'shared_to_organizations',
|
|
6970
|
+
"columns",
|
|
6971
|
+
"columns.$",
|
|
6972
|
+
"columns.$.field",
|
|
6973
|
+
"columns.$.width",
|
|
6974
|
+
"columns.$.wrap",
|
|
6975
|
+
"mobile_columns",
|
|
6976
|
+
"mobile_columns.$",
|
|
6977
|
+
"mobile_columns.$.field",
|
|
6978
|
+
"sort",
|
|
6979
|
+
"sort.$",
|
|
6980
|
+
"sort.$.field_name",
|
|
6981
|
+
"sort.$.order",
|
|
6982
|
+
"filters",
|
|
6983
|
+
"searchable_fields",
|
|
6984
|
+
"searchable_fields.$",
|
|
6985
|
+
"searchable_fields.$.field",
|
|
6986
|
+
],
|
|
6987
|
+
"tabsMode": "line",
|
|
6988
|
+
"fieldsExtend": {
|
|
6989
|
+
"columns": {
|
|
6990
|
+
"amis": {
|
|
6991
|
+
"showIndex": true,
|
|
6992
|
+
"footerToolbar": [
|
|
6993
|
+
{
|
|
6994
|
+
"type": "button",
|
|
6995
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
6996
|
+
"actionType": "dialog",
|
|
6997
|
+
"dialog": {
|
|
6998
|
+
"type": "dialog",
|
|
6999
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
7000
|
+
"size": "md",
|
|
7001
|
+
"body": [
|
|
7002
|
+
{
|
|
7003
|
+
"type": "transfer",
|
|
7004
|
+
"options": [
|
|
7005
|
+
],
|
|
7006
|
+
"multiple": true,
|
|
7007
|
+
"id": "u:92c0b3cccca0",
|
|
7008
|
+
"required": true,
|
|
7009
|
+
"placeholder": "-",
|
|
7010
|
+
"className": "col-span-2 m-0",
|
|
7011
|
+
"checkAll": false,
|
|
7012
|
+
"searchable": true,
|
|
7013
|
+
"sortable": true,
|
|
7014
|
+
"itemHeight": 40,
|
|
7015
|
+
"source": {
|
|
7016
|
+
"method": "get",
|
|
7017
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7018
|
+
"headers": {
|
|
7019
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7020
|
+
},
|
|
7021
|
+
"requestAdaptor": "",
|
|
7022
|
+
"adaptor": ""
|
|
7023
|
+
},
|
|
7024
|
+
"joinValues": false,
|
|
7025
|
+
"extractValue": true,
|
|
7026
|
+
"name": "columns_quick_select",
|
|
7027
|
+
"value": "${columns|pick:field|split}"
|
|
7028
|
+
}
|
|
7029
|
+
],
|
|
7030
|
+
"onEvent": {
|
|
7031
|
+
"confirm": {
|
|
7032
|
+
"actions": [
|
|
7033
|
+
{
|
|
7034
|
+
"actionType": "custom",
|
|
7035
|
+
"script": "const columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.columns, { field });\n if (column_field) {\n columns.push(column_field)\n } else {\n columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n columns\n }\n }\n});"
|
|
7036
|
+
}
|
|
7037
|
+
]
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
}
|
|
7041
|
+
}
|
|
7042
|
+
],
|
|
7043
|
+
"addable": false,
|
|
7044
|
+
"draggable": false,
|
|
7045
|
+
"columns": [
|
|
7046
|
+
{
|
|
7047
|
+
"name": "field",
|
|
7048
|
+
"inlineEditMode": false
|
|
7049
|
+
},
|
|
7050
|
+
{
|
|
7051
|
+
"name": "width",
|
|
7052
|
+
"width": 100
|
|
7053
|
+
},
|
|
7054
|
+
{
|
|
7055
|
+
"name": "wrap",
|
|
7056
|
+
"width": 50
|
|
7057
|
+
}
|
|
7058
|
+
],
|
|
7059
|
+
"enableDialog": false
|
|
7060
|
+
}
|
|
7061
|
+
},
|
|
7062
|
+
"sort": {
|
|
7063
|
+
"label": "",
|
|
7064
|
+
"amis": {
|
|
7065
|
+
"type": "tabs-transfer",
|
|
7066
|
+
"options": [
|
|
7067
|
+
],
|
|
7068
|
+
"id": "u:32f3e4e73115",
|
|
7069
|
+
"strictMode": true,
|
|
7070
|
+
"itemHeight": 40,
|
|
7071
|
+
"source": {
|
|
7072
|
+
"method": "get",
|
|
7073
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
|
|
7074
|
+
"headers": {
|
|
7075
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7076
|
+
},
|
|
7077
|
+
"data": null,
|
|
7078
|
+
"requestAdaptor": "",
|
|
7079
|
+
"adaptor": "",
|
|
7080
|
+
"sendOn": "!!this.object_name"
|
|
7081
|
+
},
|
|
7082
|
+
"visibleOn": "!!this.object_name",
|
|
7083
|
+
"sortable": true,
|
|
7084
|
+
"className": "col-span-2 m-0",
|
|
7085
|
+
"searchable": true,
|
|
7086
|
+
"checkAll": false,
|
|
7087
|
+
"clearValueOnHidden": false,
|
|
7088
|
+
"joinValues": false,
|
|
7089
|
+
"extractValue": true,
|
|
7090
|
+
"en-US": {
|
|
7091
|
+
"label": "Default Sort Order"
|
|
7092
|
+
},
|
|
7093
|
+
"multiple": true
|
|
7094
|
+
}
|
|
7095
|
+
},
|
|
7096
|
+
"filters": {
|
|
7097
|
+
"label": "",
|
|
7098
|
+
"amis": {
|
|
7099
|
+
"type": "group",
|
|
7100
|
+
"body": [
|
|
7101
|
+
{
|
|
7102
|
+
"type": "radios",
|
|
7103
|
+
"label": "${'object_listviews.listview_form.filter_configuration_method' | t}",
|
|
7104
|
+
"name": "_filters_type_controller",
|
|
7105
|
+
"options": [
|
|
7106
|
+
{
|
|
7107
|
+
"label": "${'object_listviews.listview_form.conditions_combination' | t}",
|
|
7108
|
+
"value": "conditions"
|
|
7109
|
+
},
|
|
7110
|
+
{
|
|
7111
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
7112
|
+
"value": "function"
|
|
7113
|
+
}
|
|
7114
|
+
],
|
|
7115
|
+
"id": "u:318671bc196c",
|
|
7116
|
+
"joinValues": true,
|
|
7117
|
+
"className": "col-span-2 m-0",
|
|
7118
|
+
"language": "javascript",
|
|
7119
|
+
"visibleOn": "false",
|
|
7120
|
+
"en-US": {
|
|
7121
|
+
"label": "Controller"
|
|
7122
|
+
}
|
|
7123
|
+
},
|
|
7124
|
+
{
|
|
7125
|
+
"type": "condition-builder",
|
|
7126
|
+
"label": "",
|
|
7127
|
+
"labelClassName": "none",
|
|
7128
|
+
"name": "_filters_conditions",
|
|
7129
|
+
"description": "",
|
|
7130
|
+
"id": "u:a9f2232e30d7",
|
|
7131
|
+
"source": {
|
|
7132
|
+
"method": "get",
|
|
7133
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
|
|
7134
|
+
"dataType": "json",
|
|
7135
|
+
"headers": {
|
|
7136
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7137
|
+
}
|
|
7138
|
+
},
|
|
7139
|
+
"disabled": false,
|
|
7140
|
+
"className": "col-span-2 m-0",
|
|
7141
|
+
"visibleOn": "!!this.object_name",
|
|
7142
|
+
"en-US": {
|
|
7143
|
+
"label": "Filters Conditions"
|
|
7144
|
+
}
|
|
7145
|
+
},
|
|
7146
|
+
{
|
|
7147
|
+
"type": "editor",
|
|
7148
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
7149
|
+
"name": "_filters_function",
|
|
7150
|
+
"id": "u:84714ec9abba",
|
|
7151
|
+
"visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
|
|
7152
|
+
"className": "col-span-2 m-0",
|
|
7153
|
+
"labelClassName": "hidden"
|
|
7154
|
+
}
|
|
7155
|
+
]
|
|
7156
|
+
}
|
|
7157
|
+
},
|
|
7158
|
+
"mobile_columns": {
|
|
7159
|
+
"amis": {
|
|
7160
|
+
"showIndex": true,
|
|
7161
|
+
"footerToolbar": [
|
|
7162
|
+
{
|
|
7163
|
+
"type": "button",
|
|
7164
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
7165
|
+
"actionType": "dialog",
|
|
7166
|
+
"dialog": {
|
|
7167
|
+
"type": "dialog",
|
|
7168
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
7169
|
+
"size": "md",
|
|
7170
|
+
"body": [
|
|
7171
|
+
{
|
|
7172
|
+
"type": "transfer",
|
|
7173
|
+
"options": [
|
|
7174
|
+
],
|
|
7175
|
+
"multiple": true,
|
|
7176
|
+
"id": "u:92c0b3cccca0",
|
|
7177
|
+
"required": true,
|
|
7178
|
+
"placeholder": "-",
|
|
7179
|
+
"className": "col-span-2 m-0",
|
|
7180
|
+
"itemHeight": 40,
|
|
7181
|
+
"checkAll": false,
|
|
7182
|
+
"searchable": true,
|
|
7183
|
+
"sortable": true,
|
|
7184
|
+
"source": {
|
|
7185
|
+
"method": "get",
|
|
7186
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7187
|
+
"headers": {
|
|
7188
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7189
|
+
},
|
|
7190
|
+
"requestAdaptor": "",
|
|
7191
|
+
"adaptor": ""
|
|
7192
|
+
},
|
|
7193
|
+
"joinValues": false,
|
|
7194
|
+
"extractValue": true,
|
|
7195
|
+
"name": "columns_quick_select",
|
|
7196
|
+
"value": "${mobile_columns|pick:field|split}"
|
|
7197
|
+
}
|
|
7198
|
+
],
|
|
7199
|
+
"onEvent": {
|
|
7200
|
+
"confirm": {
|
|
7201
|
+
"actions": [
|
|
7202
|
+
{
|
|
7203
|
+
"actionType": "custom",
|
|
7204
|
+
"script": "const mobile_columns = [];\nconst columns_quick_select = _.cloneDeep(event.data.columns_quick_select);\n_.forEach(columns_quick_select, function (field) {\n const column_field = _.find(event.data.mobile_columns, { field });\n if (column_field) {\n mobile_columns.push(column_field)\n } else {\n mobile_columns.push({\n field\n })\n }\n});\ndoAction({\n \"componentId\": \"form_object_listviews\",\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n mobile_columns\n }\n }\n});"
|
|
7205
|
+
}
|
|
7206
|
+
]
|
|
7207
|
+
}
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
],
|
|
7212
|
+
"columns": [
|
|
7213
|
+
{
|
|
7214
|
+
"name": "field",
|
|
7215
|
+
"inlineEditMode": false
|
|
7216
|
+
}
|
|
7217
|
+
],
|
|
7218
|
+
"addable": false,
|
|
7219
|
+
"draggable": false,
|
|
7220
|
+
"enableDialog": false
|
|
7221
|
+
}
|
|
7222
|
+
},
|
|
7223
|
+
"searchable_fields": {
|
|
7224
|
+
"label": "",
|
|
7225
|
+
"amis": {
|
|
7226
|
+
"type": "transfer",
|
|
7227
|
+
"options": [
|
|
7228
|
+
],
|
|
7229
|
+
"selectMode": "list",
|
|
7230
|
+
"searchable": true,
|
|
7231
|
+
"searchApi": "",
|
|
7232
|
+
"sortable": true,
|
|
7233
|
+
"mode": "normal",
|
|
7234
|
+
"searchResultMode": "list",
|
|
7235
|
+
"joinValues": false,
|
|
7236
|
+
"extractValue": true,
|
|
7237
|
+
"itemHeight": 40,
|
|
7238
|
+
"source": {
|
|
7239
|
+
"method": "get",
|
|
7240
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7241
|
+
"headers": {
|
|
7242
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7243
|
+
},
|
|
7244
|
+
"data": null,
|
|
7245
|
+
"requestAdaptor": "",
|
|
7246
|
+
"adaptor": "",
|
|
7247
|
+
"sendOn": "!!this.object_name"
|
|
7248
|
+
},
|
|
7249
|
+
"visibleOn": "!!this.object_name",
|
|
7250
|
+
"className": "col-span-2 m-0",
|
|
7251
|
+
"multiple": true,
|
|
7252
|
+
"id": "u:adb91066539e"
|
|
7253
|
+
}
|
|
7254
|
+
},
|
|
7255
|
+
"shared_to": {
|
|
7256
|
+
"amis":{
|
|
7257
|
+
"type": "radios",
|
|
7258
|
+
"inline": false
|
|
7259
|
+
},
|
|
7260
|
+
"group": "",
|
|
7261
|
+
"is_wide": true
|
|
7262
|
+
}
|
|
7263
|
+
},
|
|
7264
|
+
initApiAdaptor,
|
|
7265
|
+
apiRequestAdaptor,
|
|
7266
|
+
"onEvent": {
|
|
7267
|
+
"submitSucc": {
|
|
7268
|
+
"weight": 0,
|
|
7269
|
+
"actions": [
|
|
7270
|
+
{
|
|
7271
|
+
"args": {
|
|
7272
|
+
"url": "${context.rootUrl}/app/${appId}/${object_name}/grid/${name}",
|
|
7273
|
+
"blank": false
|
|
7274
|
+
},
|
|
7275
|
+
"actionType": "url",
|
|
7276
|
+
},
|
|
7277
|
+
]
|
|
7278
|
+
}
|
|
7279
|
+
},
|
|
7280
|
+
"id": "u:ce9e3fcc411a"
|
|
7281
|
+
}
|
|
7282
|
+
],
|
|
7283
|
+
"className": "steedos-overflow-visible-dialog",
|
|
7284
|
+
"showCloseButton": true,
|
|
7285
|
+
"showErrorMsg": true,
|
|
7286
|
+
"showLoading": true,
|
|
7287
|
+
"closeOnEsc": false,
|
|
7288
|
+
"dataMapSwitch": false,
|
|
7289
|
+
"size": "lg"
|
|
7290
|
+
}
|
|
7291
|
+
}
|
|
7292
|
+
]
|
|
7293
|
+
}
|
|
7294
|
+
],
|
|
7295
|
+
actionType: "link",
|
|
7296
|
+
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
7297
|
+
});
|
|
7298
|
+
}
|
|
7299
|
+
);
|
|
7300
|
+
|
|
7301
|
+
let amisButtonsSchema = getObjectListViewButtonsSchemas(objectSchema, {formFactor: ctx.formFactor});
|
|
7302
|
+
const reg = new RegExp('_', 'g');
|
|
7303
|
+
const standardIcon = icon && icon.replace(reg, '-');
|
|
7304
|
+
const standardNewButton = _.find(amisButtonsSchema, { name: "standard_new" });
|
|
7305
|
+
const buttonSchema = [{
|
|
7306
|
+
"type": "flex",
|
|
7307
|
+
"items": amisButtonsSchema,
|
|
7308
|
+
"visibleOn": "${display == 'split'?false:true}"
|
|
7309
|
+
}];
|
|
7310
|
+
if(ctx.formFactor !== 'SMALL'){
|
|
7311
|
+
const restButtons = Array.isArray(amisButtonsSchema) ? amisButtonsSchema.filter(obj => obj.name !== "standard_new"):[];
|
|
7312
|
+
buttonSchema.push({
|
|
7313
|
+
"type": "flex",
|
|
7314
|
+
"items":[
|
|
7315
|
+
standardNewButton,
|
|
7316
|
+
(restButtons.length > 0) && {
|
|
7317
|
+
"type": "dropdown-button",
|
|
7318
|
+
"buttons": restButtons,
|
|
7319
|
+
"className": " ml-1",
|
|
7320
|
+
"menuClassName": "p-none split-dropdown-buttons",
|
|
7321
|
+
"align": "right",
|
|
7322
|
+
"size": "sm"
|
|
7323
|
+
}
|
|
7324
|
+
],
|
|
7325
|
+
"visibleOn": "${display == 'split'?true:false}"
|
|
7326
|
+
});
|
|
7327
|
+
}
|
|
7328
|
+
const listviewNewButton = getNewListviewButtonSchema();
|
|
7329
|
+
listviewNewButton.visibleOn = "global.user.is_space_admin";
|
|
7330
|
+
return {
|
|
7331
|
+
"type": "grid",
|
|
7332
|
+
"columns": [
|
|
7333
|
+
{
|
|
7334
|
+
"body": [
|
|
7335
|
+
{
|
|
7336
|
+
"type": "grid",
|
|
7337
|
+
"columns": [
|
|
7338
|
+
{
|
|
7339
|
+
"body": {
|
|
7340
|
+
"type": "tpl",
|
|
7341
|
+
"className": "block",
|
|
7342
|
+
"tpl":`<svg class="slds-icon slds-icon_container slds-icon-standard-${standardIcon} slds-page-header__icon" aria-hidden="true"><use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#${icon}"></use></svg>`
|
|
7343
|
+
},
|
|
7344
|
+
"md": "auto",
|
|
7345
|
+
"className": "",
|
|
7346
|
+
"columnClassName": "flex justify-center items-center",
|
|
7347
|
+
"valign": "middle",
|
|
7348
|
+
},
|
|
7349
|
+
{
|
|
7350
|
+
"body": [
|
|
7351
|
+
{
|
|
7352
|
+
"type": "tpl",
|
|
7353
|
+
"tpl": `${label}`,
|
|
7354
|
+
"inline": false,
|
|
7355
|
+
"wrapperComponent": "",
|
|
7356
|
+
"className": "text-md leading-none text-black",
|
|
7357
|
+
},
|
|
7358
|
+
{
|
|
7359
|
+
"type": "dropdown-button",
|
|
7360
|
+
"className": "steedos-listview-change-button",
|
|
7361
|
+
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
7362
|
+
"rightIcon": "fa fa-caret-down",
|
|
7363
|
+
"size": "sm",
|
|
7364
|
+
"hideCaret": true,
|
|
7365
|
+
"closeOnClick": true,
|
|
7366
|
+
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
7367
|
+
"buttons": [
|
|
7368
|
+
...listViewButtonOptions,
|
|
7369
|
+
listviewNewButton
|
|
7370
|
+
]
|
|
7371
|
+
}
|
|
7372
|
+
],
|
|
7373
|
+
"md": "",
|
|
7374
|
+
"columnClassName": "p-l-xs"
|
|
7375
|
+
}
|
|
7376
|
+
],
|
|
7377
|
+
"className": "flex justify-between"
|
|
6615
7378
|
}
|
|
6616
7379
|
],
|
|
6617
7380
|
"md": "auto"
|
|
@@ -7132,216 +7895,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7132
7895
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
7133
7896
|
}
|
|
7134
7897
|
|
|
7135
|
-
const getNewListviewButtonSchema = ()=>{
|
|
7136
|
-
return {
|
|
7137
|
-
"type": "button",
|
|
7138
|
-
"label": i18next.t('frontend_listview_control_new_label'),
|
|
7139
|
-
"onEvent": {
|
|
7140
|
-
"click": {
|
|
7141
|
-
"weight": 0,
|
|
7142
|
-
"actions": [
|
|
7143
|
-
{
|
|
7144
|
-
"dialog": {
|
|
7145
|
-
"type": "dialog",
|
|
7146
|
-
"title": i18next.t('frontend_listview_control_new_title'),
|
|
7147
|
-
"data": {
|
|
7148
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
7149
|
-
"all": "${uiSchema.list_views.all}",
|
|
7150
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
7151
|
-
"appId": "${appId}",
|
|
7152
|
-
"global": "${global}",
|
|
7153
|
-
"targetObjectName": "${objectName}",
|
|
7154
|
-
"context": "${context}"
|
|
7155
|
-
},
|
|
7156
|
-
"body": [
|
|
7157
|
-
{
|
|
7158
|
-
"type": "steedos-object-form",
|
|
7159
|
-
"label": "对象表单",
|
|
7160
|
-
"objectApiName": "object_listviews",
|
|
7161
|
-
"recordId": "",
|
|
7162
|
-
"mode": "edit",
|
|
7163
|
-
"layout": "normal",
|
|
7164
|
-
"defaultData": {
|
|
7165
|
-
"&": "${list_view}",
|
|
7166
|
-
"name":"",
|
|
7167
|
-
"label":"",
|
|
7168
|
-
"filters":"",
|
|
7169
|
-
"shared":false,
|
|
7170
|
-
"object_name": "${targetObjectName}",
|
|
7171
|
-
"_id":"",
|
|
7172
|
-
"shared_to": null,
|
|
7173
|
-
"shared_to_organizations": null,
|
|
7174
|
-
"locked": false,
|
|
7175
|
-
"owner": null,
|
|
7176
|
-
"company_id": null,
|
|
7177
|
-
"company_ids": null,
|
|
7178
|
-
"is_system": false
|
|
7179
|
-
},
|
|
7180
|
-
"fieldsExtend": fieldsExtend$5(),
|
|
7181
|
-
"fields": fields$1(),
|
|
7182
|
-
"onEvent": {
|
|
7183
|
-
"submitSucc": {
|
|
7184
|
-
"weight": 0,
|
|
7185
|
-
"actions": [
|
|
7186
|
-
{
|
|
7187
|
-
"args": {
|
|
7188
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
7189
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
7190
|
-
"blank": false
|
|
7191
|
-
},
|
|
7192
|
-
"actionType": "url",
|
|
7193
|
-
}
|
|
7194
|
-
]
|
|
7195
|
-
}
|
|
7196
|
-
},
|
|
7197
|
-
"messages": {
|
|
7198
|
-
"success": i18next.t('frontend_listview_control_new_message_success'),
|
|
7199
|
-
"failed": i18next.t('frontend_listview_control_new_message_failed')
|
|
7200
|
-
},
|
|
7201
|
-
}
|
|
7202
|
-
],
|
|
7203
|
-
"showCloseButton": true,
|
|
7204
|
-
"showErrorMsg": true,
|
|
7205
|
-
"showLoading": true,
|
|
7206
|
-
"closeOnEsc": false,
|
|
7207
|
-
"dataMapSwitch": false,
|
|
7208
|
-
"size": "lg"
|
|
7209
|
-
},
|
|
7210
|
-
"actionType": "dialog"
|
|
7211
|
-
}
|
|
7212
|
-
]
|
|
7213
|
-
}
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
};
|
|
7217
|
-
|
|
7218
|
-
function fields$1(){
|
|
7219
|
-
return [
|
|
7220
|
-
"label",
|
|
7221
|
-
"name",
|
|
7222
|
-
"object_name",
|
|
7223
|
-
"filter_scope",
|
|
7224
|
-
"show_count",
|
|
7225
|
-
"columns",
|
|
7226
|
-
"sort",
|
|
7227
|
-
"filters",
|
|
7228
|
-
"mobile_columns",
|
|
7229
|
-
"searchable_fields",
|
|
7230
|
-
"is_system",
|
|
7231
|
-
"shared",
|
|
7232
|
-
"shared_to",
|
|
7233
|
-
"shared_to_organizations"
|
|
7234
|
-
]
|
|
7235
|
-
}
|
|
7236
|
-
|
|
7237
|
-
function fieldsExtend$5(){
|
|
7238
|
-
return {
|
|
7239
|
-
"group": "",
|
|
7240
|
-
"label": {
|
|
7241
|
-
"group": "",
|
|
7242
|
-
"is_wide": true
|
|
7243
|
-
},
|
|
7244
|
-
"name": {
|
|
7245
|
-
"group": "",
|
|
7246
|
-
"amis": {
|
|
7247
|
-
"hidden": true,
|
|
7248
|
-
"required": false
|
|
7249
|
-
}
|
|
7250
|
-
},
|
|
7251
|
-
"object_name": {
|
|
7252
|
-
"group": "",
|
|
7253
|
-
"amis": {
|
|
7254
|
-
"hidden": true
|
|
7255
|
-
}
|
|
7256
|
-
},
|
|
7257
|
-
"filter_scope": {
|
|
7258
|
-
"group": "",
|
|
7259
|
-
"amis": {
|
|
7260
|
-
"hidden": true,
|
|
7261
|
-
"required": false
|
|
7262
|
-
}
|
|
7263
|
-
},
|
|
7264
|
-
"columns": {
|
|
7265
|
-
"group": "",
|
|
7266
|
-
"amis": {
|
|
7267
|
-
"hidden": true,
|
|
7268
|
-
"required": false
|
|
7269
|
-
}
|
|
7270
|
-
},
|
|
7271
|
-
"mobile_columns":{
|
|
7272
|
-
"group": "",
|
|
7273
|
-
"amis": {
|
|
7274
|
-
"hidden": true,
|
|
7275
|
-
"required": false
|
|
7276
|
-
}
|
|
7277
|
-
},
|
|
7278
|
-
"searchable_fields":{
|
|
7279
|
-
"group": "",
|
|
7280
|
-
"amis": {
|
|
7281
|
-
"hidden": true,
|
|
7282
|
-
"required": false
|
|
7283
|
-
}
|
|
7284
|
-
},
|
|
7285
|
-
"filter_fields": {
|
|
7286
|
-
"group": "",
|
|
7287
|
-
"amis": {
|
|
7288
|
-
"hidden": true,
|
|
7289
|
-
"required": false
|
|
7290
|
-
}
|
|
7291
|
-
},
|
|
7292
|
-
"scrolling_mode": {
|
|
7293
|
-
"group": "",
|
|
7294
|
-
"amis": {
|
|
7295
|
-
"hidden": true,
|
|
7296
|
-
"required": false
|
|
7297
|
-
}
|
|
7298
|
-
},
|
|
7299
|
-
"sort": {
|
|
7300
|
-
"group": "",
|
|
7301
|
-
"amis": {
|
|
7302
|
-
"hidden": true,
|
|
7303
|
-
"required": false
|
|
7304
|
-
}
|
|
7305
|
-
},
|
|
7306
|
-
"show_count": {
|
|
7307
|
-
"group": "",
|
|
7308
|
-
"amis": {
|
|
7309
|
-
"hidden": true,
|
|
7310
|
-
"required": false
|
|
7311
|
-
}
|
|
7312
|
-
},
|
|
7313
|
-
"type": {
|
|
7314
|
-
"group": "",
|
|
7315
|
-
"amis": {
|
|
7316
|
-
"hidden": true,
|
|
7317
|
-
"required": false
|
|
7318
|
-
}
|
|
7319
|
-
},
|
|
7320
|
-
"shared": {
|
|
7321
|
-
"group": "",
|
|
7322
|
-
"amis": {
|
|
7323
|
-
"visibleOn": "${false}"
|
|
7324
|
-
}
|
|
7325
|
-
},
|
|
7326
|
-
"shared_to": {
|
|
7327
|
-
"group": "",
|
|
7328
|
-
"amis":{
|
|
7329
|
-
"type": "radios",
|
|
7330
|
-
"inline": false
|
|
7331
|
-
}
|
|
7332
|
-
},
|
|
7333
|
-
"shared_to_organizations": {
|
|
7334
|
-
"group": ""
|
|
7335
|
-
},
|
|
7336
|
-
"filters": {
|
|
7337
|
-
"group": "",
|
|
7338
|
-
"amis": {
|
|
7339
|
-
"hidden": true
|
|
7340
|
-
}
|
|
7341
|
-
}
|
|
7342
|
-
}
|
|
7343
|
-
}
|
|
7344
|
-
|
|
7345
7898
|
const getCopyListviewButtonSchema = ()=>{
|
|
7346
7899
|
return {
|
|
7347
7900
|
"type": "button",
|
|
@@ -13034,13 +13587,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
13034
13587
|
};
|
|
13035
13588
|
break;
|
|
13036
13589
|
case 'avatar':
|
|
13037
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13590
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13038
13591
|
break;
|
|
13039
13592
|
case 'image':
|
|
13040
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13593
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13041
13594
|
break;
|
|
13042
13595
|
case 'file':
|
|
13043
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13596
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13044
13597
|
break;
|
|
13045
13598
|
case 'formula':
|
|
13046
13599
|
if(readonly){
|