@steedos-widgets/amis-object 1.2.38 → 1.2.39-beta.1

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.
@@ -254,6 +254,16 @@ fieldset.antd-Collapse > legend{
254
254
  height: unset;
255
255
  }
256
256
 
257
+ /* crud中的快速搜索框样式改成与按钮风格统一的边框 */
258
+ .antd-Crud .antd-Crud-toolbar .antd-SearchBox.is-active{
259
+ border-color: var(--button-default-default-top-border-color);
260
+ }
261
+
262
+ /* crud中的快速搜索框图标没对齐 */
263
+ .antd-Crud .antd-Crud-toolbar .antd-SearchBox.is-active svg.icon{
264
+ top: unset
265
+ }
266
+
257
267
  .ant-dropdown-menu {
258
268
  border: 1px solid #e5e5e5;
259
269
  border-radius: 0.25rem;
@@ -412,6 +422,9 @@ fieldset.antd-Collapse > legend{
412
422
  .mr-2 {
413
423
  margin-right: 0.5rem
414
424
  }
425
+ .mr-1 {
426
+ margin-right: 0.25rem
427
+ }
415
428
  .mt-0\.5 {
416
429
  margin-top: 0.125rem
417
430
  }
@@ -427,9 +440,6 @@ fieldset.antd-Collapse > legend{
427
440
  .-ml-px {
428
441
  margin-left: -1px
429
442
  }
430
- .mr-1 {
431
- margin-right: 0.25rem
432
- }
433
443
  .mb-\[-3px\] {
434
444
  margin-bottom: -3px
435
445
  }
@@ -871,6 +881,9 @@ fieldset.antd-Collapse > legend{
871
881
  .leading-5 {
872
882
  line-height: 1.25rem
873
883
  }
884
+ .leading-6 {
885
+ line-height: 1.5rem
886
+ }
874
887
  .leading-3 {
875
888
  line-height: .75rem
876
889
  }
@@ -1167,8 +1180,15 @@ fieldset.antd-Collapse > legend{
1167
1180
  display: none;
1168
1181
  }
1169
1182
  }
1170
- .steedos-select-user > .antd-Form {
1171
- margin-left: -200px;
1183
+ .steedos-select-user .antd-Table {
1184
+ margin-bottom: 0;
1185
+ position: unset;
1186
+ }
1187
+ .steedos-select-user .antd-Table .antd-Table-content {
1188
+ max-height: calc(100vh - 560px);
1189
+ }
1190
+ .steedos-select-user .antd-Table .antd-SearchBox {
1191
+ margin-top: 0;
1172
1192
  }
1173
1193
  @media (max-width: 576px) {
1174
1194
  .antd-Crud-toolbar {
@@ -1407,12 +1427,6 @@ fieldset.antd-Collapse > legend{
1407
1427
  .h-fill {
1408
1428
  height: -webkit-fill-available !important;
1409
1429
  }
1410
- .steedos-global-header-root .sidebar-wrapper .antd-Nav .antd-Nav-Menu-item-label {
1411
- white-space: normal;
1412
- line-height: 1.5;
1413
- padding-top: 6px;
1414
- padding-bottom: 6px;
1415
- }
1416
1430
  .steedos-global-header-root .sidebar-wrapper .antd-Nav .antd-Nav-Menu-item-link {
1417
1431
  min-height: var(--Nav-Item-height);
1418
1432
  height: unset;
@@ -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} = {}){
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) {
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){
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;
@@ -8499,21 +8513,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8499
8513
  "type": "tpl",
8500
8514
  "tpl": "${count} " + instance.t('frontend_record_sum')
8501
8515
  },
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
8516
  filterVisible ? {
8515
8517
  "label": instance.t('frontend_button_search_tooltip'),
8516
- "icon": "fa fa-search",
8518
+ "icon": "fa fa-filter",
8517
8519
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8518
8520
  // "tooltip": i18next.t('frontend_button_search_tooltip'),
8519
8521
  // "tooltipPlacement": "top",
@@ -8539,14 +8541,39 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8539
8541
  ]
8540
8542
  }
8541
8543
  }
8542
- } : {}
8543
- // {
8544
- // "type": "search-box",
8545
- // "align": "right",
8546
- // "name": "__keywords",
8547
- // "placeholder": "请输入关键字",
8548
- // "mini": true
8549
- // },
8544
+ } : {},
8545
+ {
8546
+ "type": "reload",
8547
+ "align": "right",
8548
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
8549
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
8550
+ "tooltip":"",
8551
+ "tooltipPlacement": "top",
8552
+ "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8553
+ },
8554
+ // getExportExcelToolbarButtonSchema(),
8555
+ mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8556
+ getDisplayAsButton(mainObject?.name),
8557
+ {
8558
+ "type": "tooltip-wrapper",
8559
+ "align": "right",
8560
+ "title": "",
8561
+ "content": "可模糊搜索字段:" + searchableFieldsLabel.join(","),
8562
+ "placement": "bottom",
8563
+ "tooltipTheme": "dark",
8564
+ "trigger": "click",
8565
+ "className": "mr-1",
8566
+ "body": [
8567
+ {
8568
+ "type": "search-box",
8569
+ "name": "__keywords",
8570
+ "placeholder": "请输入关键字",
8571
+ "value": crudKeywords,
8572
+ "clearable": true,
8573
+ "clearAndSubmit": true
8574
+ }
8575
+ ]
8576
+ },
8550
8577
  // {
8551
8578
  // "type": "drag-toggler",
8552
8579
  // "align": "right"
@@ -8890,16 +8917,17 @@ function getLookupSapceUserTreeSchema(){
8890
8917
  "autoCheckChildren": false,
8891
8918
  "searchable": true,
8892
8919
  "searchConfig": {
8893
- "sticky": true
8920
+ "sticky": true,
8921
+ "placeholder": "查找部门"
8894
8922
  },
8895
8923
  "unfoldedLevel": 2,
8896
8924
  "style": {
8897
8925
  "max-height": "100%",
8898
8926
  "position": "absolute",
8899
- "left": "-200px",
8900
- "width": "190px",
8927
+ "left": "-220px",
8928
+ "width": "210px",
8901
8929
  "bottom": 0,
8902
- "top": "2px",
8930
+ "top": "0",
8903
8931
  "overflow": "auto",
8904
8932
  "min-height":"300px"
8905
8933
  },
@@ -8918,7 +8946,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
8918
8946
  ctx.idFieldName = refObjectConfig.idFieldName;
8919
8947
  ctx.objectName = refObjectConfig.name;
8920
8948
 
8921
- const tableFields = [];
8949
+ let tableFields = [];
8922
8950
  let i = 0;
8923
8951
  const searchableFields = [];
8924
8952
 
@@ -9047,16 +9075,31 @@ async function lookupToAmisPicker(field, readonly, ctx){
9047
9075
  }
9048
9076
  }
9049
9077
 
9050
-
9051
9078
  if(allowSearchFields){
9052
9079
  allowSearchFields.forEach(function(key){
9053
9080
  const keyValue = selfData[key];
9054
- if(keyValue){
9081
+ if(_.isString(keyValue)){
9055
9082
  filters.push([key, "contains", keyValue]);
9083
+ }else if(_.isArray(keyValue) || _.isBoolean(keyValue) || keyValue){
9084
+ filters.push([key, "=", keyValue]);
9056
9085
  }
9057
9086
  })
9058
9087
  }
9059
9088
 
9089
+ if(selfData.__keywords && allowSearchFields){
9090
+ const keywordsFilters = [];
9091
+ allowSearchFields.forEach(function(key, index){
9092
+ const keyValue = selfData.__keywords;
9093
+ if(keyValue){
9094
+ keywordsFilters.push([key, "contains", keyValue]);
9095
+ if(index < allowSearchFields.length - 1){
9096
+ keywordsFilters.push('or');
9097
+ }
9098
+ }
9099
+ })
9100
+ filters.push(keywordsFilters);
9101
+ };
9102
+
9060
9103
  var fieldFilters = ${JSON.stringify(field.filters)};
9061
9104
  if(fieldFilters && fieldFilters.length){
9062
9105
  filters.push(fieldFilters);
@@ -9145,6 +9188,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
9145
9188
  if(refObjectConfig.paging && refObjectConfig.paging.enabled === false){
9146
9189
  top = 1000;
9147
9190
  }
9191
+
9148
9192
  let pickerSchema = null;
9149
9193
  if(ctx.formFactor === 'SMALL'){
9150
9194
  pickerSchema = await getListSchema$1(tableFields, {
@@ -9166,7 +9210,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
9166
9210
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
9167
9211
  headerToolbarItems = getLookupSapceUserTreeSchema();
9168
9212
  pickerSchema["style"] = {
9169
- "margin-left":"200px",
9213
+ "margin-left":"220px",
9170
9214
  "min-height": "300px"
9171
9215
  };
9172
9216
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
@@ -9177,7 +9221,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
9177
9221
  if (isAllowCreate) {
9178
9222
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
9179
9223
  new_button.align = "right";
9180
- pickerSchema.headerToolbar.push(new_button);
9224
+ // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
9225
+ pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
9181
9226
  }
9182
9227
  pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
9183
9228
  if (ctx.filterVisible !== false) {
@@ -10867,7 +10912,71 @@ async function getQuickEditSchema(field, options){
10867
10912
  `;
10868
10913
  break;
10869
10914
  }
10870
-
10915
+ quickEditSchema.body[0].visibleOn = "${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";
10916
+ quickEditSchema.body.push({
10917
+ "type":"service",
10918
+ "body":[
10919
+ {
10920
+ "type": "tpl",
10921
+ "tpl": instance.t('frontend_records_no_allowedit'),
10922
+ "visibleOn": "${!quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}"
10923
+ },
10924
+ {
10925
+ "type": "spinner",
10926
+ "showOn": "${quickedit_record_permissions_loading}"
10927
+ }
10928
+ ],
10929
+ "onEvent":{
10930
+ "init":{
10931
+ "actions":[
10932
+ {
10933
+ "actionType": "setValue",
10934
+ "componentId": `service_listview_${options.objectName}`,
10935
+ "args": {
10936
+ "value":{
10937
+ "quickedit_record_permissions_loading": true
10938
+ }
10939
+ }
10940
+ },
10941
+ {
10942
+ "actionType": "ajax",
10943
+ "args": {
10944
+ "api": {
10945
+ "url": "${context.rootUrl}/service/api/@\${objectName}/recordPermissions/${_id}",
10946
+ "method": "get",
10947
+ "headers": {
10948
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
10949
+ },
10950
+ "cache": 30000,
10951
+ "messages": {
10952
+ "failed": "失败了呢。。"
10953
+ }
10954
+ }
10955
+ }
10956
+ },
10957
+ {
10958
+ "actionType": "setValue",
10959
+ "componentId": `service_listview_${options.objectName}`,
10960
+ "args": {
10961
+ "value":{
10962
+ "quickedit_record_permissions_loading": false
10963
+ }
10964
+ }
10965
+ },
10966
+ {
10967
+ "actionType": "setValue",
10968
+ "componentId": `service_listview_${options.objectName}`,
10969
+ "args": {
10970
+ "value":{
10971
+ "quickedit_record_permissions": "${event.data}"
10972
+ }
10973
+ }
10974
+ }
10975
+ ]
10976
+ }
10977
+ }
10978
+
10979
+ });
10871
10980
  } else {
10872
10981
  quickEditSchema = false;
10873
10982
  }
@@ -10900,7 +11009,7 @@ function getFieldWidth(width){
10900
11009
 
10901
11010
  async function getTableColumns$1(fields, options){
10902
11011
  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;
11012
+ const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
10904
11013
 
10905
11014
  for (const field of fields) {
10906
11015
  //增加quickEdit属性,实现快速编辑
@@ -11438,7 +11547,7 @@ async function getTableApi(mainObject, fields, options){
11438
11547
  try{
11439
11548
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11440
11549
  const listName = api.data.listName;
11441
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11550
+ const listViewPropsStoreKey = location.pathname + "/crud";
11442
11551
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
11443
11552
  if(localListViewProps){
11444
11553
  localListViewProps = JSON.parse(localListViewProps);
@@ -11639,7 +11748,7 @@ async function getTableApi(mainObject, fields, options){
11639
11748
  try{
11640
11749
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11641
11750
  const listName = api.body.listName;
11642
- const listViewPropsStoreKey = location.pathname + "/crud/" + (listName || "");
11751
+ const listViewPropsStoreKey = location.pathname + "/crud";
11643
11752
  /**
11644
11753
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
11645
11754
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -12829,7 +12938,7 @@ async function getObjectCRUD(objectSchema, fields, options){
12829
12938
  }
12830
12939
  }
12831
12940
  // console.log(`getObjectHeaderToolbar====2===>`, options.filterVisible)
12832
- bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, options.formFactor, {
12941
+ bodyProps.headerToolbar = getObjectHeaderToolbar(objectSchema, fields, options.formFactor, {
12833
12942
  showDisplayAs,
12834
12943
  hiddenCount: options.queryCount === false,
12835
12944
  headerToolbarItems: options.headerToolbarItems,
@@ -12954,6 +13063,7 @@ async function getObjectCRUD(objectSchema, fields, options){
12954
13063
  return {
12955
13064
  type: 'service',
12956
13065
  className: '',
13066
+ //目前crud的service层id不认用户自定义id,只支持默认规则id
12957
13067
  id: `service_${id}`,
12958
13068
  name: `page`,
12959
13069
  data: {
@@ -18542,7 +18652,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18542
18652
  if (links) {
18543
18653
  return [2 /*return*/, {
18544
18654
  "type": "nav",
18545
- className: "".concat(className),
18655
+ className: "".concat(className, " text-black"),
18546
18656
  "stacked": stacked,
18547
18657
  "overflow": overflow,
18548
18658
  "indentSize": indentSize,
@@ -18554,7 +18664,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
18554
18664
  schemaApi: {
18555
18665
  "method": "get",
18556
18666
  "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 "),
18667
+ "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
18668
  "headers": {
18559
18669
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18560
18670
  }