@steedos-widgets/amis-lib 1.3.0-beta.6 → 1.3.0-beta.8
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 +93 -93
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +93 -93
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +16 -20
- package/dist/index.umd.js.map +1 -1
- package/dist/types/schema/standard_export_excel.amis.d.ts +8 -2
- package/dist/types/standard/button.d.ts +8 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1014,6 +1014,7 @@ var frontend_listview_control_rename_title$1 = "Rename List View";
|
|
|
1014
1014
|
var frontend_listview_control_share$1 = "Sharing Settings";
|
|
1015
1015
|
var frontend_listview_control_sort$1 = "Default sorting rule";
|
|
1016
1016
|
var frontend_export_excel$1 = "Export Excel";
|
|
1017
|
+
var frontend_export_excel_toast$1 = "Exporting, please wait";
|
|
1017
1018
|
var frontend_operation$1 = "Operation";
|
|
1018
1019
|
var frontend_import_data$1 = "Import data";
|
|
1019
1020
|
var frontend_import_data_object_name$1 = "Import object";
|
|
@@ -1098,6 +1099,7 @@ var en_us = {
|
|
|
1098
1099
|
frontend_listview_control_share: frontend_listview_control_share$1,
|
|
1099
1100
|
frontend_listview_control_sort: frontend_listview_control_sort$1,
|
|
1100
1101
|
frontend_export_excel: frontend_export_excel$1,
|
|
1102
|
+
frontend_export_excel_toast: frontend_export_excel_toast$1,
|
|
1101
1103
|
frontend_operation: frontend_operation$1,
|
|
1102
1104
|
frontend_import_data: frontend_import_data$1,
|
|
1103
1105
|
frontend_import_data_object_name: frontend_import_data_object_name$1,
|
|
@@ -1184,6 +1186,7 @@ var frontend_listview_control_rename_title = "重命名 列表视图";
|
|
|
1184
1186
|
var frontend_listview_control_share = "共享设置";
|
|
1185
1187
|
var frontend_listview_control_sort = "默认排序规则";
|
|
1186
1188
|
var frontend_export_excel = "导出";
|
|
1189
|
+
var frontend_export_excel_toast = "正在导出,请稍后...";
|
|
1187
1190
|
var frontend_operation = "操作";
|
|
1188
1191
|
var frontend_import_data = "导入数据";
|
|
1189
1192
|
var frontend_import_data_object_name = "导入对象";
|
|
@@ -1269,6 +1272,7 @@ var zh_cn = {
|
|
|
1269
1272
|
frontend_listview_control_share: frontend_listview_control_share,
|
|
1270
1273
|
frontend_listview_control_sort: frontend_listview_control_sort,
|
|
1271
1274
|
frontend_export_excel: frontend_export_excel,
|
|
1275
|
+
frontend_export_excel_toast: frontend_export_excel_toast,
|
|
1272
1276
|
frontend_operation: frontend_operation,
|
|
1273
1277
|
frontend_import_data: frontend_import_data,
|
|
1274
1278
|
frontend_import_data_object_name: frontend_import_data_object_name,
|
|
@@ -2474,90 +2478,69 @@ const getSchema$1 = (uiSchema)=>{
|
|
|
2474
2478
|
};
|
|
2475
2479
|
|
|
2476
2480
|
const getSchema = async (uiSchema, ctx) => {
|
|
2477
|
-
const requestAdaptor =
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
if (sortField.field_name == undefined)
|
|
2498
|
-
sort.push(sortField);
|
|
2499
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
2500
|
-
})
|
|
2501
|
-
|
|
2502
|
-
let orders = [];
|
|
2503
|
-
_.map(sort, (value) => {
|
|
2504
|
-
let order_tmp = [];
|
|
2505
|
-
if (value[1] == "desc")
|
|
2506
|
-
order_tmp = value[0] + ' desc';
|
|
2507
|
-
else
|
|
2508
|
-
order_tmp = value[0];
|
|
2509
|
-
orders.push(order_tmp);
|
|
2510
|
-
});
|
|
2511
|
-
let order = orders.join(',');
|
|
2512
|
-
|
|
2513
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2514
|
-
|
|
2515
|
-
url_tmp = api.url.split('?')[0];
|
|
2516
|
-
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2517
|
-
|
|
2518
|
-
// 判断sort 和 filters
|
|
2519
|
-
if (sort.length > 0) {
|
|
2520
|
-
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2521
|
-
}
|
|
2522
|
-
let filters = list_views[list_views_name].filters;
|
|
2523
|
-
if (filters && filters.length > 0) {
|
|
2524
|
-
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2525
|
-
}
|
|
2526
|
-
return api;
|
|
2527
|
-
`;
|
|
2481
|
+
const requestAdaptor = function () {
|
|
2482
|
+
let uiSchema = api.body.uiSchema;
|
|
2483
|
+
let list_views_name = api.body.listName;
|
|
2484
|
+
let list_views = uiSchema.list_views;
|
|
2485
|
+
const listViewPropsStoreKey = location.pathname + "/crud/query";
|
|
2486
|
+
const query = JSON.parse(sessionStorage.getItem(listViewPropsStoreKey));
|
|
2487
|
+
const { filters, sort, fields: select } = query;
|
|
2488
|
+
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2489
|
+
|
|
2490
|
+
var url_tmp = api.url.split('?')[0];
|
|
2491
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2492
|
+
// 判断sort 和 filters
|
|
2493
|
+
if (sort.length > 0) {
|
|
2494
|
+
api.url += "&$orderby=" + encodeURIComponent(sort);
|
|
2495
|
+
}
|
|
2496
|
+
if (filters && filters.length > 0) {
|
|
2497
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2498
|
+
}
|
|
2499
|
+
return api;
|
|
2500
|
+
};
|
|
2528
2501
|
return {
|
|
2529
2502
|
"type": "service",
|
|
2530
|
-
"body": [
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
"
|
|
2537
|
-
|
|
2538
|
-
"
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
"
|
|
2547
|
-
"
|
|
2548
|
-
"
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
"
|
|
2503
|
+
"body": [
|
|
2504
|
+
{
|
|
2505
|
+
"type": "button",
|
|
2506
|
+
"label": i18next.t('frontend_export_excel'),
|
|
2507
|
+
"id": "u:standard_export_excel",
|
|
2508
|
+
"level": "default",
|
|
2509
|
+
"disabledTip": i18next.t('frontend_export_excel_toast'),
|
|
2510
|
+
"onEvent": {
|
|
2511
|
+
"click": {
|
|
2512
|
+
"weight": 0,
|
|
2513
|
+
"actions": [{
|
|
2514
|
+
"componentId": "u:standard_export_excel",
|
|
2515
|
+
"actionType": "disabled"
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
"args": {
|
|
2519
|
+
"api": {
|
|
2520
|
+
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
2521
|
+
"method": "get",
|
|
2522
|
+
"messages": {},
|
|
2523
|
+
"requestAdaptor": requestAdaptor.toString().match(/function[^{]+\{([\s\S]*)\}$/)[1],
|
|
2524
|
+
"data": {
|
|
2525
|
+
"uiSchema": "${uiSchema}",
|
|
2526
|
+
"listName": "${listName}"
|
|
2527
|
+
},
|
|
2528
|
+
"headers": {
|
|
2529
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
2530
|
+
}
|
|
2552
2531
|
}
|
|
2553
|
-
}
|
|
2532
|
+
},
|
|
2533
|
+
"actionType": "download"
|
|
2554
2534
|
},
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2535
|
+
{
|
|
2536
|
+
"componentId": "u:standard_export_excel",
|
|
2537
|
+
"actionType": "enabled"
|
|
2538
|
+
}
|
|
2539
|
+
]
|
|
2540
|
+
}
|
|
2558
2541
|
}
|
|
2559
2542
|
}
|
|
2560
|
-
|
|
2543
|
+
]
|
|
2561
2544
|
}
|
|
2562
2545
|
};
|
|
2563
2546
|
|
|
@@ -8038,7 +8021,7 @@ async function getTableColumns(fields, options){
|
|
|
8038
8021
|
*/
|
|
8039
8022
|
function getMobileLines(tpls){
|
|
8040
8023
|
let lines = [];
|
|
8041
|
-
let maxLineCount =
|
|
8024
|
+
let maxLineCount = 3;
|
|
8042
8025
|
let lineChildren = [];
|
|
8043
8026
|
let isNewLine = false;
|
|
8044
8027
|
let isLeft = true;
|
|
@@ -8056,10 +8039,10 @@ function getMobileLines(tpls){
|
|
|
8056
8039
|
}
|
|
8057
8040
|
if(isLeft){
|
|
8058
8041
|
// 左侧半行
|
|
8059
|
-
lineChildrenClassName = "steedos-listview-item-left
|
|
8042
|
+
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
8060
8043
|
if(item.field.is_wide){
|
|
8061
|
-
//
|
|
8062
|
-
lineChildrenClassName = "steedos-listview-item-wide
|
|
8044
|
+
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
8045
|
+
lineChildrenClassName = "steedos-listview-item-wide";
|
|
8063
8046
|
}
|
|
8064
8047
|
if(lines.length === 0){
|
|
8065
8048
|
// 第一个字段加粗黑色显示
|
|
@@ -8067,7 +8050,7 @@ function getMobileLines(tpls){
|
|
|
8067
8050
|
}
|
|
8068
8051
|
}
|
|
8069
8052
|
else {
|
|
8070
|
-
//
|
|
8053
|
+
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
8071
8054
|
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
8072
8055
|
}
|
|
8073
8056
|
lineChildren.push({
|
|
@@ -8326,6 +8309,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8326
8309
|
columns.push(await getTableOperation(options));
|
|
8327
8310
|
}
|
|
8328
8311
|
}
|
|
8312
|
+
|
|
8329
8313
|
return {
|
|
8330
8314
|
mode: "table",
|
|
8331
8315
|
name: "thelist",
|
|
@@ -8434,6 +8418,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8434
8418
|
// 所以会把localSearchableFilter中已经存过的页码覆盖
|
|
8435
8419
|
// 如果是第一次加载组件始终让翻页页码从本地存储中取值
|
|
8436
8420
|
let formFactor = "${options.formFactor}";
|
|
8421
|
+
// 移动端不识别本地存储中的翻页页码,否则点击加载更多按钮后无法刷新回第一页
|
|
8437
8422
|
// api.data.pageNo = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
|
|
8438
8423
|
// 移动端暂时去除加载更多,放开翻页
|
|
8439
8424
|
api.data.pageNo = localListViewProps.page || 1;
|
|
@@ -8557,7 +8542,17 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8557
8542
|
api.data = {
|
|
8558
8543
|
query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
|
|
8559
8544
|
}
|
|
8560
|
-
${options.requestAdaptor || ''}
|
|
8545
|
+
${options.requestAdaptor || ''};
|
|
8546
|
+
|
|
8547
|
+
//写入本次存储filters、sort
|
|
8548
|
+
const listViewPropsStoreKey = location.pathname + "/crud/query";
|
|
8549
|
+
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
|
|
8550
|
+
filters: filters,
|
|
8551
|
+
sort: sort.trim(),
|
|
8552
|
+
pageSize: pageSize,
|
|
8553
|
+
skip: skip,
|
|
8554
|
+
fields: ${JSON.stringify(_$1.map(fields, 'name'))}
|
|
8555
|
+
}));
|
|
8561
8556
|
return api;
|
|
8562
8557
|
`;
|
|
8563
8558
|
api.adaptor = `
|
|
@@ -9918,6 +9913,10 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9918
9913
|
}
|
|
9919
9914
|
}
|
|
9920
9915
|
`;
|
|
9916
|
+
let autoFillHeight = true;
|
|
9917
|
+
if(options.isRelated || Steedos.isMobile()){
|
|
9918
|
+
autoFillHeight = false;
|
|
9919
|
+
}
|
|
9921
9920
|
|
|
9922
9921
|
body = Object.assign({}, table, {
|
|
9923
9922
|
type: 'crud',
|
|
@@ -9928,7 +9927,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
9928
9927
|
keepItemSelectionOnPageChange: true,
|
|
9929
9928
|
api: await getTableApi(objectSchema, fields, options),
|
|
9930
9929
|
hiddenOn: options.tableHiddenOn,
|
|
9931
|
-
autoFillHeight
|
|
9930
|
+
autoFillHeight,
|
|
9932
9931
|
className: `flex-auto ${crudClassName || ""}`,
|
|
9933
9932
|
bodyClassName: "bg-white",
|
|
9934
9933
|
crudClassName: crudClassName,
|
|
@@ -10634,8 +10633,8 @@ async function getRelatedListSchema(
|
|
|
10634
10633
|
/*
|
|
10635
10634
|
* @Author: baozhoutao@steedos.com
|
|
10636
10635
|
* @Date: 2022-07-05 15:55:39
|
|
10637
|
-
* @LastEditors:
|
|
10638
|
-
* @LastEditTime: 2023-08-
|
|
10636
|
+
* @LastEditors: liaodaxue
|
|
10637
|
+
* @LastEditTime: 2023-08-25 11:55:15
|
|
10639
10638
|
* @Description:
|
|
10640
10639
|
*/
|
|
10641
10640
|
|
|
@@ -10900,7 +10899,7 @@ async function getListSchema(
|
|
|
10900
10899
|
* 本次存储代码段
|
|
10901
10900
|
*/
|
|
10902
10901
|
try {
|
|
10903
|
-
const listViewPropsStoreKey = location.pathname + "/crud
|
|
10902
|
+
const listViewPropsStoreKey = location.pathname + "/crud";
|
|
10904
10903
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
10905
10904
|
/**
|
|
10906
10905
|
* localListViewProps规范来自crud请求api中api.data.$self参数值的。
|
|
@@ -10922,11 +10921,12 @@ async function getListSchema(
|
|
|
10922
10921
|
if(localListViewProps.orderDir){
|
|
10923
10922
|
listSchema.orderDir = localListViewProps.orderDir;
|
|
10924
10923
|
}
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10924
|
+
|
|
10925
|
+
if(localListViewProps.perPage){
|
|
10926
|
+
listSchema.defaultParams = {
|
|
10927
|
+
perPage: localListViewProps.perPage
|
|
10928
|
+
};
|
|
10929
|
+
}
|
|
10930
10930
|
defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
|
|
10931
10931
|
}
|
|
10932
10932
|
}
|