@steedos-widgets/sortable 3.6.2-beta.8 → 3.6.2

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.
@@ -53932,27 +53932,33 @@ function getRootUrl(defaultRootUrl){
53932
53932
  /*
53933
53933
  * @Author: baozhoutao@steedos.com
53934
53934
  * @Date: 2022-08-16 17:02:08
53935
- * @LastEditors: baozhoutao@steedos.com
53936
- * @LastEditTime: 2023-06-20 13:50:15
53935
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53936
+ * @LastEditTime: 2024-02-02 10:15:00
53937
53937
  * @Description:
53938
53938
  */
53939
53939
 
53940
-
53941
53940
  const Router = {
53942
- getTabDisplayAs(tab_id){
53941
+ getTabDisplayAs(tab_id, defaultEnableSplit){
53943
53942
  var urlSearch = new URLSearchParams(document.location.search);
53944
53943
  if(urlSearch.has('display')){
53945
53944
  return urlSearch.get('display')
53946
53945
  }
53947
53946
  const key = `tab_${tab_id}_display`;
53948
53947
  // const key = `page_display`;
53949
- const value = localStorage.getItem(key);
53950
- return value ? value : 'grid'
53948
+ const value = sessionStorage.getItem(key);
53949
+ let defaultDisplay = "grid";
53950
+ if(defaultEnableSplit === true){
53951
+ defaultDisplay = "split";
53952
+ }
53953
+ if(window.innerWidth <= 768){
53954
+ return "grid";
53955
+ }
53956
+ return value ? value : defaultDisplay;
53951
53957
  },
53952
53958
 
53953
53959
  setTabDisplayAs(tab_id, displayAs){
53954
53960
  const key = `tab_${tab_id}_display`;
53955
- localStorage.setItem(key, displayAs);
53961
+ sessionStorage.setItem(key, displayAs);
53956
53962
  },
53957
53963
  getAppPath({formFactor, appId}){
53958
53964
  return `/app/${appId}`;
@@ -53979,8 +53985,8 @@ const Router = {
53979
53985
  /*
53980
53986
  * @Author: baozhoutao@steedos.com
53981
53987
  * @Date: 2022-07-20 16:29:22
53982
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53983
- * @LastEditTime: 2023-12-28 14:59:08
53988
+ * @LastEditors: liaodaxue
53989
+ * @LastEditTime: 2024-01-25 14:44:17
53984
53990
  * @Description:
53985
53991
  */
53986
53992
 
@@ -54052,6 +54058,25 @@ function getComparableAmisVersion() {
54052
54058
  }
54053
54059
  }
54054
54060
 
54061
+ /**
54062
+ * 判断浏览器类型
54063
+ * @returns 按需返回浏览器类型;
54064
+ */
54065
+ function getBowserType() {
54066
+ const userAgent = navigator.userAgent;
54067
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
54068
+ return "Chrome";
54069
+ } else if (userAgent.indexOf("Firefox") !== -1) {
54070
+ return "Firefox";
54071
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
54072
+ return "Safari";
54073
+ } else if (userAgent.indexOf("Edg") !== -1) {
54074
+ return "Edge";
54075
+ } else {
54076
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
54077
+ }
54078
+ }
54079
+
54055
54080
  function getNumberTpl(field){
54056
54081
  return `<span>\${_display.${field.name}}</span>`
54057
54082
  }
@@ -54092,7 +54117,7 @@ function getSelectMap(selectOptions){
54092
54117
  lodash.exports.forEach(selectOptions,(option)=>{
54093
54118
  const optionValue = option.value + '';
54094
54119
  const optionColor = option.color + '';
54095
- if(optionColor){
54120
+ if(optionColor && optionColor != "undefined"){
54096
54121
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
54097
54122
  const color = getContrastColor(background);
54098
54123
  const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
@@ -54476,7 +54501,31 @@ const getAmisFileReadonlySchema = (steedosField)=>{
54476
54501
  }
54477
54502
  }
54478
54503
  if(type === 'file'){
54479
- return {
54504
+ return window.Meteor?.isCordova ? {
54505
+ "type": "control",
54506
+ "body": {
54507
+ "type": "each",
54508
+ "name": "_display." + steedosField.name,
54509
+ "items": {
54510
+ "type": "tpl",
54511
+ "tpl": "${name}",
54512
+ "className": "antd-Button--link inline-block",
54513
+ "onEvent": {
54514
+ "click": {
54515
+ "actions": [
54516
+ {
54517
+ "script": `
54518
+ Steedos.cordovaDownload(encodeURI(event.data.url), event.data.name);
54519
+ `,
54520
+ "actionType": "custom"
54521
+ }
54522
+ ],
54523
+ "weight": 0
54524
+ }
54525
+ }
54526
+ }
54527
+ }
54528
+ } : {
54480
54529
  type: amisFieldType,
54481
54530
  tpl: `
54482
54531
  <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
@@ -54620,6 +54669,7 @@ var frontend_notifications$1 = "Notifications";
54620
54669
  var frontend_notifications_allread$1 = "Mark all as read";
54621
54670
  var frontend_notifications_allread_message$1 = "All marked as read";
54622
54671
  var frontend_profile$1 = "Profile";
54672
+ var switch_space$1 = "Switch Space";
54623
54673
  var frontend_about$1 = "About";
54624
54674
  var frontend_log_out$1 = "Log out";
54625
54675
  var frontend_listview_warning_start$1 = "The current ";
@@ -54707,6 +54757,7 @@ var en_us = {
54707
54757
  frontend_notifications_allread: frontend_notifications_allread$1,
54708
54758
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
54709
54759
  frontend_profile: frontend_profile$1,
54760
+ switch_space: switch_space$1,
54710
54761
  frontend_about: frontend_about$1,
54711
54762
  frontend_log_out: frontend_log_out$1,
54712
54763
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -54762,7 +54813,7 @@ var frontend_listview_control_delete_label = "删除";
54762
54813
  var frontend_listview_control_delete_confirm_text = "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?";
54763
54814
  var frontend_listview_control_delete_message_success = "删除成功";
54764
54815
  var frontend_listview_control_filters = "过滤设置";
54765
- var frontend_listview_control_filters_fields_extend = "条件组件1";
54816
+ var frontend_listview_control_filters_fields_extend = "条件组件";
54766
54817
  var frontend_listview_control_new_label = "新建";
54767
54818
  var frontend_listview_control_new_title = "新建 列表视图";
54768
54819
  var frontend_listview_control_new_message_success = "成功";
@@ -54796,6 +54847,7 @@ var frontend_notifications = "通知";
54796
54847
  var frontend_notifications_allread = "全部标记为已读";
54797
54848
  var frontend_notifications_allread_message = "已全部标记为已读";
54798
54849
  var frontend_profile = "个人资料";
54850
+ var switch_space = "切换工作区";
54799
54851
  var frontend_about = "关于";
54800
54852
  var frontend_log_out = "注销";
54801
54853
  var frontend_listview_warning_start = "当前";
@@ -54884,6 +54936,7 @@ var zh_cn = {
54884
54936
  frontend_notifications_allread: frontend_notifications_allread,
54885
54937
  frontend_notifications_allread_message: frontend_notifications_allread_message,
54886
54938
  frontend_profile: frontend_profile,
54939
+ switch_space: switch_space,
54887
54940
  frontend_about: frontend_about,
54888
54941
  frontend_log_out: frontend_log_out,
54889
54942
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -54938,7 +54991,7 @@ async function getQuickEditSchema(field, options){
54938
54991
  isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
54939
54992
  }
54940
54993
  const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
54941
- var quickEditSchema = { body: [], id: quickEditId };
54994
+ var quickEditSchema = { body: [], id: quickEditId, className: "steedos-table-quickEdit" };
54942
54995
  //select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
54943
54996
  if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
54944
54997
  const submitEvent = {
@@ -55197,7 +55250,8 @@ async function getQuickEditSchema(field, options){
55197
55250
  "failed": "失败了呢。。"
55198
55251
  }
55199
55252
  }
55200
- }
55253
+ },
55254
+ "expression": "${!recordPermissions.modifyAllRecords}"
55201
55255
  },
55202
55256
  {
55203
55257
  "actionType": "setValue",
@@ -55213,7 +55267,7 @@ async function getQuickEditSchema(field, options){
55213
55267
  "componentId": quickEditId,
55214
55268
  "args": {
55215
55269
  "value":{
55216
- "quickedit_record_permissions": "${event.data}"
55270
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
55217
55271
  }
55218
55272
  }
55219
55273
  }
@@ -55277,7 +55331,7 @@ async function getQuickEditSchema(field, options){
55277
55331
  `
55278
55332
  }
55279
55333
  },
55280
- "expression":"${event.data.value}"
55334
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
55281
55335
  },
55282
55336
  {
55283
55337
  "actionType": "setValue",
@@ -55308,10 +55362,20 @@ async function getQuickEditSchema(field, options){
55308
55362
  "script": `
55309
55363
  const noPermission = event.data.noPermission;
55310
55364
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
55311
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55365
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55312
55366
  noPermission.forEach(function (item) {
55313
55367
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
55368
+ _.remove(selectedItems, (selected) => selected._id === item);
55314
55369
  })
55370
+ doAction({
55371
+ "componentId": "${quickEditId}",
55372
+ "actionType": "setValue",
55373
+ "args": {
55374
+ "value": {
55375
+ selectedItems
55376
+ }
55377
+ }
55378
+ });
55315
55379
  `
55316
55380
  },
55317
55381
  {
@@ -55372,7 +55436,7 @@ async function getQuickEditSchema(field, options){
55372
55436
  }
55373
55437
 
55374
55438
  function getFieldWidth(width){
55375
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
55439
+ const defaultWidth = null;
55376
55440
  if(typeof width == 'string'){
55377
55441
  if(isNaN(width)){
55378
55442
  return width || defaultWidth;
@@ -55402,18 +55466,35 @@ async function getTableColumns(fields, options){
55402
55466
  //增加quickEdit属性,实现快速编辑
55403
55467
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55404
55468
  let className = "";
55405
- if(field.wrap != true){
55469
+ const bowserType = getBowserType();
55470
+ if(bowserType === "Safari"){
55406
55471
  className += " whitespace-nowrap ";
55407
55472
  }else {
55408
- className += " break-words ";
55473
+ if(field.wrap != true){
55474
+ className += " whitespace-nowrap ";
55475
+ }else {
55476
+ className += " break-words ";
55477
+ }
55478
+ }
55479
+
55480
+ if (typeof field.amis?.className == "object") {
55481
+ className = {
55482
+ [className]: "true",
55483
+ ...field.amis.className
55484
+ };
55485
+ } else if (typeof field.amis?.className == "string") {
55486
+ className = `${className} ${field.amis.className} `;
55409
55487
  }
55488
+ let fieldAmis = lodash.exports.clone(field.amis);
55489
+ delete fieldAmis?.className;
55490
+
55410
55491
  let columnItem;
55411
55492
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
55412
55493
  const previewFileScript = `
55413
55494
  var data = event.data;
55414
55495
  var file_name = data.versions ? data.name : "${field.label}";
55415
- var file_id = data._id;
55416
- SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
55496
+ var file_id = data.versions && data.versions[0] && data.versions[0]._id;
55497
+ window.previewFile && window.previewFile({file_name, file_id});
55417
55498
  `;
55418
55499
  columnItem = {
55419
55500
  "type": "button",
@@ -55438,11 +55519,11 @@ async function getTableColumns(fields, options){
55438
55519
  "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
55439
55520
  },
55440
55521
  {
55441
- "args": {},
55442
- "actionType": "custom",
55443
- "script": previewFileScript,
55444
- // "expression": "!!window?.nw?.require" //PC客户端预览附件
55445
- "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55522
+ "args": {},
55523
+ "actionType": "custom",
55524
+ "script": previewFileScript,
55525
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
55526
+ "expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55446
55527
  }
55447
55528
  ]
55448
55529
  }
@@ -55457,7 +55538,7 @@ async function getTableColumns(fields, options){
55457
55538
  toggled: field.toggled,
55458
55539
  static: true,
55459
55540
  className,
55460
- }, field.amis, {name: field.name});
55541
+ }, fieldAmis, {name: field.name});
55461
55542
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
55462
55543
  columnItem = Object.assign({}, {
55463
55544
  type: "switch",
@@ -55468,7 +55549,7 @@ async function getTableColumns(fields, options){
55468
55549
  static: true,
55469
55550
  className,
55470
55551
  ...getAmisFileReadonlySchema(field)
55471
- }, field.amis, {name: field.name});
55552
+ }, fieldAmis, {name: field.name});
55472
55553
  }
55473
55554
  else if(field.type === 'select'){
55474
55555
  const map = getSelectMap(field.options);
@@ -55483,7 +55564,7 @@ async function getTableColumns(fields, options){
55483
55564
  className,
55484
55565
  inputClassName: "inline",
55485
55566
  static: true,
55486
- }, field.amis, {name: field.name});
55567
+ }, fieldAmis, {name: field.name});
55487
55568
  }
55488
55569
  else {
55489
55570
  const tpl = await getFieldTpl(field, options);
@@ -55502,23 +55583,14 @@ async function getTableColumns(fields, options){
55502
55583
  if(field.type === 'textarea'){
55503
55584
  className += 'min-w-56';
55504
55585
  }
55505
- if(field.type === 'date'){
55506
- className += 'date-min-w';
55507
- }
55508
- if(field.type === 'datetime'){
55509
- className += 'datetime-min-w';
55510
- }
55586
+ // if(field.type === 'date'){
55587
+ // className += 'date-min-w';
55588
+ // }
55589
+ // if(field.type === 'datetime'){
55590
+ // className += 'datetime-min-w';
55591
+ // }
55511
55592
 
55512
55593
  //field上的amis属性里的clssname需要单独判断类型合并
55513
- if (typeof field.amis?.className == "object") {
55514
- className = {
55515
- [className]: "true",
55516
- ...field.amis.className
55517
- };
55518
- } else if (typeof field.amis?.className == "string") {
55519
- className = `${className} ${field.amis.className} `;
55520
- }
55521
- delete field.amis?.className;
55522
55594
 
55523
55595
  if(!field.hidden && !field.extra){
55524
55596
  columnItem = Object.assign({}, {
@@ -55535,7 +55607,7 @@ async function getTableColumns(fields, options){
55535
55607
  static: true,
55536
55608
  options: field.type === 'html' ? {html: true} : null
55537
55609
  // toggled: true
55538
- }, field.amis, {name: field.name});
55610
+ }, fieldAmis, {name: field.name});
55539
55611
 
55540
55612
  if(field.type === 'color'){
55541
55613
  columnItem.type = 'color';
@@ -55731,10 +55803,10 @@ async function getMobileTableColumns(fields, options){
55731
55803
  if(value.url){
55732
55804
  cms_url = value.url;
55733
55805
  }else{
55734
- cms_url = "/api/files/files/"+value+"?download=true"
55806
+ cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
55735
55807
  }
55736
55808
  }
55737
- Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55809
+ Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
55738
55810
  `,
55739
55811
  "actionType": "custom"
55740
55812
  }
@@ -55996,6 +56068,50 @@ async function getTableSchema$1(fields, options){
55996
56068
  }
55997
56069
  }
55998
56070
 
56071
+ /*
56072
+ img/avatar字段值添加URL前缀使其在amis中正常显示图片。
56073
+ */
56074
+ function getScriptForAddUrlPrefixForImgFields(fields){
56075
+ let imgFieldsKeys = [];
56076
+ let imgFields = {};
56077
+ fields.forEach((item)=>{
56078
+ if(lodash.exports.includes(['image','avatar'], item.type)){
56079
+ imgFieldsKeys.push(item.name);
56080
+ imgFields[item.name] = {
56081
+ name: item.name,
56082
+ type: item.type,
56083
+ multiple: item.multiple
56084
+ };
56085
+ }
56086
+ });
56087
+ if(!imgFieldsKeys.length){
56088
+ return '';
56089
+ }
56090
+ return `
56091
+ // image字段值添加URL前缀
56092
+ let imgFieldsKeys = ${JSON.stringify(imgFieldsKeys)};
56093
+ let imgFields = ${JSON.stringify(imgFields)};
56094
+ imgFieldsKeys.forEach((item)=>{
56095
+ let imgFieldValue = data[item];
56096
+ let imgFieldDisplayValue = data._display && data._display[item];
56097
+ if(imgFieldValue && imgFieldValue.length){
56098
+ let fieldProps = imgFields[item];
56099
+ if(fieldProps.multiple){
56100
+ if(imgFieldDisplayValue instanceof Array){
56101
+ data[item] = imgFieldDisplayValue.map((i)=>{
56102
+ const url = window.getImageFieldUrl(i.url);
56103
+ return url;
56104
+ });
56105
+ }
56106
+ }else{
56107
+ const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url);
56108
+ data[item] = url;
56109
+ }
56110
+ }
56111
+ })
56112
+ `
56113
+ }
56114
+
55999
56115
  /******************************************************************************
56000
56116
  Copyright (c) Microsoft Corporation.
56001
56117
 
@@ -56367,7 +56483,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
56367
56483
  const formSchema = {
56368
56484
  "type": "service",
56369
56485
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
56370
- "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-2 sm:grid-cols-4 mb-2",
56486
+ "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
56371
56487
  "style":{
56372
56488
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
56373
56489
  },
@@ -56954,7 +57070,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
56954
57070
  "className": "slds-filters"
56955
57071
  },
56956
57072
  "size": "xs",
56957
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
57073
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
56958
57074
  "visibleOn": "this.showFieldsFilter",
56959
57075
  },
56960
57076
  "className": "bg-white"
@@ -57000,6 +57116,7 @@ const getNewListviewButtonSchema = ()=>{
57000
57116
  "objectApiName": "object_listviews",
57001
57117
  "recordId": "",
57002
57118
  "mode": "edit",
57119
+ "layout": "normal",
57003
57120
  "defaultData": {
57004
57121
  "&": "${list_view}",
57005
57122
  "name":"",
@@ -57007,8 +57124,16 @@ const getNewListviewButtonSchema = ()=>{
57007
57124
  "filters":"",
57008
57125
  "shared":false,
57009
57126
  "object_name": "${targetObjectName}",
57127
+ "_id":"",
57128
+ "shared_to": null,
57129
+ "shared_to_organizations": null,
57130
+ "locked": false,
57131
+ "owner": null,
57132
+ "company_id": null,
57133
+ "company_ids": null,
57134
+ "is_system": false
57010
57135
  },
57011
- "fieldsExtend": fieldsExtend$4(),
57136
+ "fieldsExtend": fieldsExtend$5(),
57012
57137
  "fields": fields$1(),
57013
57138
  "onEvent": {
57014
57139
  "submitSucc": {
@@ -57059,14 +57184,17 @@ function fields$1(){
57059
57184
  "mobile_columns",
57060
57185
  "searchable_fields",
57061
57186
  "is_system",
57062
- "shared"
57187
+ "shared",
57188
+ "shared_to",
57189
+ "shared_to_organizations"
57063
57190
  ]
57064
57191
  }
57065
57192
 
57066
- function fieldsExtend$4(){
57193
+ function fieldsExtend$5(){
57067
57194
  return {
57068
57195
  "group": "",
57069
57196
  "label": {
57197
+ "group": "",
57070
57198
  "is_wide": true
57071
57199
  },
57072
57200
  "name": {
@@ -57148,9 +57276,19 @@ function fieldsExtend$4(){
57148
57276
  "shared": {
57149
57277
  "group": "",
57150
57278
  "amis": {
57151
- "visibleOn": "${global.user.is_space_admin}"
57279
+ "visibleOn": "${false}"
57152
57280
  }
57153
57281
  },
57282
+ "shared_to": {
57283
+ "group": "",
57284
+ "amis":{
57285
+ "type": "radios",
57286
+ "inline": false
57287
+ }
57288
+ },
57289
+ "shared_to_organizations": {
57290
+ "group": ""
57291
+ },
57154
57292
  "filters": {
57155
57293
  "group": "",
57156
57294
  "amis": {
@@ -57188,14 +57326,23 @@ const getCopyListviewButtonSchema = ()=>{
57188
57326
  "objectApiName": "object_listviews",
57189
57327
  "recordId": "",
57190
57328
  "mode": "edit",
57329
+ "layout": "normal",
57191
57330
  "defaultData": {
57192
57331
  "&": "${list_view}",
57193
57332
  "name":"",
57194
57333
  "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
57195
57334
  "shared":false,
57196
57335
  "object_name": "${targetObjectName}",
57336
+ "_id":"",
57337
+ "shared_to": null,
57338
+ "shared_to_organizations": null,
57339
+ "locked": false,
57340
+ "owner": null,
57341
+ "company_id": null,
57342
+ "company_ids": null,
57343
+ "is_system": false
57197
57344
  },
57198
- "fieldsExtend": fieldsExtend$3(),
57345
+ "fieldsExtend": fieldsExtend$4(),
57199
57346
  "fields": fields(),
57200
57347
  "onEvent": {
57201
57348
  "submitSucc": {
@@ -57243,13 +57390,16 @@ function fields(){
57243
57390
  "mobile_columns.$.field",
57244
57391
  "searchable_fields.$.field",
57245
57392
  "is_system",
57246
- "shared"
57393
+ "shared",
57394
+ "shared_to",
57395
+ "shared_to_organizations"
57247
57396
  ]
57248
57397
  }
57249
57398
 
57250
- function fieldsExtend$3(){
57399
+ function fieldsExtend$4(){
57251
57400
  return {
57252
57401
  "label": {
57402
+ "group": "",
57253
57403
  "is_wide": true
57254
57404
  },
57255
57405
  "name": {
@@ -57299,10 +57449,21 @@ function fieldsExtend$3(){
57299
57449
  }
57300
57450
  },
57301
57451
  "shared": {
57452
+ "group": "",
57302
57453
  "amis": {
57303
- "visibleOn": "${global.user.is_space_admin}"
57454
+ "visibleOn": "${false}"
57304
57455
  }
57305
57456
  },
57457
+ "shared_to": {
57458
+ "group": "",
57459
+ "amis":{
57460
+ "type": "radios",
57461
+ "inline": false
57462
+ }
57463
+ },
57464
+ "shared_to_organizations": {
57465
+ "group": ""
57466
+ },
57306
57467
  "filters": {
57307
57468
  "group": "",
57308
57469
  "amis": {
@@ -57312,6 +57473,12 @@ function fieldsExtend$3(){
57312
57473
  }
57313
57474
  }
57314
57475
 
57476
+ /*
57477
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
57478
+ * @Date: 2023-06-13 13:51:19
57479
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
57480
+ * @LastEditTime: 2024-02-05 11:25:09
57481
+ */
57315
57482
  const getRenameListviewButtonSchema = ()=>{
57316
57483
  return {
57317
57484
  "type": "button",
@@ -57337,6 +57504,7 @@ const getRenameListviewButtonSchema = ()=>{
57337
57504
  "label": "对象表单",
57338
57505
  "objectApiName": "object_listviews",
57339
57506
  "recordId": "${recordId}",
57507
+ "layout": "normal",
57340
57508
  "mode": "edit",
57341
57509
  "fields": [
57342
57510
  "label"
@@ -57371,6 +57539,12 @@ const getRenameListviewButtonSchema = ()=>{
57371
57539
  }
57372
57540
  };
57373
57541
 
57542
+ /*
57543
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
57544
+ * @Date: 2023-06-13 13:51:19
57545
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
57546
+ * @LastEditTime: 2024-02-06 15:38:49
57547
+ */
57374
57548
  const getSetListviewShareButtonSchema = ()=>{
57375
57549
  return {
57376
57550
  "type": "button",
@@ -57386,6 +57560,8 @@ const getSetListviewShareButtonSchema = ()=>{
57386
57560
  "title": instance.t('frontend_listview_control_share'),
57387
57561
  "data": {
57388
57562
  "recordId": "${uiSchema.list_views[listName]._id}",
57563
+ "appId": "${appId}",
57564
+ "global": "${global}",
57389
57565
  "context": "${context}"
57390
57566
  },
57391
57567
  "body": [
@@ -57395,9 +57571,12 @@ const getSetListviewShareButtonSchema = ()=>{
57395
57571
  "objectApiName": "object_listviews",
57396
57572
  "recordId": "${recordId}",
57397
57573
  "mode": "edit",
57574
+ "layout": "normal",
57398
57575
  "fields": [
57399
- "shared"
57400
- ]
57576
+ "shared_to",
57577
+ "shared_to_organizations"
57578
+ ],
57579
+ "fieldsExtend": fieldsExtend$3(),
57401
57580
  }
57402
57581
  ],
57403
57582
  "showCloseButton": true,
@@ -57415,6 +57594,21 @@ const getSetListviewShareButtonSchema = ()=>{
57415
57594
  }
57416
57595
  };
57417
57596
 
57597
+ function fieldsExtend$3(){
57598
+ return {
57599
+ "shared_to": {
57600
+ "group": "",
57601
+ "amis":{
57602
+ "type": "radios",
57603
+ "inline": false
57604
+ }
57605
+ },
57606
+ "shared_to_organizations": {
57607
+ "group": ""
57608
+ }
57609
+ }
57610
+ }
57611
+
57418
57612
  const getSetListviewFiltersButtonSchema = ()=>{
57419
57613
  return {
57420
57614
  "type": "button",
@@ -57546,10 +57740,12 @@ function apiRequestAdaptor$2(){
57546
57740
  function fieldsExtend$2(){
57547
57741
  return {
57548
57742
  "filters": {
57743
+ "label": "",
57744
+ "group": "",
57549
57745
  "visible_on": "true",
57550
57746
  "amis": {
57551
57747
  "type": "condition-builder",
57552
- "label": instance.t('frontend_listview_control_filters_fields_extend'),
57748
+ // "label": i18next.t('frontend_listview_control_filters_fields_extend'),
57553
57749
  "source": {
57554
57750
  "method": "get",
57555
57751
  "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
@@ -57592,6 +57788,7 @@ const getSetListviewColumnsButtonSchema = ()=>{
57592
57788
  "objectApiName": "object_listviews",
57593
57789
  "recordId": "${recordId}",
57594
57790
  "mode": "edit",
57791
+ "layout": "normal",
57595
57792
  "fieldsExtend": fieldsExtend$1(),
57596
57793
  "initApiAdaptor": initApiAdaptor$1(),
57597
57794
  "apiRequestAdaptor": apiRequestAdaptor$1(),
@@ -57788,6 +57985,8 @@ const getSetListviewSortButtonSchema = ()=>{
57788
57985
  function fieldsExtend(){
57789
57986
  return {
57790
57987
  "sort": {
57988
+ "label": "",
57989
+ "group": "",
57791
57990
  "amis": {
57792
57991
  "type": "tabs-transfer",
57793
57992
  "sortable": true,
@@ -57915,7 +58114,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57915
58114
  "icon": "fa fa-cog",
57916
58115
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57917
58116
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
57918
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58117
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57919
58118
  "align": "right",
57920
58119
  "visibleOn": "${!isLookup}",
57921
58120
  "buttons": [
@@ -57936,20 +58135,20 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57936
58135
  }
57937
58136
  };
57938
58137
 
57939
- const getDisplayAsButton = function(objectName, showDisplayAs){
57940
- let displayAs = Router.getTabDisplayAs(objectName);
58138
+ const getDisplayAsButton = function(objectName, defaultEnableSplit){
58139
+ let displayAs = Router.getTabDisplayAs(objectName, defaultEnableSplit);
57941
58140
  let buttons = [
57942
58141
  {
57943
58142
  "type": "button",
57944
58143
  "label": instance.t('frontend_display_type_is_table'),
57945
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
58144
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
57946
58145
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57947
58146
  "rightIconClassName": "m-l-sm"
57948
58147
  },
57949
58148
  {
57950
58149
  "type": "button",
57951
58150
  "label": instance.t('frontend_display_type_is_split'),
57952
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
58151
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57953
58152
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57954
58153
  "rightIconClassName": "m-l-sm"
57955
58154
  }
@@ -57960,7 +58159,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57960
58159
  "icon": "fa fa-table-columns",
57961
58160
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57962
58161
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
57963
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58162
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57964
58163
  "align": "right",
57965
58164
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
57966
58165
  "buttons": [
@@ -58153,7 +58352,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58153
58352
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58154
58353
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58155
58354
  // "tooltipPlacement": "top",
58156
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58355
+ // "className": "bg-white p-2 rounded text-gray-500",
58157
58356
  // "label": "",
58158
58357
  // "icon": "fa fa-sync",
58159
58358
  // "visibleOn": "${!showFieldsFilter}",
@@ -58177,7 +58376,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58177
58376
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58178
58377
  "tooltip":"",
58179
58378
  "tooltipPlacement": "top",
58180
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58379
+ "className": "bg-white p-2 rounded text-gray-500"
58181
58380
  };
58182
58381
  }
58183
58382
  else {
@@ -58188,7 +58387,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58188
58387
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58189
58388
  "tooltip":"",
58190
58389
  "tooltipPlacement": "top",
58191
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58390
+ "className": "bg-white p-2 rounded text-gray-500"
58192
58391
  };
58193
58392
  }
58194
58393
  let toolbarFilter;
@@ -58210,7 +58409,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58210
58409
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
58211
58410
  },
58212
58411
  "align": "right",
58213
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58412
+ "className": "bg-white p-2 rounded text-gray-500",
58214
58413
  "onEvent": {
58215
58414
  "click": {
58216
58415
  "actions": [
@@ -58224,7 +58423,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58224
58423
  "id": "steedos_crud_toolbar_filter"
58225
58424
  };
58226
58425
  }
58227
- let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
58426
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name, mainObject?.enable_split);
58228
58427
  let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
58229
58428
 
58230
58429
  // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
@@ -58370,7 +58569,6 @@ async function getObjectFilter(objectSchema, fields, options) {
58370
58569
  "timeOut": 1000
58371
58570
  }
58372
58571
  });
58373
- resizeWindow();
58374
58572
  const scope = event.context.scoped;
58375
58573
  // let filterFormValues = event.data;
58376
58574
  let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
@@ -58446,8 +58644,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58446
58644
  /*
58447
58645
  * @Author: baozhoutao@steedos.com
58448
58646
  * @Date: 2022-07-05 15:55:39
58449
- * @LastEditors: baozhoutao@steedos.com
58450
- * @LastEditTime: 2024-01-16 11:14:34
58647
+ * @LastEditors: liaodaxue
58648
+ * @LastEditTime: 2024-02-05 17:56:27
58451
58649
  * @Description:
58452
58650
  */
58453
58651
 
@@ -59014,17 +59212,13 @@ function getReferenceToSync(field) {
59014
59212
 
59015
59213
  function getLookupSapceUserTreeSchema(isMobile){
59016
59214
  let apiAdaptor = `
59017
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
59018
59215
  const records = payload.data.options;
59019
- let isTreeOptionsComputed = false;
59020
- if(records.length === 1 && records[0].children){
59021
- isTreeOptionsComputed = true;
59022
- }
59023
- if(isTreeOptionsComputed){
59024
- return payload;
59025
- }
59026
59216
  const treeRecords = [];
59027
- const getChildren = (records, childrenIds) => {
59217
+ const getChildren = (currentRecord, records, childrenIds) => {
59218
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
59219
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
59220
+ return currentRecord.children;
59221
+ }
59028
59222
  if (!childrenIds) {
59029
59223
  return;
59030
59224
  }
@@ -59033,7 +59227,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59033
59227
  });
59034
59228
  _.each(children, (item) => {
59035
59229
  if (item.children) {
59036
- item.children = getChildren(records, item.children)
59230
+ item.children = getChildren(item, records, item.children)
59037
59231
  }else{
59038
59232
  item.children = [];
59039
59233
  }
@@ -59059,7 +59253,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59059
59253
 
59060
59254
  _.each(records, (record) => {
59061
59255
  if (record.noParent == 1) {
59062
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
59256
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
59063
59257
  }
59064
59258
  });
59065
59259
  console.log(treeRecords)
@@ -59109,6 +59303,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59109
59303
  }
59110
59304
  },
59111
59305
  "label": "",
59306
+ "mode": "normal",
59112
59307
  "name": "organizations",
59113
59308
  "multiple": false,
59114
59309
  "joinValues": false,
@@ -59251,6 +59446,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
59251
59446
  }
59252
59447
  });
59253
59448
 
59449
+ let listviewFilter = getListViewFilter(listView);
59450
+ let listviewFiltersFunction = listView && listView._filters;
59451
+
59254
59452
  let sort = "";
59255
59453
  if(listView){
59256
59454
  sort = getListViewSort(listView);
@@ -59297,7 +59495,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59297
59495
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
59298
59496
  }
59299
59497
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
59300
- var filters = [];
59498
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59301
59499
  var pageSize = api.data.pageSize || 10;
59302
59500
  var pageNo = api.data.pageNo || 1;
59303
59501
  var skip = (pageNo - 1) * pageSize;
@@ -59359,6 +59557,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59359
59557
  }
59360
59558
 
59361
59559
  const inFilterForm = ${ctx.inFilterForm};
59560
+
59561
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59562
+
59563
+ if(listviewFiltersFunction && !inFilterForm){
59564
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
59565
+ if(_filters0 && _filters0.length){
59566
+ filters.push(_filters0);
59567
+ }
59568
+ }
59569
+
59362
59570
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59363
59571
 
59364
59572
  if(filtersFunction && !inFilterForm){
@@ -59446,6 +59654,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59446
59654
  });
59447
59655
  payload.data.rows = treeRecords;
59448
59656
  }
