@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.
@@ -53928,27 +53928,33 @@ function getRootUrl(defaultRootUrl){
53928
53928
  /*
53929
53929
  * @Author: baozhoutao@steedos.com
53930
53930
  * @Date: 2022-08-16 17:02:08
53931
- * @LastEditors: baozhoutao@steedos.com
53932
- * @LastEditTime: 2023-06-20 13:50:15
53931
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53932
+ * @LastEditTime: 2024-02-02 10:15:00
53933
53933
  * @Description:
53934
53934
  */
53935
53935
 
53936
-
53937
53936
  const Router = {
53938
- getTabDisplayAs(tab_id){
53937
+ getTabDisplayAs(tab_id, defaultEnableSplit){
53939
53938
  var urlSearch = new URLSearchParams(document.location.search);
53940
53939
  if(urlSearch.has('display')){
53941
53940
  return urlSearch.get('display')
53942
53941
  }
53943
53942
  const key = `tab_${tab_id}_display`;
53944
53943
  // const key = `page_display`;
53945
- const value = localStorage.getItem(key);
53946
- return value ? value : 'grid'
53944
+ const value = sessionStorage.getItem(key);
53945
+ let defaultDisplay = "grid";
53946
+ if(defaultEnableSplit === true){
53947
+ defaultDisplay = "split";
53948
+ }
53949
+ if(window.innerWidth <= 768){
53950
+ return "grid";
53951
+ }
53952
+ return value ? value : defaultDisplay;
53947
53953
  },
53948
53954
 
53949
53955
  setTabDisplayAs(tab_id, displayAs){
53950
53956
  const key = `tab_${tab_id}_display`;
53951
- localStorage.setItem(key, displayAs);
53957
+ sessionStorage.setItem(key, displayAs);
53952
53958
  },
53953
53959
  getAppPath({formFactor, appId}){
53954
53960
  return `/app/${appId}`;
@@ -53975,8 +53981,8 @@ const Router = {
53975
53981
  /*
53976
53982
  * @Author: baozhoutao@steedos.com
53977
53983
  * @Date: 2022-07-20 16:29:22
53978
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53979
- * @LastEditTime: 2023-12-28 14:59:08
53984
+ * @LastEditors: liaodaxue
53985
+ * @LastEditTime: 2024-01-25 14:44:17
53980
53986
  * @Description:
53981
53987
  */
53982
53988
 
@@ -54048,6 +54054,25 @@ function getComparableAmisVersion() {
54048
54054
  }
54049
54055
  }
54050
54056
 
54057
+ /**
54058
+ * 判断浏览器类型
54059
+ * @returns 按需返回浏览器类型;
54060
+ */
54061
+ function getBowserType() {
54062
+ const userAgent = navigator.userAgent;
54063
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
54064
+ return "Chrome";
54065
+ } else if (userAgent.indexOf("Firefox") !== -1) {
54066
+ return "Firefox";
54067
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
54068
+ return "Safari";
54069
+ } else if (userAgent.indexOf("Edg") !== -1) {
54070
+ return "Edge";
54071
+ } else {
54072
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
54073
+ }
54074
+ }
54075
+
54051
54076
  function getNumberTpl(field){
54052
54077
  return `<span>\${_display.${field.name}}</span>`
54053
54078
  }
@@ -54088,7 +54113,7 @@ function getSelectMap(selectOptions){
54088
54113
  lodash.exports.forEach(selectOptions,(option)=>{
54089
54114
  const optionValue = option.value + '';
54090
54115
  const optionColor = option.color + '';
54091
- if(optionColor){
54116
+ if(optionColor && optionColor != "undefined"){
54092
54117
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
54093
54118
  const color = getContrastColor(background);
54094
54119
  const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
@@ -54472,7 +54497,31 @@ const getAmisFileReadonlySchema = (steedosField)=>{
54472
54497
  }
54473
54498
  }
54474
54499
  if(type === 'file'){
54475
- return {
54500
+ return window.Meteor?.isCordova ? {
54501
+ "type": "control",
54502
+ "body": {
54503
+ "type": "each",
54504
+ "name": "_display." + steedosField.name,
54505
+ "items": {
54506
+ "type": "tpl",
54507
+ "tpl": "${name}",
54508
+ "className": "antd-Button--link inline-block",
54509
+ "onEvent": {
54510
+ "click": {
54511
+ "actions": [
54512
+ {
54513
+ "script": `
54514
+ Steedos.cordovaDownload(encodeURI(event.data.url), event.data.name);
54515
+ `,
54516
+ "actionType": "custom"
54517
+ }
54518
+ ],
54519
+ "weight": 0
54520
+ }
54521
+ }
54522
+ }
54523
+ }
54524
+ } : {
54476
54525
  type: amisFieldType,
54477
54526
  tpl: `
54478
54527
  <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
@@ -54616,6 +54665,7 @@ var frontend_notifications$1 = "Notifications";
54616
54665
  var frontend_notifications_allread$1 = "Mark all as read";
54617
54666
  var frontend_notifications_allread_message$1 = "All marked as read";
54618
54667
  var frontend_profile$1 = "Profile";
54668
+ var switch_space$1 = "Switch Space";
54619
54669
  var frontend_about$1 = "About";
54620
54670
  var frontend_log_out$1 = "Log out";
54621
54671
  var frontend_listview_warning_start$1 = "The current ";
@@ -54703,6 +54753,7 @@ var en_us = {
54703
54753
  frontend_notifications_allread: frontend_notifications_allread$1,
54704
54754
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
54705
54755
  frontend_profile: frontend_profile$1,
54756
+ switch_space: switch_space$1,
54706
54757
  frontend_about: frontend_about$1,
54707
54758
  frontend_log_out: frontend_log_out$1,
54708
54759
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -54758,7 +54809,7 @@ var frontend_listview_control_delete_label = "删除";
54758
54809
  var frontend_listview_control_delete_confirm_text = "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?";
54759
54810
  var frontend_listview_control_delete_message_success = "删除成功";
54760
54811
  var frontend_listview_control_filters = "过滤设置";
54761
- var frontend_listview_control_filters_fields_extend = "条件组件1";
54812
+ var frontend_listview_control_filters_fields_extend = "条件组件";
54762
54813
  var frontend_listview_control_new_label = "新建";
54763
54814
  var frontend_listview_control_new_title = "新建 列表视图";
54764
54815
  var frontend_listview_control_new_message_success = "成功";
@@ -54792,6 +54843,7 @@ var frontend_notifications = "通知";
54792
54843
  var frontend_notifications_allread = "全部标记为已读";
54793
54844
  var frontend_notifications_allread_message = "已全部标记为已读";
54794
54845
  var frontend_profile = "个人资料";
54846
+ var switch_space = "切换工作区";
54795
54847
  var frontend_about = "关于";
54796
54848
  var frontend_log_out = "注销";
54797
54849
  var frontend_listview_warning_start = "当前";
@@ -54880,6 +54932,7 @@ var zh_cn = {
54880
54932
  frontend_notifications_allread: frontend_notifications_allread,
54881
54933
  frontend_notifications_allread_message: frontend_notifications_allread_message,
54882
54934
  frontend_profile: frontend_profile,
54935
+ switch_space: switch_space,
54883
54936
  frontend_about: frontend_about,
54884
54937
  frontend_log_out: frontend_log_out,
54885
54938
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -54934,7 +54987,7 @@ async function getQuickEditSchema(field, options){
54934
54987
  isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
54935
54988
  }
54936
54989
  const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
54937
- var quickEditSchema = { body: [], id: quickEditId };
54990
+ var quickEditSchema = { body: [], id: quickEditId, className: "steedos-table-quickEdit" };
54938
54991
  //select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
54939
54992
  if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
54940
54993
  const submitEvent = {
@@ -55193,7 +55246,8 @@ async function getQuickEditSchema(field, options){
55193
55246
  "failed": "失败了呢。。"
55194
55247
  }
55195
55248
  }
55196
- }
55249
+ },
55250
+ "expression": "${!recordPermissions.modifyAllRecords}"
55197
55251
  },
55198
55252
  {
55199
55253
  "actionType": "setValue",
@@ -55209,7 +55263,7 @@ async function getQuickEditSchema(field, options){
55209
55263
  "componentId": quickEditId,
55210
55264
  "args": {
55211
55265
  "value":{
55212
- "quickedit_record_permissions": "${event.data}"
55266
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
55213
55267
  }
55214
55268
  }
55215
55269
  }
@@ -55273,7 +55327,7 @@ async function getQuickEditSchema(field, options){
55273
55327
  `
55274
55328
  }
55275
55329
  },
55276
- "expression":"${event.data.value}"
55330
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
55277
55331
  },
55278
55332
  {
55279
55333
  "actionType": "setValue",
@@ -55304,10 +55358,20 @@ async function getQuickEditSchema(field, options){
55304
55358
  "script": `
55305
55359
  const noPermission = event.data.noPermission;
55306
55360
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
55307
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55361
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55308
55362
  noPermission.forEach(function (item) {
55309
55363
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
55364
+ _.remove(selectedItems, (selected) => selected._id === item);
55310
55365
  })
55366
+ doAction({
55367
+ "componentId": "${quickEditId}",
55368
+ "actionType": "setValue",
55369
+ "args": {
55370
+ "value": {
55371
+ selectedItems
55372
+ }
55373
+ }
55374
+ });
55311
55375
  `
55312
55376
  },
55313
55377
  {
@@ -55368,7 +55432,7 @@ async function getQuickEditSchema(field, options){
55368
55432
  }
55369
55433
 
55370
55434
  function getFieldWidth(width){
55371
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
55435
+ const defaultWidth = null;
55372
55436
  if(typeof width == 'string'){
55373
55437
  if(isNaN(width)){
55374
55438
  return width || defaultWidth;
@@ -55398,18 +55462,35 @@ async function getTableColumns(fields, options){
55398
55462
  //增加quickEdit属性,实现快速编辑
55399
55463
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55400
55464
  let className = "";
55401
- if(field.wrap != true){
55465
+ const bowserType = getBowserType();
55466
+ if(bowserType === "Safari"){
55402
55467
  className += " whitespace-nowrap ";
55403
55468
  }else {
55404
- className += " break-words ";
55469
+ if(field.wrap != true){
55470
+ className += " whitespace-nowrap ";
55471
+ }else {
55472
+ className += " break-words ";
55473
+ }
55474
+ }
55475
+
55476
+ if (typeof field.amis?.className == "object") {
55477
+ className = {
55478
+ [className]: "true",
55479
+ ...field.amis.className
55480
+ };
55481
+ } else if (typeof field.amis?.className == "string") {
55482
+ className = `${className} ${field.amis.className} `;
55405
55483
  }
55484
+ let fieldAmis = lodash.exports.clone(field.amis);
55485
+ delete fieldAmis?.className;
55486
+
55406
55487
  let columnItem;
55407
55488
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
55408
55489
  const previewFileScript = `
55409
55490
  var data = event.data;
55410
55491
  var file_name = data.versions ? data.name : "${field.label}";
55411
- var file_id = data._id;
55412
- SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
55492
+ var file_id = data.versions && data.versions[0] && data.versions[0]._id;
55493
+ window.previewFile && window.previewFile({file_name, file_id});
55413
55494
  `;
55414
55495
  columnItem = {
55415
55496
  "type": "button",
@@ -55434,11 +55515,11 @@ async function getTableColumns(fields, options){
55434
55515
  "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
55435
55516
  },
55436
55517
  {
55437
- "args": {},
55438
- "actionType": "custom",
55439
- "script": previewFileScript,
55440
- // "expression": "!!window?.nw?.require" //PC客户端预览附件
55441
- "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55518
+ "args": {},
55519
+ "actionType": "custom",
55520
+ "script": previewFileScript,
55521
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
55522
+ "expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55442
55523
  }
55443
55524
  ]
55444
55525
  }
@@ -55453,7 +55534,7 @@ async function getTableColumns(fields, options){
55453
55534
  toggled: field.toggled,
55454
55535
  static: true,
55455
55536
  className,
55456
- }, field.amis, {name: field.name});
55537
+ }, fieldAmis, {name: field.name});
55457
55538
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
55458
55539
  columnItem = Object.assign({}, {
55459
55540
  type: "switch",
@@ -55464,7 +55545,7 @@ async function getTableColumns(fields, options){
55464
55545
  static: true,
55465
55546
  className,
55466
55547
  ...getAmisFileReadonlySchema(field)
55467
- }, field.amis, {name: field.name});
55548
+ }, fieldAmis, {name: field.name});
55468
55549
  }
55469
55550
  else if(field.type === 'select'){
55470
55551
  const map = getSelectMap(field.options);
@@ -55479,7 +55560,7 @@ async function getTableColumns(fields, options){
55479
55560
  className,
55480
55561
  inputClassName: "inline",
55481
55562
  static: true,
55482
- }, field.amis, {name: field.name});
55563
+ }, fieldAmis, {name: field.name});
55483
55564
  }
55484
55565
  else {
55485
55566
  const tpl = await getFieldTpl(field, options);
@@ -55498,23 +55579,14 @@ async function getTableColumns(fields, options){
55498
55579
  if(field.type === 'textarea'){
55499
55580
  className += 'min-w-56';
55500
55581
  }
55501
- if(field.type === 'date'){
55502
- className += 'date-min-w';
55503
- }
55504
- if(field.type === 'datetime'){
55505
- className += 'datetime-min-w';
55506
- }
55582
+ // if(field.type === 'date'){
55583
+ // className += 'date-min-w';
55584
+ // }
55585
+ // if(field.type === 'datetime'){
55586
+ // className += 'datetime-min-w';
55587
+ // }
55507
55588
 
55508
55589
  //field上的amis属性里的clssname需要单独判断类型合并
55509
- if (typeof field.amis?.className == "object") {
55510
- className = {
55511
- [className]: "true",
55512
- ...field.amis.className
55513
- };
55514
- } else if (typeof field.amis?.className == "string") {
55515
- className = `${className} ${field.amis.className} `;
55516
- }
55517
- delete field.amis?.className;
55518
55590
 
55519
55591
  if(!field.hidden && !field.extra){
55520
55592
  columnItem = Object.assign({}, {
@@ -55531,7 +55603,7 @@ async function getTableColumns(fields, options){
55531
55603
  static: true,
55532
55604
  options: field.type === 'html' ? {html: true} : null
55533
55605
  // toggled: true
55534
- }, field.amis, {name: field.name});
55606
+ }, fieldAmis, {name: field.name});
55535
55607
 
55536
55608
  if(field.type === 'color'){
55537
55609
  columnItem.type = 'color';
@@ -55727,10 +55799,10 @@ async function getMobileTableColumns(fields, options){
55727
55799
  if(value.url){
55728
55800
  cms_url = value.url;
55729
55801
  }else{
55730
- cms_url = "/api/files/files/"+value+"?download=true"
55802
+ cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
55731
55803
  }
55732
55804
  }
55733
- Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55805
+ Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
55734
55806
  `,
55735
55807
  "actionType": "custom"
55736
55808
  }
@@ -55992,6 +56064,50 @@ async function getTableSchema$1(fields, options){
55992
56064
  }
55993
56065
  }
55994
56066
 
56067
+ /*
56068
+ img/avatar字段值添加URL前缀使其在amis中正常显示图片。
56069
+ */
56070
+ function getScriptForAddUrlPrefixForImgFields(fields){
56071
+ let imgFieldsKeys = [];
56072
+ let imgFields = {};
56073
+ fields.forEach((item)=>{
56074
+ if(lodash.exports.includes(['image','avatar'], item.type)){
56075
+ imgFieldsKeys.push(item.name);
56076
+ imgFields[item.name] = {
56077
+ name: item.name,
56078
+ type: item.type,
56079
+ multiple: item.multiple
56080
+ };
56081
+ }
56082
+ });
56083
+ if(!imgFieldsKeys.length){
56084
+ return '';
56085
+ }
56086
+ return `
56087
+ // image字段值添加URL前缀
56088
+ let imgFieldsKeys = ${JSON.stringify(imgFieldsKeys)};
56089
+ let imgFields = ${JSON.stringify(imgFields)};
56090
+ imgFieldsKeys.forEach((item)=>{
56091
+ let imgFieldValue = data[item];
56092
+ let imgFieldDisplayValue = data._display && data._display[item];
56093
+ if(imgFieldValue && imgFieldValue.length){
56094
+ let fieldProps = imgFields[item];
56095
+ if(fieldProps.multiple){
56096
+ if(imgFieldDisplayValue instanceof Array){
56097
+ data[item] = imgFieldDisplayValue.map((i)=>{
56098
+ const url = window.getImageFieldUrl(i.url);
56099
+ return url;
56100
+ });
56101
+ }
56102
+ }else{
56103
+ const url = imgFieldDisplayValue && window.getImageFieldUrl(imgFieldDisplayValue.url);
56104
+ data[item] = url;
56105
+ }
56106
+ }
56107
+ })
56108
+ `
56109
+ }
56110
+
55995
56111
  /******************************************************************************
55996
56112
  Copyright (c) Microsoft Corporation.
55997
56113
 
@@ -56363,7 +56479,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
56363
56479
  const formSchema = {
56364
56480
  "type": "service",
56365
56481
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
56366
- "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",
56482
+ "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",
56367
56483
  "style":{
56368
56484
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
56369
56485
  },
@@ -56950,7 +57066,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
56950
57066
  "className": "slds-filters"
56951
57067
  },
56952
57068
  "size": "xs",
56953
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
57069
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
56954
57070
  "visibleOn": "this.showFieldsFilter",
56955
57071
  },
56956
57072
  "className": "bg-white"
@@ -56996,6 +57112,7 @@ const getNewListviewButtonSchema = ()=>{
56996
57112
  "objectApiName": "object_listviews",
56997
57113
  "recordId": "",
56998
57114
  "mode": "edit",
57115
+ "layout": "normal",
56999
57116
  "defaultData": {
57000
57117
  "&": "${list_view}",
57001
57118
  "name":"",
@@ -57003,8 +57120,16 @@ const getNewListviewButtonSchema = ()=>{
57003
57120
  "filters":"",
57004
57121
  "shared":false,
57005
57122
  "object_name": "${targetObjectName}",
57123
+ "_id":"",
57124
+ "shared_to": null,
57125
+ "shared_to_organizations": null,
57126
+ "locked": false,
57127
+ "owner": null,
57128
+ "company_id": null,
57129
+ "company_ids": null,
57130
+ "is_system": false
57006
57131
  },
57007
- "fieldsExtend": fieldsExtend$4(),
57132
+ "fieldsExtend": fieldsExtend$5(),
57008
57133
  "fields": fields$1(),
57009
57134
  "onEvent": {
57010
57135
  "submitSucc": {
@@ -57055,14 +57180,17 @@ function fields$1(){
57055
57180
  "mobile_columns",
57056
57181
  "searchable_fields",
57057
57182
  "is_system",
57058
- "shared"
57183
+ "shared",
57184
+ "shared_to",
57185
+ "shared_to_organizations"
57059
57186
  ]
57060
57187
  }
57061
57188
 
57062
- function fieldsExtend$4(){
57189
+ function fieldsExtend$5(){
57063
57190
  return {
57064
57191
  "group": "",
57065
57192
  "label": {
57193
+ "group": "",
57066
57194
  "is_wide": true
57067
57195
  },
57068
57196
  "name": {
@@ -57144,9 +57272,19 @@ function fieldsExtend$4(){
57144
57272
  "shared": {
57145
57273
  "group": "",
57146
57274
  "amis": {
57147
- "visibleOn": "${global.user.is_space_admin}"
57275
+ "visibleOn": "${false}"
57148
57276
  }
57149
57277
  },
57278
+ "shared_to": {
57279
+ "group": "",
57280
+ "amis":{
57281
+ "type": "radios",
57282
+ "inline": false
57283
+ }
57284
+ },
57285
+ "shared_to_organizations": {
57286
+ "group": ""
57287
+ },
57150
57288
  "filters": {
57151
57289
  "group": "",
57152
57290
  "amis": {
@@ -57184,14 +57322,23 @@ const getCopyListviewButtonSchema = ()=>{
57184
57322
  "objectApiName": "object_listviews",
57185
57323
  "recordId": "",
57186
57324
  "mode": "edit",
57325
+ "layout": "normal",
57187
57326
  "defaultData": {
57188
57327
  "&": "${list_view}",
57189
57328
  "name":"",
57190
57329
  "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
57191
57330
  "shared":false,
57192
57331
  "object_name": "${targetObjectName}",
57332
+ "_id":"",
57333
+ "shared_to": null,
57334
+ "shared_to_organizations": null,
57335
+ "locked": false,
57336
+ "owner": null,
57337
+ "company_id": null,
57338
+ "company_ids": null,
57339
+ "is_system": false
57193
57340
  },
57194
- "fieldsExtend": fieldsExtend$3(),
57341
+ "fieldsExtend": fieldsExtend$4(),
57195
57342
  "fields": fields(),
57196
57343
  "onEvent": {
57197
57344
  "submitSucc": {
@@ -57239,13 +57386,16 @@ function fields(){
57239
57386
  "mobile_columns.$.field",
57240
57387
  "searchable_fields.$.field",
57241
57388
  "is_system",
57242
- "shared"
57389
+ "shared",
57390
+ "shared_to",
57391
+ "shared_to_organizations"
57243
57392
  ]
57244
57393
  }
57245
57394
 
57246
- function fieldsExtend$3(){
57395
+ function fieldsExtend$4(){
57247
57396
  return {
57248
57397
  "label": {
57398
+ "group": "",
57249
57399
  "is_wide": true
57250
57400
  },
57251
57401
  "name": {
@@ -57295,10 +57445,21 @@ function fieldsExtend$3(){
57295
57445
  }
57296
57446
  },
57297
57447
  "shared": {
57448
+ "group": "",
57298
57449
  "amis": {
57299
- "visibleOn": "${global.user.is_space_admin}"
57450
+ "visibleOn": "${false}"
57300
57451
  }
57301
57452
  },
57453
+ "shared_to": {
57454
+ "group": "",
57455
+ "amis":{
57456
+ "type": "radios",
57457
+ "inline": false
57458
+ }
57459
+ },
57460
+ "shared_to_organizations": {
57461
+ "group": ""
57462
+ },
57302
57463
  "filters": {
57303
57464
  "group": "",
57304
57465
  "amis": {
@@ -57308,6 +57469,12 @@ function fieldsExtend$3(){
57308
57469
  }
57309
57470
  }
57310
57471
 
57472
+ /*
57473
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
57474
+ * @Date: 2023-06-13 13:51:19
57475
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
57476
+ * @LastEditTime: 2024-02-05 11:25:09
57477
+ */
57311
57478
  const getRenameListviewButtonSchema = ()=>{
57312
57479
  return {
57313
57480
  "type": "button",
@@ -57333,6 +57500,7 @@ const getRenameListviewButtonSchema = ()=>{
57333
57500
  "label": "对象表单",
57334
57501
  "objectApiName": "object_listviews",
57335
57502
  "recordId": "${recordId}",
57503
+ "layout": "normal",
57336
57504
  "mode": "edit",
57337
57505
  "fields": [
57338
57506
  "label"
@@ -57367,6 +57535,12 @@ const getRenameListviewButtonSchema = ()=>{
57367
57535
  }
57368
57536
  };
57369
57537
 
57538
+ /*
57539
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
57540
+ * @Date: 2023-06-13 13:51:19
57541
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
57542
+ * @LastEditTime: 2024-02-06 15:38:49
57543
+ */
57370
57544
  const getSetListviewShareButtonSchema = ()=>{
57371
57545
  return {
57372
57546
  "type": "button",
@@ -57382,6 +57556,8 @@ const getSetListviewShareButtonSchema = ()=>{
57382
57556
  "title": instance.t('frontend_listview_control_share'),
57383
57557
  "data": {
57384
57558
  "recordId": "${uiSchema.list_views[listName]._id}",
57559
+ "appId": "${appId}",
57560
+ "global": "${global}",
57385
57561
  "context": "${context}"
57386
57562
  },
57387
57563
  "body": [
@@ -57391,9 +57567,12 @@ const getSetListviewShareButtonSchema = ()=>{
57391
57567
  "objectApiName": "object_listviews",
57392
57568
  "recordId": "${recordId}",
57393
57569
  "mode": "edit",
57570
+ "layout": "normal",
57394
57571
  "fields": [
57395
- "shared"
57396
- ]
57572
+ "shared_to",
57573
+ "shared_to_organizations"
57574
+ ],
57575
+ "fieldsExtend": fieldsExtend$3(),
57397
57576
  }
57398
57577
  ],
57399
57578
  "showCloseButton": true,
@@ -57411,6 +57590,21 @@ const getSetListviewShareButtonSchema = ()=>{
57411
57590
  }
57412
57591
  };
57413
57592
 
57593
+ function fieldsExtend$3(){
57594
+ return {
57595
+ "shared_to": {
57596
+ "group": "",
57597
+ "amis":{
57598
+ "type": "radios",
57599
+ "inline": false
57600
+ }
57601
+ },
57602
+ "shared_to_organizations": {
57603
+ "group": ""
57604
+ }
57605
+ }
57606
+ }
57607
+
57414
57608
  const getSetListviewFiltersButtonSchema = ()=>{
57415
57609
  return {
57416
57610
  "type": "button",
@@ -57542,10 +57736,12 @@ function apiRequestAdaptor$2(){
57542
57736
  function fieldsExtend$2(){
57543
57737
  return {
57544
57738
  "filters": {
57739
+ "label": "",
57740
+ "group": "",
57545
57741
  "visible_on": "true",
57546
57742
  "amis": {
57547
57743
  "type": "condition-builder",
57548
- "label": instance.t('frontend_listview_control_filters_fields_extend'),
57744
+ // "label": i18next.t('frontend_listview_control_filters_fields_extend'),
57549
57745
  "source": {
57550
57746
  "method": "get",
57551
57747
  "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
@@ -57588,6 +57784,7 @@ const getSetListviewColumnsButtonSchema = ()=>{
57588
57784
  "objectApiName": "object_listviews",
57589
57785
  "recordId": "${recordId}",
57590
57786
  "mode": "edit",
57787
+ "layout": "normal",
57591
57788
  "fieldsExtend": fieldsExtend$1(),
57592
57789
  "initApiAdaptor": initApiAdaptor$1(),
57593
57790
  "apiRequestAdaptor": apiRequestAdaptor$1(),
@@ -57784,6 +57981,8 @@ const getSetListviewSortButtonSchema = ()=>{
57784
57981
  function fieldsExtend(){
57785
57982
  return {
57786
57983
  "sort": {
57984
+ "label": "",
57985
+ "group": "",
57787
57986
  "amis": {
57788
57987
  "type": "tabs-transfer",
57789
57988
  "sortable": true,
@@ -57911,7 +58110,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57911
58110
  "icon": "fa fa-cog",
57912
58111
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57913
58112
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
57914
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58113
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57915
58114
  "align": "right",
57916
58115
  "visibleOn": "${!isLookup}",
57917
58116
  "buttons": [
@@ -57932,20 +58131,20 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57932
58131
  }
57933
58132
  };
57934
58133
 
57935
- const getDisplayAsButton = function(objectName, showDisplayAs){
57936
- let displayAs = Router.getTabDisplayAs(objectName);
58134
+ const getDisplayAsButton = function(objectName, defaultEnableSplit){
58135
+ let displayAs = Router.getTabDisplayAs(objectName, defaultEnableSplit);
57937
58136
  let buttons = [
57938
58137
  {
57939
58138
  "type": "button",
57940
58139
  "label": instance.t('frontend_display_type_is_table'),
57941
- "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');",
58140
+ "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');",
57942
58141
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57943
58142
  "rightIconClassName": "m-l-sm"
57944
58143
  },
57945
58144
  {
57946
58145
  "type": "button",
57947
58146
  "label": instance.t('frontend_display_type_is_split'),
57948
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
58147
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57949
58148
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57950
58149
  "rightIconClassName": "m-l-sm"
57951
58150
  }
@@ -57956,7 +58155,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57956
58155
  "icon": "fa fa-table-columns",
57957
58156
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57958
58157
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
57959
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58158
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57960
58159
  "align": "right",
57961
58160
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
57962
58161
  "buttons": [
@@ -58149,7 +58348,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58149
58348
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58150
58349
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58151
58350
  // "tooltipPlacement": "top",
58152
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58351
+ // "className": "bg-white p-2 rounded text-gray-500",
58153
58352
  // "label": "",
58154
58353
  // "icon": "fa fa-sync",
58155
58354
  // "visibleOn": "${!showFieldsFilter}",
@@ -58173,7 +58372,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58173
58372
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58174
58373
  "tooltip":"",
58175
58374
  "tooltipPlacement": "top",
58176
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58375
+ "className": "bg-white p-2 rounded text-gray-500"
58177
58376
  };
58178
58377
  }
58179
58378
  else {
@@ -58184,7 +58383,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58184
58383
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58185
58384
  "tooltip":"",
58186
58385
  "tooltipPlacement": "top",
58187
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58386
+ "className": "bg-white p-2 rounded text-gray-500"
58188
58387
  };
58189
58388
  }
58190
58389
  let toolbarFilter;
@@ -58206,7 +58405,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58206
58405
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
58207
58406
  },
58208
58407
  "align": "right",
58209
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58408
+ "className": "bg-white p-2 rounded text-gray-500",
58210
58409
  "onEvent": {
58211
58410
  "click": {
58212
58411
  "actions": [
@@ -58220,7 +58419,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58220
58419
  "id": "steedos_crud_toolbar_filter"
58221
58420
  };
58222
58421
  }
58223
- let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
58422
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name, mainObject?.enable_split);
58224
58423
  let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
58225
58424
 
58226
58425
  // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
@@ -58366,7 +58565,6 @@ async function getObjectFilter(objectSchema, fields, options) {
58366
58565
  "timeOut": 1000
58367
58566
  }
58368
58567
  });
58369
- resizeWindow();
58370
58568
  const scope = event.context.scoped;
58371
58569
  // let filterFormValues = event.data;
58372
58570
  let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
@@ -58442,8 +58640,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58442
58640
  /*
58443
58641
  * @Author: baozhoutao@steedos.com
58444
58642
  * @Date: 2022-07-05 15:55:39
58445
- * @LastEditors: baozhoutao@steedos.com
58446
- * @LastEditTime: 2024-01-16 11:14:34
58643
+ * @LastEditors: liaodaxue
58644
+ * @LastEditTime: 2024-02-05 17:56:27
58447
58645
  * @Description:
58448
58646
  */
58449
58647
 
@@ -59010,17 +59208,13 @@ function getReferenceToSync(field) {
59010
59208
 
59011
59209
  function getLookupSapceUserTreeSchema(isMobile){
59012
59210
  let apiAdaptor = `
59013
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
59014
59211
  const records = payload.data.options;
59015
- let isTreeOptionsComputed = false;
59016
- if(records.length === 1 && records[0].children){
59017
- isTreeOptionsComputed = true;
59018
- }
59019
- if(isTreeOptionsComputed){
59020
- return payload;
59021
- }
59022
59212
  const treeRecords = [];
59023
- const getChildren = (records, childrenIds) => {
59213
+ const getChildren = (currentRecord, records, childrenIds) => {
59214
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
59215
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
59216
+ return currentRecord.children;
59217
+ }
59024
59218
  if (!childrenIds) {
59025
59219
  return;
59026
59220
  }
@@ -59029,7 +59223,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59029
59223
  });
59030
59224
  _.each(children, (item) => {
59031
59225
  if (item.children) {
59032
- item.children = getChildren(records, item.children)
59226
+ item.children = getChildren(item, records, item.children)
59033
59227
  }else{
59034
59228
  item.children = [];
59035
59229
  }
@@ -59055,7 +59249,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59055
59249
 
59056
59250
  _.each(records, (record) => {
59057
59251
  if (record.noParent == 1) {
59058
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
59252
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
59059
59253
  }
59060
59254
  });
59061
59255
  console.log(treeRecords)
@@ -59105,6 +59299,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59105
59299
  }
59106
59300
  },
59107
59301
  "label": "",
59302
+ "mode": "normal",
59108
59303
  "name": "organizations",
59109
59304
  "multiple": false,
59110
59305
  "joinValues": false,
@@ -59247,6 +59442,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
59247
59442
  }
59248
59443
  });
59249
59444
 
59445
+ let listviewFilter = getListViewFilter(listView);
59446
+ let listviewFiltersFunction = listView && listView._filters;
59447
+
59250
59448
  let sort = "";
59251
59449
  if(listView){
59252
59450
  sort = getListViewSort(listView);
@@ -59293,7 +59491,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59293
59491
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
59294
59492
  }
59295
59493
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
59296
- var filters = [];
59494
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59297
59495
  var pageSize = api.data.pageSize || 10;
59298
59496
  var pageNo = api.data.pageNo || 1;
59299
59497
  var skip = (pageNo - 1) * pageSize;
@@ -59355,6 +59553,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59355
59553
  }
59356
59554
 
59357
59555
  const inFilterForm = ${ctx.inFilterForm};
59556
+
59557
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59558
+
59559
+ if(listviewFiltersFunction && !inFilterForm){
59560
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
59561
+ if(_filters0 && _filters0.length){
59562
+ filters.push(_filters0);
59563
+ }
59564
+ }
59565
+
59358
59566
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59359
59567
 
59360
59568
  if(filtersFunction && !inFilterForm){
@@ -59442,6 +59650,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59442
59650
  });
59443
59651
  payload.data.rows = treeRecords;
59444
59652
  }
59653
+ const result = payload.data.rows;
59654
+ if(result && result.length){
59655
+ const updatedResult = _.map(result, (element) => {
59656
+ const data = { ...element };
59657
+ // image字段值添加URL前缀
59658
+ ${getScriptForAddUrlPrefixForImgFields(lodash.exports.values(refObjectConfig.fields))}
59659
+ return data;
59660
+ });
59661
+ payload.data.rows = updatedResult;
59662
+ }
59445
59663
  return payload;
59446
59664
  `;
59447
59665
  if(field.optionsFunction || field._optionsFunction){
@@ -59473,13 +59691,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
59473
59691
 
59474
59692
  pickerSchema.affixHeader = false;
59475
59693
 
59476
- var headerToolbarItems = [];
59694
+
59695
+
59696
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
59697
+
59477
59698
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
59478
- headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
59699
+ pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
59479
59700
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
59480
59701
  }
59481
-
59482
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
59702
+
59483
59703
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
59484
59704
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
59485
59705
  // lookup字段配置过滤条件就强制不显示新建按钮
@@ -59592,8 +59812,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
59592
59812
  pickerSchema.footerToolbar = ["pagination"];
59593
59813
  }
59594
59814
 
59815
+ if(field.inlineHelpText){
59816
+ pickerSchema.toolbarClassName = "hasHelpText";
59817
+ pickerSchema.headerToolbar = [{
59818
+ "type": "tpl",
59819
+ "tpl": field.inlineHelpText,
59820
+ "className": "text-secondary"
59821
+ }, ...pickerSchema.headerToolbar];
59822
+ }
59823
+ pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
59824
+
59595
59825
  const data = {
59596
59826
  type: getAmisStaticFieldType('picker', readonly),
59827
+ className: ctx.className || '',
59597
59828
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
59598
59829
  labelField: referenceTo.labelField.name,
59599
59830
  valueField: referenceTo.valueField.name,
@@ -59667,6 +59898,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
59667
59898
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59668
59899
  let listView = getLookupListView(refObjectConfig);
59669
59900
 
59901
+ let listviewFilter = getListViewFilter(listView);
59902
+ let listviewFiltersFunction = listView && listView._filters;
59903
+
59670
59904
  let sort = "";
59671
59905
  if(listView){
59672
59906
  sort = getListViewSort(listView);
@@ -59696,7 +59930,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59696
59930
  apiInfo.data['rfield'] = `\${object_name}`;
59697
59931
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
59698
59932
  apiInfo.requestAdaptor = `
59699
- var filters = [];
59933
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59700
59934
  var top = 200;
59701
59935
  if(api.data.$term){
59702
59936
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -59719,6 +59953,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
59719
59953
  }
59720
59954
 
59721
59955
  const inFilterForm = ${ctx.inFilterForm};
59956
+
59957
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59958
+
59959
+ if(listviewFiltersFunction && !inFilterForm){
59960
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
59961
+ if(_filters0 && _filters0.length){
59962
+ filters.push(_filters0);
59963
+ }
59964
+ }
59965
+
59722
59966
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59723
59967
 
59724
59968
  if(filtersFunction && !inFilterForm){
@@ -59795,6 +60039,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59795
60039
  // 但是同时配置autoComplete和source会多请求一次接口
59796
60040
  // TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
59797
60041
  data.source = apiInfo;
60042
+ delete data.autoComplete;
59798
60043
  }
59799
60044
  //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
59800
60045
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
@@ -59841,7 +60086,8 @@ async function lookupToAmis(field, readonly, ctx){
59841
60086
  }
59842
60087
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59843
60088
  if(readonly){
59844
- if(field.reference_to){
60089
+ if(field.reference_to && !field.isTableField){
60090
+ //isTableField只在grid字段内存在
59845
60091
  return {
59846
60092
  type: 'steedos-field',
59847
60093
  config: field,
@@ -60052,8 +60298,8 @@ if(typeof window != 'undefined'){
60052
60298
  /*
60053
60299
  * @Author: baozhoutao@steedos.com
60054
60300
  * @Date: 2023-01-13 17:27:54
60055
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
60056
- * @LastEditTime: 2023-08-28 17:45:38
60301
+ * @LastEditors: liaodaxue
60302
+ * @LastEditTime: 2024-02-04 17:29:54
60057
60303
  * @Description:
60058
60304
  */
60059
60305
 
@@ -60154,7 +60400,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
60154
60400
  "title": "Insert",
60155
60401
  "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
60156
60402
  }
60157
- }
60403
+ },
60404
+ "statusbar": false
60158
60405
  },
60159
60406
  "name": field.name
60160
60407
  }
@@ -60392,13 +60639,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60392
60639
  };
