@steedos-widgets/sortable 3.6.2-beta.2 → 3.6.2-beta.21

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.
@@ -53937,22 +53937,29 @@ function getRootUrl(defaultRootUrl){
53937
53937
  * @Description:
53938
53938
  */
53939
53939
 
53940
-
53941
53940
  const Router = {
53942
53941
  getTabDisplayAs(tab_id){
53942
+ const uiSchema = getUISchemaSync$1(tab_id, false);
53943
53943
  var urlSearch = new URLSearchParams(document.location.search);
53944
53944
  if(urlSearch.has('display')){
53945
53945
  return urlSearch.get('display')
53946
53946
  }
53947
53947
  const key = `tab_${tab_id}_display`;
53948
53948
  // const key = `page_display`;
53949
- const value = localStorage.getItem(key);
53950
- return value ? value : 'grid'
53949
+ const value = sessionStorage.getItem(key);
53950
+ let defaultDisplay = "grid";
53951
+ if(uiSchema.enable_split){
53952
+ defaultDisplay = "split";
53953
+ }
53954
+ if(window.innerWidth <= 768){
53955
+ return "grid";
53956
+ }
53957
+ return value ? value : defaultDisplay;
53951
53958
  },
53952
53959
 
53953
53960
  setTabDisplayAs(tab_id, displayAs){
53954
53961
  const key = `tab_${tab_id}_display`;
53955
- localStorage.setItem(key, displayAs);
53962
+ sessionStorage.setItem(key, displayAs);
53956
53963
  },
53957
53964
  getAppPath({formFactor, appId}){
53958
53965
  return `/app/${appId}`;
@@ -53979,8 +53986,8 @@ const Router = {
53979
53986
  /*
53980
53987
  * @Author: baozhoutao@steedos.com
53981
53988
  * @Date: 2022-07-20 16:29:22
53982
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53983
- * @LastEditTime: 2023-12-28 14:59:08
53989
+ * @LastEditors: liaodaxue
53990
+ * @LastEditTime: 2024-01-25 14:44:17
53984
53991
  * @Description:
53985
53992
  */
53986
53993
 
@@ -54052,6 +54059,25 @@ function getComparableAmisVersion() {
54052
54059
  }
54053
54060
  }
54054
54061
 
54062
+ /**
54063
+ * 判断浏览器类型
54064
+ * @returns 按需返回浏览器类型;
54065
+ */
54066
+ function getBowserType() {
54067
+ const userAgent = navigator.userAgent;
54068
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
54069
+ return "Chrome";
54070
+ } else if (userAgent.indexOf("Firefox") !== -1) {
54071
+ return "Firefox";
54072
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
54073
+ return "Safari";
54074
+ } else if (userAgent.indexOf("Edg") !== -1) {
54075
+ return "Edge";
54076
+ } else {
54077
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
54078
+ }
54079
+ }
54080
+
54055
54081
  function getNumberTpl(field){
54056
54082
  return `<span>\${_display.${field.name}}</span>`
54057
54083
  }
@@ -54106,7 +54132,7 @@ function getSelectMap(selectOptions){
54106
54132
 
54107
54133
  function getNameTplUrl(field, ctx){
54108
54134
  if(ctx.objectName === 'cms_files'){
54109
- return `\${context.rootUrl}/api/files/files/\${versions[0]}?download=true`
54135
+ return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
54110
54136
  }
54111
54137
  const href = Router.getObjectDetailPath({
54112
54138
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
@@ -54620,6 +54646,7 @@ var frontend_notifications$1 = "Notifications";
54620
54646
  var frontend_notifications_allread$1 = "Mark all as read";
54621
54647
  var frontend_notifications_allread_message$1 = "All marked as read";
54622
54648
  var frontend_profile$1 = "Profile";
54649
+ var switch_space$1 = "Switch Space";
54623
54650
  var frontend_about$1 = "About";
54624
54651
  var frontend_log_out$1 = "Log out";
54625
54652
  var frontend_listview_warning_start$1 = "The current ";
@@ -54707,6 +54734,7 @@ var en_us = {
54707
54734
  frontend_notifications_allread: frontend_notifications_allread$1,
54708
54735
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
54709
54736
  frontend_profile: frontend_profile$1,
54737
+ switch_space: switch_space$1,
54710
54738
  frontend_about: frontend_about$1,
54711
54739
  frontend_log_out: frontend_log_out$1,
54712
54740
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -54746,9 +54774,9 @@ var frontend_display_type_is_split = "分栏视图";
54746
54774
  var frontend_display_as = "显示为";
54747
54775
  var frontend_record_sum = "个项目";
54748
54776
  var frontend_button_reload_tooltip = "刷新";
54749
- var frontend_button_search_tooltip = "筛选";
54777
+ var frontend_button_search_tooltip = "搜索";
54750
54778
  var frontend_fields_filter_button_search = "搜索";
54751
- var frontend_fields_filter_button_settings = "设置搜索项";
54779
+ var frontend_fields_filter_button_settings = "选择搜索项";
54752
54780
  var frontend_button_listview_control_tooltip = "列表视图控制";
54753
54781
  var frontend_button_listview_control_label = "列表视图控制";
54754
54782
  var frontend_listview_control_columns = "显示的列";
@@ -54796,6 +54824,7 @@ var frontend_notifications = "通知";
54796
54824
  var frontend_notifications_allread = "全部标记为已读";
54797
54825
  var frontend_notifications_allread_message = "已全部标记为已读";
54798
54826
  var frontend_profile = "个人资料";
54827
+ var switch_space = "切换工作区";
54799
54828
  var frontend_about = "关于";
54800
54829
  var frontend_log_out = "注销";
54801
54830
  var frontend_listview_warning_start = "当前";
@@ -54884,6 +54913,7 @@ var zh_cn = {
54884
54913
  frontend_notifications_allread: frontend_notifications_allread,
54885
54914
  frontend_notifications_allread_message: frontend_notifications_allread_message,
54886
54915
  frontend_profile: frontend_profile,
54916
+ switch_space: switch_space,
54887
54917
  frontend_about: frontend_about,
54888
54918
  frontend_log_out: frontend_log_out,
54889
54919
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -55197,7 +55227,8 @@ async function getQuickEditSchema(field, options){
55197
55227
  "failed": "失败了呢。。"
55198
55228
  }
55199
55229
  }
55200
- }
55230
+ },
55231
+ "expression": "${!recordPermissions.modifyAllRecords}"
55201
55232
  },
55202
55233
  {
55203
55234
  "actionType": "setValue",
@@ -55213,7 +55244,7 @@ async function getQuickEditSchema(field, options){
55213
55244
  "componentId": quickEditId,
55214
55245
  "args": {
55215
55246
  "value":{
55216
- "quickedit_record_permissions": "${event.data}"
55247
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
55217
55248
  }
55218
55249
  }
55219
55250
  }
@@ -55277,7 +55308,7 @@ async function getQuickEditSchema(field, options){
55277
55308
  `
55278
55309
  }
55279
55310
  },
55280
- "expression":"${event.data.value}"
55311
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
55281
55312
  },
55282
55313
  {
55283
55314
  "actionType": "setValue",
@@ -55308,10 +55339,20 @@ async function getQuickEditSchema(field, options){
55308
55339
  "script": `
55309
55340
  const noPermission = event.data.noPermission;
55310
55341
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
55311
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55342
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55312
55343
  noPermission.forEach(function (item) {
55313
55344
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
55345
+ _.remove(selectedItems, (selected) => selected._id === item);
55314
55346
  })
55347
+ doAction({
55348
+ "componentId": "${quickEditId}",
55349
+ "actionType": "setValue",
55350
+ "args": {
55351
+ "value": {
55352
+ selectedItems
55353
+ }
55354
+ }
55355
+ });
55315
55356
  `
55316
55357
  },
55317
55358
  {
@@ -55372,7 +55413,7 @@ async function getQuickEditSchema(field, options){
55372
55413
  }
55373
55414
 
55374
55415
  function getFieldWidth(width){
55375
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
55416
+ const defaultWidth = null;
55376
55417
  if(typeof width == 'string'){
55377
55418
  if(isNaN(width)){
55378
55419
  return width || defaultWidth;
@@ -55402,18 +55443,35 @@ async function getTableColumns(fields, options){
55402
55443
  //增加quickEdit属性,实现快速编辑
55403
55444
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55404
55445
  let className = "";
55405
- if(field.wrap != true){
55446
+ const bowserType = getBowserType();
55447
+ if(bowserType === "Safari"){
55406
55448
  className += " whitespace-nowrap ";
55407
55449
  }else {
55408
- className += " break-all ";
55450
+ if(field.wrap != true){
55451
+ className += " whitespace-nowrap ";
55452
+ }else {
55453
+ className += " break-words ";
55454
+ }
55455
+ }
55456
+
55457
+ if (typeof field.amis?.className == "object") {
55458
+ className = {
55459
+ [className]: "true",
55460
+ ...field.amis.className
55461
+ };
55462
+ } else if (typeof field.amis?.className == "string") {
55463
+ className = `${className} ${field.amis.className} `;
55409
55464
  }
55465
+ let fieldAmis = lodash.exports.clone(field.amis);
55466
+ delete fieldAmis?.className;
55467
+
55410
55468
  let columnItem;
55411
55469
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
55412
55470
  const previewFileScript = `
55413
55471
  var data = event.data;
55414
55472
  var file_name = data.versions ? data.name : "${field.label}";
55415
- var file_id = data._id;
55416
- SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
55473
+ var file_id = data.versions && data.versions[0] && data.versions[0]._id;
55474
+ window.previewFile && window.previewFile({file_name, file_id});
55417
55475
  `;
55418
55476
  columnItem = {
55419
55477
  "type": "button",
@@ -55438,11 +55496,11 @@ async function getTableColumns(fields, options){
55438
55496
  "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
55439
55497
  },
55440
55498
  {
55441
- "args": {},
55442
- "actionType": "custom",
55443
- "script": previewFileScript,
55444
- // "expression": "!!window?.nw?.require" //PC客户端预览附件
55445
- "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55499
+ "args": {},
55500
+ "actionType": "custom",
55501
+ "script": previewFileScript,
55502
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
55503
+ "expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55446
55504
  }
55447
55505
  ]
55448
55506
  }
@@ -55457,7 +55515,7 @@ async function getTableColumns(fields, options){
55457
55515
  toggled: field.toggled,
55458
55516
  static: true,
55459
55517
  className,
55460
- }, field.amis, {name: field.name});
55518
+ }, fieldAmis, {name: field.name});
55461
55519
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
55462
55520
  columnItem = Object.assign({}, {
55463
55521
  type: "switch",
@@ -55468,7 +55526,7 @@ async function getTableColumns(fields, options){
55468
55526
  static: true,
55469
55527
  className,
55470
55528
  ...getAmisFileReadonlySchema(field)
55471
- }, field.amis, {name: field.name});
55529
+ }, fieldAmis, {name: field.name});
55472
55530
  }
55473
55531
  else if(field.type === 'select'){
55474
55532
  const map = getSelectMap(field.options);
@@ -55483,7 +55541,7 @@ async function getTableColumns(fields, options){
55483
55541
  className,
55484
55542
  inputClassName: "inline",
55485
55543
  static: true,
55486
- }, field.amis, {name: field.name});
55544
+ }, fieldAmis, {name: field.name});
55487
55545
  }
55488
55546
  else {
55489
55547
  const tpl = await getFieldTpl(field, options);
@@ -55502,23 +55560,14 @@ async function getTableColumns(fields, options){
55502
55560
  if(field.type === 'textarea'){
55503
55561
  className += 'min-w-56';
55504
55562
  }
55505
- if(field.type === 'date'){
55506
- className += 'date-min-w';
55507
- }
55508
- if(field.type === 'datetime'){
55509
- className += 'datetime-min-w';
55510
- }
55563
+ // if(field.type === 'date'){
55564
+ // className += 'date-min-w';
55565
+ // }
55566
+ // if(field.type === 'datetime'){
55567
+ // className += 'datetime-min-w';
55568
+ // }
55511
55569
 
55512
55570
  //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
55571
 
55523
55572
  if(!field.hidden && !field.extra){
55524
55573
  columnItem = Object.assign({}, {
@@ -55535,7 +55584,7 @@ async function getTableColumns(fields, options){
55535
55584
  static: true,
55536
55585
  options: field.type === 'html' ? {html: true} : null
55537
55586
  // toggled: true
55538
- }, field.amis, {name: field.name});
55587
+ }, fieldAmis, {name: field.name});
55539
55588
 
55540
55589
  if(field.type === 'color'){
55541
55590
  columnItem.type = 'color';
@@ -55602,7 +55651,7 @@ function getMobileLines(tpls){
55602
55651
  }
55603
55652
  if(isLeft){
55604
55653
  // 左侧半行
55605
- lineChildrenClassName = "steedos-listview-item-left truncate";
55654
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
55606
55655
  if(item.field.is_wide){
55607
55656
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
55608
55657
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -55614,7 +55663,7 @@ function getMobileLines(tpls){
55614
55663
  }
55615
55664
  else {
55616
55665
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
55617
- lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
55666
+ lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
55618
55667
  }
55619
55668
  //支持字段amis属性配置classname,识别classname的类型,与原样式合并
55620
55669
  var className;
@@ -55725,8 +55774,16 @@ async function getMobileTableColumns(fields, options){
55725
55774
  "actions": [
55726
55775
  {
55727
55776
  "script": `
55728
- let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
55729
- Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55777
+ let cms_url = '';
55778
+ let value = event.data.versions[0];
55779
+ if(value){
55780
+ if(value.url){
55781
+ cms_url = value.url;
55782
+ }else{
55783
+ cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
55784
+ }
55785
+ }
55786
+ Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
55730
55787
  `,
55731
55788
  "actionType": "custom"
55732
55789
  }
@@ -55841,7 +55898,8 @@ async function getTableOperation(ctx){
55841
55898
  label: "&nbsp;",
55842
55899
  fixed: 'right',
55843
55900
  labelClassName: 'text-center',
55844
- className: 'text-center steedos-listview-operation w-10',
55901
+ //TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
55902
+ className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
55845
55903
  buttons: [
55846
55904
  {
55847
55905
  "type": "steedos-dropdown-button",
@@ -55937,7 +55995,7 @@ async function getTableSchema$1(fields, options){
55937
55995
  }
55938
55996
  return {
55939
55997
  mode: "cards",
55940
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55998
+ perPageAvailable: [20, 50, 100, 500],
55941
55999
  name: "thelist",
55942
56000
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55943
56001
  className: "",
@@ -55970,7 +56028,7 @@ async function getTableSchema$1(fields, options){
55970
56028
 
55971
56029
  return {
55972
56030
  mode: "table",
55973
- perPageAvailable: [5, 10, 20, 50, 100, 500],
56031
+ perPageAvailable: [20, 50, 100, 500],
55974
56032
  name: "thelist",
55975
56033
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55976
56034
  className: "",
@@ -56096,7 +56154,7 @@ async function getListBody(fields, options){
56096
56154
 
56097
56155
  function getDefaultParams(options){
56098
56156
  return {
56099
- perPage: options.top || options.perPage || 10
56157
+ perPage: options.top || options.perPage || 20
56100
56158
  }
56101
56159
  }
56102
56160
 
@@ -56150,7 +56208,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
56150
56208
  "objectApiName": "\${objectName}",
56151
56209
  "recordId": "",
56152
56210
  "mode": "edit",
56153
- "layout": "normal"
56154
56211
  };
56155
56212
 
56156
56213
  if (payload && payload.schema) {
@@ -56359,7 +56416,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
56359
56416
  const formSchema = {
56360
56417
  "type": "service",
56361
56418
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
56362
- "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",
56419
+ "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",
56363
56420
  "style":{
56364
56421
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
56365
56422
  },
@@ -56946,7 +57003,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
56946
57003
  "className": "slds-filters"
56947
57004
  },
56948
57005
  "size": "xs",
56949
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
57006
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
56950
57007
  "visibleOn": "this.showFieldsFilter",
56951
57008
  },
56952
57009
  "className": "bg-white"
@@ -57907,7 +57964,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57907
57964
  "icon": "fa fa-cog",
57908
57965
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57909
57966
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
57910
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
57967
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57911
57968
  "align": "right",
57912
57969
  "visibleOn": "${!isLookup}",
57913
57970
  "buttons": [
@@ -57934,14 +57991,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57934
57991
  {
57935
57992
  "type": "button",
57936
57993
  "label": instance.t('frontend_display_type_is_table'),
57937
- "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');",
57994
+ "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');",
57938
57995
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57939
57996
  "rightIconClassName": "m-l-sm"
57940
57997
  },
57941
57998
  {
57942
57999
  "type": "button",
57943
58000
  "label": instance.t('frontend_display_type_is_split'),
57944
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
58001
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57945
58002
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57946
58003
  "rightIconClassName": "m-l-sm"
57947
58004
  }
@@ -57952,7 +58009,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57952
58009
  "icon": "fa fa-table-columns",
57953
58010
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57954
58011
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
57955
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58012
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57956
58013
  "align": "right",
57957
58014
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
57958
58015
  "buttons": [
@@ -58084,7 +58141,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58084
58141
  {
58085
58142
  "type": "search-box",
58086
58143
  "name": keywordsSearchBoxName,
58087
- "placeholder": "搜索此列表",
58144
+ "placeholder": "快捷搜索",
58088
58145
  "value": crudKeywords,
58089
58146
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58090
58147
  "clearAndSubmit": true,
@@ -58145,7 +58202,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58145
58202
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58146
58203
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58147
58204
  // "tooltipPlacement": "top",
58148
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58205
+ // "className": "bg-white p-2 rounded text-gray-500",
58149
58206
  // "label": "",
58150
58207
  // "icon": "fa fa-sync",
58151
58208
  // "visibleOn": "${!showFieldsFilter}",
@@ -58169,7 +58226,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58169
58226
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58170
58227
  "tooltip":"",
58171
58228
  "tooltipPlacement": "top",
58172
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58229
+ "className": "bg-white p-2 rounded text-gray-500"
58173
58230
  };
58174
58231
  }
58175
58232
  else {
@@ -58180,7 +58237,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58180
58237
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58181
58238
  "tooltip":"",
58182
58239
  "tooltipPlacement": "top",
58183
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58240
+ "className": "bg-white p-2 rounded text-gray-500"
58184
58241
  };
58185
58242
  }
58186
58243
  let toolbarFilter;
@@ -58202,7 +58259,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58202
58259
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
58203
58260
  },
58204
58261
  "align": "right",
58205
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58262
+ "className": "bg-white p-2 rounded text-gray-500",
58206
58263
  "onEvent": {
58207
58264
  "click": {
58208
58265
  "actions": [
@@ -58288,7 +58345,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58288
58345
  // ]
58289
58346
  if(options.displayAs === 'split'){
58290
58347
  return [
58291
- "switch-per-page",
58348
+ {
58349
+ "type": "switch-per-page",
58350
+ "visibleOn": "${count >= 20}"
58351
+ },
58292
58352
  {
58293
58353
  "type": "pagination",
58294
58354
  "maxButtons": 5,
@@ -58310,7 +58370,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58310
58370
  else {
58311
58371
  if(options && options.isRelated){
58312
58372
  return [
58313
- "statistics",
58314
58373
  {
58315
58374
  "type": "pagination",
58316
58375
  "maxButtons": 10,
@@ -58323,7 +58382,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58323
58382
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
58324
58383
  const is_lookup = options.isLookup;
58325
58384
  const commonConfig = [
58326
- "statistics",
58327
58385
  {
58328
58386
  "type": "pagination",
58329
58387
  "maxButtons": 10,
@@ -58334,7 +58392,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58334
58392
  if (no_pagination && is_lookup) {
58335
58393
  return commonConfig;
58336
58394
  } else {
58337
- return ["switch-per-page", ...commonConfig];
58395
+ return [{
58396
+ "type": "switch-per-page",
58397
+ "visibleOn": "${count >= 20}"
58398
+ }, ...commonConfig];
58338
58399
  }
58339
58400
  }
58340
58401
  }
@@ -58358,7 +58419,6 @@ async function getObjectFilter(objectSchema, fields, options) {
58358
58419
  "timeOut": 1000
58359
58420
  }
58360
58421
  });
58361
- resizeWindow();
58362
58422
  const scope = event.context.scoped;
58363
58423
  // let filterFormValues = event.data;
58364
58424
  let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
@@ -58434,8 +58494,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58434
58494
  /*
58435
58495
  * @Author: baozhoutao@steedos.com
58436
58496
  * @Date: 2022-07-05 15:55:39
58437
- * @LastEditors: liaodaxue
58438
- * @LastEditTime: 2023-10-20 11:38:25
58497
+ * @LastEditors: baozhoutao@steedos.com
58498
+ * @LastEditTime: 2024-01-16 11:14:34
58439
58499
  * @Description:
58440
58500
  */
58441
58501
 
@@ -59002,17 +59062,13 @@ function getReferenceToSync(field) {
59002
59062
 
59003
59063
  function getLookupSapceUserTreeSchema(isMobile){
59004
59064
  let apiAdaptor = `
59005
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
59006
59065
  const records = payload.data.options;
59007
- let isTreeOptionsComputed = false;
59008
- if(records.length === 1 && records[0].children){
59009
- isTreeOptionsComputed = true;
59010
- }
59011
- if(isTreeOptionsComputed){
59012
- return payload;
59013
- }
59014
59066
  const treeRecords = [];
59015
- const getChildren = (records, childrenIds) => {
59067
+ const getChildren = (currentRecord, records, childrenIds) => {
59068
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
59069
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
59070
+ return currentRecord.children;
59071
+ }
59016
59072
  if (!childrenIds) {
59017
59073
  return;
59018
59074
  }
@@ -59021,7 +59077,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59021
59077
  });
59022
59078
  _.each(children, (item) => {
59023
59079
  if (item.children) {
59024
- item.children = getChildren(records, item.children)
59080
+ item.children = getChildren(item, records, item.children)
59025
59081
  }else{
59026
59082
  item.children = [];
59027
59083
  }
@@ -59047,7 +59103,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59047
59103
 
59048
59104
  _.each(records, (record) => {
59049
59105
  if (record.noParent == 1) {
59050
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
59106
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
59051
59107
  }
59052
59108
  });
59053
59109
  console.log(treeRecords)
@@ -59097,6 +59153,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59097
59153
  }
59098
59154
  },
59099
59155
  "label": "",
59156
+ "mode": "normal",
59100
59157
  "name": "organizations",
59101
59158
  "multiple": false,
59102
59159
  "joinValues": false,
@@ -59239,6 +59296,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
59239
59296
  }
59240
59297
  });
59241
59298
 
59299
+ let listviewFilter = getListViewFilter(listView);
59300
+ let listviewFiltersFunction = listView && listView._filters;
59301
+
59242
59302
  let sort = "";
59243
59303
  if(listView){
59244
59304
  sort = getListViewSort(listView);
@@ -59285,7 +59345,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59285
59345
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
59286
59346
  }
59287
59347
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
59288
- var filters = [];
59348
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59289
59349
  var pageSize = api.data.pageSize || 10;
59290
59350
  var pageNo = api.data.pageNo || 1;
59291
59351
  var skip = (pageNo - 1) * pageSize;
@@ -59347,6 +59407,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59347
59407
  }
59348
59408
 
59349
59409
  const inFilterForm = ${ctx.inFilterForm};
59410
+
59411
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59412
+
59413
+ if(listviewFiltersFunction && !inFilterForm){
59414
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
59415
+ if(_filters0 && _filters0.length){
59416
+ filters.push(_filters0);
59417
+ }
59418
+ }
59419
+
59350
59420
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59351
59421
 
59352
59422
  if(filtersFunction && !inFilterForm){
@@ -59465,13 +59535,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
59465
59535
 
59466
59536
  pickerSchema.affixHeader = false;
59467
59537
 
59468
- var headerToolbarItems = [];
59538
+
59539
+
59540
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
59541
+
59469
59542
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
59470
- headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
59543
+ pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
59471
59544
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
59472
59545
  }
59473
-
59474
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
59546
+
59475
59547
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
59476
59548
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
59477
59549
  // lookup字段配置过滤条件就强制不显示新建按钮
@@ -59584,6 +59656,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59584
59656
  pickerSchema.footerToolbar = ["pagination"];
59585
59657
  }