59657
+ const result = payload.data.rows;
59658
+ if(result && result.length){
59659
+ const updatedResult = _.map(result, (element) => {
59660
+ const data = { ...element };
59661
+ // image字段值添加URL前缀
59662
+ ${getScriptForAddUrlPrefixForImgFields(lodash.exports.values(refObjectConfig.fields))}
59663
+ return data;
59664
+ });
59665
+ payload.data.rows = updatedResult;
59666
+ }
59449
59667
  return payload;
59450
59668
  `;
59451
59669
  if(field.optionsFunction || field._optionsFunction){
@@ -59477,13 +59695,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
59477
59695
 
59478
59696
  pickerSchema.affixHeader = false;
59479
59697
 
59480
- var headerToolbarItems = [];
59698
+
59699
+
59700
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
59701
+
59481
59702
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
59482
- headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
59703
+ pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
59483
59704
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
59484
59705
  }
59485
-
59486
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
59706
+
59487
59707
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
59488
59708
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
59489
59709
  // lookup字段配置过滤条件就强制不显示新建按钮
@@ -59596,8 +59816,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
59596
59816
  pickerSchema.footerToolbar = ["pagination"];
59597
59817
  }
59598
59818
 
59819
+ if(field.inlineHelpText){
59820
+ pickerSchema.toolbarClassName = "hasHelpText";
59821
+ pickerSchema.headerToolbar = [{
59822
+ "type": "tpl",
59823
+ "tpl": field.inlineHelpText,
59824
+ "className": "text-secondary"
59825
+ }, ...pickerSchema.headerToolbar];
59826
+ }
59827
+ pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
59828
+
59599
59829
  const data = {
59600
59830
  type: getAmisStaticFieldType('picker', readonly),
59831
+ className: ctx.className || '',
59601
59832
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
59602
59833
  labelField: referenceTo.labelField.name,
59603
59834
  valueField: referenceTo.valueField.name,
@@ -59671,6 +59902,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
59671
59902
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59672
59903
  let listView = getLookupListView(refObjectConfig);
59673
59904
 
59905
+ let listviewFilter = getListViewFilter(listView);
59906
+ let listviewFiltersFunction = listView && listView._filters;
59907
+
59674
59908
  let sort = "";
59675
59909
  if(listView){
59676
59910
  sort = getListViewSort(listView);
@@ -59700,7 +59934,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59700
59934
  apiInfo.data['rfield'] = `\${object_name}`;
59701
59935
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
59702
59936
  apiInfo.requestAdaptor = `
