@steedos-widgets/amis-lib 1.2.17 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +115 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +115 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +115 -11
- package/dist/index.umd.js.map +1 -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.esm.js
CHANGED
|
@@ -1586,7 +1586,7 @@ var frontend_listview_control_rename_label = "重命名";
|
|
|
1586
1586
|
var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
1587
1587
|
var frontend_listview_control_share = "共享设置";
|
|
1588
1588
|
var frontend_listview_control_sort = "默认排序规则";
|
|
1589
|
-
var frontend_export_excel = "导出
|
|
1589
|
+
var frontend_export_excel = "导出";
|
|
1590
1590
|
var frontend_ercord_operation = "操作";
|
|
1591
1591
|
var frontend_import_data = "导入数据";
|
|
1592
1592
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -1737,7 +1737,7 @@ i18next
|
|
|
1737
1737
|
* @Description:
|
|
1738
1738
|
*/
|
|
1739
1739
|
|
|
1740
|
-
const getSchema$
|
|
1740
|
+
const getSchema$5 = async (uiSchema, ctx) => {
|
|
1741
1741
|
const schemaApiAdaptor = `
|
|
1742
1742
|
let formSchema = {
|
|
1743
1743
|
"type": "steedos-object-form",
|
|
@@ -1911,7 +1911,7 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1911
1911
|
* @Description:
|
|
1912
1912
|
*/
|
|
1913
1913
|
|
|
1914
|
-
const getSchema$
|
|
1914
|
+
const getSchema$4 = async (uiSchema, ctx) => {
|
|
1915
1915
|
const title = i18next.t('frontend_form_edit') + " " + uiSchema.label;
|
|
1916
1916
|
|
|
1917
1917
|
const defaultFormSchema = {
|
|
@@ -1979,7 +1979,7 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
1979
1979
|
* @LastEditors: Please set LastEditors
|
|
1980
1980
|
* @LastEditTime: 2023-04-12 10:35:36
|
|
1981
1981
|
*/
|
|
1982
|
-
const getSchema$
|
|
1982
|
+
const getSchema$3 = (uiSchema)=>{
|
|
1983
1983
|
return {
|
|
1984
1984
|
"type": "service",
|
|
1985
1985
|
"className": "p-0",
|
|
@@ -2048,7 +2048,7 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
2048
2048
|
}
|
|
2049
2049
|
};
|
|
2050
2050
|
|
|
2051
|
-
const getSchema$
|
|
2051
|
+
const getSchema$2 = (uiSchema) => {
|
|
2052
2052
|
return {
|
|
2053
2053
|
type: "service",
|
|
2054
2054
|
body: [
|
|
@@ -2349,7 +2349,7 @@ const getSchema$1 = (uiSchema) => {
|
|
|
2349
2349
|
* @Description:
|
|
2350
2350
|
*/
|
|
2351
2351
|
|
|
2352
|
-
const getSchema = (uiSchema)=>{
|
|
2352
|
+
const getSchema$1 = (uiSchema)=>{
|
|
2353
2353
|
return {
|
|
2354
2354
|
"type": "service",
|
|
2355
2355
|
"className": "p-0",
|
|
@@ -2381,6 +2381,94 @@ const getSchema = (uiSchema)=>{
|
|
|
2381
2381
|
}
|
|
2382
2382
|
};
|
|
2383
2383
|
|
|
2384
|
+
const getSchema = async (uiSchema, ctx) => {
|
|
2385
|
+
const requestAdaptor = `
|
|
2386
|
+
// 获取列表视图的属性
|
|
2387
|
+
let uiSchema = api.body.uiSchema;
|
|
2388
|
+
let list_views = uiSchema.list_views;
|
|
2389
|
+
let list_views_name = api.body.listName;
|
|
2390
|
+
let col = list_views[list_views_name].columns;
|
|
2391
|
+
let sort_test = list_views[list_views_name].sort;
|
|
2392
|
+
|
|
2393
|
+
// 获取下载字段
|
|
2394
|
+
let select = [];
|
|
2395
|
+
_.each(col, (col) => {
|
|
2396
|
+
if (col.field == undefined)
|
|
2397
|
+
select.push(col);
|
|
2398
|
+
else select.push(col.field);
|
|
2399
|
+
});
|
|
2400
|
+
|
|
2401
|
+
// 获取排序字段
|
|
2402
|
+
|
|
2403
|
+
let sort = [];
|
|
2404
|
+
_.forEach(sort_test, (sortField) => {
|
|
2405
|
+
if (sortField.field_name == undefined)
|
|
2406
|
+
sort.push(sortField);
|
|
2407
|
+
else sort.push([sortField.field_name, sortField.order]);
|
|
2408
|
+
})
|
|
2409
|
+
|
|
2410
|
+
let orders = [];
|
|
2411
|
+
_.map(sort, (value) => {
|
|
2412
|
+
let order_tmp = [];
|
|
2413
|
+
if (value[1] == "desc")
|
|
2414
|
+
order_tmp = value[0] + ' desc';
|
|
2415
|
+
else
|
|
2416
|
+
order_tmp = value[0];
|
|
2417
|
+
orders.push(order_tmp);
|
|
2418
|
+
});
|
|
2419
|
+
let order = orders.join(',');
|
|
2420
|
+
|
|
2421
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2422
|
+
|
|
2423
|
+
url_tmp = api.url.split('?')[0];
|
|
2424
|
+
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
2425
|
+
|
|
2426
|
+
// 判断sort 和 filters
|
|
2427
|
+
if (sort.length > 0) {
|
|
2428
|
+
api.url += "&$orderby=" + order;
|
|
2429
|
+
}
|
|
2430
|
+
let filters = list_views[list_views_name].filters;
|
|
2431
|
+
if (filters && filters.length > 0) {
|
|
2432
|
+
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
2433
|
+
}
|
|
2434
|
+
return api;
|
|
2435
|
+
`;
|
|
2436
|
+
return {
|
|
2437
|
+
"type": "service",
|
|
2438
|
+
"body": [{
|
|
2439
|
+
"type": "button",
|
|
2440
|
+
"label": i18next.t('frontend_export_excel'),
|
|
2441
|
+
"id": "u:standard_export_excel",
|
|
2442
|
+
"level": "default",
|
|
2443
|
+
"onEvent": {
|
|
2444
|
+
"click": {
|
|
2445
|
+
"weight": 0,
|
|
2446
|
+
"actions": [
|
|
2447
|
+
{
|
|
2448
|
+
"args": {
|
|
2449
|
+
"api": {
|
|
2450
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
2451
|
+
"method": "get",
|
|
2452
|
+
"messages": {},
|
|
2453
|
+
"requestAdaptor": requestAdaptor,
|
|
2454
|
+
"data": {
|
|
2455
|
+
"uiSchema": "${uiSchema}",
|
|
2456
|
+
"listName": "${listName}"
|
|
2457
|
+
},
|
|
2458
|
+
"headers": {
|
|
2459
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
},
|
|
2463
|
+
"actionType": "download"
|
|
2464
|
+
}
|
|
2465
|
+
]
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
}]
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2384
2472
|
/*
|
|
2385
2473
|
* @Author: baozhoutao@steedos.com
|
|
2386
2474
|
* @Date: 2022-11-01 15:53:07
|
|
@@ -2393,19 +2481,19 @@ const StandardButtons = {
|
|
|
2393
2481
|
getStandardNew: async (uiSchema, ctx)=>{
|
|
2394
2482
|
return {
|
|
2395
2483
|
type: 'amis_button',
|
|
2396
|
-
amis_schema: await getSchema$
|
|
2484
|
+
amis_schema: await getSchema$5(uiSchema)
|
|
2397
2485
|
}
|
|
2398
2486
|
},
|
|
2399
2487
|
getStandardEdit: async (uiSchema, ctx)=>{
|
|
2400
2488
|
return {
|
|
2401
2489
|
type: 'amis_button',
|
|
2402
|
-
amis_schema: await getSchema$
|
|
2490
|
+
amis_schema: await getSchema$4(uiSchema, ctx)
|
|
2403
2491
|
}
|
|
2404
2492
|
},
|
|
2405
2493
|
getStandardDelete: async (uiSchema, ctx)=>{
|
|
2406
2494
|
return {
|
|
2407
2495
|
type: 'amis_button',
|
|
2408
|
-
amis_schema: await getSchema$
|
|
2496
|
+
amis_schema: await getSchema$3(uiSchema)
|
|
2409
2497
|
}
|
|
2410
2498
|
},
|
|
2411
2499
|
getStandardDeleteMany: async (uiSchema, ctx)=>{
|
|
@@ -2441,10 +2529,16 @@ const StandardButtons = {
|
|
|
2441
2529
|
getStandardImportData: async (uiSchema, ctx)=>{
|
|
2442
2530
|
return {
|
|
2443
2531
|
type: 'amis_button',
|
|
2444
|
-
amis_schema: await getSchema$
|
|
2532
|
+
amis_schema: await getSchema$2()
|
|
2445
2533
|
}
|
|
2446
2534
|
},
|
|
2447
2535
|
getStandardOpenView: async (uiSchema, ctx)=>{
|
|
2536
|
+
return {
|
|
2537
|
+
type: 'amis_button',
|
|
2538
|
+
amis_schema: await getSchema$1()
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
getStandardExportExcel: async (uiSchema, ctx)=>{
|
|
2448
2542
|
return {
|
|
2449
2543
|
type: 'amis_button',
|
|
2450
2544
|
amis_schema: await getSchema()
|
|
@@ -2709,6 +2803,16 @@ const getButton = async (objectName, buttonName, ctx)=>{
|
|
|
2709
2803
|
}
|
|
2710
2804
|
}
|
|
2711
2805
|
|
|
2806
|
+
if(button.name === 'standard_export_excel'){
|
|
2807
|
+
return {
|
|
2808
|
+
label: button.label,
|
|
2809
|
+
name: button.name,
|
|
2810
|
+
on: button.on,
|
|
2811
|
+
sort: button.sort,
|
|
2812
|
+
...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2712
2816
|
if(button.name === 'standard_open_view'){
|
|
2713
2817
|
return {
|
|
2714
2818
|
label: button.label,
|
|
@@ -5808,7 +5912,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5808
5912
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
|
|
5809
5913
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
5810
5914
|
if (isAllowCreate) {
|
|
5811
|
-
const new_button = await getSchema$
|
|
5915
|
+
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
5812
5916
|
new_button.align = "right";
|
|
5813
5917
|
pickerSchema.headerToolbar.push(new_button);
|
|
5814
5918
|
}
|