60393
60640
  break;
60394
60641
  case 'input-datetime-range':
60642
+ // convertData = {
60643
+ // type: "input-datetime-range",
60644
+ // inputFormat: 'YYYY-MM-DD HH:mm',
60645
+ // format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60646
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
60647
+ // utc: true,
60648
+ // joinValues: false
60649
+ // }
60650
+ // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
60395
60651
  convertData = {
60396
- type: "input-datetime-range",
60397
- inputFormat: 'YYYY-MM-DD HH:mm',
60652
+ type: "input-date-range",
60653
+ inputFormat: "YYYY-MM-DD HH:mm",
60398
60654
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60399
60655
  tpl: readonly ? getDateTimeTpl(field) : null,
60400
60656
  utc: true,
60401
- joinValues: false
60657
+ joinValues: false,
60658
+ "shortcuts": [
60659
+ "thismonth",
60660
+ "2monthsago",
60661
+ "3monthslater",
60662
+ "prevquarter",
60663
+ "thisquarter",
60664
+ "thisyear",
60665
+ "lastYear"
60666
+ ]
60402
60667
  };
60403
60668
  break;
60404
60669
  case 'datetime':
@@ -60449,7 +60714,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60449
60714
  convertData = {
60450
60715
  type: getAmisStaticFieldType('datetime', readonly),
60451
60716
  inputFormat: 'YYYY-MM-DD HH:mm',
60452
- format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
60717
+ format: 'YYYY-MM-DDTHH:mm:00.000Z',
60453
60718
  tpl: readonly ? getDateTimeTpl(field) : null,
60454
60719
  utc: true,
60455
60720
  };