59703
- var filters = [];
59937
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59704
59938
  var top = 200;
59705
59939
  if(api.data.$term){
59706
59940
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -59723,6 +59957,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
59723
59957
  }
59724
59958
 
59725
59959
  const inFilterForm = ${ctx.inFilterForm};
59960
+
59961
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59962
+
59963
+ if(listviewFiltersFunction && !inFilterForm){
59964
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
59965
+ if(_filters0 && _filters0.length){
59966
+ filters.push(_filters0);
59967
+ }
59968
+ }
59969
+
59726
59970
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59727
59971
 
59728
59972
  if(filtersFunction && !inFilterForm){
@@ -59799,6 +60043,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59799
60043
  // 但是同时配置autoComplete和source会多请求一次接口
59800
60044
  // TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
59801
60045
  data.source = apiInfo;
60046
+ delete data.autoComplete;
59802
60047
  }
59803
60048
  //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
59804
60049
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
@@ -59845,7 +60090,8 @@ async function lookupToAmis(field, readonly, ctx){
59845
60090
  }
59846
60091
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59847
60092
  if(readonly){
59848
- if(field.reference_to){
60093
+ if(field.reference_to && !field.isTableField){
60094
+ //isTableField只在grid字段内存在
59849
60095
  return {
59850
60096
  type: 'steedos-field',
59851
60097
  config: field,
@@ -60056,8 +60302,8 @@ if(typeof window != 'undefined'){
60056
60302
  /*
60057
60303
  * @Author: baozhoutao@steedos.com
60058
60304
  * @Date: 2023-01-13 17:27:54
60059
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
60060
- * @LastEditTime: 2023-08-28 17:45:38
60305
+ * @LastEditors: liaodaxue
60306
+ * @LastEditTime: 2024-02-04 17:29:54
60061
60307
  * @Description:
60062
60308
  */
60063
60309
 
@@ -60158,7 +60404,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
60158
60404
  "title": "Insert",
60159
60405
  "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
60160
60406
  }
60161
- }
60407
+ },
60408
+ "statusbar": false
60162
60409
  },
60163
60410
  "name": field.name
60164
60411
  }
