@steedos-widgets/amis-lib 1.2.43 → 1.3.0-beta.10

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/index.esm.js CHANGED
@@ -787,7 +787,7 @@ function getScriptForRemoveUrlPrefixForImgFields(fields){
787
787
  if(imgFields[item].multiple){
788
788
  if(imgFieldValue instanceof Array){
789
789
  formData[item] = imgFieldValue.map((value)=>{
790
- let itemValue = value?.split('/');
790
+ let itemValue = value && value.split('/');
791
791
  return itemValue[itemValue.length - 1];
792
792
  });
793
793
  }
@@ -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,
@@ -2258,7 +2262,7 @@ const getSchema$2 = (uiSchema) => {
2258
2262
  "Bearer ${context.tenantId},${context.authToken}",
2259
2263
  },
2260
2264
  requestAdaptor:
2261
- "\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value?.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
2265
+ "\n const selfData = JSON.parse(JSON.stringify(api.data.$self));\n var filters = [];\n var pageSize = api.data.pageSize || 10;\n var pageNo = api.data.pageNo || 1;\n var skip = (pageNo - 1) * pageSize;\n var orderBy = api.data.orderBy || '';\n var orderDir = api.data.orderDir || '';\n var sort = orderBy + ' ' + orderDir;\n var allowSearchFields = [\"description\"];\n if(api.data.$term){\n filters = [[\"name\", \"contains\", \"'+ api.data.$term +'\"]];\n }else if(selfData.op === 'loadOptions' && selfData.value){\n if(selfData.value && selfData.value.indexOf(',') > 0){\n filters = [[\"_id\", \"=\", selfData.value.split(',')]];\n }else{\n filters = [[\"_id\", \"=\", selfData.value]];\n }\n }\n if(allowSearchFields){\n allowSearchFields.forEach(function(key){\n const keyValue = selfData[key];\n if(keyValue){\n filters.push([key, \"contains\", keyValue]);\n }\n })\n }\n\n const filtersFunction = function(filters, values){return ['object_name', '=', values.object_name]};\n\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data.$self.__super.__super);\n if(_filters && _filters.length > 0){\n filters.push(_filters);\n }\n }\n\n api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim());\n return api;\n ",
2262
2266
  adaptor:
2263
2267
  "\n const enable_tree = undefined;\n if(enable_tree){\n const records = payload.data.rows;\n const treeRecords = [];\n const getChildren = (records, childrenIds)=>{\n if(!childrenIds){\n return;\n }\n const children = _.filter(records, (record)=>{\n return _.includes(childrenIds, record._id)\n });\n _.each(children, (item)=>{\n if(item.children){\n item.children = getChildren(records, item.children)\n }\n })\n return children;\n }\n\n _.each(records, (record)=>{\n if(!record.parent){\n treeRecords.push(Object.assign({}, record, {children: getChildren(records, record.children)}));\n }\n });\n payload.data.rows = treeRecords;\n }\n return payload;\n ",
2264
2268
  },
@@ -2437,7 +2441,7 @@ const getSchema$2 = (uiSchema) => {
2437
2441
  * @Author: baozhoutao@steedos.com
2438
2442
  * @Date: 2022-11-07 17:00:38
2439
2443
  * @LastEditors: baozhoutao@steedos.com
2440
- * @LastEditTime: 2022-11-07 17:12:20
2444
+ * @LastEditTime: 2023-08-24 16:44:42
2441
2445
  * @Description:
2442
2446
  */
2443
2447
 
@@ -2457,7 +2461,7 @@ const getSchema$1 = (uiSchema)=>{
2457
2461
  "componentId": "",
2458
2462
  "args": {
2459
2463
  "blank": false,
2460
- "url": "/app/${app_id}/${objectName}/view/${_id}"
2464
+ "url": "/app/${app_id}/${objectName}/view/${_id}?side_object=${objectName}&side_listview_id=${listName}"
2461
2465
  },
2462
2466
  "actionType": "link"
2463
2467
  }
@@ -2474,90 +2478,69 @@ const getSchema$1 = (uiSchema)=>{
2474
2478
  };
2475
2479
 
2476
2480
  const getSchema = async (uiSchema, ctx) => {
2477
- const requestAdaptor = `
2478
- // 获取列表视图的属性
2479
- let uiSchema = api.body.uiSchema;
2480
- let list_views = uiSchema.list_views;
2481
- let list_views_name = api.body.listName;
2482
- let col = list_views[list_views_name].columns;
2483
- let sort_test = list_views[list_views_name].sort;
2484
-
2485
- // 获取下载字段
2486
- let select = [];
2487
- _.each(col, (col) => {
2488
- if (col.field == undefined)
2489
- select.push(col);
2490
- else select.push(col.field);
2491
- });
2492
-
2493
- // 获取排序字段
2494
-
2495
- let sort = [];
2496
- _.forEach(sort_test, (sortField) => {
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
- "type": "button",
2532
- "label": i18next.t('frontend_export_excel'),
2533
- "id": "u:standard_export_excel",
2534
- "level": "default",
2535
- "onEvent": {
2536
- "click": {
2537
- "weight": 0,
2538
- "actions": [
2539
- {
2540
- "args": {
2541
- "api": {
2542
- "url": "${context.rootUrl}/api/record/export/${objectName}",
2543
- "method": "get",
2544
- "messages": {},
2545
- "requestAdaptor": requestAdaptor,
2546
- "data": {
2547
- "uiSchema": "${uiSchema}",
2548
- "listName": "${listName}"
2549
- },
2550
- "headers": {
2551
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
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
- "actionType": "download"
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
 
@@ -3640,7 +3623,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3640
3623
  const selfData = api.body.$self;
3641
3624
  const uiSchema = selfData.uiSchema;
3642
3625
  const fields = uiSchema.fields;
3643
- const options = (payload.data?.options || []).filter(function(item){
3626
+ const options = ((payload.data && payload.data.options) || []).filter(function(item){
3644
3627
  let field = fields[item.value];
3645
3628
  // TODO: 暂时禁用location类型字段的列表搜索
3646
3629
  return !!field && window.isFieldTypeSearchable(field.type) && field.type !== 'location'
@@ -4043,7 +4026,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
4043
4026
  "actions": [
4044
4027
  {
4045
4028
  "actionType": "custom",
4046
- "script": "Steedos.goBack()"
4029
+ "script": "window.goBack()"
4047
4030
  }
4048
4031
  ]
4049
4032
  }
@@ -4919,10 +4902,10 @@ function apiRequestAdaptor$1(){
4919
4902
  const recordId_tmp = api.body.recordId;
4920
4903
 
4921
4904
  if (typeof formData_tmp.columns == 'string') {
4922
- formData_tmp.columns = formData_tmp.columns?.split(',');
4905
+ formData_tmp.columns = formData_tmp.columns && formData_tmp.columns.split(',');
4923
4906
  }
4924
4907
  if (typeof formData_tmp.mobile_columns == 'string') {
4925
- formData_tmp.mobile_columns = formData_tmp.mobile_columns?.split(',');
4908
+ formData_tmp.mobile_columns = formData_tmp.mobile_columns && formData_tmp.mobile_columns.split(',');
4926
4909
  }
4927
4910
 
4928
4911
  // 数据格式转换
@@ -5055,7 +5038,7 @@ function apiRequestAdaptor(){
5055
5038
  const recordId = api.body.recordId;
5056
5039
  //数据格式转换
5057
5040
  if (typeof formData.sort == 'string') {
5058
- formData.sort = formData.sort?.split(',');
5041
+ formData.sort = formData.sort && formData.sort.split(',');
5059
5042
  }
5060
5043
  formData.sort = lodash.map(formData.sort, (item) => {
5061
5044
  const arr = item.split(':');
@@ -5245,7 +5228,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
5245
5228
 
5246
5229
  function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup = false, keywordsSearchBoxName = "__keywords" } = {}){
5247
5230
  const searchableFieldsLabel = [];
5248
- _.each(fields, function (field) {
5231
+ _.each(mainObject.fields, function (field) {
5249
5232
  if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
5250
5233
  searchableFieldsLabel.push(field.label);
5251
5234
  }
@@ -5437,8 +5420,14 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
5437
5420
 
5438
5421
  function getObjectFooterToolbar(mainObject, formFactor, options) {
5439
5422
  if (formFactor === 'SMALL') {
5423
+ // return [
5424
+ // "load-more",
5425
+ // ]
5440
5426
  return [
5441
- "load-more",
5427
+ {
5428
+ "type": "pagination",
5429
+ "maxButtons": 5
5430
+ }
5442
5431
  ]
5443
5432
  }
5444
5433
  else {
@@ -5837,13 +5826,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
5837
5826
  })){
5838
5827
  i++;
5839
5828
  tableFields.push(field);
5840
- if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
5841
- searchableFields.push(field.name);
5842
- }
5843
5829
  }
5844
5830
  }
5845
5831
  });
5846
5832
 
5833
+ _$1.each(refObjectConfig.fields, function (field) {
5834
+ if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
5835
+ searchableFields.push(field.name);
5836
+ }
5837
+ });
5838
+
5847
5839
  const fields = {
5848
5840
  [referenceTo.labelField.name]: referenceTo.labelField,
5849
5841
  [referenceTo.valueField.name]: referenceTo.valueField
@@ -5895,7 +5887,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5895
5887
  if(api.data.$term){
5896
5888
  filters = [["name", "contains", "'+ api.data.$term +'"]];
5897
5889
  }else if(selfData.op === 'loadOptions' && selfData.value){
5898
- if(selfData.value?.indexOf(',') > 0){
5890
+ if(selfData.value && selfData.value.indexOf(',') > 0){
5899
5891
  fieldValue = selfData.value.split(',');
5900
5892
  filters = [["${referenceTo.valueField.name}", "=", fieldValue]];
5901
5893
  }else{
@@ -6090,7 +6082,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
6090
6082
  {
6091
6083
  "actionType": "custom",
6092
6084
  "script": `
6093
- const masterRecord = event.data._master?.record;
6085
+ const masterRecord = event.data._master && event.data._master.record;
6094
6086
  const fieldConfig = ${JSON.stringify(field)};
6095
6087
  let reference_to = fieldConfig.reference_to;
6096
6088
  let saveValue;
@@ -6473,7 +6465,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
6473
6465
  var pageNo = api.data.pageNo || 1;
6474
6466
  var skip = (pageNo - 1) * pageSize;
6475
6467
  if(selfData.op === 'loadOptions' && selfData.value){
6476
- if(selfData.value?.indexOf(',') > 0){
6468
+ if(selfData.value && selfData.value.indexOf(',') > 0){
6477
6469
  filters = [["${referenceTo.valueField.name}", "=", selfData.value.split(',')]];
6478
6470
  }else{
6479
6471
  filters = [["${referenceTo.valueField.name}", "=", selfData.value]];
@@ -6676,6 +6668,9 @@ function getAmisStaticFieldType(type, readonly, options){
6676
6668
  return type;
6677
6669
  }
6678
6670
  if(_$1.includes(['text','image'], type)){
6671
+ if('text' === type && options && options.amis && options.amis.tpl){
6672
+ return 'static';
6673
+ }
6679
6674
  if('image' === type && options && options.multiple){
6680
6675
  return `static-images`;
6681
6676
  }
@@ -6946,7 +6941,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
6946
6941
  // }
6947
6942
  switch (field.type) {
6948
6943
  case 'text':
6949
- convertData.type = getAmisStaticFieldType('text', readonly);
6944
+ convertData.type = getAmisStaticFieldType('text', readonly, field);
6950
6945
  break;
6951
6946
  case 'textarea':
6952
6947
  convertData.type = getAmisStaticFieldType('textarea', readonly);
@@ -7712,7 +7707,7 @@ async function getQuickEditSchema(field, options){
7712
7707
  case "number":
7713
7708
  case "currency":
7714
7709
  TempDisplayField = `
7715
- _display["${field.name}"] = event.data.value?.toFixed(${field.scale});
7710
+ _display["${field.name}"] = event.data.value && event.data.value.toFixed(${field.scale});
7716
7711
  `;
7717
7712
  quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
7718
7713
 
@@ -7900,13 +7895,15 @@ async function getTableColumns(fields, options){
7900
7895
  }
7901
7896
  },
7902
7897
  "actionType": "download",
7903
- "expression": "!!!window?.nw?.require"//浏览器上直接下载
7898
+ // "expression": "!!!window?.nw?.require"//浏览器上直接下载
7899
+ "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
7904
7900
  },
7905
7901
  {
7906
7902
  "args": {},
7907
7903
  "actionType": "custom",
7908
7904
  "script": previewFileScript,
7909
- "expression": "!!window?.nw?.require" //PC客户端预览附件
7905
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
7906
+ "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
7910
7907
  }
7911
7908
  ]
7912
7909
  }
@@ -8027,7 +8024,7 @@ async function getTableColumns(fields, options){
8027
8024
  */
8028
8025
  function getMobileLines(tpls){
8029
8026
  let lines = [];
8030
- let maxLineCount = 2;
8027
+ let maxLineCount = 3;
8031
8028
  let lineChildren = [];
8032
8029
  let isNewLine = false;
8033
8030
  let isLeft = true;
@@ -8045,10 +8042,10 @@ function getMobileLines(tpls){
8045
8042
  }
8046
8043
  if(isLeft){
8047
8044
  // 左侧半行
8048
- lineChildrenClassName = "steedos-listview-item-left two-lines-truncate";
8045
+ lineChildrenClassName = "steedos-listview-item-left truncate";
8049
8046
  if(item.field.is_wide){
8050
- // 左侧全行样式可以单独写
8051
- lineChildrenClassName = "steedos-listview-item-wide truncate";
8047
+ // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
8048
+ lineChildrenClassName = "steedos-listview-item-wide";
8052
8049
  }
8053
8050
  if(lines.length === 0){
8054
8051
  // 第一个字段加粗黑色显示
@@ -8056,7 +8053,7 @@ function getMobileLines(tpls){
8056
8053
  }
8057
8054
  }
8058
8055
  else {
8059
- // 右侧半行
8056
+ // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
8060
8057
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
8061
8058
  }
8062
8059
  lineChildren.push({
@@ -8110,7 +8107,8 @@ async function getMobileTableColumns(fields, options){
8110
8107
  tpl = await getFieldTpl(field, options);
8111
8108
  }
8112
8109
  if(!tpl){
8113
- tpl = `\${${field.name}}`;
8110
+ //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
8111
+ tpl = `\${${field.name} | raw}`;
8114
8112
  }
8115
8113
  if(!field.hidden && !field.extra){
8116
8114
  tpls.push({ field, tpl });
@@ -8301,6 +8299,7 @@ async function getTableOperation(ctx){
8301
8299
 
8302
8300
  async function getTableSchema$1(fields, options){
8303
8301
  let isLookup = options && options.isLookup;
8302
+ let hiddenColumnOperation = options && options.hiddenColumnOperation;
8304
8303
  if(!options){
8305
8304
  options = {};
8306
8305
  }
@@ -8310,10 +8309,11 @@ async function getTableSchema$1(fields, options){
8310
8309
  }
8311
8310
  else {
8312
8311
  columns = await getTableColumns(fields, options);
8313
- if(!isLookup){
8312
+ if(!isLookup && !hiddenColumnOperation){
8314
8313
  columns.push(await getTableOperation(options));
8315
8314
  }
8316
8315
  }
8316
+
8317
8317
  return {
8318
8318
  mode: "table",
8319
8319
  name: "thelist",
@@ -8361,7 +8361,7 @@ async function getTableApi(mainObject, fields, options){
8361
8361
  baseFilters = filter;
8362
8362
  }
8363
8363
 
8364
- _$1.each(fields, function (field) {
8364
+ _$1.each(mainObject.fields, function (field) {
8365
8365
  if (isFieldQuickSearchable(field, mainObject.NAME_FIELD_KEY)) {
8366
8366
  searchableFields.push(field.name);
8367
8367
  }
@@ -8423,7 +8423,9 @@ async function getTableApi(mainObject, fields, options){
8423
8423
  // 如果是第一次加载组件始终让翻页页码从本地存储中取值
8424
8424
  let formFactor = "${options.formFactor}";
8425
8425
  // 移动端不识别本地存储中的翻页页码,否则点击加载更多按钮后无法刷新回第一页
8426
- api.data.pageNo = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
8426
+ // api.data.pageNo = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
8427
+ // 移动端暂时去除加载更多,放开翻页
8428
+ api.data.pageNo = localListViewProps.page || 1;
8427
8429
  }
8428
8430
  }
8429
8431
  }
@@ -8544,7 +8546,17 @@ async function getTableApi(mainObject, fields, options){
8544
8546
  api.data = {
8545
8547
  query: api.data.query.replace(/{__filters}/g, JSON.stringify(filters)).replace('{__top}', pageSize).replace('{__skip}', skip).replace('{__sort}', sort.trim())
8546
8548
  }
8547
- ${options.requestAdaptor || ''}
8549
+ ${options.requestAdaptor || ''};
8550
+
8551
+ //写入本次存储filters、sort
8552
+ const listViewPropsStoreKey = location.pathname + "/crud/query";
8553
+ sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
8554
+ filters: filters,
8555
+ sort: sort.trim(),
8556
+ pageSize: pageSize,
8557
+ skip: skip,
8558
+ fields: ${JSON.stringify(_$1.map(fields, 'name'))}
8559
+ }));
8548
8560
  return api;
8549
8561
  `;
8550
8562
  api.adaptor = `
@@ -8623,7 +8635,8 @@ async function getTableApi(mainObject, fields, options){
8623
8635
  // 如果是第一次加载组件始终让翻页页码从本地存储中取值
8624
8636
  let formFactor = "${options.formFactor}";
8625
8637
  // 移动端不识别本地存储中的翻页页码,否则点击加载更多按钮后无法刷新回第一页
8626
- selfData.page = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
8638
+ // selfData.page = formFactor === "SMALL" ? 1 : (localListViewProps.page || 1);
8639
+ selfData.page = localListViewProps.page || 1;
8627
8640
  }
8628
8641
  }
8629
8642
  delete selfData.context;
@@ -8641,7 +8654,13 @@ async function getTableApi(mainObject, fields, options){
8641
8654
  const setDataToComponentId = "${setDataToComponentId}";
8642
8655
  if(setDataToComponentId){
8643
8656
  //https://github.com/baidu/amis/pull/6807 .parent的改动是为适应3.2getComponentById的规则改动,不影响2.9
8644
- SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
8657
+ var scope = SteedosUI.getRef(api.body.$self.$scopeId);
8658
+ var scopeParent = scope && scope.parent;
8659
+ var setDataToComponent = scopeParent && scopeParent.getComponentById(setDataToComponentId);
8660
+ if(setDataToComponent){
8661
+ setDataToComponent.setData({$count: payload.data.count});
8662
+ }
8663
+ // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
8645
8664
  };
8646
8665
  ${options.adaptor || ''}
8647
8666
  return payload;
@@ -8927,7 +8946,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
8927
8946
  var uiSchema = api.body.uiSchema;
8928
8947
  var defaultData = api.body.defaultData;
8929
8948
  var defaultValues = {};
8930
- _.each(uiSchema?.fields, function(field){
8949
+ _.each(uiSchema && uiSchema.fields, function(field){
8931
8950
  var value = SteedosUI.getFieldDefaultValue(field, api.body.global);
8932
8951
  if(value){
8933
8952
  defaultValues[field.name] = value;
@@ -9146,7 +9165,12 @@ async function getCalendarApi(mainObject, fields, options) {
9146
9165
  window.postMessage(Object.assign({type: "listview.loaded"}), "*");
9147
9166
  const setDataToComponentId = "${setDataToComponentId}";
9148
9167
  if(setDataToComponentId){
9149
- SteedosUI.getRef(api.body.$self.scopeId)?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
9168
+ var scope = SteedosUI.getRef(api.body.$self.scopeId);
9169
+ var setDataToComponent = scope && scope.getComponentById(setDataToComponentId);
9170
+ if(setDataToComponent){
9171
+ setDataToComponent.setData({$count: payload.data.count});
9172
+ }
9173
+ // SteedosUI.getRef(api.body.$self.scopeId)?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
9150
9174
  }
9151
9175
  const rows = payload.data.rows || [];
9152
9176
  const selfData = api.data.$self;
@@ -9893,6 +9917,10 @@ async function getObjectCRUD(objectSchema, fields, options){
9893
9917
  }
9894
9918
  }
9895
9919
  `;
9920
+ let autoFillHeight = true;
9921
+ if(options.isRelated || Steedos.isMobile()){
9922
+ autoFillHeight = false;
9923
+ }
9896
9924
 
9897
9925
  body = Object.assign({}, table, {
9898
9926
  type: 'crud',
@@ -9903,7 +9931,7 @@ async function getObjectCRUD(objectSchema, fields, options){
9903
9931
  keepItemSelectionOnPageChange: true,
9904
9932
  api: await getTableApi(objectSchema, fields, options),
9905
9933
  hiddenOn: options.tableHiddenOn,
9906
- autoFillHeight: options.isRelated ? false : true,
9934
+ autoFillHeight,
9907
9935
  className: `flex-auto ${crudClassName || ""}`,
9908
9936
  bodyClassName: "bg-white",
9909
9937
  crudClassName: crudClassName,
@@ -10146,7 +10174,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
10146
10174
  // "blank": false
10147
10175
  // },
10148
10176
  "actionType": "custom",
10149
- "script": "Steedos.goBack()",
10177
+ "script": "window.goBack()",
10150
10178
  "expression": "this.__deletedRecord === true"
10151
10179
  }
10152
10180
  ]
@@ -10609,8 +10637,8 @@ async function getRelatedListSchema(
10609
10637
  /*
10610
10638
  * @Author: baozhoutao@steedos.com
10611
10639
  * @Date: 2022-07-05 15:55:39
10612
- * @LastEditors: baozhoutao@steedos.com
10613
- * @LastEditTime: 2023-08-17 18:03:51
10640
+ * @LastEditors: liaodaxue
10641
+ * @LastEditTime: 2023-08-25 11:55:15
10614
10642
  * @Description:
10615
10643
  */
10616
10644
 
@@ -10875,7 +10903,7 @@ async function getListSchema(
10875
10903
  * 本次存储代码段
10876
10904
  */
10877
10905
  try {
10878
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewName || "");
10906
+ const listViewPropsStoreKey = location.pathname + "/crud";
10879
10907
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
10880
10908
  /**
10881
10909
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -10897,11 +10925,12 @@ async function getListSchema(
10897
10925
  if(localListViewProps.orderDir){
10898
10926
  listSchema.orderDir = localListViewProps.orderDir;
10899
10927
  }
10900
- // if(localListViewProps.perPage){
10901
- // listSchema.defaultParams = {
10902
- // perPage: localListViewProps.perPage
10903
- // }
10904
- // }
10928
+
10929
+ if(localListViewProps.perPage){
10930
+ listSchema.defaultParams = {
10931
+ perPage: localListViewProps.perPage
10932
+ };
10933
+ }
10905
10934
  defaults.listSchema = defaultsDeep$1({}, listSchema, defaults.listSchema || {});
10906
10935
  }
10907
10936
  }
@@ -12254,7 +12283,7 @@ const getNextStepUsersInput = async (instance) => {
12254
12283
  id: "u:ffff15b76c89",
12255
12284
  className: "b-a b-1x p-xs m-b-none m-l-none m-r-none m-t-sm",
12256
12285
  subFormMode: "",
12257
- hiddenOn: "!!!this.new_next_step || this.new_next_step?.step_type === 'end'"
12286
+ hiddenOn: "!!!this.new_next_step || (this.new_next_step && this.new_next_step.step_type === 'end')"
12258
12287
  };
12259
12288
  };
12260
12289
 
@@ -13174,7 +13203,7 @@ const getFieldReadonlyTpl = async (field, label)=>{
13174
13203
  map[item.value] = item.label;
13175
13204
  });
13176
13205
  tpl.type = 'static';
13177
- tpl.tpl = `<% var options = ${JSON.stringify(map)}; return options?.[data.${field.code}] || ''%>`;
13206
+ tpl.tpl = `<% var options = ${JSON.stringify(map)}; return (options && options[data.${field.code}]) || ''%>`;
13178
13207
  }else if(field.type === 'odata'){
13179
13208
  tpl.type = 'static';
13180
13209
  tpl.tpl = `<div>\${${field.code}['@label']}</div>`;
@@ -13204,7 +13233,7 @@ const getFieldReadonlyTpl = async (field, label)=>{
13204
13233
  if(field.is_multiselect){
13205
13234
  tpl.tpl = `\${_.map(${field.code}, 'name')}`;
13206
13235
  }else {
13207
- tpl.tpl = `\${${field.code}?.name}`;
13236
+ tpl.tpl = `\${${field.code} && ${field.code}.name}`;
13208
13237
  }
13209
13238
  }else if(field.type === 'group'){
13210
13239
  tpl.type = 'static';