59586
59658
 
59659
+ if(field.inlineHelpText){
59660
+ pickerSchema.toolbarClassName = "hasHelpText";
59661
+ pickerSchema.headerToolbar = [{
59662
+ "type": "tpl",
59663
+ "tpl": field.inlineHelpText,
59664
+ "className": "text-secondary"
59665
+ }, ...pickerSchema.headerToolbar];
59666
+ }
59667
+ pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
59668
+
59587
59669
  const data = {
59588
59670
  type: getAmisStaticFieldType('picker', readonly),
59589
59671
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
@@ -59659,6 +59741,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
59659
59741
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59660
59742
  let listView = getLookupListView(refObjectConfig);
59661
59743
 
59744
+ let listviewFilter = getListViewFilter(listView);
59745
+ let listviewFiltersFunction = listView && listView._filters;
59746
+
59662
59747
  let sort = "";
59663
59748
  if(listView){
59664
59749
  sort = getListViewSort(listView);
@@ -59688,7 +59773,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59688
59773
  apiInfo.data['rfield'] = `\${object_name}`;
59689
59774
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
59690
59775
  apiInfo.requestAdaptor = `
59691
- var filters = [];
59776
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59692
59777
  var top = 200;
59693
59778
  if(api.data.$term){
59694
59779
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -59711,6 +59796,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
59711
59796
  }
59712
59797
 
59713
59798
  const inFilterForm = ${ctx.inFilterForm};
59799
+
59800
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59801
+
59802
+ if(listviewFiltersFunction && !inFilterForm){
59803
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
59804
+ if(_filters0 && _filters0.length){
59805
+ filters.push(_filters0);
59806
+ }
59807
+ }
59808
+
59714
59809
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59715
59810
 
59716
59811
  if(filtersFunction && !inFilterForm){
@@ -59833,9 +59928,17 @@ async function lookupToAmis(field, readonly, ctx){
59833
59928
  }
59834
59929
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59835
59930
  if(readonly){
59836
- return {
59837
- type: getAmisStaticFieldType('picker', readonly),
59838
- tpl: getRelatedFieldTpl(field, ctx)
59931
+ if(field.reference_to){
59932
+ return {
59933
+ type: 'steedos-field',
59934
+ config: field,
59935
+ static: true
59936
+ }
59937
+ }else {
59938
+ return {
59939
+ type: getAmisStaticFieldType('picker', readonly),
59940
+ tpl: getRelatedFieldTpl(field, ctx)
59941
+ }
59839
59942
  }
59840
59943
  }
59841
59944
  if(field.reference_to && !lodash.exports.isString(field.reference_to) && !readonly){
@@ -60376,13 +60479,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60376
60479
  };
60377
60480
  break;
60378
60481
  case 'input-datetime-range':
60482
+ // convertData = {
60483
+ // type: "input-datetime-range",
60484
+ // inputFormat: 'YYYY-MM-DD HH:mm',
60485
+ // format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60486
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
60487
+ // utc: true,
60488
+ // joinValues: false
60489
+ // }
60490
+ // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
60379
60491
  convertData = {
60380
- type: "input-datetime-range",
60381
- inputFormat: 'YYYY-MM-DD HH:mm',
60492
+ type: "input-date-range",
60493
+ inputFormat: "YYYY-MM-DD HH:mm",
60382
60494
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60383
60495
  tpl: readonly ? getDateTimeTpl(field) : null,
60384
60496
  utc: true,
60385
- joinValues: false
60497
+ joinValues: false,
60498
+ "shortcuts": [
60499
+ "thismonth",
60500
+ "2monthsago",
60501
+ "3monthslater",
60502
+ "prevquarter",
60503
+ "thisquarter",
60504
+ "thisyear",
60505
+ "lastYear"
60506
+ ]
60386
60507
  };
60387
60508
  break;
60388
60509
  case 'datetime':
@@ -60433,7 +60554,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60433
60554
  convertData = {
60434
60555
  type: getAmisStaticFieldType('datetime', readonly),
60435
60556
  inputFormat: 'YYYY-MM-DD HH:mm',
60436
- format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
60557
+ format: 'YYYY-MM-DDTHH:mm:00.000Z',
60437
60558
  tpl: readonly ? getDateTimeTpl(field) : null,
60438
60559
  utc: true,
60439
60560
  };
@@ -60564,6 +60685,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60564
60685
  convertData = {
60565
60686
  type: 'static-text'
60566
60687
  };
60688
+ }else if(field.autonumber_enable_modify){
60689
+ convertData = {
60690
+ "type": "input-group",
60691
+ "body": [
60692
+ {
60693
+ "type": "input-text",
60694
+ "name": field.name
60695
+ },
60696
+ {
60697
+ "type": "button",
60698
+ "label": "自动获取",
60699
+ "actionType": "ajax",
60700
+ "api": {
60701
+ "url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
60702
+ "method": "post",
60703
+ "headers": {
60704
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
60705
+ },
60706
+ "adaptor": `
60707
+ payload.data["${field.name}"] = payload.data && payload.data.autonumber;
60708
+ delete payload.data.autonumber;
60709
+ return payload;
60710
+ `
60711
+ },
60712
+ "messages": {
60713
+ "success": "获取成功"
60714
+ }
60715
+ }
60716
+ ]
60717
+ };
60567
60718
  }
60568
60719
  break;
60569
60720
  case 'url':
@@ -60718,11 +60869,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60718
60869
  if(field.subFields){
60719
60870
  convertData = {
60720
60871
  type: 'steedos-input-table',
60721
- showIndex: true,
60722
60872
  editable: !readonly,
60723
60873
  addable: !readonly,
60724
60874
  removable: !readonly,
60725
- draggable: !readonly,
60726
60875
  fields: [],
60727
60876
  amis:{
60728
60877
  columnsTogglable: false
@@ -60774,9 +60923,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60774
60923
  if(field.is_wide || convertData.type === 'group'){
60775
60924
  convertData.className = 'col-span-2 m-0';
60776
60925
  }else {
60777
- convertData.className = 'm-1';
60926
+ convertData.className = 'm-0';
60778
60927
  }
60779
- if(readonly){
60928
+ if(readonly && ctx.mode !== 'edit'){
60780
60929
  convertData.className = `${convertData.className} border-b`;
60781
60930
  }
60782
60931
  if(readonly){
@@ -60799,6 +60948,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60799
60948
  }
60800
60949
  }
60801
60950
 
60951
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
60952
+ convertData.className = `${convertData.className || ''} hidden`;
60953
+ }
60954
+
60802
60955
  if(lodash.exports.isString(baseData.required)){
60803
60956
  if(baseData.required.startsWith("{{")){
60804
60957
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
@@ -60867,8 +61020,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
60867
61020
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60868
61021
  }
60869
61022
  if(_field.type === 'datetime'){
60870
- // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
60871
- _field.type = 'input-date-range';
61023
+ // 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
61024
+ // 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
61025
+ _field.type = 'input-datetime-range';
60872
61026
  _field.is_wide = true;
60873
61027
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60874
61028
  }