@@ -60396,13 +60643,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60396
60643
  };
60397
60644
  break;
60398
60645
  case 'input-datetime-range':
60646
+ // convertData = {
60647
+ // type: "input-datetime-range",
60648
+ // inputFormat: 'YYYY-MM-DD HH:mm',
60649
+ // format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60650
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
60651
+ // utc: true,
60652
+ // joinValues: false
60653
+ // }
60654
+ // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
60399
60655
  convertData = {
60400
- type: "input-datetime-range",
60401
- inputFormat: 'YYYY-MM-DD HH:mm',
60656
+ type: "input-date-range",
60657
+ inputFormat: "YYYY-MM-DD HH:mm",
60402
60658
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60403
60659
  tpl: readonly ? getDateTimeTpl(field) : null,
60404
60660
  utc: true,
60405
- joinValues: false
60661
+ joinValues: false,
60662
+ "shortcuts": [
60663
+ "thismonth",
60664
+ "2monthsago",
60665
+ "3monthslater",
60666
+ "prevquarter",
60667
+ "thisquarter",
60668
+ "thisyear",
60669
+ "lastYear"
60670
+ ]
60406
60671
  };
60407
60672
  break;
60408
60673
  case 'datetime':
@@ -60453,7 +60718,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60453
60718
  convertData = {
60454
60719
  type: getAmisStaticFieldType('datetime', readonly),
60455
60720
  inputFormat: 'YYYY-MM-DD HH:mm',
60456
- format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
60721
+ format: 'YYYY-MM-DDTHH:mm:00.000Z',
60457
60722
  tpl: readonly ? getDateTimeTpl(field) : null,
60458
60723
  utc: true,
60459
60724
  };
