@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.cjs.js
CHANGED
|
@@ -1613,7 +1613,7 @@ var frontend_listview_control_rename_label = "重命名";
|
|
|
1613
1613
|
var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
1614
1614
|
var frontend_listview_control_share = "共享设置";
|
|
1615
1615
|
var frontend_listview_control_sort = "默认排序规则";
|
|
1616
|
-
var frontend_export_excel = "导出
|
|
1616
|
+
var frontend_export_excel = "导出";
|
|
1617
1617
|
var frontend_ercord_operation = "操作";
|
|
1618
1618
|
var frontend_import_data = "导入数据";
|
|
1619
1619
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -1764,7 +1764,7 @@ i18next__default["default"]
|
|
|
1764
1764
|
* @Description:
|
|
1765
1765
|
*/
|
|
1766
1766
|
|
|
1767
|
-
const getSchema$
|
|
1767
|
+
const getSchema$5 = async (uiSchema, ctx) => {
|
|
1768
1768
|
const schemaApiAdaptor = `
|
|
1769
1769
|
let formSchema = {
|
|
1770
1770
|
"type": "steedos-object-form",
|
|
@@ -1938,7 +1938,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1938
1938
|
* @Description:
|
|
1939
1939
|
*/
|
|
1940
1940
|
|
|
1941
|
-
const getSchema$
|
|
1941
|
+
const getSchema$4 = async (uiSchema, ctx) => {
|
|
1942
1942
|
const title = i18next__default["default"].t('frontend_form_edit') + " " + uiSchema.label;
|
|
1943
1943
|
|
|
1944
1944
|
const defaultFormSchema = {
|
|
@@ -2006,7 +2006,7 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
2006
2006
|
* @LastEditors: Please set LastEditors
|
|
2007
2007
|
* @LastEditTime: 2023-04-12 10:35:36
|
|
2008
2008
|
*/
|
|
2009
|
-
const getSchema$
|
|
2009
|
+
const getSchema$3 = (uiSchema)=>{
|
|
2010
2010
|
return {
|
|
2011
2011
|
"type": "service",
|
|
2012
2012
|
"className": "p-0",
|
|
@@ -2075,7 +2075,7 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
2075
2075
|
}
|
|
2076
2076
|
};
|
|
2077
2077
|
|
|
2078
|
-
const getSchema$
|
|
2078
|
+
const getSchema$2 = (uiSchema) => {
|
|
2079
2079
|
return {
|
|
2080
2080
|
type: "service",
|
|
2081
2081
|
body: [
|
|
@@ -2376,7 +2376,7 @@ const getSchema$1 = (uiSchema) => {
|
|
|
2376
2376
|
* @Description:
|
|
2377
2377
|
*/
|
|
2378
2378
|
|
|
2379
|
-
const getSchema = (uiSchema)=>{
|
|
2379
|
+
const getSchema$1 = (uiSchema)=>{
|
|
2380
2380
|
return {
|
|
2381
2381
|
"type": "service",
|
|
2382
2382
|
"className": "p-0",
|
|
@@ -2408,6 +2408,94 @@ const getSchema = (uiSchema)=>{
|
|
|
2408
2408
|
}
|
|
2409
2409
|
};
|
|
2410
2410
|
|
|
2411
|
+
const getSchema = async (uiSchema, ctx) => {
|
|
2412
|
+
const requestAdaptor = `
|
|
2413
|
+
// 获取列表视图的属性
|
|
2414
|
+
let uiSchema = api.body.uiSchema;
|
|
2415
|
+
let list_views = uiSchema.list_views;
|
|
2416
|
+
let list_views_name = api.body.listName;
|
|
2417
|
+
let col = list_views[list_views_name].columns;
|
|
2418
|
+
let sort_test = list_views[list_views_name].sort;
|
|
2419
|
+
|
|
2420
|
+
// 获取下载字段
|
|
2421
|
+
let select = [];
|
|
2422
|
+
_.each(col, (col) => {
|
|
2423
|
+
if (col.field == undefined)
|
|
2424
|
+
select.push(col);
|
|
2425
|
+
else select.push(col.field);
|
|
2426
|
+
});
|
|
2427
|
+
|
|
2428
|
+
// 获取排序字段
|
|
2429
|
+
|
|
2430
|
+
let sort = [];
|
|
2431
|
+
_.forEach(sort_test, (sortField) => {
|
|
2432
|
+
if (sortField.field_name == undefined)
|
|
2433
|
+
sort.push(sortField);
|
|
2434
|
+
else sort.push([sortField.field_name, sortField.order]);
|
|
2435
|
+
})
|
|
2436
|
+
|
|
2437
|
+
let orders = [];
|
|
2438
|
+
_.map(sort, (value) => {
|
|
2439
|
+
let order_tmp = [];
|
|
2440
|
+
if (value[1] == "desc")
|
|
2441
|
+
order_tmp = value[0] + ' desc';
|
|
2442
|
+
else
|
|
2443
|
+
order_tmp = value[0];
|
|
2444
|
+
orders.push(order_tmp);
|
|
2445
|
+
});
|
|
2446
|
+
let order = orders.join(',');
|
|
2447
|
+
|
|
2448
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2449
|
+
|
|
2450
|
+
url_tmp = api.url.split('?')[0];
|
|
2451
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2452
|
+
|
|
2453
|
+
// 判断sort 和 filters
|
|
2454
|
+
if (sort.length > 0) {
|
|
2455
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2456
|
+
}
|
|
2457
|
+
let filters = list_views[list_views_name].filters;
|
|
2458
|
+
if (filters && filters.length > 0) {
|
|
2459
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2460
|
+
}
|
|
2461
|
+
return api;
|
|
2462
|
+
`;
|
|
2463
|
+
return {
|
|
2464
|
+
"type": "service",
|
|
2465
|
+
"body": [{
|
|
2466
|
+
"type": "button",
|
|
2467
|
+
"label": i18next__default["default"].t('frontend_export_excel'),
|
|
2468
|
+
"id": "u:standard_export_excel",
|
|
2469
|
+
"level": "default",
|
|
2470
|
+
"onEvent": {
|
|
2471
|
+
"click": {
|
|
2472
|
+
"weight": 0,
|
|
2473
|
+
"actions": [
|
|
2474
|
+
{
|
|
2475
|
+
"args": {
|
|
2476
|
+
"api": {
|
|
2477
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
2478
|
+
"method": "get",
|
|
2479
|
+
"messages": {},
|
|
2480
|
+
"requestAdaptor": requestAdaptor,
|
|
2481
|
+
"data": {
|
|
2482
|
+
"uiSchema": "${uiSchema}",
|
|
2483
|
+
"listName": "${listName}"
|
|
2484
|
+
},
|
|
2485
|
+
"headers": {
|
|
2486
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
},
|
|
2490
|
+
"actionType": "download"
|
|
2491
|
+
}
|
|
2492
|
+
]
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
}]
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
|
|
2411
2499
|
/*
|
|
2412
2500
|
* @Author: baozhoutao@steedos.com
|
|
2413
2501
|
* @Date: 2022-11-01 15:53:07
|
|
@@ -2420,19 +2508,19 @@ const StandardButtons = {
|
|
|
2420
2508
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
2421
2509
|
return {
|
|
2422
2510
|
type: 'amis_button',
|
|
2423
|
-
amis_schema: await getSchema$
|
|
2511
|
+
amis_schema: await getSchema$5(uiSchema)
|
|
2424
2512
|
}
|
|
2425
2513
|
},
|
|
2426
2514
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
2427
2515
|
return {
|
|
2428
2516
|
type: 'amis_button',
|
|
2429
|
-
amis_schema: await getSchema$
|
|
2517
|
+
amis_schema: await getSchema$4(uiSchema, ctx)
|
|
2430
2518
|
}
|
|
2431
2519
|
},
|
|
2432
2520
|
getStandardDelete: async (uiSchema, ctx)=>{
|
|
2433
2521
|
return {
|
|
2434
2522
|
type: 'amis_button',
|
|
2435
|
-
amis_schema: await getSchema$
|
|
2523
|
+
amis_schema: await getSchema$3(uiSchema)
|
|
2436
2524
|
}
|
|
2437
2525
|
},
|
|
2438
2526
|
getStandardDeleteMany: async (uiSchema, ctx)=>{
|
|
@@ -2468,10 +2556,16 @@ const StandardButtons = {
|
|
|
2468
2556
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2469
2557
|
return {
|
|
2470
2558
|
type: 'amis_button',
|
|
2471
|
-
amis_schema: await getSchema$
|
|
2559
|
+
amis_schema: await getSchema$2()
|
|
2472
2560
|
}
|
|
2473
2561
|
},
|
|
2474
2562
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
2563
|
+
return {
|
|
2564
|
+
type: 'amis_button',
|
|
2565
|
+
amis_schema: await getSchema$1()
|
|
2566
|
+
}
|
|
2567
|
+
},
|
|
2568
|
+
getStandardExportExcel: async (uiSchema, ctx)=>{
|
|
2475
2569
|
return {
|
|
2476
2570
|
type: 'amis_button',
|
|
2477
2571
|
amis_schema: await getSchema()
|
|
@@ -2736,6 +2830,16 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
2736
2830
|
}
|
|
2737
2831
|
}
|
|
2738
2832
|
|
|
2833
|
+
if(button.name === 'standard_export_excel'){
|
|
2834
|
+
return {
|
|
2835
|
+
label: button.label,
|
|
2836
|
+
name: button.name,
|
|
2837
|
+
on: button.on,
|
|
2838
|
+
sort: button.sort,
|
|
2839
|
+
...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2739
2843
|
if(button.name === 'standard_open_view'){
|
|
2740
2844
|
return {
|
|
2741
2845
|
label: button.label,
|
|
@@ -4031,97 +4135,6 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
4031
4135
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
4032
4136
|
}
|
|
4033
4137
|
|
|
4034
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
4035
|
-
return {
|
|
4036
|
-
"type": "button",
|
|
4037
|
-
"icon": "fa fa-download",
|
|
4038
|
-
"align": "right",
|
|
4039
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4040
|
-
"tooltipPlacement": "bottom",
|
|
4041
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4042
|
-
"tooltip": i18next__default["default"].t('frontend_export_excel'),
|
|
4043
|
-
"onEvent": {
|
|
4044
|
-
"click": {
|
|
4045
|
-
"weight": 0,
|
|
4046
|
-
"actions": [
|
|
4047
|
-
{
|
|
4048
|
-
"args": {
|
|
4049
|
-
"api": {
|
|
4050
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
4051
|
-
"method": "get",
|
|
4052
|
-
"messages": {},
|
|
4053
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
4054
|
-
"data": {
|
|
4055
|
-
"uiSchema": "${uiSchema}",
|
|
4056
|
-
"listName": "${listName}"
|
|
4057
|
-
},
|
|
4058
|
-
"headers": {
|
|
4059
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
4062
|
-
},
|
|
4063
|
-
"actionType": "download"
|
|
4064
|
-
}
|
|
4065
|
-
]
|
|
4066
|
-
}
|
|
4067
|
-
}
|
|
4068
|
-
}
|
|
4069
|
-
};
|
|
4070
|
-
|
|
4071
|
-
function requestAdaptor$1(){
|
|
4072
|
-
return `
|
|
4073
|
-
// 获取列表视图的属性
|
|
4074
|
-
let uiSchema = api.body.uiSchema;
|
|
4075
|
-
let list_views = uiSchema.list_views;
|
|
4076
|
-
let list_views_name = api.body.listName;
|
|
4077
|
-
let col = list_views[list_views_name].columns;
|
|
4078
|
-
let sort_test = list_views[list_views_name].sort;
|
|
4079
|
-
|
|
4080
|
-
// 获取下载字段
|
|
4081
|
-
let select = [];
|
|
4082
|
-
_.each(col, (col) => {
|
|
4083
|
-
if (col.field == undefined)
|
|
4084
|
-
select.push(col);
|
|
4085
|
-
else select.push(col.field);
|
|
4086
|
-
});
|
|
4087
|
-
|
|
4088
|
-
// 获取排序字段
|
|
4089
|
-
|
|
4090
|
-
let sort = [];
|
|
4091
|
-
_.forEach(sort_test, (sortField) => {
|
|
4092
|
-
if (sortField.field_name == undefined)
|
|
4093
|
-
sort.push(sortField);
|
|
4094
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
4095
|
-
})
|
|
4096
|
-
|
|
4097
|
-
let orders = [];
|
|
4098
|
-
_.map(sort, (value) => {
|
|
4099
|
-
let order_tmp = [];
|
|
4100
|
-
if (value[1] == "desc")
|
|
4101
|
-
order_tmp = value[0] + ' desc';
|
|
4102
|
-
else
|
|
4103
|
-
order_tmp = value[0];
|
|
4104
|
-
orders.push(order_tmp);
|
|
4105
|
-
});
|
|
4106
|
-
let order = orders.join(',');
|
|
4107
|
-
|
|
4108
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
4109
|
-
|
|
4110
|
-
url_tmp = api.url.split('?')[0];
|
|
4111
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
4112
|
-
|
|
4113
|
-
// 判断sort 和 filters
|
|
4114
|
-
if (sort.length > 0) {
|
|
4115
|
-
api.url += "&$orderby=" + order;
|
|
4116
|
-
}
|
|
4117
|
-
let filters = list_views[list_views_name].filters;
|
|
4118
|
-
if (filters && filters.length > 0) {
|
|
4119
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
4120
|
-
}
|
|
4121
|
-
return api;
|
|
4122
|
-
`
|
|
4123
|
-
}
|
|
4124
|
-
|
|
4125
4138
|
const getNewListviewButtonSchema = ()=>{
|
|
4126
4139
|
return {
|
|
4127
4140
|
"type": "button",
|
|
@@ -5211,7 +5224,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5211
5224
|
"tooltipPlacement": "bottom",
|
|
5212
5225
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5213
5226
|
},
|
|
5214
|
-
getExportExcelToolbarButtonSchema(),
|
|
5227
|
+
// getExportExcelToolbarButtonSchema(),
|
|
5215
5228
|
filterVisible ? {
|
|
5216
5229
|
"label": "",
|
|
5217
5230
|
"icon": "fa fa-search",
|
|
@@ -5835,7 +5848,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5835
5848
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
5836
5849
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
5837
5850
|
if (isAllowCreate) {
|
|
5838
|
-
const new_button = await getSchema$
|
|
5851
|
+
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
5839
5852
|
new_button.align = "right";
|
|
5840
5853
|
pickerSchema.headerToolbar.push(new_button);
|
|
5841
5854
|
}
|
|
@@ -7585,7 +7598,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
7585
7598
|
level: "link",
|
|
7586
7599
|
actionType: "link",
|
|
7587
7600
|
link: url,
|
|
7588
|
-
innerClassName:
|
|
7601
|
+
innerClassName: {
|
|
7602
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
7603
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
7604
|
+
},
|
|
7589
7605
|
body: {
|
|
7590
7606
|
"type": "wrapper",
|
|
7591
7607
|
"body": columnLines,
|