@steedos-widgets/amis-object 1.3.0-beta.7 → 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.
@@ -45,6 +45,8 @@
45
45
  --Nav-Item-maxWidth--tabs: 200px;
46
46
  --Crud-toolbar-gap: 2px;
47
47
  --DropDown-caret-marginLeft: 0;
48
+ --Tabs--vertical-width: 180px;
49
+ --Tabs-link-maxWidth: 180px;
48
50
  }
49
51
 
50
52
  .steedos-header-container .antd-Nav-Menu {
@@ -1192,6 +1194,35 @@ fieldset.antd-Collapse > legend{
1192
1194
  flex-basis: 0;
1193
1195
  flex-grow: 1;
1194
1196
  }
1197
+ .steedos-object-table .antd-Table-footToolbar {
1198
+ border-top: 1px solid #e5e7eb;
1199
+ }
1200
+ .steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar-item {
1201
+ justify-content: center;
1202
+ width: 100%;
1203
+ }
1204
+ .steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar-item .antd-Pagination-inputGroup-left {
1205
+ display: none;
1206
+ }
1207
+ .steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar-item .antd-Pagination-inputGroup-input {
1208
+ min-width: 0;
1209
+ width: 30px;
1210
+ }
1211
+ .steedos-object-table .antd-Table-footToolbar .antd-Crud-toolbar-item .antd-Pagination-inputGroup-right {
1212
+ width: 25px;
1213
+ }
1214
+ body.zoom-large .steedos-object-table .antd-Table-footToolbar {
1215
+ zoom: 90%;
1216
+ }
1217
+ body.zoom-extra-large .steedos-object-table .antd-Table-footToolbar {
1218
+ zoom: 80%;
1219
+ }
1220
+ }
1221
+ /* 手机屏幕宽度小于380px时隐藏分页器快速跳转*/
1222
+ @media (max-width: 380px) {
1223
+ .steedos-object-table .antd-Table-footToolbar .antd-Pagination-inputGroup {
1224
+ display: none;
1225
+ }
1195
1226
  }
