@steedos-widgets/amis-lib 1.2.17 → 1.2.19
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 +120 -104
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +120 -104
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +120 -104
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +8 -2
- package/dist/types/lib/converter/amis/fields/table.d.ts +4 -1
- package/dist/types/lib/converter/amis/header.d.ts +0 -5
- package/dist/types/schema/standard_export_excel.amis.d.ts +32 -0
- package/dist/types/standard/button.d.ts +35 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1610,7 +1610,7 @@
|
|
|
1610
1610
|
var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
1611
1611
|
var frontend_listview_control_share = "共享设置";
|
|
1612
1612
|
var frontend_listview_control_sort = "默认排序规则";
|
|
1613
|
-
var frontend_export_excel = "导出
|
|
1613
|
+
var frontend_export_excel = "导出";
|
|
1614
1614
|
var frontend_ercord_operation = "操作";
|
|
1615
1615
|
var frontend_import_data = "导入数据";
|
|
1616
1616
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -1761,7 +1761,7 @@
|
|
|
1761
1761
|
* @Description:
|
|
1762
1762
|
*/
|
|
1763
1763
|
|
|
1764
|
-
const getSchema$
|
|
1764
|
+
const getSchema$5 = async (uiSchema, ctx) => {
|
|
1765
1765
|
const schemaApiAdaptor = `
|
|
1766
1766
|
let formSchema = {
|
|
1767
1767
|
"type": "steedos-object-form",
|
|
@@ -1935,7 +1935,7 @@
|
|
|
1935
1935
|
* @Description:
|
|
1936
1936
|
*/
|
|
1937
1937
|
|
|
1938
|
-
const getSchema$
|
|
1938
|
+
const getSchema$4 = async (uiSchema, ctx) => {
|
|
1939
1939
|
const title = i18next__default["default"].t('frontend_form_edit') + " " + uiSchema.label;
|
|
1940
1940
|
|
|
1941
1941
|
const defaultFormSchema = {
|
|
@@ -2003,7 +2003,7 @@
|
|
|
2003
2003
|
* @LastEditors: Please set LastEditors
|
|
2004
2004
|
* @LastEditTime: 2023-04-12 10:35:36
|
|
2005
2005
|
*/
|
|
2006
|
-
const getSchema$
|
|
2006
|
+
const getSchema$3 = (uiSchema)=>{
|
|
2007
2007
|
return {
|
|
2008
2008
|
"type": "service",
|
|
2009
2009
|
"className": "p-0",
|
|
@@ -2072,7 +2072,7 @@
|
|
|
2072
2072
|
}
|
|
2073
2073
|
};
|
|
2074
2074
|
|
|
2075
|
-
const getSchema$
|
|
2075
|
+
const getSchema$2 = (uiSchema) => {
|
|
2076
2076
|
return {
|
|
2077
2077
|
type: "service",
|
|
2078
2078
|
body: [
|
|
@@ -2373,7 +2373,7 @@
|
|
|
2373
2373
|
* @Description:
|
|
2374
2374
|
*/
|
|
2375
2375
|
|
|
2376
|
-
const getSchema = (uiSchema)=>{
|
|
2376
|
+
const getSchema$1 = (uiSchema)=>{
|
|
2377
2377
|
return {
|
|
2378
2378
|
"type": "service",
|
|
2379
2379
|
"className": "p-0",
|
|
@@ -2405,6 +2405,94 @@
|
|
|
2405
2405
|
}
|
|
2406
2406
|
};
|
|
2407
2407
|
|
|
2408
|
+
const getSchema = async (uiSchema, ctx) => {
|
|
2409
|
+
const requestAdaptor = `
|
|
2410
|
+
// 获取列表视图的属性
|
|
2411
|
+
let uiSchema = api.body.uiSchema;
|
|
2412
|
+
let list_views = uiSchema.list_views;
|
|
2413
|
+
let list_views_name = api.body.listName;
|
|
2414
|
+
let col = list_views[list_views_name].columns;
|
|
2415
|
+
let sort_test = list_views[list_views_name].sort;
|
|
2416
|
+
|
|
2417
|
+
// 获取下载字段
|
|
2418
|
+
let select = [];
|
|
2419
|
+
_.each(col, (col) => {
|
|
2420
|
+
if (col.field == undefined)
|
|
2421
|
+
select.push(col);
|
|
2422
|
+
else select.push(col.field);
|
|
2423
|
+
});
|
|
2424
|
+
|
|
2425
|
+
// 获取排序字段
|
|
2426
|
+
|
|
2427
|
+
let sort = [];
|
|
2428
|
+
_.forEach(sort_test, (sortField) => {
|
|
2429
|
+
if (sortField.field_name == undefined)
|
|
2430
|
+
sort.push(sortField);
|
|
2431
|
+
else sort.push([sortField.field_name, sortField.order]);
|
|
2432
|
+
})
|
|
2433
|
+
|
|
2434
|
+
let orders = [];
|
|
2435
|
+
_.map(sort, (value) => {
|
|
2436
|
+
let order_tmp = [];
|
|
2437
|
+
if (value[1] == "desc")
|
|
2438
|
+
order_tmp = value[0] + ' desc';
|
|
2439
|
+
else
|
|
2440
|
+
order_tmp = value[0];
|
|
2441
|
+
orders.push(order_tmp);
|
|
2442
|
+
});
|
|
2443
|
+
let order = orders.join(',');
|
|
2444
|
+
|
|
2445
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2446
|
+
|
|
2447
|
+
url_tmp = api.url.split('?')[0];
|
|
2448
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2449
|
+
|
|
2450
|
+
// 判断sort 和 filters
|
|
2451
|
+
if (sort.length > 0) {
|
|
2452
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2453
|
+
}
|
|
2454
|
+
let filters = list_views[list_views_name].filters;
|
|
2455
|
+
if (filters && filters.length > 0) {
|
|
2456
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2457
|
+
}
|
|
2458
|
+
return api;
|
|
2459
|
+
`;
|
|
2460
|
+
return {
|
|
2461
|
+
"type": "service",
|
|
2462
|
+
"body": [{
|
|
2463
|
+
"type": "button",
|
|
2464
|
+
"label": i18next__default["default"].t('frontend_export_excel'),
|
|
2465
|
+
"id": "u:standard_export_excel",
|
|
2466
|
+
"level": "default",
|
|
2467
|
+
"onEvent": {
|
|
2468
|
+
"click": {
|
|
2469
|
+
"weight": 0,
|
|
2470
|
+
"actions": [
|
|
2471
|
+
{
|
|
2472
|
+
"args": {
|
|
2473
|
+
"api": {
|
|
2474
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
2475
|
+
"method": "get",
|
|
2476
|
+
"messages": {},
|
|
2477
|
+
"requestAdaptor": requestAdaptor,
|
|
2478
|
+
"data": {
|
|
2479
|
+
"uiSchema": "${uiSchema}",
|
|
2480
|
+
"listName": "${listName}"
|
|
2481
|
+
},
|
|
2482
|
+
"headers": {
|
|
2483
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
},
|
|
2487
|
+
"actionType": "download"
|
|
2488
|
+
}
|
|
2489
|
+
]
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}]
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
|
|
2408
2496
|
/*
|
|
2409
2497
|
* @Author: baozhoutao@steedos.com
|
|
2410
2498
|
* @Date: 2022-11-01 15:53:07
|
|
@@ -2417,19 +2505,19 @@
|
|
|
2417
2505
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
2418
2506
|
return {
|
|
2419
2507
|
type: 'amis_button',
|
|
2420
|
-
amis_schema: await getSchema$
|
|
2508
|
+
amis_schema: await getSchema$5(uiSchema)
|
|
2421
2509
|
}
|
|
2422
2510
|
},
|
|
2423
2511
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
2424
2512
|
return {
|
|
2425
2513
|
type: 'amis_button',
|
|
2426
|
-
amis_schema: await getSchema$
|
|
2514
|
+
amis_schema: await getSchema$4(uiSchema, ctx)
|
|
2427
2515
|
}
|
|
2428
2516
|
},
|
|
2429
2517
|
getStandardDelete: async (uiSchema, ctx)=>{
|
|
2430
2518
|
return {
|
|
2431
2519
|
type: 'amis_button',
|
|
2432
|
-
amis_schema: await getSchema$
|
|
2520
|
+
amis_schema: await getSchema$3(uiSchema)
|
|
2433
2521
|
}
|
|
2434
2522
|
},
|
|
2435
2523
|
getStandardDeleteMany: async (uiSchema, ctx)=>{
|
|
@@ -2465,10 +2553,16 @@
|
|
|
2465
2553
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2466
2554
|
return {
|
|
2467
2555
|
type: 'amis_button',
|
|
2468
|
-
amis_schema: await getSchema$
|
|
2556
|
+
amis_schema: await getSchema$2()
|
|
2469
2557
|
}
|
|
2470
2558
|
},
|
|
2471
2559
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
2560
|
+
return {
|
|
2561
|
+
type: 'amis_button',
|
|
2562
|
+
amis_schema: await getSchema$1()
|
|
2563
|
+
}
|
|
2564
|
+
},
|
|
2565
|
+
getStandardExportExcel: async (uiSchema, ctx)=>{
|
|
2472
2566
|
return {
|
|
2473
2567
|
type: 'amis_button',
|
|
2474
2568
|
amis_schema: await getSchema()
|
|
@@ -2733,6 +2827,16 @@
|
|
|
2733
2827
|
}
|
|
2734
2828
|
}
|
|
2735
2829
|
|
|
2830
|
+
if(button.name === 'standard_export_excel'){
|
|
2831
|
+
return {
|
|
2832
|
+
label: button.label,
|
|
2833
|
+
name: button.name,
|
|
2834
|
+
on: button.on,
|
|
2835
|
+
sort: button.sort,
|
|
2836
|
+
...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2736
2840
|
if(button.name === 'standard_open_view'){
|
|
2737
2841
|
return {
|
|
2738
2842
|
label: button.label,
|
|
@@ -4028,97 +4132,6 @@
|
|
|
4028
4132
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
4029
4133
|
}
|
|
4030
4134
|
|
|
4031
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
4032
|
-
return {
|
|
4033
|
-
"type": "button",
|
|
4034
|
-
"icon": "fa fa-download",
|
|
4035
|
-
"align": "right",
|
|
4036
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4037
|
-
"tooltipPlacement": "bottom",
|
|
4038
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4039
|
-
"tooltip": i18next__default["default"].t('frontend_export_excel'),
|
|
4040
|
-
"onEvent": {
|
|
4041
|
-
"click": {
|
|
4042
|
-
"weight": 0,
|
|
4043
|
-
"actions": [
|
|
4044
|
-
{
|
|
4045
|
-
"args": {
|
|
4046
|
-
"api": {
|
|
4047
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
4048
|
-
"method": "get",
|
|
4049
|
-
"messages": {},
|
|
4050
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
4051
|
-
"data": {
|
|
4052
|
-
"uiSchema": "${uiSchema}",
|
|
4053
|
-
"listName": "${listName}"
|
|
4054
|
-
},
|
|
4055
|
-
"headers": {
|
|
4056
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4057
|
-
}
|
|
4058
|
-
}
|
|
4059
|
-
},
|
|
4060
|
-
"actionType": "download"
|
|
4061
|
-
}
|
|
4062
|
-
]
|
|
4063
|
-
}
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
|
-
};
|
|
4067
|
-
|
|
4068
|
-
function requestAdaptor$1(){
|
|
4069
|
-
return `
|
|
4070
|
-
// 获取列表视图的属性
|
|
4071
|
-
let uiSchema = api.body.uiSchema;
|
|
4072
|
-
let list_views = uiSchema.list_views;
|
|
4073
|
-
let list_views_name = api.body.listName;
|
|
4074
|
-
let col = list_views[list_views_name].columns;
|
|
4075
|
-
let sort_test = list_views[list_views_name].sort;
|
|
4076
|
-
|
|
4077
|
-
// 获取下载字段
|
|
4078
|
-
let select = [];
|
|
4079
|
-
_.each(col, (col) => {
|
|
4080
|
-
if (col.field == undefined)
|
|
4081
|
-
select.push(col);
|
|
4082
|
-
else select.push(col.field);
|
|
4083
|
-
});
|
|
4084
|
-
|
|
4085
|
-
// 获取排序字段
|
|
4086
|
-
|
|
4087
|
-
let sort = [];
|
|
4088
|
-
_.forEach(sort_test, (sortField) => {
|
|
4089
|
-
if (sortField.field_name == undefined)
|
|
4090
|
-
sort.push(sortField);
|
|
4091
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
4092
|
-
})
|
|
4093
|
-
|
|
4094
|
-
let orders = [];
|
|
4095
|
-
_.map(sort, (value) => {
|
|
4096
|
-
let order_tmp = [];
|
|
4097
|
-
if (value[1] == "desc")
|
|
4098
|
-
order_tmp = value[0] + ' desc';
|
|
4099
|
-
else
|
|
4100
|
-
order_tmp = value[0];
|
|
4101
|
-
orders.push(order_tmp);
|
|
4102
|
-
});
|
|
4103
|
-
let order = orders.join(',');
|
|
4104
|
-
|
|
4105
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
4106
|
-
|
|
4107
|
-
url_tmp = api.url.split('?')[0];
|
|
4108
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
4109
|
-
|
|
4110
|
-
// 判断sort 和 filters
|
|
4111
|
-
if (sort.length > 0) {
|
|
4112
|
-
api.url += "&$orderby=" + order;
|
|
4113
|
-
}
|
|
4114
|
-
let filters = list_views[list_views_name].filters;
|
|
4115
|
-
if (filters && filters.length > 0) {
|
|
4116
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
4117
|
-
}
|
|
4118
|
-
return api;
|
|
4119
|
-
`
|
|
4120
|
-
}
|
|
4121
|
-
|
|
4122
4135
|
const getNewListviewButtonSchema = ()=>{
|
|
4123
4136
|
return {
|
|
4124
4137
|
"type": "button",
|
|
@@ -5208,7 +5221,7 @@ else{
|
|
|
5208
5221
|
"tooltipPlacement": "bottom",
|
|
5209
5222
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5210
5223
|
},
|
|
5211
|
-
getExportExcelToolbarButtonSchema(),
|
|
5224
|
+
// getExportExcelToolbarButtonSchema(),
|
|
5212
5225
|
filterVisible ? {
|
|
5213
5226
|
"label": "",
|
|
5214
5227
|
"icon": "fa fa-search",
|
|
@@ -5832,7 +5845,7 @@ else{
|
|
|
5832
5845
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
5833
5846
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
5834
5847
|
if (isAllowCreate) {
|
|
5835
|
-
const new_button = await getSchema$
|
|
5848
|
+
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
5836
5849
|
new_button.align = "right";
|
|
5837
5850
|
pickerSchema.headerToolbar.push(new_button);
|
|
5838
5851
|
}
|
|
@@ -7582,7 +7595,10 @@ else{
|
|
|
7582
7595
|
level: "link",
|
|
7583
7596
|
actionType: "link",
|
|
7584
7597
|
link: url,
|
|
7585
|
-
innerClassName:
|
|
7598
|
+
innerClassName: {
|
|
7599
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
7600
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
7601
|
+
},
|
|
7586
7602
|
body: {
|
|
7587
7603
|
"type": "wrapper",
|
|
7588
7604
|
"body": columnLines,
|