@@ -60580,6 +60845,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60580
60845
  convertData = {
60581
60846
  type: 'static-text'
60582
60847
  };
60848
+ }else if(field.autonumber_enable_modify){
60849
+ convertData = {
60850
+ "type": "input-group",
60851
+ "body": [
60852
+ {
60853
+ "type": "input-text",
60854
+ "name": field.name
60855
+ },
60856
+ {
60857
+ "type": "button",
60858
+ "label": "自动获取",
60859
+ "actionType": "ajax",
60860
+ "api": {
60861
+ "url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
60862
+ "method": "post",
60863
+ "headers": {
60864
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
60865
+ },
60866
+ "adaptor": `
60867
+ payload.data["${field.name}"] = payload.data && payload.data.autonumber;
60868
+ delete payload.data.autonumber;
60869
+ return payload;
60870
+ `
60871
+ },
60872
+ "messages": {
60873
+ "success": "获取成功"
60874
+ }
60875
+ }
60876
+ ]
60877
+ };
60583
60878
  }
60584
60879
  break;
60585
60880
  case 'url':
@@ -60785,12 +61080,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60785
61080
  break;
60786
61081
  }
60787
61082
  if(!lodash.exports.isEmpty(convertData)){
61083
+ const className = convertData.className;
60788
61084
  if(field.is_wide || convertData.type === 'group'){
60789
- convertData.className = 'col-span-2 m-0';
61085
+ convertData.className = className ? 'col-span-2 m-0 ' + className : 'col-span-2 m-0';
60790
61086
  }else {
60791
- convertData.className = 'm-0';
61087
+ convertData.className = className ? 'm-0 ' + className : 'm-0';
60792
61088
  }
60793
- if(readonly){
61089
+ if(readonly && ctx.mode !== 'edit'){
60794
61090
  convertData.className = `${convertData.className} border-b`;
60795
61091
  }
60796
61092
  if(readonly){
@@ -60798,11 +61094,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60798
61094
  }
60799
61095
 
60800
61096
  let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
60801
- if (convertData.className) {
60802
- convertData.className = convertData.className + fieldTypeClassName;
60803
- } else {
60804
- convertData.className = fieldTypeClassName;
60805
- }
61097
+ convertData.className = convertData.className + fieldTypeClassName;
60806
61098
 
60807
61099
  if(field.visible_on && !ctx.inFilterForm){
60808
61100
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
@@ -60885,8 +61177,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
60885
61177
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60886
61178
  }
60887
61179
  if(_field.type === 'datetime'){
60888
- // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
60889
- _field.type = 'input-date-range';
61180
+ // 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
61181
+ // 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
61182
+ _field.type = 'input-datetime-range';
60890
61183
  _field.is_wide = true;
60891
61184
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60892
61185
  }