1196
1227
  .steedos-object-table .two-lines-truncate {
1197
1228
  white-space: pre-wrap;
@@ -1567,12 +1598,6 @@ fieldset.antd-Collapse > legend{
1567
1598
  height: 100%;
1568
1599
  }
1569
1600
  @media (max-width: 767px) {
1570
- .steedos-object-table .antd-Table-content {
1571
- max-height: calc(100vh - 195px);
1572
- }
1573
- .steedos-object-listview .antd-Table-content {
1574
- max-height: calc(100vh - 295px);
1575
- }
1576
1601
  .steedos-global-footer-root .antd-Nav-Menu-horizontal:after {
1577
1602
  /*手机端底部导航左右间隔不平衡*/
1578
1603
  content: unset;
@@ -4183,6 +4183,7 @@ var frontend_listview_control_rename_title$1 = "Rename List View";
4183
4183
  var frontend_listview_control_share$1 = "Sharing Settings";
4184
4184
  var frontend_listview_control_sort$1 = "Default sorting rule";
4185
4185
  var frontend_export_excel$1 = "Export Excel";
4186
+ var frontend_export_excel_toast$1 = "Exporting, please wait";
4186
4187
  var frontend_operation$1 = "Operation";
4187
4188
  var frontend_import_data$1 = "Import data";
4188
4189
  var frontend_import_data_object_name$1 = "Import object";
@@ -4267,6 +4268,7 @@ var en_us = {
4267
4268
  frontend_listview_control_share: frontend_listview_control_share$1,
4268
4269
  frontend_listview_control_sort: frontend_listview_control_sort$1,
4269
4270
  frontend_export_excel: frontend_export_excel$1,
4271
+ frontend_export_excel_toast: frontend_export_excel_toast$1,
4270
4272
  frontend_operation: frontend_operation$1,
4271
4273
  frontend_import_data: frontend_import_data$1,
4272
4274
  frontend_import_data_object_name: frontend_import_data_object_name$1,
@@ -4353,6 +4355,7 @@ var frontend_listview_control_rename_title = "重命名 列表视图";
4353
4355
  var frontend_listview_control_share = "共享设置";
4354
4356
  var frontend_listview_control_sort = "默认排序规则";
4355
4357
  var frontend_export_excel = "导出";
4358
+ var frontend_export_excel_toast = "正在导出,请稍后...";
4356
4359
  var frontend_operation = "操作";
4357
4360
  var frontend_import_data = "导入数据";
4358
4361
  var frontend_import_data_object_name = "导入对象";
@@ -4438,6 +4441,7 @@ var zh_cn = {
4438
4441
  frontend_listview_control_share: frontend_listview_control_share,
4439
4442
  frontend_listview_control_sort: frontend_listview_control_sort,
4440
4443
  frontend_export_excel: frontend_export_excel,
4444
+ frontend_export_excel_toast: frontend_export_excel_toast,
4441
4445
  frontend_operation: frontend_operation,
4442
4446
  frontend_import_data: frontend_import_data,
4443
4447
  frontend_import_data_object_name: frontend_import_data_object_name,
@@ -5643,90 +5647,69 @@ const getSchema$1 = (uiSchema)=>{
5643
5647
  };
5644
5648
 
5645
5649
  const getSchema$6 = async (uiSchema, ctx) => {
5646
- const requestAdaptor = `
5647
- // 获取列表视图的属性
5648
- let uiSchema = api.body.uiSchema;
5649
- let list_views = uiSchema.list_views;
5650
- let list_views_name = api.body.listName;
5651
- let col = list_views[list_views_name].columns;
5652
- let sort_test = list_views[list_views_name].sort;
5653
-
5654
- // 获取下载字段
5655
- let select = [];
5656
- _.each(col, (col) => {
5657
- if (col.field == undefined)
5658
- select.push(col);
5659
- else select.push(col.field);
5660
- });
5661
-
5662
- // 获取排序字段
5663
-
5664
- let sort = [];
5665
- _.forEach(sort_test, (sortField) => {
5666
- if (sortField.field_name == undefined)
5667
- sort.push(sortField);
5668
- else sort.push([sortField.field_name, sortField.order]);
5669
- })
5670
-
5671
- let orders = [];
5672
- _.map(sort, (value) => {
5673
- let order_tmp = [];
5674
- if (value[1] == "desc")
5675
- order_tmp = value[0] + ' desc';
5676
- else
5677
- order_tmp = value[0];
5678
- orders.push(order_tmp);
5679
- });
5680
- let order = orders.join(',');
5681
-
5682
- let filename = uiSchema.label + "-" + list_views[list_views_name].label;
5683
-
5684
- url_tmp = api.url.split('?')[0];
5685
- api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
5686
-
5687
- // 判断sort 和 filters
5688
- if (sort.length > 0) {
5689
- api.url += "&$orderby=" + encodeURIComponent(order);
5690
- }
5691
- let filters = list_views[list_views_name].filters;
5692
- if (filters && filters.length > 0) {
5693
- api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
5694
- }
5695
- return api;
5696
- `;
5650
+ const requestAdaptor = function () {
5651
+ let uiSchema = api.body.uiSchema;
5652
+ let list_views_name = api.body.listName;
5653
+ let list_views = uiSchema.list_views;
5654
+ const listViewPropsStoreKey = location.pathname + "/crud/query";
5655
+ const query = JSON.parse(sessionStorage.getItem(listViewPropsStoreKey));
5656
+ const { filters, sort, fields: select } = query;
5657
+ let filename = uiSchema.label + "-" + list_views[list_views_name].label;
5658
+
5659
+ var url_tmp = api.url.split('?')[0];
5660
+ api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
5661
+ // 判断sort filters
5662
+ if (sort.length > 0) {
5663
+ api.url += "&$orderby=" + encodeURIComponent(sort);
5664
+ }
5665
+ if (filters && filters.length > 0) {
5666
+ api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
5667
+ }
5668
+ return api;
5669
+ };
5697
5670
  return {
5698
5671
  "type": "service",
5699
- "body": [{
5700
- "type": "button",
5701
- "label": instance.t('frontend_export_excel'),
5702
- "id": "u:standard_export_excel",
5703
- "level": "default",
5704
- "onEvent": {
5705
- "click": {
5706
- "weight": 0,
5707
- "actions": [
5708
- {
5709
- "args": {
5710
- "api": {
5711
- "url": "${context.rootUrl}/api/record/export/${objectName}",
5712
- "method": "get",
5713
- "messages": {},
5714
- "requestAdaptor": requestAdaptor,
5715
- "data": {
5716
- "uiSchema": "${uiSchema}",
5717
- "listName": "${listName}"
5718
- },
5719
- "headers": {
5720
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
5672
+ "body": [
5673
+ {
5674
+ "type": "button",
5675
+ "label": instance.t('frontend_export_excel'),
5676
+ "id": "u:standard_export_excel",
5677
+ "level": "default",
5678
+ "disabledTip": instance.t('frontend_export_excel_toast'),
5679
+ "onEvent": {
5680
+ "click": {
5681
+ "weight": 0,
5682
+ "actions": [{
5683
+ "componentId": "u:standard_export_excel",
5684
+ "actionType": "disabled"
5685
+ },
5686
+ {
5687
+ "args": {
5688
+ "api": {
5689
+ "url": "${context.rootUrl}/api/record/export/${objectName}",
5690
+ "method": "get",
5691
+ "messages": {},
5692
+ "requestAdaptor": requestAdaptor.toString().match(/function[^{]+\{([\s\S]*)\}$/)[1],
5693
+ "data": {
5694
+ "uiSchema": "${uiSchema}",
5695
+ "listName": "${listName}"
5696
+ },
5697
+ "headers": {
5698
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
5699
+ }
5721
5700
  }
5722
- }
5701
+ },
5702
+ "actionType": "download"
5723
5703
  },
5724
- "actionType": "download"
5725
- }
5726
- ]
5704
+ {
5705
+ "componentId": "u:standard_export_excel",
5706
+ "actionType": "enabled"
5707
+ }
5708
+ ]
5709
+ }
5727
5710
  }
5728
5711
  }
5729
- }]
5712
+ ]
5730
5713
  }
5731
5714
  };
5732
5715
 
@@ -8606,15 +8589,15 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
8606
8589
 
8607
8590
  function getObjectFooterToolbar(mainObject, formFactor, options) {
8608
8591
  if (formFactor === 'SMALL') {
8609
- return [
8610
- "load-more",
8611
- ]
8612
8592
  // return [
8613
- // {
8614
- // "type": "pagination",
8615
- // "maxButtons": 5
8616
- // }
8593
+ // "load-more",
8617
8594
  // ]
8595
+ return [
8596
+ {
8597
+ "type": "pagination",
8598
+ "maxButtons": 5
8599
+ }
8600
+ ]
8618
8601
  }
8619
8602
  else {
8620
8603
  if(options && options.isRelated){
@@ -11207,7 +11190,7 @@ async function getTableColumns$1(fields, options){
11207
11190
  */
11208
11191
  function getMobileLines(tpls){
11209
11192
  let lines = [];
11210
- let maxLineCount = 2;
11193
+ let maxLineCount = 3;
11211
11194
  let lineChildren = [];
11212
11195
  let isNewLine = false;
11213
11196
  let isLeft = true;
@@ -11225,10 +11208,10 @@ function getMobileLines(tpls){
11225
11208
  }
11226
11209
  if(isLeft){
11227
11210
  // 左侧半行
11228
- lineChildrenClassName = "steedos-listview-item-left two-lines-truncate";
11211
+ lineChildrenClassName = "steedos-listview-item-left truncate";
11229
11212
  if(item.field.is_wide){
11230
- // 左侧全行样式可以单独写
11231
- lineChildrenClassName = "steedos-listview-item-wide two-lines-truncate";
11213
+ // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
11214
+ lineChildrenClassName = "steedos-listview-item-wide";
11232
11215
  }
11233
11216
  if(lines.length === 0){
11234
11217
  // 第一个字段加粗黑色显示
@@ -11236,7 +11219,7 @@ function getMobileLines(tpls){
11236
11219
  }
11237
11220
  }
11238
11221
  else {
11239
- // 右侧半行
11222
+ // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
11240
11223
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
11241
11224
  }
11242
11225
  lineChildren.push({
@@ -11495,6 +11478,7 @@ async function getTableSchema$1(fields, options){
11495
11478
  columns.push(await getTableOperation(options));
11496
11479
  }
11497
11480
  }
11481
+
11498
11482
  return {
11499
11483
  mode: "table",
11500
11484
  name: "thelist",
@@ -11604,9 +11588,9 @@ async function getTableApi(mainObject, fields, options){
11604
11588
  // 如果是第一次加载组件始终让翻页页码从本地存储中取值
11605
11589
  let formFactor = "${options.formFactor}";
11606
11590
  // 移动端不识别本地存储中的翻页页码,否则点击加载更多按钮后无法刷新回第一页
11607
- api.data.pageNo = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
11591
+ // api.data.pageNo = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
11608
11592
  // 移动端暂时去除加载更多,放开翻页
11609
- // api.data.pageNo = localListViewProps.page || 1;
11593
+ api.data.pageNo = localListViewProps.page || 1;
11610
11594
  }
11611
11595
  }
11612
11596
  }
@@ -11727,7 +11711,17 @@ async function getTableApi(mainObject, fields, options){
11727
11711
  api.data = {
11728
11712
  query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
11729
11713
  }
11730
- ${options.requestAdaptor || ''}
11714
+ ${options.requestAdaptor || ''};
11715
+
11716
+ //写入本次存储filters、sort
11717
+ const listViewPropsStoreKey = location.pathname + "/crud/query";
11718
+ sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
11719
+ filters: filters,
11720
+ sort: sort.trim(),
11721
+ pageSize: pageSize,
11722
+ skip: skip,
11723
+ fields: ${JSON.stringify(___default__namespace.map(fields, 'name'))}
11724
+ }));
11731
11725
  return api;
11732
11726
  `;
11733
11727
  api.adaptor = `
@@ -11806,8 +11800,8 @@ async function getTableApi(mainObject, fields, options){
11806
11800
  // 如果是第一次加载组件始终让翻页页码从本地存储中取值
11807
11801
  let formFactor = "${options.formFactor}";
11808
11802
  // 移动端不识别本地存储中的翻页页码,否则点击加载更多按钮后无法刷新回第一页
11809
- selfData.page = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
11810
- // selfData.page = localListViewProps.page || 1;
11803
+ // selfData.page = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
11804
+ selfData.page = localListViewProps.page || 1;
11811
11805
  }
11812
11806
  }
11813
11807
  delete selfData.context;
@@ -13088,6 +13082,10 @@ async function getObjectCRUD(objectSchema, fields, options){
13088
13082
  }
13089
13083
  }
13090
13084
  `;
13085
+ let autoFillHeight = true;
13086
+ if(options.isRelated || Steedos.isMobile()){
13087
+ autoFillHeight = false;
13088
+ }
13091
13089
 
13092
13090
  body = Object.assign({}, table, {
13093
13091
  type: 'crud',
@@ -13098,7 +13096,7 @@ async function getObjectCRUD(objectSchema, fields, options){
13098
13096
  keepItemSelectionOnPageChange: true,
13099
13097
  api: await getTableApi(objectSchema, fields, options),
13100
13098
  hiddenOn: options.tableHiddenOn,
13101
- autoFillHeight: options.isRelated ? false : true,
13099
+ autoFillHeight,
13102
13100
  className: `flex-auto ${crudClassName || ""}`,
13103
13101
  bodyClassName: "bg-white",
13104
13102
  crudClassName: crudClassName,
@@ -13804,8 +13802,8 @@ async function getRelatedListSchema(
13804
13802
  /*
13805
13803
  * @Author: baozhoutao@steedos.com
13806
13804
  * @Date: 2022-07-05 15:55:39
13807
- * @LastEditors: baozhoutao@steedos.com
13808
- * @LastEditTime: 2023-08-17 18:03:51
13805
+ * @LastEditors: liaodaxue
13806
+ * @LastEditTime: 2023-08-25 11:55:15
13809
13807
  * @Description:
13810
13808
  */
13811
13809
 
@@ -14070,7 +14068,7 @@ async function getListSchema(
14070
14068
  * 本次存储代码段
14071
14069
  */
14072
14070
  try {
14073
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewName || "");
14071
+ const listViewPropsStoreKey = location.pathname + "/crud";
14074
14072
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
14075
14073
  /**
14076
14074
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -14092,11 +14090,12 @@ async function getListSchema(
14092
14090
  if(localListViewProps.orderDir){
14093
14091
  listSchema.orderDir = localListViewProps.orderDir;
14094
14092
  }
14095
- // if(localListViewProps.perPage){
14096
- // listSchema.defaultParams = {
14097
- // perPage: localListViewProps.perPage
14098
- // }
14099
- // }
14093
+
14094
+ if(localListViewProps.perPage){
14095
+ listSchema.defaultParams = {
14096
+ perPage: localListViewProps.perPage
14097
+ };
14098
+ }
14100
14099
  defaults.listSchema = ___default.defaultsDeep({}, listSchema, defaults.listSchema || {});
14101
14100
  }
14102
14101
  }