@steedos-widgets/amis-object 1.2.38 → 1.2.39

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.
@@ -4219,6 +4219,7 @@ var frontend_message_modification_failed$1 = "Modification failed!";
4219
4219
  var frontend_objects_related_alert_start$1 = "No related table fields associated with the related list object";
4220
4220
  var frontend_objects_related_alert_end$1 = "were found.";
4221
4221
  var frontend_no_records_found$1 = "No records found.";
4222
+ var frontend_records_no_allowedit$1 = "You do not have edit permission for this record";
4222
4223
  var en_us = {
4223
4224
  frontend_field_group_generalization: frontend_field_group_generalization$1,
4224
4225
  frontend_download: frontend_download$1,
@@ -4301,7 +4302,8 @@ var en_us = {
4301
4302
  frontend_message_modification_failed: frontend_message_modification_failed$1,
4302
4303
  frontend_objects_related_alert_start: frontend_objects_related_alert_start$1,
4303
4304
  frontend_objects_related_alert_end: frontend_objects_related_alert_end$1,
4304
- frontend_no_records_found: frontend_no_records_found$1
4305
+ frontend_no_records_found: frontend_no_records_found$1,
4306
+ frontend_records_no_allowedit: frontend_records_no_allowedit$1
4305
4307
  };
4306
4308
 
4307
4309
  var frontend_field_group_generalization = "通用";
@@ -4325,7 +4327,7 @@ var frontend_display_type_is_split = "分栏视图";
4325
4327
  var frontend_display_as = "显示为";
4326
4328
  var frontend_record_sum = "个项目";
4327
4329
  var frontend_button_reload_tooltip = "刷新";
4328
- var frontend_button_search_tooltip = "搜索";
4330
+ var frontend_button_search_tooltip = "查询";
4329
4331
  var frontend_fields_filter_button_search = "搜索";
4330
4332
  var frontend_fields_filter_button_settings = "设置搜索项";
4331
4333
  var frontend_button_listview_control_tooltip = "列表视图控制";
@@ -4387,6 +4389,7 @@ var frontend_message_modification_failed = "修改失败!";
4387
4389
  var frontend_objects_related_alert_start = "未找到与相关列表对象";
4388
4390
  var frontend_objects_related_alert_end = "关联的相关表字段";
4389
4391
  var frontend_no_records_found = "无法找到记录";
4392
+ var frontend_records_no_allowedit = "您对这条记录没有编辑权限";
4390
4393
  var zh_cn = {
4391
4394
  frontend_field_group_generalization: frontend_field_group_generalization,
4392
4395
  frontend_download: frontend_download,
@@ -4470,7 +4473,8 @@ var zh_cn = {
4470
4473
  frontend_message_modification_failed: frontend_message_modification_failed,
4471
4474
  frontend_objects_related_alert_start: frontend_objects_related_alert_start,
4472
4475
  frontend_objects_related_alert_end: frontend_objects_related_alert_end,
4473
- frontend_no_records_found: frontend_no_records_found
4476
+ frontend_no_records_found: frontend_no_records_found,
4477
+ frontend_records_no_allowedit: frontend_records_no_allowedit
4474
4478
  };
4475
4479
 
4476
4480
  const resources = {
@@ -6524,12 +6528,14 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6524
6528
  if(!event.data.isLookup){
6525
6529
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
6526
6530
  const listName = event.data.listName;
6527
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6531
+ const listViewPropsStoreKey = location.pathname + "/crud";
6528
6532
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6529
6533
  if(localListViewProps){
6530
6534
  localListViewProps = JSON.parse(localListViewProps);
6531
6535
  for(var k in localListViewProps){
6532
- removedValues[k] = null;
6536
+ if(k !== "__keywords"){
6537
+ removedValues[k] = null;
6538
+ }
6533
6539
  }
6534
6540
  }
6535
6541
  }
@@ -6551,12 +6557,9 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6551
6557
  const objectName = data.objectName;
6552
6558
  const isLookup = data.isLookup;
6553
6559
  const listName = data.listName;
6554
- let searchableFieldsStoreKey = location.pathname + "/searchable_fields/";
6560
+ let searchableFieldsStoreKey = location.pathname + "/searchable_fields";
6555
6561
  if(isLookup){
6556
- searchableFieldsStoreKey += "lookup/" + objectName;
6557
- }
6558
- else{
6559
- searchableFieldsStoreKey += (listName || "");
6562
+ searchableFieldsStoreKey += "/lookup/" + objectName;
6560
6563
  }
6561
6564
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
6562
6565
  if(defaultSearchableFields){
@@ -6583,7 +6586,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6583
6586
  setData({ showFieldsFilter: false });
6584
6587
  }
6585
6588
  else{
6586
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6589
+ const listViewPropsStoreKey = location.pathname + "/crud";
6587
6590
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6588
6591
  if(localListViewProps){
6589
6592
  localListViewProps = JSON.parse(localListViewProps);
@@ -6623,12 +6626,9 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6623
6626
  return n.props.type === "service";
6624
6627
  });
6625
6628
  filterService.setData({ filterFormSearchableFields: value });
6626
- let searchableFieldsStoreKey = location.pathname + "/searchable_fields/";
6629
+ let searchableFieldsStoreKey = location.pathname + "/searchable_fields";
6627
6630
  if(isLookup){
6628
- searchableFieldsStoreKey += "lookup/" + objectName;
6629
- }
6630
- else{
6631
- searchableFieldsStoreKey += (listName || "");
6631
+ searchableFieldsStoreKey += "/lookup/" + objectName;
6632
6632
  }
6633
6633
  sessionStorage.setItem(searchableFieldsStoreKey, value);
6634
6634
 
@@ -6686,7 +6686,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6686
6686
  }
6687
6687
 
6688
6688
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
6689
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
6689
+ const listViewPropsStoreKey = location.pathname + "/crud";
6690
6690
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6691
6691
  if(localListViewProps){
6692
6692
  localListViewProps = JSON.parse(localListViewProps);
@@ -8407,9 +8407,23 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8407
8407
  `;
8408
8408
 
8409
8409
 
8410
- function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
8410
+ function getObjectHeaderToolbar(mainObject, fields, formFactor, { showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true, isLookup = false } = {}){
8411
8411
  // console.log(`getObjectHeaderToolbar====>`, filterVisible)
8412
- console.log(`getObjectHeaderToolbar`, mainObject);
8412
+ // console.log(`getObjectHeaderToolbar`, mainObject)
8413
+ const searchableFieldsLabel = [];
8414
+ _.each(fields, function (field) {
8415
+ if (field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1) {
8416
+ searchableFieldsLabel.push(field.label);
8417
+ }
8418
+ });
8419
+ const listViewPropsStoreKey = location.pathname + "/crud";
8420
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
8421
+ let crudKeywords = "";
8422
+ if(localListViewProps && !isLookup){
8423
+ localListViewProps = JSON.parse(localListViewProps);
8424
+ crudKeywords = (localListViewProps && localListViewProps.__keywords) || "";
8425
+ }
8426
+
8413
8427
  const isMobile = window.innerWidth < 768;
8414
8428
  if(isMobile){
8415
8429
  showDisplayAs = false;
@@ -8465,7 +8479,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8465
8479
  ],
8466
8480
  "size":8,
8467
8481
  "animation": true,
8468
- "visibleOn": "${isFieldsFilterEmpty == false}"
8482
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8469
8483
  },
8470
8484
  "align": "right",
8471
8485
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
@@ -8480,7 +8494,27 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8480
8494
  }
8481
8495
  }
8482
8496
  } : {},
8483
- getDisplayAsButton(mainObject?.name)
8497
+ getDisplayAsButton(mainObject?.name),
8498
+ {
8499
+ "type": "tooltip-wrapper",
8500
+ "align": "right",
8501
+ "title": "",
8502
+ "content": "可搜索字段:" + searchableFieldsLabel.join(","),
8503
+ "placement": "bottom",
8504
+ "tooltipTheme": "dark",
8505
+ "trigger": "click",
8506
+ // "className": "mr-1",
8507
+ "body": [
8508
+ {
8509
+ "type": "search-box",
8510
+ "name": "__keywords",
8511
+ "placeholder": "请输入关键字",
8512
+ "value": crudKeywords,
8513
+ "clearable": true,
8514
+ "clearAndSubmit": true
8515
+ }
8516
+ ]
8517
+ },
8484
8518
  ]
8485
8519
  }else {
8486
8520
  return [
@@ -8499,21 +8533,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8499
8533
  "type": "tpl",
8500
8534
  "tpl": "${count} " + instance.t('frontend_record_sum')
8501
8535
  },
8502
- {
8503
- "type": "reload",
8504
- "align": "right",
8505
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8506
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8507
- "tooltip":"",
8508
- "tooltipPlacement": "top",
8509
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8510
- },
8511
- // getExportExcelToolbarButtonSchema(),
8512
- mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8513
- getDisplayAsButton(mainObject?.name),
8514
8536
  filterVisible ? {
8515
8537
  "label": instance.t('frontend_button_search_tooltip'),
8516
- "icon": "fa fa-search",
8538
+ "icon": "fa fa-filter",
8517
8539
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8518
8540
  // "tooltip": i18next.t('frontend_button_search_tooltip'),
8519
8541
  // "tooltipPlacement": "top",
@@ -8525,7 +8547,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8525
8547
  ],
8526
8548
  "size":8,
8527
8549
  "animation": true,
8528
- "visibleOn": "${isFieldsFilterEmpty == false}"
8550
+ "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
8529
8551
  },
8530
8552
  "align": "right",
8531
8553
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
@@ -8539,14 +8561,39 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8539
8561
  ]
8540
8562
  }
8541
8563
  }
8542
- } : {}
8543
- // {
8544
- // "type": "search-box",
8545
- // "align": "right",
8546
- // "name": "__keywords",
8547
- // "placeholder": "请输入关键字",
8548
- // "mini": true
8549
- // },
8564
+ } : {},
8565
+ {
8566
+ "type": "reload",
8567
+ "align": "right",
8568
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8569
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8570
+ "tooltip":"",
8571
+ "tooltipPlacement": "top",
8572
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8573
+ },
8574
+ // getExportExcelToolbarButtonSchema(),
8575
+ mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8576
+ getDisplayAsButton(mainObject?.name),
8577
+ {
8578
+ "type": "tooltip-wrapper",
8579
+ "align": "right",
8580
+ "title": "",
8581
+ "content": "可搜索字段:" + searchableFieldsLabel.join(","),
8582
+ "placement": "bottom",
8583
+ "tooltipTheme": "dark",
8584
+ "trigger": "click",
8585
+ "className": "mr-1",
8586
+ "body": [
8587
+ {
8588
+ "type": "search-box",
8589
+ "name": "__keywords",
8590
+ "placeholder": "请输入关键字",
8591
+ "value": crudKeywords,
8592
+ "clearable": true,
8593
+ "clearAndSubmit": true
8594
+ }
8595
+ ]
8596
+ },
8550
8597
  // {
8551
8598
  // "type": "drag-toggler",
8552
8599
  // "align": "right"
@@ -8890,16 +8937,17 @@ function getLookupSapceUserTreeSchema(){
8890
8937
  "autoCheckChildren": false,
8891
8938
  "searchable": true,
8892
8939
  "searchConfig": {
8893
- "sticky": true
8940
+ "sticky": true,
8941
+ "placeholder": "查找部门"
8894
8942
  },
8895
8943
  "unfoldedLevel": 2,
8896
8944
  "style": {
8897
8945
  "max-height": "100%",
8898
8946
  "position": "absolute",
8899
- "left": "-200px",
8900
- "width": "190px",
8947
+ "left": "-330px",
8948
+ "width": "320px",
8901
8949
  "bottom": 0,
8902
- "top": "2px",
8950
+ "top": "0",
8903
8951
  "overflow": "auto",
8904
8952
  "min-height":"300px"
8905
8953
  },
@@ -8918,7 +8966,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
8918
8966
  ctx.idFieldName = refObjectConfig.idFieldName;
8919
8967
  ctx.objectName = refObjectConfig.name;
8920
8968
 
8921
- const tableFields = [];
8969
+ let tableFields = [];
8922
8970
  let i = 0;
8923
8971
  const searchableFields = [];
8924
8972
 
@@ -8963,7 +9011,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
8963
9011
  })){
8964
9012
  i++;
8965
9013
  tableFields.push(field);
8966
- if(field.searchable){
9014
+ if(field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1){
8967
9015
  searchableFields.push(field.name);
8968
9016
  }
8969
9017
  }
@@ -9047,16 +9095,31 @@ async function lookupToAmisPicker(field, readonly, ctx){
9047
9095
  }
9048
9096
  }
9049
9097
 
9050
-
9051
9098
  if(allowSearchFields){
9052
9099
  allowSearchFields.forEach(function(key){
9053
9100
  const keyValue = selfData[key];
9054
- if(keyValue){
9101
+ if(_.isString(keyValue)){
9055
9102
  filters.push([key, "contains", keyValue]);
9103
+ }else if(_.isArray(keyValue) || _.isBoolean(keyValue) || keyValue){
9104
+ filters.push([key, "=", keyValue]);
9056
9105
  }
9057
9106
  })
9058
9107
  }
9059
9108
 
9109
+ if(selfData.__keywords && allowSearchFields){
9110
+ const keywordsFilters = [];
9111
+ allowSearchFields.forEach(function(key, index){
9112
+ const keyValue = selfData.__keywords;
9113
+ if(keyValue){
9114
+ keywordsFilters.push([key, "contains", keyValue]);
9115
+ if(index < allowSearchFields.length - 1){
9116
+ keywordsFilters.push('or');
9117
+ }
9118
+ }
9119
+ })
9120
+ filters.push(keywordsFilters);
9121
+ };
9122
+
9060
9123
  var fieldFilters = ${JSON.stringify(field.filters)};
9061
9124
  if(fieldFilters && fieldFilters.length){
9062
9125
  filters.push(fieldFilters);
@@ -9145,6 +9208,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
9145
9208
  if(refObjectConfig.paging && refObjectConfig.paging.enabled === false){
9146
9209
  top = 1000;
9147
9210
  }
9211
+
9148
9212
  let pickerSchema = null;
9149
9213
  if(ctx.formFactor === 'SMALL'){
9150
9214
  pickerSchema = await getListSchema$1(tableFields, {
@@ -9166,18 +9230,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
9166
9230
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
9167
9231
  headerToolbarItems = getLookupSapceUserTreeSchema();
9168
9232
  pickerSchema["style"] = {
9169
- "margin-left":"200px",
9233
+ "margin-left":"330px",
9170
9234
  "min-height": "300px"
9171
9235
  };
9172
9236
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
9173
9237
  }
9174
9238
 
9175
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
9239
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true });
9176
9240
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
9177
9241
  if (isAllowCreate) {
9178
9242
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
9179
9243
  new_button.align = "right";
9180
- pickerSchema.headerToolbar.push(new_button);
9244
+ // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
9245
+ pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
9181
9246
  }
9182
9247
  pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
9183
9248
  if (ctx.filterVisible !== false) {
@@ -9894,6 +9959,7 @@ const getAmisFileSchema = (steedosField, readonly)=>{
9894
9959
  return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
9895
9960
  };
9896
9961
 
9962
+ const SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
9897
9963
  const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
9898
9964
  // const Lookup = require('./lookup');
9899
9965
 
@@ -10668,6 +10734,7 @@ if (typeof window != 'undefined') {
10668
10734
 
10669
10735
  var index = /*#__PURE__*/Object.freeze({
10670
10736
  __proto__: null,
10737
+ SEARCHABLE_FIELD_TYPES: SEARCHABLE_FIELD_TYPES,
10671
10738
  OMIT_FIELDS: OMIT_FIELDS,
10672
10739
  getBaseFields: getBaseFields,
10673
10740
  getAmisFieldType: getAmisFieldType,
@@ -10867,7 +10934,71 @@ async function getQuickEditSchema(field, options){
10867
10934
  `;
10868
10935
  break;
10869
10936
  }
10870
-
10937
+ quickEditSchema.body[0].visibleOn = "${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";
10938
+ quickEditSchema.body.push({
10939
+ "type":"service",
10940
+ "body":[
10941
+ {
10942
+ "type": "tpl",
10943
+ "tpl": instance.t('frontend_records_no_allowedit'),
10944
+ "visibleOn": "${!quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}"
10945
+ },
10946
+ {
10947
+ "type": "spinner",
10948
+ "showOn": "${quickedit_record_permissions_loading}"
10949
+ }
10950
+ ],
10951
+ "onEvent":{
10952
+ "init":{
10953
+ "actions":[
10954
+ {
10955
+ "actionType": "setValue",
10956
+ "componentId": `service_listview_${options.objectName}`,
10957
+ "args": {
10958
+ "value":{
10959
+ "quickedit_record_permissions_loading": true
10960
+ }
10961
+ }
10962
+ },
10963
+ {
10964
+ "actionType": "ajax",
10965
+ "args": {
10966
+ "api": {
10967
+ "url": "${context.rootUrl}/service/api/@\${objectName}/recordPermissions/${_id}",
10968
+ "method": "get",
10969
+ "headers": {
10970
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
10971
+ },
10972
+ "cache": 30000,
10973
+ "messages": {
10974
+ "failed": "失败了呢。。"
10975
+ }
10976
+ }
10977
+ }
10978
+ },
10979
+ {
10980
+ "actionType": "setValue",
10981
+ "componentId": `service_listview_${options.objectName}`,
10982
+ "args": {
10983
+ "value":{
10984
+ "quickedit_record_permissions_loading": false
10985
+ }
10986
+ }
10987
+ },
10988
+ {
10989
+ "actionType": "setValue",
10990
+ "componentId": `service_listview_${options.objectName}`,
10991
+ "args": {
10992
+ "value":{
10993
+ "quickedit_record_permissions": "${event.data}"
10994
+ }
10995
+ }
10996
+ }
10997
+ ]
10998
+ }
10999
+ }
11000
+
11001
+ });
10871
11002
  } else {
10872
11003
  quickEditSchema = false;
10873
11004
  }
@@ -10900,7 +11031,7 @@ function getFieldWidth(width){
10900
11031
 
10901
11032
  async function getTableColumns$1(fields, options){
10902
11033
  const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
10903
- const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
11034
+ const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
10904
11035
 
10905
11036
  for (const field of fields) {
10906
11037
  //增加quickEdit属性,实现快速编辑
@@ -11391,7 +11522,7 @@ async function getTableApi(mainObject, fields, options){
11391
11522
  baseFilters = filter;
11392
11523
  }
11393
11524
  ___default__namespace.each(fields,function(field){
11394
- if(field.searchable){
11525
+ if(field.searchable && SEARCHABLE_FIELD_TYPES.indexOf(field.type) > -1){
11395
11526
  searchableFields.push(field.name);
11396
11527
  }
11397
11528
  });
@@ -11438,7 +11569,7 @@ async function getTableApi(mainObject, fields, options){
11438
11569
  try{
11439
11570
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11440
11571
  const listName = api.data.listName;
11441
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11572
+ const listViewPropsStoreKey = location.pathname + "/crud";
11442
11573
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
11443
11574
  if(localListViewProps){
11444
11575
  localListViewProps = JSON.parse(localListViewProps);
@@ -11639,7 +11770,7 @@ async function getTableApi(mainObject, fields, options){
11639
11770
  try{
11640
11771
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11641
11772
  const listName = api.body.listName;
11642
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11773
+ const listViewPropsStoreKey = location.pathname + "/crud";
11643
11774
  /**
11644
11775
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
11645
11776
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -12829,7 +12960,7 @@ async function getObjectCRUD(objectSchema, fields, options){
12829
12960
  }
12830
12961
  }
12831
12962
  // console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
12832
- bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
12963
+ bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, fields, options.formFactor, {
12833
12964
  showDisplayAs,
12834
12965
  hiddenCount: options.queryCount === false,
12835
12966
  headerToolbarItems: options.headerToolbarItems,
@@ -12954,6 +13085,7 @@ async function getObjectCRUD(objectSchema, fields, options){
12954
13085
  return {
12955
13086
  type: 'service',
12956
13087
  className: '',
13088
+ //目前crud的service层id不认用户自定义id,只支持默认规则id
12957
13089
  id: `service_${id}`,
12958
13090
  name: `page`,
12959
13091
  data: {
@@ -18542,7 +18674,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18542
18674
  if (links) {
18543
18675
  return [2 /*return*/, {
18544
18676
  "type": "nav",
18545
- className: "".concat(className),
18677
+ className: "".concat(className, " text-black"),
18546
18678
  "stacked": stacked,
18547
18679
  "overflow": overflow,
18548
18680
  "indentSize": indentSize,
@@ -18554,7 +18686,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18554
18686
  schemaApi: {
18555
18687
  "method": "get",
18556
18688
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
18557
- "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18689
+ "adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 word-break leading-6 block -ml-px no-underline group flex items-center text-[15px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\"\n // active: selectedId === tab.id,\n });\n })\n }\n\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
18558
18690
  "headers": {
18559
18691
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18560
18692
  }
@@ -19590,7 +19722,8 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
19590
19722
  type: 'service',
19591
19723
  className: {
19592
19724
  "h-full": "true",
19593
- "sm:px-3 sm:pt-3": "${display != 'split'}"
19725
+ "sm:px-3 sm:pt-3 page-list-grid": "${display != 'split'}",
19726
+ "page-list-split": "${display == 'split'}"
19594
19727
  },
19595
19728
  body: listSchema
19596
19729
  }];