@@ -60584,6 +60849,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60584
60849
  convertData = {
60585
60850
  type: 'static-text'
60586
60851
  };
60852
+ }else if(field.autonumber_enable_modify){
60853
+ convertData = {
60854
+ "type": "input-group",
60855
+ "body": [
60856
+ {
60857
+ "type": "input-text",
60858
+ "name": field.name
60859
+ },
60860
+ {
60861
+ "type": "button",
60862
+ "label": "自动获取",
60863
+ "actionType": "ajax",
60864
+ "api": {
60865
+ "url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
60866
+ "method": "post",
60867
+ "headers": {
60868
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
60869
+ },
60870
+ "adaptor": `
60871
+ payload.data["${field.name}"] = payload.data && payload.data.autonumber;
60872
+ delete payload.data.autonumber;
60873
+ return payload;
60874
+ `
60875
+ },
60876
+ "messages": {
60877
+ "success": "获取成功"
60878
+ }
60879
+ }
60880
+ ]
60881
+ };
60587
60882
  }
60588
60883
  break;
60589
60884
  case 'url':
@@ -60789,12 +61084,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60789
61084
  break;
60790
61085
  }
60791
61086
  if(!lodash.exports.isEmpty(convertData)){
61087
+ const className = convertData.className;
60792
61088
  if(field.is_wide || convertData.type === 'group'){
60793
- convertData.className = 'col-span-2 m-0';
61089
+ convertData.className = className ? 'col-span-2 m-0 ' + className : 'col-span-2 m-0';
60794
61090
  }else {
60795
- convertData.className = 'm-0';
61091
+ convertData.className = className ? 'm-0 ' + className : 'm-0';
60796
61092
  }
60797
- if(readonly){
61093
+ if(readonly && ctx.mode !== 'edit'){
60798
61094
  convertData.className = `${convertData.className} border-b`;
60799
61095
  }
60800
61096
  if(readonly){
@@ -60802,11 +61098,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60802
61098
  }
60803
61099
 
60804
61100
  let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
60805
- if (convertData.className) {
60806
- convertData.className = convertData.className + fieldTypeClassName;
60807
- } else {
60808
- convertData.className = fieldTypeClassName;
60809
- }
61101
+ convertData.className = convertData.className + fieldTypeClassName;
60810
61102
 
60811
61103
  if(field.visible_on && !ctx.inFilterForm){
60812
61104
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
@@ -60889,8 +61181,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
60889
61181
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60890
61182
  }
60891
61183
  if(_field.type === 'datetime'){
60892
- // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
60893
- _field.type = 'input-date-range';
61184
+ // 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
61185
+ // 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
61186
+ _field.type = 'input-datetime-range';
60894
61187
  _field.is_wide = true;
60895
61188
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60896
61189
  }