@steedos-widgets/amis-lib 6.3.0-beta.9 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1138 -532
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1138 -533
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +312 -263
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/buttons.d.ts +296 -107
- package/dist/types/lib/converter/amis/fields/editor.d.ts +1 -0
- package/dist/types/lib/converter/amis/fields/file.d.ts +82 -14
- package/dist/types/lib/converter/amis/graphql.d.ts +1 -1
- package/dist/types/lib/converter/amis/header.d.ts +307 -118
- 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/dist/types/lib/input_table.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +1 -0
- package/dist/types/schema/standard_edit.amis.d.ts +17 -9
- package/dist/types/schema/standard_new.amis.d.ts +0 -9
- package/dist/types/standard/button.d.ts +17 -18
- package/dist/types/utils/uuid.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -582,9 +582,9 @@ function getSelectMap(selectOptions){
|
|
|
582
582
|
}
|
|
583
583
|
|
|
584
584
|
function getNameTplUrl(field, ctx){
|
|
585
|
-
if(ctx.objectName === 'cms_files'){
|
|
586
|
-
|
|
587
|
-
}
|
|
585
|
+
// if(ctx.objectName === 'cms_files'){
|
|
586
|
+
// return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
|
|
587
|
+
// }
|
|
588
588
|
const href = Router.getObjectDetailPath({
|
|
589
589
|
...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
|
|
590
590
|
});
|
|
@@ -599,7 +599,7 @@ function getNameTpl(field, ctx){
|
|
|
599
599
|
}
|
|
600
600
|
let nameLabel = field.name;
|
|
601
601
|
//若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
|
|
602
|
-
if (field.type == "lookup") {
|
|
602
|
+
if (field.type == "lookup" || field.type == "master_detail") {
|
|
603
603
|
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
604
604
|
if(!field.isTableField){
|
|
605
605
|
nameLabel = `\${${field.name}__label}`;
|
|
@@ -774,12 +774,15 @@ async function getFieldTpl (field, options){
|
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
async function getFieldsTemplate(fields, display){
|
|
777
|
+
async function getFieldsTemplate(object, fields, display){
|
|
778
778
|
let expandFields = [];
|
|
779
779
|
if(display != false){
|
|
780
780
|
display = true;
|
|
781
781
|
}
|
|
782
782
|
let fieldsName = ['_id'];
|
|
783
|
+
if(!object.datasource || object.datasource === 'default' || object.datasource === 'meteor'){
|
|
784
|
+
fieldsName.push('space');
|
|
785
|
+
}
|
|
783
786
|
let displayFields = [];
|
|
784
787
|
let fieldsArr = [];
|
|
785
788
|
if(___namespace.isArray(fields)){
|
|
@@ -875,7 +878,7 @@ async function getFindOneQuery$1(object, recordId, fields, options){
|
|
|
875
878
|
}
|
|
876
879
|
}
|
|
877
880
|
return {
|
|
878
|
-
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
881
|
+
query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(object, fields)}, ${getRecordPermissionsTemplate()}}}`
|
|
879
882
|
}
|
|
880
883
|
}
|
|
881
884
|
|
|
@@ -1064,7 +1067,7 @@ async function getFindQuery(object, recordId, fields, options){
|
|
|
1064
1067
|
// return item.replace(/^{/,"").replace(/}$/,"");
|
|
1065
1068
|
// }).join(",")) : "";
|
|
1066
1069
|
|
|
1067
|
-
const fieldsTemplate = `${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}`;
|
|
1070
|
+
const fieldsTemplate = `${await getFieldsTemplate(object, fields, options.expand)}${treeFields}${cfsFields}`;
|
|
1068
1071
|
|
|
1069
1072
|
return {
|
|
1070
1073
|
orderBy: "${orderBy}",
|
|
@@ -1112,7 +1115,7 @@ function getRecordPermissionsQuery(object, recordId, options){
|
|
|
1112
1115
|
function getApi$2 (isMobile){
|
|
1113
1116
|
if(isMobile);else {
|
|
1114
1117
|
// return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
|
|
1115
|
-
return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
|
|
1118
|
+
return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
|
|
1116
1119
|
}
|
|
1117
1120
|
}
|
|
1118
1121
|
|
|
@@ -1180,6 +1183,29 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
1180
1183
|
}
|
|
1181
1184
|
}
|
|
1182
1185
|
|
|
1186
|
+
/*
|
|
1187
|
+
* @Author: baozhoutao@steedos.com
|
|
1188
|
+
* @Date: 2022-07-13 15:18:03
|
|
1189
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
1190
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
1191
|
+
* @Description:
|
|
1192
|
+
*/
|
|
1193
|
+
|
|
1194
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
1195
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
1196
|
+
const page = await fetchAPI(api);
|
|
1197
|
+
if (page && page.schema) {
|
|
1198
|
+
page.schema = JSON.parse(page.schema);
|
|
1199
|
+
if(page.schema.data){
|
|
1200
|
+
delete page.schema.data.recordId;
|
|
1201
|
+
delete page.schema.data.objectName;
|
|
1202
|
+
delete page.schema.data.context;
|
|
1203
|
+
delete page.schema.data.global;
|
|
1204
|
+
}
|
|
1205
|
+
return page;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1183
1209
|
/*
|
|
1184
1210
|
* @Author: baozhoutao@steedos.com
|
|
1185
1211
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -1203,9 +1229,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
|
|
|
1203
1229
|
return getAmisStaticFieldType(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
1204
1230
|
};
|
|
1205
1231
|
|
|
1206
|
-
|
|
1232
|
+
async function getLookupLinkOnClick(field, options) {
|
|
1233
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
1234
|
+
|
|
1235
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
1236
|
+
"recordId": `\${${field.name}}`,
|
|
1237
|
+
"data": {
|
|
1238
|
+
...recordPage.schema.data,
|
|
1239
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
1240
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
1241
|
+
"objectName": options.objectName,
|
|
1242
|
+
}
|
|
1243
|
+
}) : {
|
|
1244
|
+
"type": "steedos-record-detail",
|
|
1245
|
+
"objectApiName": options.objectName,
|
|
1246
|
+
"recordId": `\${${field.name}}`,
|
|
1247
|
+
"showBackButton": false,
|
|
1248
|
+
"showButtons": true,
|
|
1249
|
+
"data": {
|
|
1250
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
1251
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
return {
|
|
1255
|
+
"click": {
|
|
1256
|
+
"actions": [
|
|
1257
|
+
// {
|
|
1258
|
+
// "type": "custom",
|
|
1259
|
+
// "script": `
|
|
1260
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
1261
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
1262
|
+
// event.data.recordId = fileRecordId;
|
|
1263
|
+
// `,
|
|
1264
|
+
// },
|
|
1265
|
+
{
|
|
1266
|
+
"actionType": "drawer",
|
|
1267
|
+
"drawer": {
|
|
1268
|
+
"type": "drawer",
|
|
1269
|
+
"title": " ",
|
|
1270
|
+
"headerClassName": "hidden",
|
|
1271
|
+
"size": "lg",
|
|
1272
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
1273
|
+
"closeOnEsc": true,
|
|
1274
|
+
"closeOnOutside": true,
|
|
1275
|
+
"resizable": true,
|
|
1276
|
+
"actions": [],
|
|
1277
|
+
"body": [
|
|
1278
|
+
drawerRecordDetailSchema
|
|
1279
|
+
],
|
|
1280
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
1281
|
+
},
|
|
1282
|
+
"preventDefault": true
|
|
1283
|
+
}
|
|
1284
|
+
]
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx = {})=>{
|
|
1207
1290
|
const type = steedosField.type;
|
|
1291
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
1208
1292
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
1293
|
+
|
|
1294
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
1295
|
+
|
|
1296
|
+
if(window.innerWidth < 768){
|
|
1297
|
+
lookupATagClick = "";
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1209
1300
|
if(_.includes(['avatar','image'], type)){
|
|
1210
1301
|
return {
|
|
1211
1302
|
type: amisFieldType,
|
|
@@ -1240,13 +1331,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
1240
1331
|
}
|
|
1241
1332
|
}
|
|
1242
1333
|
} : {
|
|
1243
|
-
type: amisFieldType,
|
|
1244
|
-
tpl: `
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1334
|
+
// type: amisFieldType,
|
|
1335
|
+
// tpl: `
|
|
1336
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
1337
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
1338
|
+
// <% fileData.forEach(function(item) { %>
|
|
1339
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
1340
|
+
// <% });} %>`
|
|
1341
|
+
"type": "control",
|
|
1342
|
+
"body": {
|
|
1343
|
+
type: 'each',
|
|
1344
|
+
placeholder: "",
|
|
1345
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
1346
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
1347
|
+
items: {
|
|
1348
|
+
type: 'static',
|
|
1349
|
+
labelClassName: "hidden",
|
|
1350
|
+
label: false,
|
|
1351
|
+
className: 'm-0',
|
|
1352
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${${steedosField.name}}" ${lookupATagClick}>\${name}</a>`,
|
|
1353
|
+
// tpl: "<%= item.name >",
|
|
1354
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
1355
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick(steedosField, {
|
|
1356
|
+
appId,
|
|
1357
|
+
objectName: "cfs_files_filerecord",
|
|
1358
|
+
formFactor
|
|
1359
|
+
})
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1250
1362
|
}
|
|
1251
1363
|
}
|
|
1252
1364
|
};
|
|
@@ -1308,8 +1420,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
1308
1420
|
return convertData;
|
|
1309
1421
|
};
|
|
1310
1422
|
|
|
1311
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
1312
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
1423
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
1424
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
1313
1425
|
};
|
|
1314
1426
|
|
|
1315
1427
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -1326,6 +1438,7 @@ var frontend_form_confirm$1 = "Confirm";
|
|
|
1326
1438
|
var frontend_form_delete$1 = "Delete";
|
|
1327
1439
|
var frontend_form_view$1 = "view";
|
|
1328
1440
|
var frontend_form_details$1 = "details";
|
|
1441
|
+
var frontend_form_validation_failed_url$1 = "The URL format is incorrect";
|
|
1329
1442
|
var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
|
|
1330
1443
|
var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
|
|
1331
1444
|
var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
|
|
@@ -1382,6 +1495,7 @@ var frontend_setup$1 = "Setup";
|
|
|
1382
1495
|
var frontend_notifications$1 = "Notifications";
|
|
1383
1496
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
1384
1497
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
1498
|
+
var frontend_notifications_close_dialog$1 = "Close";
|
|
1385
1499
|
var frontend_profile$1 = "Profile";
|
|
1386
1500
|
var switch_space$1 = "Switch Space";
|
|
1387
1501
|
var frontend_about$1 = "About";
|
|
@@ -1414,6 +1528,7 @@ var en_us = {
|
|
|
1414
1528
|
frontend_form_delete: frontend_form_delete$1,
|
|
1415
1529
|
frontend_form_view: frontend_form_view$1,
|
|
1416
1530
|
frontend_form_details: frontend_form_details$1,
|
|
1531
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url$1,
|
|
1417
1532
|
frontend_delete_confirm_text: frontend_delete_confirm_text$1,
|
|
1418
1533
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
|
|
1419
1534
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
|
|
@@ -1470,6 +1585,7 @@ var en_us = {
|
|
|
1470
1585
|
frontend_notifications: frontend_notifications$1,
|
|
1471
1586
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
1472
1587
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
1588
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
|
|
1473
1589
|
frontend_profile: frontend_profile$1,
|
|
1474
1590
|
switch_space: switch_space$1,
|
|
1475
1591
|
frontend_about: frontend_about$1,
|
|
@@ -1503,6 +1619,7 @@ var frontend_form_confirm = "确认";
|
|
|
1503
1619
|
var frontend_form_delete = "删除";
|
|
1504
1620
|
var frontend_form_view = "查看";
|
|
1505
1621
|
var frontend_form_details = "详情";
|
|
1622
|
+
var frontend_form_validation_failed_url = "URL 格式不正确";
|
|
1506
1623
|
var frontend_delete_confirm_text = "确定要删除此项目?";
|
|
1507
1624
|
var frontend_delete_many_selected_required = "请选择要删除的项";
|
|
1508
1625
|
var frontend_delete_many_confirm_text = "确定要删除吗?";
|
|
@@ -1560,6 +1677,7 @@ var frontend_setup = "设置";
|
|
|
1560
1677
|
var frontend_notifications = "通知";
|
|
1561
1678
|
var frontend_notifications_allread = "全部标记为已读";
|
|
1562
1679
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
1680
|
+
var frontend_notifications_close_dialog = "关闭";
|
|
1563
1681
|
var frontend_profile = "个人资料";
|
|
1564
1682
|
var switch_space = "切换工作区";
|
|
1565
1683
|
var frontend_about = "关于";
|
|
@@ -1592,6 +1710,7 @@ var zh_cn = {
|
|
|
1592
1710
|
frontend_form_delete: frontend_form_delete,
|
|
1593
1711
|
frontend_form_view: frontend_form_view,
|
|
1594
1712
|
frontend_form_details: frontend_form_details,
|
|
1713
|
+
frontend_form_validation_failed_url: frontend_form_validation_failed_url,
|
|
1595
1714
|
frontend_delete_confirm_text: frontend_delete_confirm_text,
|
|
1596
1715
|
frontend_delete_many_selected_required: frontend_delete_many_selected_required,
|
|
1597
1716
|
frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
|
|
@@ -1649,6 +1768,7 @@ var zh_cn = {
|
|
|
1649
1768
|
frontend_notifications: frontend_notifications,
|
|
1650
1769
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
1651
1770
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
1771
|
+
frontend_notifications_close_dialog: frontend_notifications_close_dialog,
|
|
1652
1772
|
frontend_profile: frontend_profile,
|
|
1653
1773
|
switch_space: switch_space,
|
|
1654
1774
|
frontend_about: frontend_about,
|
|
@@ -1821,7 +1941,12 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
1821
1941
|
break;
|
|
1822
1942
|
case "percent":
|
|
1823
1943
|
TempDisplayField = `
|
|
1824
|
-
|
|
1944
|
+
if(event.data.value){
|
|
1945
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
1946
|
+
} else {
|
|
1947
|
+
_display["${field.name}"] = event.data.value;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1825
1950
|
`;
|
|
1826
1951
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
1827
1952
|
break;
|
|
@@ -2165,6 +2290,60 @@ function getFieldWidth(width){
|
|
|
2165
2290
|
}
|
|
2166
2291
|
}
|
|
2167
2292
|
|
|
2293
|
+
async function getColumnItemOnClick(field, options){
|
|
2294
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
2295
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
2296
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2297
|
+
"data": {
|
|
2298
|
+
...recordPage.schema.data,
|
|
2299
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2300
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2301
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
2302
|
+
}
|
|
2303
|
+
}) : {
|
|
2304
|
+
"type": "steedos-record-detail",
|
|
2305
|
+
"objectApiName": "${objectName}",
|
|
2306
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2307
|
+
"showBackButton": false,
|
|
2308
|
+
"showButtons": true,
|
|
2309
|
+
"data": {
|
|
2310
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2311
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
|
|
2315
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2316
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2317
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2318
|
+
}
|
|
2319
|
+
return {
|
|
2320
|
+
"click": {
|
|
2321
|
+
"actions": [
|
|
2322
|
+
{
|
|
2323
|
+
"actionType": "drawer",
|
|
2324
|
+
"drawer": {
|
|
2325
|
+
"type": "drawer",
|
|
2326
|
+
"title": " ",
|
|
2327
|
+
"headerClassName": "hidden",
|
|
2328
|
+
"size": "lg",
|
|
2329
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2330
|
+
"closeOnEsc": true,
|
|
2331
|
+
"closeOnOutside": true,
|
|
2332
|
+
"resizable": true,
|
|
2333
|
+
"actions": [],
|
|
2334
|
+
"body": [
|
|
2335
|
+
drawerRecordDetailSchema
|
|
2336
|
+
],
|
|
2337
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2338
|
+
"id": "u:fc5f055afa8c"
|
|
2339
|
+
},
|
|
2340
|
+
"preventDefault": true
|
|
2341
|
+
}
|
|
2342
|
+
]
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2168
2347
|
async function getTableColumns(object, fields, options){
|
|
2169
2348
|
const columns = [];
|
|
2170
2349
|
if(!options.isLookup && !options.isInputTable){
|
|
@@ -2180,7 +2359,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2180
2359
|
}
|
|
2181
2360
|
//增加quickEdit属性,实现快速编辑
|
|
2182
2361
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
|
|
2183
|
-
let className =
|
|
2362
|
+
let className = `steedos-table-${field.type}-field`;
|
|
2184
2363
|
const bowserType = getBowserType();
|
|
2185
2364
|
if(bowserType === "Safari"){
|
|
2186
2365
|
className += " whitespace-nowrap ";
|
|
@@ -2204,7 +2383,10 @@ async function getTableColumns(object, fields, options){
|
|
|
2204
2383
|
delete fieldAmis?.className;
|
|
2205
2384
|
|
|
2206
2385
|
let columnItem;
|
|
2207
|
-
|
|
2386
|
+
|
|
2387
|
+
// PC客户端点击名称字段直接预览
|
|
2388
|
+
let isNode = !!(window && window.nw && window.nw.require);
|
|
2389
|
+
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files' && isNode){
|
|
2208
2390
|
const previewFileScript = `
|
|
2209
2391
|
var data = event.data;
|
|
2210
2392
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
@@ -2219,20 +2401,20 @@ async function getTableColumns(object, fields, options){
|
|
|
2219
2401
|
"onEvent": {
|
|
2220
2402
|
"click": {
|
|
2221
2403
|
"actions": [
|
|
2222
|
-
{
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
},
|
|
2404
|
+
// {
|
|
2405
|
+
// "args": {
|
|
2406
|
+
// "api": {
|
|
2407
|
+
// "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
2408
|
+
// "method": "get",
|
|
2409
|
+
// "headers": {
|
|
2410
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2411
|
+
// }
|
|
2412
|
+
// }
|
|
2413
|
+
// },
|
|
2414
|
+
// "actionType": "download",
|
|
2415
|
+
// // "expression": "!!!window?.nw?.require"//浏览器上直接下载
|
|
2416
|
+
// "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
2417
|
+
// },
|
|
2236
2418
|
{
|
|
2237
2419
|
"args": {},
|
|
2238
2420
|
"actionType": "custom",
|
|
@@ -2263,7 +2445,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2263
2445
|
toggled: field.toggled,
|
|
2264
2446
|
static: true,
|
|
2265
2447
|
className,
|
|
2266
|
-
...getAmisFileReadonlySchema(field)
|
|
2448
|
+
...await getAmisFileReadonlySchema(field)
|
|
2267
2449
|
}, fieldAmis, {name: field.name});
|
|
2268
2450
|
}
|
|
2269
2451
|
else if(field.type === 'select'){
|
|
@@ -2330,51 +2512,7 @@ async function getTableColumns(object, fields, options){
|
|
|
2330
2512
|
}
|
|
2331
2513
|
|
|
2332
2514
|
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && ___namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2333
|
-
|
|
2334
|
-
const drawerRecordDetailSchema = {
|
|
2335
|
-
"type": "steedos-record-detail",
|
|
2336
|
-
"objectApiName": "${objectName}",
|
|
2337
|
-
"recordId": `\${${options.idFieldName}}`,
|
|
2338
|
-
"showBackButton": false,
|
|
2339
|
-
"showButtons": true,
|
|
2340
|
-
"data": {
|
|
2341
|
-
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2342
|
-
"recordLoaded": false, // 重置数据加载状态
|
|
2343
|
-
}
|
|
2344
|
-
};
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2348
|
-
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2349
|
-
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
columnItem.onEvent = {
|
|
2353
|
-
"click": {
|
|
2354
|
-
"actions": [
|
|
2355
|
-
{
|
|
2356
|
-
"actionType": "drawer",
|
|
2357
|
-
"drawer": {
|
|
2358
|
-
"type": "drawer",
|
|
2359
|
-
"title": " ",
|
|
2360
|
-
"headerClassName": "hidden",
|
|
2361
|
-
"size": "lg",
|
|
2362
|
-
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
2363
|
-
"closeOnEsc": true,
|
|
2364
|
-
"closeOnOutside": true,
|
|
2365
|
-
"resizable": true,
|
|
2366
|
-
"actions": [],
|
|
2367
|
-
"body": [
|
|
2368
|
-
drawerRecordDetailSchema
|
|
2369
|
-
],
|
|
2370
|
-
"className": "steedos-record-detail-drawer app-popover",
|
|
2371
|
-
"id": "u:fc5f055afa8c"
|
|
2372
|
-
},
|
|
2373
|
-
"preventDefault": true
|
|
2374
|
-
}
|
|
2375
|
-
]
|
|
2376
|
-
}
|
|
2377
|
-
};
|
|
2515
|
+
columnItem.onEvent = await getColumnItemOnClick(field, options);
|
|
2378
2516
|
}
|
|
2379
2517
|
|
|
2380
2518
|
}
|
|
@@ -2587,17 +2725,23 @@ async function getMobileTableColumns(fields, options){
|
|
|
2587
2725
|
onEvent: {
|
|
2588
2726
|
"click": {
|
|
2589
2727
|
"actions": [
|
|
2728
|
+
// {
|
|
2729
|
+
// "args": {
|
|
2730
|
+
// "api": {
|
|
2731
|
+
// "url": url,
|
|
2732
|
+
// "method": "get",
|
|
2733
|
+
// "headers": {
|
|
2734
|
+
// "Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2735
|
+
// }
|
|
2736
|
+
// }
|
|
2737
|
+
// },
|
|
2738
|
+
// "actionType": "download"
|
|
2739
|
+
// }
|
|
2590
2740
|
{
|
|
2741
|
+
"actionType": "link",
|
|
2591
2742
|
"args": {
|
|
2592
|
-
"
|
|
2593
|
-
|
|
2594
|
-
"method": "get",
|
|
2595
|
-
"headers": {
|
|
2596
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
},
|
|
2600
|
-
"actionType": "download"
|
|
2743
|
+
"link": url
|
|
2744
|
+
}
|
|
2601
2745
|
}
|
|
2602
2746
|
],
|
|
2603
2747
|
"weight": 0
|
|
@@ -3296,8 +3440,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3296
3440
|
|
|
3297
3441
|
var fieldNames = ___namespace.map(fields, function(n){return n.name});
|
|
3298
3442
|
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
3299
|
-
let nameLabel = nameField.name;
|
|
3300
|
-
if (nameField.type == "lookup") {
|
|
3443
|
+
let nameLabel = nameField && nameField.name;
|
|
3444
|
+
if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
|
|
3301
3445
|
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
3302
3446
|
if(!nameField.isTableField){
|
|
3303
3447
|
nameLabel = `record.${nameField.name}__label`;
|
|
@@ -3305,8 +3449,8 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3305
3449
|
} else {
|
|
3306
3450
|
nameLabel = `record._display.${nameField.name}.label`;
|
|
3307
3451
|
}
|
|
3308
|
-
} else {
|
|
3309
|
-
nameLabel = `record._display.${nameField.name}
|
|
3452
|
+
} else if (nameField){
|
|
3453
|
+
nameLabel = `(record._display ? record._display.${nameField.name} : record.${nameField.name})`;
|
|
3310
3454
|
}
|
|
3311
3455
|
return `
|
|
3312
3456
|
if(payload.data.data.length === 0){
|
|
@@ -4689,16 +4833,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4689
4833
|
data: formSchema
|
|
4690
4834
|
};
|
|
4691
4835
|
`;
|
|
4692
|
-
const onDialogCancelScript = `
|
|
4693
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
4694
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
|
|
4695
|
-
setTimeout(function(){
|
|
4696
|
-
doAction({
|
|
4697
|
-
"actionType": "cancel",
|
|
4698
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
4699
|
-
});
|
|
4700
|
-
}, 200);
|
|
4701
|
-
`;
|
|
4702
4836
|
const getSelectedRowsScript = `
|
|
4703
4837
|
const isLookup = event.data.isLookup;
|
|
4704
4838
|
if(isLookup){
|
|
@@ -4788,17 +4922,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4788
4922
|
"closeOnEsc": false,
|
|
4789
4923
|
"closeOnOutside": false,
|
|
4790
4924
|
"size": "lg",
|
|
4791
|
-
"onEvent": {
|
|
4792
|
-
"cancel": {
|
|
4793
|
-
"actions": [
|
|
4794
|
-
{
|
|
4795
|
-
"actionType": "custom",
|
|
4796
|
-
"script": onDialogCancelScript,
|
|
4797
|
-
"expression": "${window:innerWidth < 768}",
|
|
4798
|
-
}
|
|
4799
|
-
]
|
|
4800
|
-
}
|
|
4801
|
-
},
|
|
4802
4925
|
"actions": [
|
|
4803
4926
|
{
|
|
4804
4927
|
type: 'button',
|
|
@@ -4834,34 +4957,11 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4834
4957
|
}
|
|
4835
4958
|
};
|
|
4836
4959
|
|
|
4837
|
-
/*
|
|
4838
|
-
* @Author: baozhoutao@steedos.com
|
|
4839
|
-
* @Date: 2022-07-13 15:18:03
|
|
4840
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
4841
|
-
* @LastEditTime: 2023-04-11 10:34:26
|
|
4842
|
-
* @Description:
|
|
4843
|
-
*/
|
|
4844
|
-
|
|
4845
|
-
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
4846
|
-
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
4847
|
-
const page = await fetchAPI(api);
|
|
4848
|
-
if (page && page.schema) {
|
|
4849
|
-
page.schema = JSON.parse(page.schema);
|
|
4850
|
-
if(page.schema.data){
|
|
4851
|
-
delete page.schema.data.recordId;
|
|
4852
|
-
delete page.schema.data.objectName;
|
|
4853
|
-
delete page.schema.data.context;
|
|
4854
|
-
delete page.schema.data.global;
|
|
4855
|
-
}
|
|
4856
|
-
return page;
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
|
|
4860
4960
|
/*
|
|
4861
4961
|
* @Author: baozhoutao@steedos.com
|
|
4862
4962
|
* @Date: 2022-11-01 15:49:58
|
|
4863
|
-
* @LastEditors:
|
|
4864
|
-
* @LastEditTime:
|
|
4963
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
4964
|
+
* @LastEditTime: 2024-05-19 10:01:07
|
|
4865
4965
|
* @Description:
|
|
4866
4966
|
*/
|
|
4867
4967
|
|
|
@@ -4891,16 +4991,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4891
4991
|
: page.schema;
|
|
4892
4992
|
}
|
|
4893
4993
|
|
|
4894
|
-
const onDialogCancelScript = `
|
|
4895
|
-
// 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
|
|
4896
|
-
// 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
|
|
4897
|
-
setTimeout(function(){
|
|
4898
|
-
doAction({
|
|
4899
|
-
"actionType": "cancel",
|
|
4900
|
-
"componentId": "object_actions_drawer_${uiSchema.name}"
|
|
4901
|
-
});
|
|
4902
|
-
}, 200);
|
|
4903
|
-
`;
|
|
4904
4994
|
|
|
4905
4995
|
return {
|
|
4906
4996
|
type: "service",
|
|
@@ -4923,18 +5013,26 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4923
5013
|
closeOnEsc: false,
|
|
4924
5014
|
closeOnOutside: false,
|
|
4925
5015
|
showCloseButton: true,
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
"
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
"actionType": "custom",
|
|
4932
|
-
"script": onDialogCancelScript,
|
|
4933
|
-
"expression": "${window:innerWidth < 768}",
|
|
4934
|
-
}
|
|
4935
|
-
]
|
|
4936
|
-
}
|
|
5016
|
+
"data": {
|
|
5017
|
+
"&": "$$",
|
|
5018
|
+
"_master": "${_master}",
|
|
5019
|
+
"_master._isRelated": "${_isRelated}",
|
|
5020
|
+
"_master.relatedKey": "${relatedKey}"
|
|
4937
5021
|
},
|
|
5022
|
+
size: "lg",
|
|
5023
|
+
"actions": [
|
|
5024
|
+
{
|
|
5025
|
+
type: 'button',
|
|
5026
|
+
actionType: 'cancel',
|
|
5027
|
+
label: i18next__default["default"].t('frontend_form_cancel')
|
|
5028
|
+
},
|
|
5029
|
+
{
|
|
5030
|
+
type: 'button',
|
|
5031
|
+
actionType: 'confirm',
|
|
5032
|
+
label: i18next__default["default"].t('frontend_form_save'),
|
|
5033
|
+
primary: true
|
|
5034
|
+
},
|
|
5035
|
+
]
|
|
4938
5036
|
},
|
|
4939
5037
|
},
|
|
4940
5038
|
],
|
|
@@ -5714,6 +5812,100 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
5714
5812
|
};
|
|
5715
5813
|
};
|
|
5716
5814
|
|
|
5815
|
+
const getDropdown = (dropdownButtons)=>{
|
|
5816
|
+
const dropdown = {
|
|
5817
|
+
"type": "dropdown-button",
|
|
5818
|
+
"icon": "fa fa-angle-down",
|
|
5819
|
+
"size": "sm",
|
|
5820
|
+
"hideCaret": true,
|
|
5821
|
+
"className": "mr-0 steedos-mobile-header-drop-down",
|
|
5822
|
+
"closeOnClick": true,
|
|
5823
|
+
"menuClassName": "buttons-drawer fixed bg-none border-0 shadow-none",
|
|
5824
|
+
"align": "right",
|
|
5825
|
+
"body": [
|
|
5826
|
+
{
|
|
5827
|
+
"type": "action",
|
|
5828
|
+
"style": {
|
|
5829
|
+
"z-index": 1,
|
|
5830
|
+
"background": "var(--Drawer-overlay-bg)",
|
|
5831
|
+
"height": "100%",
|
|
5832
|
+
"width": "100%",
|
|
5833
|
+
"padding": "0",
|
|
5834
|
+
"margin": "0",
|
|
5835
|
+
"border-radius": "0"
|
|
5836
|
+
}
|
|
5837
|
+
},
|
|
5838
|
+
{
|
|
5839
|
+
"type": "wrapper",
|
|
5840
|
+
"style": {
|
|
5841
|
+
"position": "fixed",
|
|
5842
|
+
"bottom": 0,
|
|
5843
|
+
"z-index": 2,
|
|
5844
|
+
"width": "100vw",
|
|
5845
|
+
"left": "0",
|
|
5846
|
+
"padding": "0",
|
|
5847
|
+
"background": "white",
|
|
5848
|
+
"box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
|
|
5849
|
+
},
|
|
5850
|
+
"body": [
|
|
5851
|
+
{
|
|
5852
|
+
"type": "flex",
|
|
5853
|
+
"justify": "space-between",
|
|
5854
|
+
"items": [
|
|
5855
|
+
{
|
|
5856
|
+
"type": "tpl",
|
|
5857
|
+
"tpl": "操作",
|
|
5858
|
+
"style": {
|
|
5859
|
+
"padding": "4px 12px",
|
|
5860
|
+
"align-items": "center",
|
|
5861
|
+
"display": "flex"
|
|
5862
|
+
}
|
|
5863
|
+
},
|
|
5864
|
+
{
|
|
5865
|
+
"type": "action",
|
|
5866
|
+
"label": "",
|
|
5867
|
+
"icon": "fa fa-times",
|
|
5868
|
+
"level": "link",
|
|
5869
|
+
"style": {
|
|
5870
|
+
"color": "black"
|
|
5871
|
+
},
|
|
5872
|
+
}
|
|
5873
|
+
],
|
|
5874
|
+
"style": {
|
|
5875
|
+
"padding-top": "0.5rem",
|
|
5876
|
+
"padding-bottom": "0.5rem",
|
|
5877
|
+
"border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
|
|
5878
|
+
}
|
|
5879
|
+
},
|
|
5880
|
+
{
|
|
5881
|
+
"type": "wrapper",
|
|
5882
|
+
"body": [
|
|
5883
|
+
{
|
|
5884
|
+
"type": "button-group",
|
|
5885
|
+
"id": "u:fd837823be5b",
|
|
5886
|
+
"vertical": true,
|
|
5887
|
+
"tiled": true,
|
|
5888
|
+
"buttons": dropdownButtons,
|
|
5889
|
+
"className": "w-full overflow-auto",
|
|
5890
|
+
"btnClassName": "w-full",
|
|
5891
|
+
"size": "lg"
|
|
5892
|
+
}
|
|
5893
|
+
],
|
|
5894
|
+
"style": {
|
|
5895
|
+
"padding": "0",
|
|
5896
|
+
"overflow": "auto",
|
|
5897
|
+
"max-height": "70vh"
|
|
5898
|
+
}
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
]
|
|
5902
|
+
}
|
|
5903
|
+
]
|
|
5904
|
+
};
|
|
5905
|
+
|
|
5906
|
+
return dropdown;
|
|
5907
|
+
};
|
|
5908
|
+
|
|
5717
5909
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
5718
5910
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
5719
5911
|
if(ctx.formFactor === 'SMALL'){
|
|
@@ -5737,46 +5929,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5737
5929
|
}
|
|
5738
5930
|
});
|
|
5739
5931
|
|
|
5740
|
-
return [
|
|
5741
|
-
{
|
|
5742
|
-
"type": "button",
|
|
5743
|
-
"icon": "fa fa-angle-down",
|
|
5744
|
-
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
5745
|
-
"onEvent": {
|
|
5746
|
-
"click": {
|
|
5747
|
-
"actions": [
|
|
5748
|
-
{
|
|
5749
|
-
"actionType": "drawer",
|
|
5750
|
-
"drawer": {
|
|
5751
|
-
"type": "drawer",
|
|
5752
|
-
"title": i18next__default["default"].t('frontend_operation'),
|
|
5753
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
5754
|
-
"body": [
|
|
5755
|
-
{
|
|
5756
|
-
"type": "button-group",
|
|
5757
|
-
"id": "u:fd837823be5b",
|
|
5758
|
-
"vertical": true,
|
|
5759
|
-
"tiled": true,
|
|
5760
|
-
"buttons": dropdownButtons,
|
|
5761
|
-
"btnLevel": "enhance",
|
|
5762
|
-
"className": "w-full",
|
|
5763
|
-
"btnClassName": "w-full",
|
|
5764
|
-
"size": "lg"
|
|
5765
|
-
}
|
|
5766
|
-
],
|
|
5767
|
-
"position": "bottom",
|
|
5768
|
-
"closeOnOutside": true,
|
|
5769
|
-
"resizable": false,
|
|
5770
|
-
"className": "buttons-drawer",
|
|
5771
|
-
"bodyClassName": "m-none p-none",
|
|
5772
|
-
"actions": []
|
|
5773
|
-
}
|
|
5774
|
-
}
|
|
5775
|
-
]
|
|
5776
|
-
}
|
|
5777
|
-
}
|
|
5778
|
-
}
|
|
5779
|
-
]
|
|
5932
|
+
return [getDropdown(dropdownButtons)];
|
|
5780
5933
|
}else {
|
|
5781
5934
|
if(moreButtons.length > 0){
|
|
5782
5935
|
const dropdownButtonsSchema = {
|
|
@@ -5797,54 +5950,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5797
5950
|
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
5798
5951
|
const buttons = getListViewButtons(objectSchema, ctx);
|
|
5799
5952
|
if(ctx.formFactor === 'SMALL'){
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
{
|
|
5808
|
-
"actionType": "drawer",
|
|
5809
|
-
"drawer": {
|
|
5810
|
-
"type": "drawer",
|
|
5811
|
-
"title": i18next__default["default"].t('frontend_operation'),
|
|
5812
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
5813
|
-
"body": [
|
|
5814
|
-
{
|
|
5815
|
-
"type": "button-group",
|
|
5816
|
-
"id": "u:fd837823be5b",
|
|
5817
|
-
"vertical": true,
|
|
5818
|
-
"tiled": true,
|
|
5819
|
-
"buttons": [
|
|
5820
|
-
...___namespace.map(buttons, (button)=>{
|
|
5821
|
-
return {
|
|
5822
|
-
type: 'steedos-object-button',
|
|
5823
|
-
name: button.name,
|
|
5824
|
-
objectName: button.objectName,
|
|
5825
|
-
visibleOn: getButtonVisibleOn(button),
|
|
5826
|
-
className: `button_${button.name} w-full`
|
|
5827
|
-
}
|
|
5828
|
-
})
|
|
5829
|
-
],
|
|
5830
|
-
"btnLevel": "enhance",
|
|
5831
|
-
"className": "w-full",
|
|
5832
|
-
"btnClassName": "w-full",
|
|
5833
|
-
"size": "lg"
|
|
5834
|
-
}
|
|
5835
|
-
],
|
|
5836
|
-
"position": "bottom",
|
|
5837
|
-
"closeOnOutside": true,
|
|
5838
|
-
"resizable": false,
|
|
5839
|
-
"className": "buttons-drawer",
|
|
5840
|
-
"bodyClassName": "m-none p-none",
|
|
5841
|
-
"actions": []
|
|
5842
|
-
}
|
|
5843
|
-
}
|
|
5844
|
-
]
|
|
5845
|
-
}
|
|
5953
|
+
const dropdownButtons = ___namespace.map(buttons, (button)=>{
|
|
5954
|
+
return {
|
|
5955
|
+
type: 'steedos-object-button',
|
|
5956
|
+
name: button.name,
|
|
5957
|
+
objectName: button.objectName,
|
|
5958
|
+
visibleOn: getButtonVisibleOn(button),
|
|
5959
|
+
className: `button_${button.name} w-full`
|
|
5846
5960
|
}
|
|
5847
|
-
|
|
5961
|
+
});
|
|
5962
|
+
return getDropdown(dropdownButtons);
|
|
5848
5963
|
}else {
|
|
5849
5964
|
return ___namespace.map(buttons, (button) => {
|
|
5850
5965
|
return {
|
|
@@ -5861,55 +5976,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
5861
5976
|
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
5862
5977
|
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
5863
5978
|
if(ctx.formFactor === 'SMALL'){
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
"actionType": "drawer",
|
|
5872
|
-
"drawer": {
|
|
5873
|
-
"type": "drawer",
|
|
5874
|
-
"title": i18next__default["default"].t('frontend_operation'),
|
|
5875
|
-
"id": "object_actions_drawer_" + objectSchema.name,
|
|
5876
|
-
"body": [
|
|
5877
|
-
{
|
|
5878
|
-
"type": "button-group",
|
|
5879
|
-
"vertical": true,
|
|
5880
|
-
"tiled": true,
|
|
5881
|
-
"buttons": [
|
|
5882
|
-
...___namespace.map(buttons, (button)=>{
|
|
5883
|
-
return {
|
|
5884
|
-
type: 'steedos-object-button',
|
|
5885
|
-
name: button.name,
|
|
5886
|
-
objectName: button.objectName,
|
|
5887
|
-
visibleOn: getButtonVisibleOn(button),
|
|
5888
|
-
className: `button_${button.name} w-full`
|
|
5889
|
-
}
|
|
5890
|
-
})
|
|
5891
|
-
],
|
|
5892
|
-
"btnLevel": "enhance",
|
|
5893
|
-
"className": "w-full",
|
|
5894
|
-
"btnClassName": "w-full",
|
|
5895
|
-
"size": "lg"
|
|
5896
|
-
}
|
|
5897
|
-
],
|
|
5898
|
-
"position": "bottom",
|
|
5899
|
-
"closeOnOutside": true,
|
|
5900
|
-
"resizable": false,
|
|
5901
|
-
"className": "buttons-drawer",
|
|
5902
|
-
"bodyClassName": "m-none p-none",
|
|
5903
|
-
"actions": []
|
|
5904
|
-
}
|
|
5905
|
-
}
|
|
5906
|
-
]
|
|
5907
|
-
}
|
|
5979
|
+
const dropdownButtons = ___namespace.map(buttons, (button)=>{
|
|
5980
|
+
return {
|
|
5981
|
+
type: 'steedos-object-button',
|
|
5982
|
+
name: button.name,
|
|
5983
|
+
objectName: button.objectName,
|
|
5984
|
+
visibleOn: getButtonVisibleOn(button),
|
|
5985
|
+
className: `button_${button.name} w-full`
|
|
5908
5986
|
}
|
|
5909
|
-
|
|
5987
|
+
});
|
|
5988
|
+
return [getDropdown(dropdownButtons)];
|
|
5910
5989
|
}else {
|
|
5911
5990
|
return ___namespace.map(buttons, (button) => {
|
|
5912
|
-
return {
|
|
5991
|
+
return {
|
|
5913
5992
|
type: 'steedos-object-button',
|
|
5914
5993
|
name: button.name,
|
|
5915
5994
|
objectName: button.objectName,
|
|
@@ -6544,6 +6623,217 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6544
6623
|
};
|
|
6545
6624
|
}
|
|
6546
6625
|
|
|
6626
|
+
const getNewListviewButtonSchema = ()=>{
|
|
6627
|
+
return {
|
|
6628
|
+
"type": "button",
|
|
6629
|
+
"label": i18next__default["default"].t('frontend_listview_control_new_label'),
|
|
6630
|
+
"className": "steedos-listview-new-button",
|
|
6631
|
+
"onEvent": {
|
|
6632
|
+
"click": {
|
|
6633
|
+
"weight": 0,
|
|
6634
|
+
"actions": [
|
|
6635
|
+
{
|
|
6636
|
+
"dialog": {
|
|
6637
|
+
"type": "dialog",
|
|
6638
|
+
"title": i18next__default["default"].t('frontend_listview_control_new_title'),
|
|
6639
|
+
"data": {
|
|
6640
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
6641
|
+
"all": "${uiSchema.list_views.all}",
|
|
6642
|
+
"list_view": "${uiSchema.list_views[listName]}",
|
|
6643
|
+
"appId": "${appId}",
|
|
6644
|
+
"global": "${global}",
|
|
6645
|
+
"targetObjectName": "${objectName}",
|
|
6646
|
+
"context": "${context}"
|
|
6647
|
+
},
|
|
6648
|
+
"body": [
|
|
6649
|
+
{
|
|
6650
|
+
"type": "steedos-object-form",
|
|
6651
|
+
"label": "对象表单",
|
|
6652
|
+
"objectApiName": "object_listviews",
|
|
6653
|
+
"recordId": "",
|
|
6654
|
+
"mode": "edit",
|
|
6655
|
+
"layout": "normal",
|
|
6656
|
+
"defaultData": {
|
|
6657
|
+
"&": "${list_view}",
|
|
6658
|
+
"name":"",
|
|
6659
|
+
"label":"",
|
|
6660
|
+
"filters":"",
|
|
6661
|
+
"shared":false,
|
|
6662
|
+
"object_name": "${targetObjectName}",
|
|
6663
|
+
"_id":"",
|
|
6664
|
+
"shared_to": null,
|
|
6665
|
+
"shared_to_organizations": null,
|
|
6666
|
+
"locked": false,
|
|
6667
|
+
"owner": null,
|
|
6668
|
+
"company_id": null,
|
|
6669
|
+
"company_ids": null,
|
|
6670
|
+
"is_system": false
|
|
6671
|
+
},
|
|
6672
|
+
"fieldsExtend": fieldsExtend$5(),
|
|
6673
|
+
"fields": fields$1(),
|
|
6674
|
+
"onEvent": {
|
|
6675
|
+
"submitSucc": {
|
|
6676
|
+
"weight": 0,
|
|
6677
|
+
"actions": [
|
|
6678
|
+
{
|
|
6679
|
+
"args": {
|
|
6680
|
+
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
6681
|
+
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
6682
|
+
"blank": false
|
|
6683
|
+
},
|
|
6684
|
+
"actionType": "url",
|
|
6685
|
+
}
|
|
6686
|
+
]
|
|
6687
|
+
}
|
|
6688
|
+
},
|
|
6689
|
+
"messages": {
|
|
6690
|
+
"success": i18next__default["default"].t('frontend_listview_control_new_message_success'),
|
|
6691
|
+
"failed": i18next__default["default"].t('frontend_listview_control_new_message_failed')
|
|
6692
|
+
},
|
|
6693
|
+
}
|
|
6694
|
+
],
|
|
6695
|
+
"showCloseButton": true,
|
|
6696
|
+
"showErrorMsg": true,
|
|
6697
|
+
"showLoading": true,
|
|
6698
|
+
"closeOnEsc": false,
|
|
6699
|
+
"dataMapSwitch": false,
|
|
6700
|
+
"size": "lg"
|
|
6701
|
+
},
|
|
6702
|
+
"actionType": "dialog"
|
|
6703
|
+
}
|
|
6704
|
+
]
|
|
6705
|
+
}
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6708
|
+
};
|
|
6709
|
+
|
|
6710
|
+
function fields$1(){
|
|
6711
|
+
return [
|
|
6712
|
+
"label",
|
|
6713
|
+
"name",
|
|
6714
|
+
"object_name",
|
|
6715
|
+
"filter_scope",
|
|
6716
|
+
"show_count",
|
|
6717
|
+
"columns",
|
|
6718
|
+
"sort",
|
|
6719
|
+
"filters",
|
|
6720
|
+
"mobile_columns",
|
|
6721
|
+
"searchable_fields",
|
|
6722
|
+
"is_system",
|
|
6723
|
+
"shared",
|
|
6724
|
+
"shared_to",
|
|
6725
|
+
"shared_to_organizations"
|
|
6726
|
+
]
|
|
6727
|
+
}
|
|
6728
|
+
|
|
6729
|
+
function fieldsExtend$5(){
|
|
6730
|
+
return {
|
|
6731
|
+
"group": "",
|
|
6732
|
+
"label": {
|
|
6733
|
+
"group": "",
|
|
6734
|
+
"is_wide": true
|
|
6735
|
+
},
|
|
6736
|
+
"name": {
|
|
6737
|
+
"group": "",
|
|
6738
|
+
"amis": {
|
|
6739
|
+
"hidden": true,
|
|
6740
|
+
"required": false
|
|
6741
|
+
}
|
|
6742
|
+
},
|
|
6743
|
+
"object_name": {
|
|
6744
|
+
"group": "",
|
|
6745
|
+
"amis": {
|
|
6746
|
+
"hidden": true
|
|
6747
|
+
}
|
|
6748
|
+
},
|
|
6749
|
+
"filter_scope": {
|
|
6750
|
+
"group": "",
|
|
6751
|
+
"amis": {
|
|
6752
|
+
"hidden": true,
|
|
6753
|
+
"required": false
|
|
6754
|
+
}
|
|
6755
|
+
},
|
|
6756
|
+
"columns": {
|
|
6757
|
+
"group": "",
|
|
6758
|
+
"amis": {
|
|
6759
|
+
"hidden": true,
|
|
6760
|
+
"required": false
|
|
6761
|
+
}
|
|
6762
|
+
},
|
|
6763
|
+
"mobile_columns":{
|
|
6764
|
+
"group": "",
|
|
6765
|
+
"amis": {
|
|
6766
|
+
"hidden": true,
|
|
6767
|
+
"required": false
|
|
6768
|
+
}
|
|
6769
|
+
},
|
|
6770
|
+
"searchable_fields":{
|
|
6771
|
+
"group": "",
|
|
6772
|
+
"amis": {
|
|
6773
|
+
"hidden": true,
|
|
6774
|
+
"required": false
|
|
6775
|
+
}
|
|
6776
|
+
},
|
|
6777
|
+
"filter_fields": {
|
|
6778
|
+
"group": "",
|
|
6779
|
+
"amis": {
|
|
6780
|
+
"hidden": true,
|
|
6781
|
+
"required": false
|
|
6782
|
+
}
|
|
6783
|
+
},
|
|
6784
|
+
"scrolling_mode": {
|
|
6785
|
+
"group": "",
|
|
6786
|
+
"amis": {
|
|
6787
|
+
"hidden": true,
|
|
6788
|
+
"required": false
|
|
6789
|
+
}
|
|
6790
|
+
},
|
|
6791
|
+
"sort": {
|
|
6792
|
+
"group": "",
|
|
6793
|
+
"amis": {
|
|
6794
|
+
"hidden": true,
|
|
6795
|
+
"required": false
|
|
6796
|
+
}
|
|
6797
|
+
},
|
|
6798
|
+
"show_count": {
|
|
6799
|
+
"group": "",
|
|
6800
|
+
"amis": {
|
|
6801
|
+
"hidden": true,
|
|
6802
|
+
"required": false
|
|
6803
|
+
}
|
|
6804
|
+
},
|
|
6805
|
+
"type": {
|
|
6806
|
+
"group": "",
|
|
6807
|
+
"amis": {
|
|
6808
|
+
"hidden": true,
|
|
6809
|
+
"required": false
|
|
6810
|
+
}
|
|
6811
|
+
},
|
|
6812
|
+
"shared": {
|
|
6813
|
+
"group": "",
|
|
6814
|
+
"amis": {
|
|
6815
|
+
"visibleOn": "${false}"
|
|
6816
|
+
}
|
|
6817
|
+
},
|
|
6818
|
+
"shared_to": {
|
|
6819
|
+
"group": "",
|
|
6820
|
+
"amis":{
|
|
6821
|
+
"type": "radios",
|
|
6822
|
+
"inline": false
|
|
6823
|
+
}
|
|
6824
|
+
},
|
|
6825
|
+
"shared_to_organizations": {
|
|
6826
|
+
"group": ""
|
|
6827
|
+
},
|
|
6828
|
+
"filters": {
|
|
6829
|
+
"group": "",
|
|
6830
|
+
"amis": {
|
|
6831
|
+
"hidden": true
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
}
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6547
6837
|
/**
|
|
6548
6838
|
* 列表视图顶部第一行amisSchema
|
|
6549
6839
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -6553,6 +6843,99 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
6553
6843
|
const { icon, label } = objectSchema;
|
|
6554
6844
|
const disabled_list_views = objectSchema.permissions.disabled_list_views;
|
|
6555
6845
|
const listViewButtonOptions = [];
|
|
6846
|
+
const initApiAdaptor = `
|
|
6847
|
+
var data;
|
|
6848
|
+
if (recordId) {
|
|
6849
|
+
data = payload.data || { _filters_type_controller: 'conditions' };
|
|
6850
|
+
//数据格式转换
|
|
6851
|
+
if (data) {
|
|
6852
|
+
data.sort = lodash.map(data.sort, (item) => {
|
|
6853
|
+
return item.field_name + ":" + item.order;
|
|
6854
|
+
});
|
|
6855
|
+
data.searchable_fields = lodash.map(data.searchable_fields, 'field');
|
|
6856
|
+
|
|
6857
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
6858
|
+
try {
|
|
6859
|
+
data.filters = JSON.parse(data.filters);
|
|
6860
|
+
} catch (e) { }
|
|
6861
|
+
}
|
|
6862
|
+
|
|
6863
|
+
if (data.filters && lodash.isString(data.filters)) {
|
|
6864
|
+
data._filters_type_controller = 'function';
|
|
6865
|
+
} else {
|
|
6866
|
+
data._filters_type_controller = 'conditions'
|
|
6867
|
+
}
|
|
6868
|
+
|
|
6869
|
+
if (data._filters_type_controller === 'conditions') {
|
|
6870
|
+
data._filters_conditions = window.amisConvert.filtersToConditions(data.filters || []);
|
|
6871
|
+
} else {
|
|
6872
|
+
data._filters_function = data.filters;
|
|
6873
|
+
}
|
|
6874
|
+
}
|
|
6875
|
+
} else {
|
|
6876
|
+
const uiSchema = api.body.uiSchema;
|
|
6877
|
+
const contextDefaultData = context && context.data && context.data.defaultData; const defaultData = api.body.defaultData || contextDefaultData;
|
|
6878
|
+
let defaultValues = {};
|
|
6879
|
+
_.each(uiSchema && uiSchema.fields, function (field) {
|
|
6880
|
+
var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
|
|
6881
|
+
if (!_.isNil(value)) {
|
|
6882
|
+
defaultValues[field.name] = value;
|
|
6883
|
+
}
|
|
6884
|
+
});
|
|
6885
|
+
if (defaultData && _.isObject(defaultData) && !_.isArray(defaultData)) {
|
|
6886
|
+
data = Object.assign({}, defaultValues, defaultData);
|
|
6887
|
+
}else{data = Object.assign({}, defaultValues) }
|
|
6888
|
+
}
|
|
6889
|
+
for (key in data) {
|
|
6890
|
+
if (data[key] === null) {
|
|
6891
|
+
delete data[key];
|
|
6892
|
+
}
|
|
6893
|
+
}
|
|
6894
|
+
payload.data = data;
|
|
6895
|
+
delete payload.extensions; if (data.is_enable != false) { data.is_enable = true; };
|
|
6896
|
+
return payload;
|
|
6897
|
+
`;
|
|
6898
|
+
const apiRequestAdaptor = `
|
|
6899
|
+
delete formData.created;
|
|
6900
|
+
delete formData.created_by;
|
|
6901
|
+
delete formData.modified;
|
|
6902
|
+
delete formData.modified_by;
|
|
6903
|
+
delete formData._display;
|
|
6904
|
+
|
|
6905
|
+
//数据格式转换
|
|
6906
|
+
formData.sort = lodash.map(formData.sort, (item) => {
|
|
6907
|
+
const arr = item.split(':');
|
|
6908
|
+
return { field_name: arr[0], order: arr[1] };
|
|
6909
|
+
});
|
|
6910
|
+
|
|
6911
|
+
formData.searchable_fields = lodash.map(formData.searchable_fields, (item) => {
|
|
6912
|
+
return { field: item };
|
|
6913
|
+
});
|
|
6914
|
+
|
|
6915
|
+
if (!formData._filters_type_controller) {
|
|
6916
|
+
formData._filters_type_controller = 'conditions';
|
|
6917
|
+
}
|
|
6918
|
+
|
|
6919
|
+
if (formData._filters_type_controller === 'conditions' && formData._filters_conditions) {
|
|
6920
|
+
formData.filters = window.amisConvert.conditionsToFilters(formData._filters_conditions);
|
|
6921
|
+
// formData.filters = JSON.stringify(window.amisConvert.conditionsToFilters(formData._filters_conditions), null, 4);
|
|
6922
|
+
} else {
|
|
6923
|
+
formData.filters = formData._filters_function || null;
|
|
6924
|
+
}
|
|
6925
|
+
|
|
6926
|
+
delete formData._filters_type_controller;
|
|
6927
|
+
delete formData._filters_conditions;
|
|
6928
|
+
delete formData._filters_function;
|
|
6929
|
+
|
|
6930
|
+
query = \`mutation{record: object_listviews__insert(doc: {__saveData}){_id}}\`;
|
|
6931
|
+
if (formData.recordId) {
|
|
6932
|
+
query = \`mutation{record: object_listviews__update(id: "\` + formData._id + \`", doc: {__saveData}){_id}}\`;
|
|
6933
|
+
};
|
|
6934
|
+
__saveData = JSON.stringify(JSON.stringify(formData));
|
|
6935
|
+
|
|
6936
|
+
api.data = { query: query.replace('{__saveData}', __saveData) };
|
|
6937
|
+
return api;
|
|
6938
|
+
`;
|
|
6556
6939
|
_$1.each(
|
|
6557
6940
|
objectSchema.list_views,
|
|
6558
6941
|
(listView, name) => {
|
|
@@ -6563,6 +6946,379 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
6563
6946
|
listViewButtonOptions.push({
|
|
6564
6947
|
type: "button",
|
|
6565
6948
|
label: listView.label,
|
|
6949
|
+
body: [
|
|
6950
|
+
{
|
|
6951
|
+
"type": "flex",
|
|
6952
|
+
"alignItems": "center",
|
|
6953
|
+
"justify": "space-between",
|
|
6954
|
+
"items": [
|
|
6955
|
+
{
|
|
6956
|
+
"type": "tpl",
|
|
6957
|
+
"tpl": listView.label
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
"type": "button",
|
|
6961
|
+
"className": "steedos-listview-edit-button ml-3",
|
|
6962
|
+
"icon": "fa fa-edit",
|
|
6963
|
+
"actionType": "dialog",
|
|
6964
|
+
"hiddenOn": `!((global.user.is_space_admin || global.userId == '${listView.owner || ""}') && !!'${listView.owner || ""}')`,
|
|
6965
|
+
"dialog": {
|
|
6966
|
+
"type": "dialog",
|
|
6967
|
+
"title": "编辑 列表视图",
|
|
6968
|
+
"data": {
|
|
6969
|
+
"object_name": "${objectName}",
|
|
6970
|
+
"recordId": listView._id,
|
|
6971
|
+
"listName": "${listName}",
|
|
6972
|
+
"appId": "${appId}",
|
|
6973
|
+
"context": "${context}",
|
|
6974
|
+
"global": "${global}",
|
|
6975
|
+
"_id": listView._id
|
|
6976
|
+
},
|
|
6977
|
+
"body": [
|
|
6978
|
+
{
|
|
6979
|
+
"type": "steedos-object-form",
|
|
6980
|
+
"label": "对象表单",
|
|
6981
|
+
"objectApiName": "object_listviews",
|
|
6982
|
+
"recordId": "${recordId}",
|
|
6983
|
+
"className": "sm:rounded sm:border-gray-300 bg-white",
|
|
6984
|
+
"layout": "horizontal",
|
|
6985
|
+
"form": {
|
|
6986
|
+
"id": "form_object_listviews"
|
|
6987
|
+
},
|
|
6988
|
+
"mode": "edit",
|
|
6989
|
+
"enableTabs": true,
|
|
6990
|
+
"fields": [
|
|
6991
|
+
"label",
|
|
6992
|
+
"sort_no",
|
|
6993
|
+
"crud_mode",
|
|
6994
|
+
"shared",
|
|
6995
|
+
"shared_to",
|
|
6996
|
+
'shared_to_organizations',
|
|
6997
|
+
"columns",
|
|
6998
|
+
"columns.$",
|
|
6999
|
+
"columns.$.field",
|
|
7000
|
+
"columns.$.width",
|
|
7001
|
+
"columns.$.wrap",
|
|
7002
|
+
"mobile_columns",
|
|
7003
|
+
"mobile_columns.$",
|
|
7004
|
+
"mobile_columns.$.field",
|
|
7005
|
+
"sort",
|
|
7006
|
+
"sort.$",
|
|
7007
|
+
"sort.$.field_name",
|
|
7008
|
+
"sort.$.order",
|
|
7009
|
+
"filters",
|
|
7010
|
+
"searchable_fields",
|
|
7011
|
+
"searchable_fields.$",
|
|
7012
|
+
"searchable_fields.$.field",
|
|
7013
|
+
],
|
|
7014
|
+
"tabsMode": "line",
|
|
7015
|
+
"fieldsExtend": {
|
|
7016
|
+
"columns": {
|
|
7017
|
+
"amis": {
|
|
7018
|
+
"showIndex": true,
|
|
7019
|
+
"footerToolbar": [
|
|
7020
|
+
{
|
|
7021
|
+
"type": "button",
|
|
7022
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
7023
|
+
"actionType": "dialog",
|
|
7024
|
+
"dialog": {
|
|
7025
|
+
"type": "dialog",
|
|
7026
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
7027
|
+
"size": "md",
|
|
7028
|
+
"body": [
|
|
7029
|
+
{
|
|
7030
|
+
"type": "transfer",
|
|
7031
|
+
"options": [
|
|
7032
|
+
],
|
|
7033
|
+
"multiple": true,
|
|
7034
|
+
"id": "u:92c0b3cccca0",
|
|
7035
|
+
"required": true,
|
|
7036
|
+
"placeholder": "-",
|
|
7037
|
+
"className": "col-span-2 m-0",
|
|
7038
|
+
"checkAll": false,
|
|
7039
|
+
"searchable": true,
|
|
7040
|
+
"sortable": true,
|
|
7041
|
+
"itemHeight": 40,
|
|
7042
|
+
"source": {
|
|
7043
|
+
"method": "get",
|
|
7044
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7045
|
+
"headers": {
|
|
7046
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7047
|
+
},
|
|
7048
|
+
"requestAdaptor": "",
|
|
7049
|
+
"adaptor": ""
|
|
7050
|
+
},
|
|
7051
|
+
"joinValues": false,
|
|
7052
|
+
"extractValue": true,
|
|
7053
|
+
"name": "columns_quick_select",
|
|
7054
|
+
"value": "${columns|pick:field|split}"
|
|
7055
|
+
}
|
|
7056
|
+
],
|
|
7057
|
+
"onEvent": {
|
|
7058
|
+
"confirm": {
|
|
7059
|
+
"actions": [
|
|
7060
|
+
{
|
|
7061
|
+
"actionType": "custom",
|
|
7062
|
+
"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});"
|
|
7063
|
+
}
|
|
7064
|
+
]
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
],
|
|
7070
|
+
"addable": false,
|
|
7071
|
+
"draggable": false,
|
|
7072
|
+
"columns": [
|
|
7073
|
+
{
|
|
7074
|
+
"name": "field",
|
|
7075
|
+
"inlineEditMode": false
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
"name": "width",
|
|
7079
|
+
"width": 100
|
|
7080
|
+
},
|
|
7081
|
+
{
|
|
7082
|
+
"name": "wrap",
|
|
7083
|
+
"width": 50
|
|
7084
|
+
}
|
|
7085
|
+
],
|
|
7086
|
+
"enableDialog": false
|
|
7087
|
+
}
|
|
7088
|
+
},
|
|
7089
|
+
"sort": {
|
|
7090
|
+
"label": "",
|
|
7091
|
+
"amis": {
|
|
7092
|
+
"type": "tabs-transfer",
|
|
7093
|
+
"options": [
|
|
7094
|
+
],
|
|
7095
|
+
"id": "u:32f3e4e73115",
|
|
7096
|
+
"strictMode": true,
|
|
7097
|
+
"itemHeight": 40,
|
|
7098
|
+
"source": {
|
|
7099
|
+
"method": "get",
|
|
7100
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/sortFields/options",
|
|
7101
|
+
"headers": {
|
|
7102
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7103
|
+
},
|
|
7104
|
+
"data": null,
|
|
7105
|
+
"requestAdaptor": "",
|
|
7106
|
+
"adaptor": "",
|
|
7107
|
+
"sendOn": "!!this.object_name"
|
|
7108
|
+
},
|
|
7109
|
+
"visibleOn": "!!this.object_name",
|
|
7110
|
+
"sortable": true,
|
|
7111
|
+
"className": "col-span-2 m-0",
|
|
7112
|
+
"searchable": true,
|
|
7113
|
+
"checkAll": false,
|
|
7114
|
+
"clearValueOnHidden": false,
|
|
7115
|
+
"joinValues": false,
|
|
7116
|
+
"extractValue": true,
|
|
7117
|
+
"en-US": {
|
|
7118
|
+
"label": "Default Sort Order"
|
|
7119
|
+
},
|
|
7120
|
+
"multiple": true
|
|
7121
|
+
}
|
|
7122
|
+
},
|
|
7123
|
+
"filters": {
|
|
7124
|
+
"label": "",
|
|
7125
|
+
"amis": {
|
|
7126
|
+
"type": "group",
|
|
7127
|
+
"body": [
|
|
7128
|
+
{
|
|
7129
|
+
"type": "radios",
|
|
7130
|
+
"label": "${'object_listviews.listview_form.filter_configuration_method' | t}",
|
|
7131
|
+
"name": "_filters_type_controller",
|
|
7132
|
+
"options": [
|
|
7133
|
+
{
|
|
7134
|
+
"label": "${'object_listviews.listview_form.conditions_combination' | t}",
|
|
7135
|
+
"value": "conditions"
|
|
7136
|
+
},
|
|
7137
|
+
{
|
|
7138
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
7139
|
+
"value": "function"
|
|
7140
|
+
}
|
|
7141
|
+
],
|
|
7142
|
+
"id": "u:318671bc196c",
|
|
7143
|
+
"joinValues": true,
|
|
7144
|
+
"className": "col-span-2 m-0",
|
|
7145
|
+
"language": "javascript",
|
|
7146
|
+
"visibleOn": "false",
|
|
7147
|
+
"en-US": {
|
|
7148
|
+
"label": "Controller"
|
|
7149
|
+
}
|
|
7150
|
+
},
|
|
7151
|
+
{
|
|
7152
|
+
"type": "condition-builder",
|
|
7153
|
+
"label": "",
|
|
7154
|
+
"labelClassName": "none",
|
|
7155
|
+
"name": "_filters_conditions",
|
|
7156
|
+
"description": "",
|
|
7157
|
+
"id": "u:a9f2232e30d7",
|
|
7158
|
+
"source": {
|
|
7159
|
+
"method": "get",
|
|
7160
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${object_name}",
|
|
7161
|
+
"dataType": "json",
|
|
7162
|
+
"headers": {
|
|
7163
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7164
|
+
}
|
|
7165
|
+
},
|
|
7166
|
+
"disabled": false,
|
|
7167
|
+
"className": "col-span-2 m-0",
|
|
7168
|
+
"visibleOn": "!!this.object_name",
|
|
7169
|
+
"en-US": {
|
|
7170
|
+
"label": "Filters Conditions"
|
|
7171
|
+
}
|
|
7172
|
+
},
|
|
7173
|
+
{
|
|
7174
|
+
"type": "editor",
|
|
7175
|
+
"label": "${'object_listviews.listview_form.javascript' | t}",
|
|
7176
|
+
"name": "_filters_function",
|
|
7177
|
+
"id": "u:84714ec9abba",
|
|
7178
|
+
"visibleOn": "!!this.object_name && !!this._filters_type_controller && _filters_type_controller== 'function'",
|
|
7179
|
+
"className": "col-span-2 m-0",
|
|
7180
|
+
"labelClassName": "hidden"
|
|
7181
|
+
}
|
|
7182
|
+
]
|
|
7183
|
+
}
|
|
7184
|
+
},
|
|
7185
|
+
"mobile_columns": {
|
|
7186
|
+
"amis": {
|
|
7187
|
+
"showIndex": true,
|
|
7188
|
+
"footerToolbar": [
|
|
7189
|
+
{
|
|
7190
|
+
"type": "button",
|
|
7191
|
+
"label": "${'object_listviews.listview_form.field_set' | t}",
|
|
7192
|
+
"actionType": "dialog",
|
|
7193
|
+
"dialog": {
|
|
7194
|
+
"type": "dialog",
|
|
7195
|
+
"title": "${'object_listviews.listview_form.displayed_columns' | t}",
|
|
7196
|
+
"size": "md",
|
|
7197
|
+
"body": [
|
|
7198
|
+
{
|
|
7199
|
+
"type": "transfer",
|
|
7200
|
+
"options": [
|
|
7201
|
+
],
|
|
7202
|
+
"multiple": true,
|
|
7203
|
+
"id": "u:92c0b3cccca0",
|
|
7204
|
+
"required": true,
|
|
7205
|
+
"placeholder": "-",
|
|
7206
|
+
"className": "col-span-2 m-0",
|
|
7207
|
+
"itemHeight": 40,
|
|
7208
|
+
"checkAll": false,
|
|
7209
|
+
"searchable": true,
|
|
7210
|
+
"sortable": true,
|
|
7211
|
+
"source": {
|
|
7212
|
+
"method": "get",
|
|
7213
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7214
|
+
"headers": {
|
|
7215
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7216
|
+
},
|
|
7217
|
+
"requestAdaptor": "",
|
|
7218
|
+
"adaptor": ""
|
|
7219
|
+
},
|
|
7220
|
+
"joinValues": false,
|
|
7221
|
+
"extractValue": true,
|
|
7222
|
+
"name": "columns_quick_select",
|
|
7223
|
+
"value": "${mobile_columns|pick:field|split}"
|
|
7224
|
+
}
|
|
7225
|
+
],
|
|
7226
|
+
"onEvent": {
|
|
7227
|
+
"confirm": {
|
|
7228
|
+
"actions": [
|
|
7229
|
+
{
|
|
7230
|
+
"actionType": "custom",
|
|
7231
|
+
"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});"
|
|
7232
|
+
}
|
|
7233
|
+
]
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
],
|
|
7239
|
+
"columns": [
|
|
7240
|
+
{
|
|
7241
|
+
"name": "field",
|
|
7242
|
+
"inlineEditMode": false
|
|
7243
|
+
}
|
|
7244
|
+
],
|
|
7245
|
+
"addable": false,
|
|
7246
|
+
"draggable": false,
|
|
7247
|
+
"enableDialog": false
|
|
7248
|
+
}
|
|
7249
|
+
},
|
|
7250
|
+
"searchable_fields": {
|
|
7251
|
+
"label": "",
|
|
7252
|
+
"amis": {
|
|
7253
|
+
"type": "transfer",
|
|
7254
|
+
"options": [
|
|
7255
|
+
],
|
|
7256
|
+
"selectMode": "list",
|
|
7257
|
+
"searchable": true,
|
|
7258
|
+
"searchApi": "",
|
|
7259
|
+
"sortable": true,
|
|
7260
|
+
"mode": "normal",
|
|
7261
|
+
"searchResultMode": "list",
|
|
7262
|
+
"joinValues": false,
|
|
7263
|
+
"extractValue": true,
|
|
7264
|
+
"itemHeight": 40,
|
|
7265
|
+
"source": {
|
|
7266
|
+
"method": "get",
|
|
7267
|
+
"url": "${context.rootUrl}/service/api/amis-metadata-objects/objects/${object_name}/fields/options",
|
|
7268
|
+
"headers": {
|
|
7269
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
7270
|
+
},
|
|
7271
|
+
"data": null,
|
|
7272
|
+
"requestAdaptor": "",
|
|
7273
|
+
"adaptor": "",
|
|
7274
|
+
"sendOn": "!!this.object_name"
|
|
7275
|
+
},
|
|
7276
|
+
"visibleOn": "!!this.object_name",
|
|
7277
|
+
"className": "col-span-2 m-0",
|
|
7278
|
+
"multiple": true,
|
|
7279
|
+
"id": "u:adb91066539e"
|
|
7280
|
+
}
|
|
7281
|
+
},
|
|
7282
|
+
"shared_to": {
|
|
7283
|
+
"amis":{
|
|
7284
|
+
"type": "radios",
|
|
7285
|
+
"inline": false
|
|
7286
|
+
},
|
|
7287
|
+
"group": "",
|
|
7288
|
+
"is_wide": true
|
|
7289
|
+
}
|
|
7290
|
+
},
|
|
7291
|
+
initApiAdaptor,
|
|
7292
|
+
apiRequestAdaptor,
|
|
7293
|
+
"onEvent": {
|
|
7294
|
+
"submitSucc": {
|
|
7295
|
+
"weight": 0,
|
|
7296
|
+
"actions": [
|
|
7297
|
+
{
|
|
7298
|
+
"args": {
|
|
7299
|
+
"url": "${context.rootUrl}/app/${appId}/${object_name}/grid/${name}",
|
|
7300
|
+
"blank": false
|
|
7301
|
+
},
|
|
7302
|
+
"actionType": "url",
|
|
7303
|
+
},
|
|
7304
|
+
]
|
|
7305
|
+
}
|
|
7306
|
+
},
|
|
7307
|
+
"id": "u:ce9e3fcc411a"
|
|
7308
|
+
}
|
|
7309
|
+
],
|
|
7310
|
+
"className": "steedos-overflow-visible-dialog",
|
|
7311
|
+
"showCloseButton": true,
|
|
7312
|
+
"showErrorMsg": true,
|
|
7313
|
+
"showLoading": true,
|
|
7314
|
+
"closeOnEsc": false,
|
|
7315
|
+
"dataMapSwitch": false,
|
|
7316
|
+
"size": "lg"
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
]
|
|
7320
|
+
}
|
|
7321
|
+
],
|
|
6566
7322
|
actionType: "link",
|
|
6567
7323
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
6568
7324
|
});
|
|
@@ -6596,6 +7352,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
6596
7352
|
"visibleOn": "${display == 'split'?true:false}"
|
|
6597
7353
|
});
|
|
6598
7354
|
}
|
|
7355
|
+
const listviewNewButton = getNewListviewButtonSchema();
|
|
7356
|
+
listviewNewButton.visibleOn = "global.user.is_space_admin";
|
|
6599
7357
|
return {
|
|
6600
7358
|
"type": "grid",
|
|
6601
7359
|
"columns": [
|
|
@@ -6626,14 +7384,24 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
6626
7384
|
},
|
|
6627
7385
|
{
|
|
6628
7386
|
"type": "dropdown-button",
|
|
6629
|
-
"className": "",
|
|
7387
|
+
"className": "steedos-listview-change-button",
|
|
6630
7388
|
"label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
|
|
6631
7389
|
"rightIcon": "fa fa-caret-down",
|
|
6632
7390
|
"size": "sm",
|
|
6633
7391
|
"hideCaret": true,
|
|
6634
7392
|
"closeOnClick": true,
|
|
6635
7393
|
"btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
|
|
6636
|
-
"buttons":
|
|
7394
|
+
"buttons": [
|
|
7395
|
+
...listViewButtonOptions,
|
|
7396
|
+
{
|
|
7397
|
+
"children": [
|
|
7398
|
+
{
|
|
7399
|
+
"type": "divider"
|
|
7400
|
+
}
|
|
7401
|
+
]
|
|
7402
|
+
},
|
|
7403
|
+
listviewNewButton
|
|
7404
|
+
]
|
|
6637
7405
|
}
|
|
6638
7406
|
],
|
|
6639
7407
|
"md": "",
|
|
@@ -6789,6 +7557,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6789
7557
|
function getBackButtonSchema(){
|
|
6790
7558
|
return {
|
|
6791
7559
|
"type": "service",
|
|
7560
|
+
"className": "steedos-object-record-detail-header-back-button",
|
|
6792
7561
|
"onEvent": {
|
|
6793
7562
|
"@history_paths.changed": {
|
|
6794
7563
|
"actions": [
|
|
@@ -7075,7 +7844,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7075
7844
|
id: `page_readonly_${name}_header`,
|
|
7076
7845
|
name: `page`,
|
|
7077
7846
|
body: body,
|
|
7078
|
-
className:
|
|
7847
|
+
className: "steedos-object-record-detail-header"
|
|
7079
7848
|
}
|
|
7080
7849
|
|
|
7081
7850
|
}
|
|
@@ -7160,216 +7929,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7160
7929
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
7161
7930
|
}
|
|
7162
7931
|
|
|
7163
|
-
const getNewListviewButtonSchema = ()=>{
|
|
7164
|
-
return {
|
|
7165
|
-
"type": "button",
|
|
7166
|
-
"label": i18next__default["default"].t('frontend_listview_control_new_label'),
|
|
7167
|
-
"onEvent": {
|
|
7168
|
-
"click": {
|
|
7169
|
-
"weight": 0,
|
|
7170
|
-
"actions": [
|
|
7171
|
-
{
|
|
7172
|
-
"dialog": {
|
|
7173
|
-
"type": "dialog",
|
|
7174
|
-
"title": i18next__default["default"].t('frontend_listview_control_new_title'),
|
|
7175
|
-
"data": {
|
|
7176
|
-
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
7177
|
-
"all": "${uiSchema.list_views.all}",
|
|
7178
|
-
"list_view": "${uiSchema.list_views[listName]}",
|
|
7179
|
-
"appId": "${appId}",
|
|
7180
|
-
"global": "${global}",
|
|
7181
|
-
"targetObjectName": "${objectName}",
|
|
7182
|
-
"context": "${context}"
|
|
7183
|
-
},
|
|
7184
|
-
"body": [
|
|
7185
|
-
{
|
|
7186
|
-
"type": "steedos-object-form",
|
|
7187
|
-
"label": "对象表单",
|
|
7188
|
-
"objectApiName": "object_listviews",
|
|
7189
|
-
"recordId": "",
|
|
7190
|
-
"mode": "edit",
|
|
7191
|
-
"layout": "normal",
|
|
7192
|
-
"defaultData": {
|
|
7193
|
-
"&": "${list_view}",
|
|
7194
|
-
"name":"",
|
|
7195
|
-
"label":"",
|
|
7196
|
-
"filters":"",
|
|
7197
|
-
"shared":false,
|
|
7198
|
-
"object_name": "${targetObjectName}",
|
|
7199
|
-
"_id":"",
|
|
7200
|
-
"shared_to": null,
|
|
7201
|
-
"shared_to_organizations": null,
|
|
7202
|
-
"locked": false,
|
|
7203
|
-
"owner": null,
|
|
7204
|
-
"company_id": null,
|
|
7205
|
-
"company_ids": null,
|
|
7206
|
-
"is_system": false
|
|
7207
|
-
},
|
|
7208
|
-
"fieldsExtend": fieldsExtend$5(),
|
|
7209
|
-
"fields": fields$1(),
|
|
7210
|
-
"onEvent": {
|
|
7211
|
-
"submitSucc": {
|
|
7212
|
-
"weight": 0,
|
|
7213
|
-
"actions": [
|
|
7214
|
-
{
|
|
7215
|
-
"args": {
|
|
7216
|
-
// 直接使用recordId不能拿到数据,只能通过result里面拿数据
|
|
7217
|
-
"url": "${context.rootUrl}/app/${appId}/${targetObjectName}/grid/listview_${result.data.recordId|lowerCase}",
|
|
7218
|
-
"blank": false
|
|
7219
|
-
},
|
|
7220
|
-
"actionType": "url",
|
|
7221
|
-
}
|
|
7222
|
-
]
|
|
7223
|
-
}
|
|
7224
|
-
},
|
|
7225
|
-
"messages": {
|
|
7226
|
-
"success": i18next__default["default"].t('frontend_listview_control_new_message_success'),
|
|
7227
|
-
"failed": i18next__default["default"].t('frontend_listview_control_new_message_failed')
|
|
7228
|
-
},
|
|
7229
|
-
}
|
|
7230
|
-
],
|
|
7231
|
-
"showCloseButton": true,
|
|
7232
|
-
"showErrorMsg": true,
|
|
7233
|
-
"showLoading": true,
|
|
7234
|
-
"closeOnEsc": false,
|
|
7235
|
-
"dataMapSwitch": false,
|
|
7236
|
-
"size": "lg"
|
|
7237
|
-
},
|
|
7238
|
-
"actionType": "dialog"
|
|
7239
|
-
}
|
|
7240
|
-
]
|
|
7241
|
-
}
|
|
7242
|
-
}
|
|
7243
|
-
}
|
|
7244
|
-
};
|
|
7245
|
-
|
|
7246
|
-
function fields$1(){
|
|
7247
|
-
return [
|
|
7248
|
-
"label",
|
|
7249
|
-
"name",
|
|
7250
|
-
"object_name",
|
|
7251
|
-
"filter_scope",
|
|
7252
|
-
"show_count",
|
|
7253
|
-
"columns",
|
|
7254
|
-
"sort",
|
|
7255
|
-
"filters",
|
|
7256
|
-
"mobile_columns",
|
|
7257
|
-
"searchable_fields",
|
|
7258
|
-
"is_system",
|
|
7259
|
-
"shared",
|
|
7260
|
-
"shared_to",
|
|
7261
|
-
"shared_to_organizations"
|
|
7262
|
-
]
|
|
7263
|
-
}
|
|
7264
|
-
|
|
7265
|
-
function fieldsExtend$5(){
|
|
7266
|
-
return {
|
|
7267
|
-
"group": "",
|
|
7268
|
-
"label": {
|
|
7269
|
-
"group": "",
|
|
7270
|
-
"is_wide": true
|
|
7271
|
-
},
|
|
7272
|
-
"name": {
|
|
7273
|
-
"group": "",
|
|
7274
|
-
"amis": {
|
|
7275
|
-
"hidden": true,
|
|
7276
|
-
"required": false
|
|
7277
|
-
}
|
|
7278
|
-
},
|
|
7279
|
-
"object_name": {
|
|
7280
|
-
"group": "",
|
|
7281
|
-
"amis": {
|
|
7282
|
-
"hidden": true
|
|
7283
|
-
}
|
|
7284
|
-
},
|
|
7285
|
-
"filter_scope": {
|
|
7286
|
-
"group": "",
|
|
7287
|
-
"amis": {
|
|
7288
|
-
"hidden": true,
|
|
7289
|
-
"required": false
|
|
7290
|
-
}
|
|
7291
|
-
},
|
|
7292
|
-
"columns": {
|
|
7293
|
-
"group": "",
|
|
7294
|
-
"amis": {
|
|
7295
|
-
"hidden": true,
|
|
7296
|
-
"required": false
|
|
7297
|
-
}
|
|
7298
|
-
},
|
|
7299
|
-
"mobile_columns":{
|
|
7300
|
-
"group": "",
|
|
7301
|
-
"amis": {
|
|
7302
|
-
"hidden": true,
|
|
7303
|
-
"required": false
|
|
7304
|
-
}
|
|
7305
|
-
},
|
|
7306
|
-
"searchable_fields":{
|
|
7307
|
-
"group": "",
|
|
7308
|
-
"amis": {
|
|
7309
|
-
"hidden": true,
|
|
7310
|
-
"required": false
|
|
7311
|
-
}
|
|
7312
|
-
},
|
|
7313
|
-
"filter_fields": {
|
|
7314
|
-
"group": "",
|
|
7315
|
-
"amis": {
|
|
7316
|
-
"hidden": true,
|
|
7317
|
-
"required": false
|
|
7318
|
-
}
|
|
7319
|
-
},
|
|
7320
|
-
"scrolling_mode": {
|
|
7321
|
-
"group": "",
|
|
7322
|
-
"amis": {
|
|
7323
|
-
"hidden": true,
|
|
7324
|
-
"required": false
|
|
7325
|
-
}
|
|
7326
|
-
},
|
|
7327
|
-
"sort": {
|
|
7328
|
-
"group": "",
|
|
7329
|
-
"amis": {
|
|
7330
|
-
"hidden": true,
|
|
7331
|
-
"required": false
|
|
7332
|
-
}
|
|
7333
|
-
},
|
|
7334
|
-
"show_count": {
|
|
7335
|
-
"group": "",
|
|
7336
|
-
"amis": {
|
|
7337
|
-
"hidden": true,
|
|
7338
|
-
"required": false
|
|
7339
|
-
}
|
|
7340
|
-
},
|
|
7341
|
-
"type": {
|
|
7342
|
-
"group": "",
|
|
7343
|
-
"amis": {
|
|
7344
|
-
"hidden": true,
|
|
7345
|
-
"required": false
|
|
7346
|
-
}
|
|
7347
|
-
},
|
|
7348
|
-
"shared": {
|
|
7349
|
-
"group": "",
|
|
7350
|
-
"amis": {
|
|
7351
|
-
"visibleOn": "${false}"
|
|
7352
|
-
}
|
|
7353
|
-
},
|
|
7354
|
-
"shared_to": {
|
|
7355
|
-
"group": "",
|
|
7356
|
-
"amis":{
|
|
7357
|
-
"type": "radios",
|
|
7358
|
-
"inline": false
|
|
7359
|
-
}
|
|
7360
|
-
},
|
|
7361
|
-
"shared_to_organizations": {
|
|
7362
|
-
"group": ""
|
|
7363
|
-
},
|
|
7364
|
-
"filters": {
|
|
7365
|
-
"group": "",
|
|
7366
|
-
"amis": {
|
|
7367
|
-
"hidden": true
|
|
7368
|
-
}
|
|
7369
|
-
}
|
|
7370
|
-
}
|
|
7371
|
-
}
|
|
7372
|
-
|
|
7373
7932
|
const getCopyListviewButtonSchema = ()=>{
|
|
7374
7933
|
return {
|
|
7375
7934
|
"type": "button",
|
|
@@ -8335,6 +8894,10 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8335
8894
|
// const scope = event.context.scoped;
|
|
8336
8895
|
// 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
|
|
8337
8896
|
// 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
|
|
8897
|
+
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8898
|
+
if(!filterForm){
|
|
8899
|
+
return;
|
|
8900
|
+
}
|
|
8338
8901
|
let isLookup = event.data.isLookup;
|
|
8339
8902
|
let __lookupField = event.data.__lookupField;
|
|
8340
8903
|
let __changedFilterFormValuesKey = "__changedFilterFormValues";
|
|
@@ -8345,9 +8908,8 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
|
|
|
8345
8908
|
}
|
|
8346
8909
|
__changedFilterFormValuesKey += lookupTag;
|
|
8347
8910
|
}
|
|
8348
|
-
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
8349
8911
|
setTimeout(function(){
|
|
8350
|
-
filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
8912
|
+
filterForm && filterForm.setValues(event.data[__changedFilterFormValuesKey]);
|
|
8351
8913
|
}, 500);
|
|
8352
8914
|
`;
|
|
8353
8915
|
|
|
@@ -9012,6 +9574,8 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9012
9574
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
9013
9575
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
9014
9576
|
}
|
|
9577
|
+
// 去除数组中的异常值,如null,undefined等
|
|
9578
|
+
body.columns = ___default["default"].compact(body.columns);
|
|
9015
9579
|
|
|
9016
9580
|
if (defaults) {
|
|
9017
9581
|
const headerSchema = defaults.headerSchema;
|
|
@@ -10194,6 +10758,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10194
10758
|
wrap: column.wrap // wrap = true 是没效果的
|
|
10195
10759
|
}
|
|
10196
10760
|
);
|
|
10761
|
+
} else if (filedInfo && filedInfo.type === 'object') {
|
|
10762
|
+
columnField = uiSchema.fields[column.field];
|
|
10197
10763
|
}
|
|
10198
10764
|
} else {
|
|
10199
10765
|
if (uiSchema.fields[column.field]) {
|
|
@@ -10328,7 +10894,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10328
10894
|
};
|
|
10329
10895
|
const content = {
|
|
10330
10896
|
"type": "tabs",
|
|
10331
|
-
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
10897
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
|
|
10332
10898
|
"contentClassName": "bg-none",
|
|
10333
10899
|
"tabs": [
|
|
10334
10900
|
detailed
|
|
@@ -11435,7 +12001,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11435
12001
|
}
|
|
11436
12002
|
|
|
11437
12003
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
11438
|
-
var currentAmis = amisRequire('amis');
|
|
12004
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
11439
12005
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
11440
12006
|
function traverseNestedArray(arr) {
|
|
11441
12007
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -11446,7 +12012,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11446
12012
|
// 如果当前元素不是数组,则处理该元素
|
|
11447
12013
|
// 下面正则用于匹配amis公式\${}
|
|
11448
12014
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11449
|
-
|
|
12015
|
+
try{
|
|
12016
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
12017
|
+
}catch(ex){
|
|
12018
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
12019
|
+
}
|
|
11450
12020
|
}
|
|
11451
12021
|
}
|
|
11452
12022
|
}
|
|
@@ -11607,8 +12177,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11607
12177
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
11608
12178
|
const isCreate = ___namespace.isBoolean(field.create) ? field.create : true;
|
|
11609
12179
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
11610
|
-
let
|
|
11611
|
-
if (isAllowCreate && isCreate && !
|
|
12180
|
+
let hasFilters = !___namespace.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
12181
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
11612
12182
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
11613
12183
|
new_button.align = "right";
|
|
11614
12184
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -11852,7 +12422,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11852
12422
|
// }
|
|
11853
12423
|
|
|
11854
12424
|
var fieldFilters = ${JSON.stringify(field.filters)};
|
|
11855
|
-
var currentAmis = amisRequire('amis');
|
|
12425
|
+
var currentAmis = (window.amisRequire && window.amisRequire('amis')) || Amis;
|
|
11856
12426
|
//递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
|
|
11857
12427
|
function traverseNestedArray(arr) {
|
|
11858
12428
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -11863,7 +12433,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11863
12433
|
// 如果当前元素不是数组,则处理该元素
|
|
11864
12434
|
// 下面正则用于匹配amis公式\${}
|
|
11865
12435
|
if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
|
|
11866
|
-
|
|
12436
|
+
try{
|
|
12437
|
+
arr[i] = currentAmis.evaluate(arr[i], api.context);
|
|
12438
|
+
}catch(ex){
|
|
12439
|
+
console.error("运行lookup过滤公式时出现错误:",ex);
|
|
12440
|
+
}
|
|
11867
12441
|
}
|
|
11868
12442
|
}
|
|
11869
12443
|
}
|
|
@@ -12275,8 +12849,8 @@ if(typeof window != 'undefined'){
|
|
|
12275
12849
|
/*
|
|
12276
12850
|
* @Author: baozhoutao@steedos.com
|
|
12277
12851
|
* @Date: 2023-01-13 17:27:54
|
|
12278
|
-
* @LastEditors:
|
|
12279
|
-
* @LastEditTime: 2024-
|
|
12852
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12853
|
+
* @LastEditTime: 2024-06-07 13:39:34
|
|
12280
12854
|
* @Description:
|
|
12281
12855
|
*/
|
|
12282
12856
|
|
|
@@ -12313,6 +12887,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
12313
12887
|
"name": field.name,
|
|
12314
12888
|
"labelClassName": "none",
|
|
12315
12889
|
"language": "markdown",
|
|
12890
|
+
"options": field.amis ? field.amis.editorOptions : null
|
|
12316
12891
|
}
|
|
12317
12892
|
]
|
|
12318
12893
|
},
|
|
@@ -12969,6 +13544,21 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12969
13544
|
type: getAmisStaticFieldType('url', readonly, field),
|
|
12970
13545
|
static: readonly ? true : false
|
|
12971
13546
|
};
|
|
13547
|
+
if(!readonly){
|
|
13548
|
+
// amis input-url控件不支持相对路径,这里支持下
|
|
13549
|
+
// 如果要使用amis原生input-url控件的默认的isUrl验证效果或自定义字段validations效果,配置字段的amis.validations属性即可,配置为null或空字符串则使用amis默认的isUrl效果
|
|
13550
|
+
let fieldAmisValidations = field.amis?.validations;
|
|
13551
|
+
if(typeof fieldAmisValidations === "undefined"){
|
|
13552
|
+
Object.assign(convertData, {
|
|
13553
|
+
"validations": {
|
|
13554
|
+
"matchRegexp": "^((http:\\/\\/|https:\\/\\/|ftp:\\/\\/|sftp:\\/\\/)+([^\\s\\/\\.]+(\\.[^\\s\\/\\.]+)+))*(\\/[^\\s\\.\\/]+)*$"
|
|
13555
|
+
},
|
|
13556
|
+
"validationErrors": {
|
|
13557
|
+
"matchRegexp": i18next__default["default"].t('frontend_form_validation_failed_url')//"URL 格式不正确"
|
|
13558
|
+
}
|
|
13559
|
+
});
|
|
13560
|
+
}
|
|
13561
|
+
}
|
|
12972
13562
|
if(readonly && field.show_as_qr){
|
|
12973
13563
|
convertData = {
|
|
12974
13564
|
type: "control",
|
|
@@ -13034,13 +13624,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
13034
13624
|
};
|
|
13035
13625
|
break;
|
|
13036
13626
|
case 'avatar':
|
|
13037
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13627
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13038
13628
|
break;
|
|
13039
13629
|
case 'image':
|
|
13040
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13630
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13041
13631
|
break;
|
|
13042
13632
|
case 'file':
|
|
13043
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
13633
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
13044
13634
|
break;
|
|
13045
13635
|
case 'formula':
|
|
13046
13636
|
if(readonly){
|
|
@@ -13156,6 +13746,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
13156
13746
|
if(gridSub){
|
|
13157
13747
|
delete gridSub.name;
|
|
13158
13748
|
delete gridSub.label;
|
|
13749
|
+
//去除重复样式
|
|
13750
|
+
gridSub.className = gridSub.className.replace('border-b', '');
|
|
13159
13751
|
convertData.items.push(
|
|
13160
13752
|
Object.assign({}, gridSub, {label: subField.label}, subField.amis, {
|
|
13161
13753
|
name: subFieldName
|
|
@@ -13210,6 +13802,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
13210
13802
|
}
|
|
13211
13803
|
// if(ctx.mode === 'edit'){
|
|
13212
13804
|
let convertDataResult = Object.assign({}, baseData, convertData, { labelClassName: 'text-left', clearValueOnHidden: true, fieldName: field.name}, field.amis, {name: baseData.name});
|
|
13805
|
+
// 只读时file字段的外层control层若存在name,内部each组件存在问题
|
|
13806
|
+
if(readonly && field.type == "file") {
|
|
13807
|
+
convertDataResult.name = "";
|
|
13808
|
+
}
|
|
13213
13809
|
// console.log("convertDataResult:", convertDataResult);
|
|
13214
13810
|
return convertDataResult;
|
|
13215
13811
|
// }else{
|
|
@@ -13429,13 +14025,17 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
13429
14025
|
// console.log(`perField.type object ===> field`, field)
|
|
13430
14026
|
}
|
|
13431
14027
|
if (field.name.indexOf(".") < 0) {
|
|
14028
|
+
let _field = _.cloneDeep(field);
|
|
14029
|
+
if(field.type === "select" && field.data_type && field.data_type != "text"){
|
|
14030
|
+
_field.type = field.data_type;
|
|
14031
|
+
}
|
|
13432
14032
|
if(field.type === "steedos-field"){
|
|
13433
14033
|
// 如果是steedos-field则不需要通过convertSFieldToAmisField函数转换,因为steedos-field组件会转换
|
|
13434
|
-
fieldSetBody.push(
|
|
14034
|
+
fieldSetBody.push(_field);
|
|
13435
14035
|
}
|
|
13436
14036
|
else {
|
|
13437
14037
|
ctx.__formFields = formFields;
|
|
13438
|
-
const amisField = await convertSFieldToAmisField(
|
|
14038
|
+
const amisField = await convertSFieldToAmisField(_field, _field.readonly, ctx);
|
|
13439
14039
|
// 如果steedos-field稳定了,可以放开下面的代码直接用组件统一渲染字段
|
|
13440
14040
|
// const amisField = {
|
|
13441
14041
|
// "type": "steedos-field",
|
|
@@ -13588,24 +14188,24 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
13588
14188
|
/*
|
|
13589
14189
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
13590
14190
|
* @Date: 2024-01-18 15:12:41
|
|
13591
|
-
* @LastEditors:
|
|
13592
|
-
* @LastEditTime: 2024-
|
|
14191
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
14192
|
+
* @LastEditTime: 2024-05-20 13:46:41
|
|
13593
14193
|
*/
|
|
13594
14194
|
/**
|
|
13595
14195
|
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
13596
14196
|
* @returns uuid
|
|
13597
14197
|
*/
|
|
13598
14198
|
function uuidv4() {
|
|
13599
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c
|
|
13600
|
-
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
13601
|
-
);
|
|
14199
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, function (c) {
|
|
14200
|
+
return (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
|
|
14201
|
+
});
|
|
13602
14202
|
}
|
|
13603
14203
|
|
|
13604
14204
|
/*
|
|
13605
14205
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
13606
14206
|
* @Date: 2023-11-15 09:50:22
|
|
13607
14207
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
13608
|
-
* @LastEditTime: 2024-
|
|
14208
|
+
* @LastEditTime: 2024-06-14 06:31:33
|
|
13609
14209
|
*/
|
|
13610
14210
|
|
|
13611
14211
|
/**
|
|
@@ -13824,7 +14424,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13824
14424
|
return {
|
|
13825
14425
|
"type": "steedos-field",
|
|
13826
14426
|
"config": Object.assign({}, field, {
|
|
13827
|
-
label: false
|
|
14427
|
+
label: false,
|
|
14428
|
+
description: null
|
|
13828
14429
|
}),
|
|
13829
14430
|
// quickEdit: {
|
|
13830
14431
|
// "type": "steedos-field",
|
|
@@ -13841,7 +14442,8 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13841
14442
|
return {
|
|
13842
14443
|
"type": "steedos-field",
|
|
13843
14444
|
"config": Object.assign({}, field, {
|
|
13844
|
-
label: false
|
|
14445
|
+
label: false,
|
|
14446
|
+
description: null
|
|
13845
14447
|
}),
|
|
13846
14448
|
inInputTable: true,
|
|
13847
14449
|
"static": true,
|
|
@@ -14675,6 +15277,7 @@ async function getButtonActions(props, mode) {
|
|
|
14675
15277
|
"__parentForm": mode == "new" ? "$$" : parentFormData,
|
|
14676
15278
|
"_master": "${_master}",
|
|
14677
15279
|
"global": "${global}",
|
|
15280
|
+
"context": "${context}",
|
|
14678
15281
|
"uiSchema": "${uiSchema}",
|
|
14679
15282
|
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
14680
15283
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -14799,6 +15402,7 @@ async function getButtonActions(props, mode) {
|
|
|
14799
15402
|
"__parentForm": parentFormData,
|
|
14800
15403
|
"_master": "${_master}",
|
|
14801
15404
|
"global": "${global}",
|
|
15405
|
+
"context": "${context}",
|
|
14802
15406
|
"uiSchema": "${uiSchema}",
|
|
14803
15407
|
"index": "${index}",
|
|
14804
15408
|
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
@@ -15085,7 +15689,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
15085
15689
|
}
|
|
15086
15690
|
return value;
|
|
15087
15691
|
},
|
|
15088
|
-
"required": props.required
|
|
15692
|
+
"required": props.required,
|
|
15693
|
+
"description": props.description
|
|
15089
15694
|
};
|
|
15090
15695
|
if (buttonsForColumnOperations.length) {
|
|
15091
15696
|
inputTableSchema.columns.unshift({
|
|
@@ -17958,4 +18563,5 @@ exports.setSteedosAuth = setSteedosAuth;
|
|
|
17958
18563
|
exports.setUISchemaFunction = setUISchemaFunction;
|
|
17959
18564
|
exports.setVariable = setVariable;
|
|
17960
18565
|
exports.standardButtonsTodo = standardButtonsTodo;
|
|
18566
|
+
exports.uuidv4 = uuidv4;
|
|
17961
18567
|
//# sourceMappingURL=index.cjs.js.map
|