@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.
@@ -53933,22 +53933,29 @@ function getRootUrl(defaultRootUrl){
53933
53933
  * @Description:
53934
53934
  */
53935
53935
 
53936
-
53937
53936
  const Router = {
53938
53937
  getTabDisplayAs(tab_id){
53938
+ const uiSchema = getUISchemaSync$1(tab_id, false);
53939
53939
  var urlSearch = new URLSearchParams(document.location.search);
53940
53940
  if(urlSearch.has('display')){
53941
53941
  return urlSearch.get('display')
53942
53942
  }
53943
53943
  const key = `tab_${tab_id}_display`;
53944
53944
  // const key = `page_display`;
53945
- const value = localStorage.getItem(key);
53946
- return value ? value : 'grid'
53945
+ const value = sessionStorage.getItem(key);
53946
+ let defaultDisplay = "grid";
53947
+ if(uiSchema.enable_split){
53948
+ defaultDisplay = "split";
53949
+ }
53950
+ if(window.innerWidth <= 768){
53951
+ return "grid";
53952
+ }
53953
+ return value ? value : defaultDisplay;
53947
53954
  },
53948
53955
 
53949
53956
  setTabDisplayAs(tab_id, displayAs){
53950
53957
  const key = `tab_${tab_id}_display`;
53951
- localStorage.setItem(key, displayAs);
53958
+ sessionStorage.setItem(key, displayAs);
53952
53959
  },
53953
53960
  getAppPath({formFactor, appId}){
53954
53961
  return `/app/${appId}`;
@@ -53975,8 +53982,8 @@ const Router = {
53975
53982
  /*
53976
53983
  * @Author: baozhoutao@steedos.com
53977
53984
  * @Date: 2022-07-20 16:29:22
53978
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
53979
- * @LastEditTime: 2023-12-28 14:59:08
53985
+ * @LastEditors: liaodaxue
53986
+ * @LastEditTime: 2024-01-25 14:44:17
53980
53987
  * @Description:
53981
53988
  */
53982
53989
 
@@ -54048,6 +54055,25 @@ function getComparableAmisVersion() {
54048
54055
  }
54049
54056
  }
54050
54057
 
54058
+ /**
54059
+ * 判断浏览器类型
54060
+ * @returns 按需返回浏览器类型;
54061
+ */
54062
+ function getBowserType() {
54063
+ const userAgent = navigator.userAgent;
54064
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
54065
+ return "Chrome";
54066
+ } else if (userAgent.indexOf("Firefox") !== -1) {
54067
+ return "Firefox";
54068
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
54069
+ return "Safari";
54070
+ } else if (userAgent.indexOf("Edg") !== -1) {
54071
+ return "Edge";
54072
+ } else {
54073
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
54074
+ }
54075
+ }
54076
+
54051
54077
  function getNumberTpl(field){
54052
54078
  return `<span>\${_display.${field.name}}</span>`
54053
54079
  }
@@ -54102,7 +54128,7 @@ function getSelectMap(selectOptions){
54102
54128
 
54103
54129
  function getNameTplUrl(field, ctx){
54104
54130
  if(ctx.objectName === 'cms_files'){
54105
- return `\${context.rootUrl}/api/files/files/\${versions[0]}?download=true`
54131
+ return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
54106
54132
  }
54107
54133
  const href = Router.getObjectDetailPath({
54108
54134
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
@@ -54616,6 +54642,7 @@ var frontend_notifications$1 = "Notifications";
54616
54642
  var frontend_notifications_allread$1 = "Mark all as read";
54617
54643
  var frontend_notifications_allread_message$1 = "All marked as read";
54618
54644
  var frontend_profile$1 = "Profile";
54645
+ var switch_space$1 = "Switch Space";
54619
54646
  var frontend_about$1 = "About";
54620
54647
  var frontend_log_out$1 = "Log out";
54621
54648
  var frontend_listview_warning_start$1 = "The current ";
@@ -54703,6 +54730,7 @@ var en_us = {
54703
54730
  frontend_notifications_allread: frontend_notifications_allread$1,
54704
54731
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
54705
54732
  frontend_profile: frontend_profile$1,
54733
+ switch_space: switch_space$1,
54706
54734
  frontend_about: frontend_about$1,
54707
54735
  frontend_log_out: frontend_log_out$1,
54708
54736
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -54742,9 +54770,9 @@ var frontend_display_type_is_split = "分栏视图";
54742
54770
  var frontend_display_as = "显示为";
54743
54771
  var frontend_record_sum = "个项目";
54744
54772
  var frontend_button_reload_tooltip = "刷新";
54745
- var frontend_button_search_tooltip = "筛选";
54773
+ var frontend_button_search_tooltip = "搜索";
54746
54774
  var frontend_fields_filter_button_search = "搜索";
54747
- var frontend_fields_filter_button_settings = "设置搜索项";
54775
+ var frontend_fields_filter_button_settings = "选择搜索项";
54748
54776
  var frontend_button_listview_control_tooltip = "列表视图控制";
54749
54777
  var frontend_button_listview_control_label = "列表视图控制";
54750
54778
  var frontend_listview_control_columns = "显示的列";
@@ -54792,6 +54820,7 @@ var frontend_notifications = "通知";
54792
54820
  var frontend_notifications_allread = "全部标记为已读";
54793
54821
  var frontend_notifications_allread_message = "已全部标记为已读";
54794
54822
  var frontend_profile = "个人资料";
54823
+ var switch_space = "切换工作区";
54795
54824
  var frontend_about = "关于";
54796
54825
  var frontend_log_out = "注销";
54797
54826
  var frontend_listview_warning_start = "当前";
@@ -54880,6 +54909,7 @@ var zh_cn = {
54880
54909
  frontend_notifications_allread: frontend_notifications_allread,
54881
54910
  frontend_notifications_allread_message: frontend_notifications_allread_message,
54882
54911
  frontend_profile: frontend_profile,
54912
+ switch_space: switch_space,
54883
54913
  frontend_about: frontend_about,
54884
54914
  frontend_log_out: frontend_log_out,
54885
54915
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -55193,7 +55223,8 @@ async function getQuickEditSchema(field, options){
55193
55223
  "failed": "失败了呢。。"
55194
55224
  }
55195
55225
  }
55196
- }
55226
+ },
55227
+ "expression": "${!recordPermissions.modifyAllRecords}"
55197
55228
  },
55198
55229
  {
55199
55230
  "actionType": "setValue",
@@ -55209,7 +55240,7 @@ async function getQuickEditSchema(field, options){
55209
55240
  "componentId": quickEditId,
55210
55241
  "args": {
55211
55242
  "value":{
55212
- "quickedit_record_permissions": "${event.data}"
55243
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
55213
55244
  }
55214
55245
  }
55215
55246
  }
@@ -55273,7 +55304,7 @@ async function getQuickEditSchema(field, options){
55273
55304
  `
55274
55305
  }
55275
55306
  },
55276
- "expression":"${event.data.value}"
55307
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
55277
55308
  },
55278
55309
  {
55279
55310
  "actionType": "setValue",
@@ -55304,10 +55335,20 @@ async function getQuickEditSchema(field, options){
55304
55335
  "script": `
55305
55336
  const noPermission = event.data.noPermission;
55306
55337
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
55307
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55338
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
55308
55339
  noPermission.forEach(function (item) {
55309
55340
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
55341
+ _.remove(selectedItems, (selected) => selected._id === item);
55310
55342
  })
55343
+ doAction({
55344
+ "componentId": "${quickEditId}",
55345
+ "actionType": "setValue",
55346
+ "args": {
55347
+ "value": {
55348
+ selectedItems
55349
+ }
55350
+ }
55351
+ });
55311
55352
  `
55312
55353
  },
55313
55354
  {
@@ -55368,7 +55409,7 @@ async function getQuickEditSchema(field, options){
55368
55409
  }
55369
55410
 
55370
55411
  function getFieldWidth(width){
55371
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
55412
+ const defaultWidth = null;
55372
55413
  if(typeof width == 'string'){
55373
55414
  if(isNaN(width)){
55374
55415
  return width || defaultWidth;
@@ -55398,18 +55439,35 @@ async function getTableColumns(fields, options){
55398
55439
  //增加quickEdit属性,实现快速编辑
55399
55440
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55400
55441
  let className = "";
55401
- if(field.wrap != true){
55442
+ const bowserType = getBowserType();
55443
+ if(bowserType === "Safari"){
55402
55444
  className += " whitespace-nowrap ";
55403
55445
  }else {
55404
- className += " break-all ";
55446
+ if(field.wrap != true){
55447
+ className += " whitespace-nowrap ";
55448
+ }else {
55449
+ className += " break-words ";
55450
+ }
55451
+ }
55452
+
55453
+ if (typeof field.amis?.className == "object") {
55454
+ className = {
55455
+ [className]: "true",
55456
+ ...field.amis.className
55457
+ };
55458
+ } else if (typeof field.amis?.className == "string") {
55459
+ className = `${className} ${field.amis.className} `;
55405
55460
  }
55461
+ let fieldAmis = lodash.exports.clone(field.amis);
55462
+ delete fieldAmis?.className;
55463
+
55406
55464
  let columnItem;
55407
55465
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
55408
55466
  const previewFileScript = `
55409
55467
  var data = event.data;
55410
55468
  var file_name = data.versions ? data.name : "${field.label}";
55411
- var file_id = data._id;
55412
- SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
55469
+ var file_id = data.versions && data.versions[0] && data.versions[0]._id;
55470
+ window.previewFile && window.previewFile({file_name, file_id});
55413
55471
  `;
55414
55472
  columnItem = {
55415
55473
  "type": "button",
@@ -55434,11 +55492,11 @@ async function getTableColumns(fields, options){
55434
55492
  "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
55435
55493
  },
55436
55494
  {
55437
- "args": {},
55438
- "actionType": "custom",
55439
- "script": previewFileScript,
55440
- // "expression": "!!window?.nw?.require" //PC客户端预览附件
55441
- "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55495
+ "args": {},
55496
+ "actionType": "custom",
55497
+ "script": previewFileScript,
55498
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
55499
+ "expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
55442
55500
  }
55443
55501
  ]
55444
55502
  }
@@ -55453,7 +55511,7 @@ async function getTableColumns(fields, options){
55453
55511
  toggled: field.toggled,
55454
55512
  static: true,
55455
55513
  className,
55456
- }, field.amis, {name: field.name});
55514
+ }, fieldAmis, {name: field.name});
55457
55515
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
55458
55516
  columnItem = Object.assign({}, {
55459
55517
  type: "switch",
@@ -55464,7 +55522,7 @@ async function getTableColumns(fields, options){
55464
55522
  static: true,
55465
55523
  className,
55466
55524
  ...getAmisFileReadonlySchema(field)
55467
- }, field.amis, {name: field.name});
55525
+ }, fieldAmis, {name: field.name});
55468
55526
  }
55469
55527
  else if(field.type === 'select'){
55470
55528
  const map = getSelectMap(field.options);
@@ -55479,7 +55537,7 @@ async function getTableColumns(fields, options){
55479
55537
  className,
55480
55538
  inputClassName: "inline",
55481
55539
  static: true,
55482
- }, field.amis, {name: field.name});
55540
+ }, fieldAmis, {name: field.name});
55483
55541
  }
55484
55542
  else {
55485
55543
  const tpl = await getFieldTpl(field, options);
@@ -55498,23 +55556,14 @@ async function getTableColumns(fields, options){
55498
55556
  if(field.type === 'textarea'){
55499
55557
  className += 'min-w-56';
55500
55558
  }
55501
- if(field.type === 'date'){
55502
- className += 'date-min-w';
55503
- }
55504
- if(field.type === 'datetime'){
55505
- className += 'datetime-min-w';
55506
- }
55559
+ // if(field.type === 'date'){
55560
+ // className += 'date-min-w';
55561
+ // }
55562
+ // if(field.type === 'datetime'){
55563
+ // className += 'datetime-min-w';
55564
+ // }
55507
55565
 
55508
55566
  //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
55567
 
55519
55568
  if(!field.hidden && !field.extra){
55520
55569
  columnItem = Object.assign({}, {
@@ -55531,7 +55580,7 @@ async function getTableColumns(fields, options){
55531
55580
  static: true,
55532
55581
  options: field.type === 'html' ? {html: true} : null
55533
55582
  // toggled: true
55534
- }, field.amis, {name: field.name});
55583
+ }, fieldAmis, {name: field.name});
55535
55584
 
55536
55585
  if(field.type === 'color'){
55537
55586
  columnItem.type = 'color';
@@ -55598,7 +55647,7 @@ function getMobileLines(tpls){
55598
55647
  }
55599
55648
  if(isLeft){
55600
55649
  // 左侧半行
55601
- lineChildrenClassName = "steedos-listview-item-left truncate";
55650
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
55602
55651
  if(item.field.is_wide){
55603
55652
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
55604
55653
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -55610,7 +55659,7 @@ function getMobileLines(tpls){
55610
55659
  }
55611
55660
  else {
55612
55661
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
55613
- lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
55662
+ lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
55614
55663
  }
55615
55664
  //支持字段amis属性配置classname,识别classname的类型,与原样式合并
55616
55665
  var className;
@@ -55721,8 +55770,16 @@ async function getMobileTableColumns(fields, options){
55721
55770
  "actions": [
55722
55771
  {
55723
55772
  "script": `
55724
- let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
55725
- Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55773
+ let cms_url = '';
55774
+ let value = event.data.versions[0];
55775
+ if(value){
55776
+ if(value.url){
55777
+ cms_url = value.url;
55778
+ }else{
55779
+ cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
55780
+ }
55781
+ }
55782
+ Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
55726
55783
  `,
55727
55784
  "actionType": "custom"
55728
55785
  }
@@ -55837,7 +55894,8 @@ async function getTableOperation(ctx){
55837
55894
  label: "&nbsp;",
55838
55895
  fixed: 'right',
55839
55896
  labelClassName: 'text-center',
55840
- className: 'text-center steedos-listview-operation w-10',
55897
+ //TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
55898
+ className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
55841
55899
  buttons: [
55842
55900
  {
55843
55901
  "type": "steedos-dropdown-button",
@@ -55933,7 +55991,7 @@ async function getTableSchema$1(fields, options){
55933
55991
  }
55934
55992
  return {
55935
55993
  mode: "cards",
55936
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55994
+ perPageAvailable: [20, 50, 100, 500],
55937
55995
  name: "thelist",
55938
55996
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55939
55997
  className: "",
@@ -55966,7 +56024,7 @@ async function getTableSchema$1(fields, options){
55966
56024
 
55967
56025
  return {
55968
56026
  mode: "table",
55969
- perPageAvailable: [5, 10, 20, 50, 100, 500],
56027
+ perPageAvailable: [20, 50, 100, 500],
55970
56028
  name: "thelist",
55971
56029
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55972
56030
  className: "",
@@ -56092,7 +56150,7 @@ async function getListBody(fields, options){
56092
56150
 
56093
56151
  function getDefaultParams(options){
56094
56152
  return {
56095
- perPage: options.top || options.perPage || 10
56153
+ perPage: options.top || options.perPage || 20
56096
56154
  }
56097
56155
  }
56098
56156
 
@@ -56146,7 +56204,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
56146
56204
  "objectApiName": "\${objectName}",
56147
56205
  "recordId": "",
56148
56206
  "mode": "edit",
56149
- "layout": "normal"
56150
56207
  };
56151
56208
 
56152
56209
  if (payload && payload.schema) {
@@ -56355,7 +56412,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
56355
56412
  const formSchema = {
56356
56413
  "type": "service",
56357
56414
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
56358
- "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",
56415
+ "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",
56359
56416
  "style":{
56360
56417
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
56361
56418
  },
@@ -56942,7 +56999,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
56942
56999
  "className": "slds-filters"
56943
57000
  },
56944
57001
  "size": "xs",
56945
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
57002
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
56946
57003
  "visibleOn": "this.showFieldsFilter",
56947
57004
  },
56948
57005
  "className": "bg-white"
@@ -57903,7 +57960,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
57903
57960
  "icon": "fa fa-cog",
57904
57961
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57905
57962
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
57906
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
57963
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57907
57964
  "align": "right",
57908
57965
  "visibleOn": "${!isLookup}",
57909
57966
  "buttons": [
@@ -57930,14 +57987,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57930
57987
  {
57931
57988
  "type": "button",
57932
57989
  "label": instance.t('frontend_display_type_is_table'),
57933
- "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');",
57990
+ "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');",
57934
57991
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57935
57992
  "rightIconClassName": "m-l-sm"
57936
57993
  },
57937
57994
  {
57938
57995
  "type": "button",
57939
57996
  "label": instance.t('frontend_display_type_is_split'),
57940
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57997
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57941
57998
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57942
57999
  "rightIconClassName": "m-l-sm"
57943
58000
  }
@@ -57948,7 +58005,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57948
58005
  "icon": "fa fa-table-columns",
57949
58006
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
57950
58007
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
57951
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
58008
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
57952
58009
  "align": "right",
57953
58010
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
57954
58011
  "buttons": [
@@ -58080,7 +58137,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58080
58137
  {
58081
58138
  "type": "search-box",
58082
58139
  "name": keywordsSearchBoxName,
58083
- "placeholder": "搜索此列表",
58140
+ "placeholder": "快捷搜索",
58084
58141
  "value": crudKeywords,
58085
58142
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58086
58143
  "clearAndSubmit": true,
@@ -58141,7 +58198,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58141
58198
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58142
58199
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58143
58200
  // "tooltipPlacement": "top",
58144
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58201
+ // "className": "bg-white p-2 rounded text-gray-500",
58145
58202
  // "label": "",
58146
58203
  // "icon": "fa fa-sync",
58147
58204
  // "visibleOn": "${!showFieldsFilter}",
@@ -58165,7 +58222,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58165
58222
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58166
58223
  "tooltip":"",
58167
58224
  "tooltipPlacement": "top",
58168
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58225
+ "className": "bg-white p-2 rounded text-gray-500"
58169
58226
  };
58170
58227
  }
58171
58228
  else {
@@ -58176,7 +58233,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58176
58233
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58177
58234
  "tooltip":"",
58178
58235
  "tooltipPlacement": "top",
58179
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
58236
+ "className": "bg-white p-2 rounded text-gray-500"
58180
58237
  };
58181
58238
  }
58182
58239
  let toolbarFilter;
@@ -58198,7 +58255,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58198
58255
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
58199
58256
  },
58200
58257
  "align": "right",
58201
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
58258
+ "className": "bg-white p-2 rounded text-gray-500",
58202
58259
  "onEvent": {
58203
58260
  "click": {
58204
58261
  "actions": [
@@ -58284,7 +58341,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58284
58341
  // ]
58285
58342
  if(options.displayAs === 'split'){
58286
58343
  return [
58287
- "switch-per-page",
58344
+ {
58345
+ "type": "switch-per-page",
58346
+ "visibleOn": "${count >= 20}"
58347
+ },
58288
58348
  {
58289
58349
  "type": "pagination",
58290
58350
  "maxButtons": 5,
@@ -58306,7 +58366,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58306
58366
  else {
58307
58367
  if(options && options.isRelated){
58308
58368
  return [
58309
- "statistics",
58310
58369
  {
58311
58370
  "type": "pagination",
58312
58371
  "maxButtons": 10,
@@ -58319,7 +58378,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58319
58378
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
58320
58379
  const is_lookup = options.isLookup;
58321
58380
  const commonConfig = [
58322
- "statistics",
58323
58381
  {
58324
58382
  "type": "pagination",
58325
58383
  "maxButtons": 10,
@@ -58330,7 +58388,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58330
58388
  if (no_pagination && is_lookup) {
58331
58389
  return commonConfig;
58332
58390
  } else {
58333
- return ["switch-per-page", ...commonConfig];
58391
+ return [{
58392
+ "type": "switch-per-page",
58393
+ "visibleOn": "${count >= 20}"
58394
+ }, ...commonConfig];
58334
58395
  }
58335
58396
  }
58336
58397
  }
@@ -58354,7 +58415,6 @@ async function getObjectFilter(objectSchema, fields, options) {
58354
58415
  "timeOut": 1000
58355
58416
  }
58356
58417
  });
58357
- resizeWindow();
58358
58418
  const scope = event.context.scoped;
58359
58419
  // let filterFormValues = event.data;
58360
58420
  let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
@@ -58430,8 +58490,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58430
58490
  /*
58431
58491
  * @Author: baozhoutao@steedos.com
58432
58492
  * @Date: 2022-07-05 15:55:39
58433
- * @LastEditors: liaodaxue
58434
- * @LastEditTime: 2023-10-20 11:38:25
58493
+ * @LastEditors: baozhoutao@steedos.com
58494
+ * @LastEditTime: 2024-01-16 11:14:34
58435
58495
  * @Description:
58436
58496
  */
58437
58497
 
@@ -58998,17 +59058,13 @@ function getReferenceToSync(field) {
58998
59058
 
58999
59059
  function getLookupSapceUserTreeSchema(isMobile){
59000
59060
  let apiAdaptor = `
59001
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
59002
59061
  const records = payload.data.options;
59003
- let isTreeOptionsComputed = false;
59004
- if(records.length === 1 && records[0].children){
59005
- isTreeOptionsComputed = true;
59006
- }
59007
- if(isTreeOptionsComputed){
59008
- return payload;
59009
- }
59010
59062
  const treeRecords = [];
59011
- const getChildren = (records, childrenIds) => {
59063
+ const getChildren = (currentRecord, records, childrenIds) => {
59064
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
59065
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
59066
+ return currentRecord.children;
59067
+ }
59012
59068
  if (!childrenIds) {
59013
59069
  return;
59014
59070
  }
@@ -59017,7 +59073,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59017
59073
  });
59018
59074
  _.each(children, (item) => {
59019
59075
  if (item.children) {
59020
- item.children = getChildren(records, item.children)
59076
+ item.children = getChildren(item, records, item.children)
59021
59077
  }else{
59022
59078
  item.children = [];
59023
59079
  }
@@ -59043,7 +59099,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59043
59099
 
59044
59100
  _.each(records, (record) => {
59045
59101
  if (record.noParent == 1) {
59046
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
59102
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
59047
59103
  }
59048
59104
  });
59049
59105
  console.log(treeRecords)
@@ -59093,6 +59149,7 @@ function getLookupSapceUserTreeSchema(isMobile){
59093
59149
  }
59094
59150
  },
59095
59151
  "label": "",
59152
+ "mode": "normal",
59096
59153
  "name": "organizations",
59097
59154
  "multiple": false,
59098
59155
  "joinValues": false,
@@ -59235,6 +59292,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
59235
59292
  }
59236
59293
  });
59237
59294
 
59295
+ let listviewFilter = getListViewFilter(listView);
59296
+ let listviewFiltersFunction = listView && listView._filters;
59297
+
59238
59298
  let sort = "";
59239
59299
  if(listView){
59240
59300
  sort = getListViewSort(listView);
@@ -59281,7 +59341,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59281
59341
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
59282
59342
  }
59283
59343
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
59284
- var filters = [];
59344
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59285
59345
  var pageSize = api.data.pageSize || 10;
59286
59346
  var pageNo = api.data.pageNo || 1;
59287
59347
  var skip = (pageNo - 1) * pageSize;
@@ -59343,6 +59403,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59343
59403
  }
59344
59404
 
59345
59405
  const inFilterForm = ${ctx.inFilterForm};
59406
+
59407
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59408
+
59409
+ if(listviewFiltersFunction && !inFilterForm){
59410
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
59411
+ if(_filters0 && _filters0.length){
59412
+ filters.push(_filters0);
59413
+ }
59414
+ }
59415
+
59346
59416
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59347
59417
 
59348
59418
  if(filtersFunction && !inFilterForm){
@@ -59461,13 +59531,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
59461
59531
 
59462
59532
  pickerSchema.affixHeader = false;
59463
59533
 
59464
- var headerToolbarItems = [];
59534
+
59535
+
59536
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
59537
+
59465
59538
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
59466
- headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
59539
+ pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
59467
59540
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
59468
59541
  }
59469
-
59470
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
59542
+
59471
59543
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
59472
59544
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
59473
59545
  // lookup字段配置过滤条件就强制不显示新建按钮
@@ -59580,6 +59652,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
59580
59652
  pickerSchema.footerToolbar = ["pagination"];
59581
59653
  }
59582
59654
 
59655
+ if(field.inlineHelpText){
59656
+ pickerSchema.toolbarClassName = "hasHelpText";
59657
+ pickerSchema.headerToolbar = [{
59658
+ "type": "tpl",
59659
+ "tpl": field.inlineHelpText,
59660
+ "className": "text-secondary"
59661
+ }, ...pickerSchema.headerToolbar];
59662
+ }
59663
+ pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
59664
+
59583
59665
  const data = {
59584
59666
  type: getAmisStaticFieldType('picker', readonly),
59585
59667
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
@@ -59655,6 +59737,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
59655
59737
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59656
59738
  let listView = getLookupListView(refObjectConfig);
59657
59739
 
59740
+ let listviewFilter = getListViewFilter(listView);
59741
+ let listviewFiltersFunction = listView && listView._filters;
59742
+
59658
59743
  let sort = "";
59659
59744
  if(listView){
59660
59745
  sort = getListViewSort(listView);
@@ -59684,7 +59769,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
59684
59769
  apiInfo.data['rfield'] = `\${object_name}`;
59685
59770
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
59686
59771
  apiInfo.requestAdaptor = `
59687
- var filters = [];
59772
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
59688
59773
  var top = 200;
59689
59774
  if(api.data.$term){
59690
59775
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -59707,6 +59792,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
59707
59792
  }
59708
59793
 
59709
59794
  const inFilterForm = ${ctx.inFilterForm};
59795
+
59796
+ const listviewFiltersFunction = ${listviewFiltersFunction};
59797
+
59798
+ if(listviewFiltersFunction && !inFilterForm){
59799
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
59800
+ if(_filters0 && _filters0.length){
59801
+ filters.push(_filters0);
59802
+ }
59803
+ }
59804
+
59710
59805
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
59711
59806
 
59712
59807
  if(filtersFunction && !inFilterForm){
@@ -59829,9 +59924,17 @@ async function lookupToAmis(field, readonly, ctx){
59829
59924
  }
59830
59925
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59831
59926
  if(readonly){
59832
- return {
59833
- type: getAmisStaticFieldType('picker', readonly),
59834
- tpl: getRelatedFieldTpl(field, ctx)
59927
+ if(field.reference_to){
59928
+ return {
59929
+ type: 'steedos-field',
59930
+ config: field,
59931
+ static: true
59932
+ }
59933
+ }else {
59934
+ return {
59935
+ type: getAmisStaticFieldType('picker', readonly),
59936
+ tpl: getRelatedFieldTpl(field, ctx)
59937
+ }
59835
59938
  }
59836
59939
  }
59837
59940
  if(field.reference_to && !lodash.exports.isString(field.reference_to) && !readonly){
@@ -60372,13 +60475,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60372
60475
  };
60373
60476
  break;
60374
60477
  case 'input-datetime-range':
60478
+ // convertData = {
60479
+ // type: "input-datetime-range",
60480
+ // inputFormat: 'YYYY-MM-DD HH:mm',
60481
+ // format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60482
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
60483
+ // utc: true,
60484
+ // joinValues: false
60485
+ // }
60486
+ // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
60375
60487
  convertData = {
60376
- type: "input-datetime-range",
60377
- inputFormat: 'YYYY-MM-DD HH:mm',
60488
+ type: "input-date-range",
60489
+ inputFormat: "YYYY-MM-DD HH:mm",
60378
60490
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
60379
60491
  tpl: readonly ? getDateTimeTpl(field) : null,
60380
60492
  utc: true,
60381
- joinValues: false
60493
+ joinValues: false,
60494
+ "shortcuts": [
60495
+ "thismonth",
60496
+ "2monthsago",
60497
+ "3monthslater",
60498
+ "prevquarter",
60499
+ "thisquarter",
60500
+ "thisyear",
60501
+ "lastYear"
60502
+ ]
60382
60503
  };
60383
60504
  break;
60384
60505
  case 'datetime':
@@ -60429,7 +60550,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60429
60550
  convertData = {
60430
60551
  type: getAmisStaticFieldType('datetime', readonly),
60431
60552
  inputFormat: 'YYYY-MM-DD HH:mm',
60432
- format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
60553
+ format: 'YYYY-MM-DDTHH:mm:00.000Z',
60433
60554
  tpl: readonly ? getDateTimeTpl(field) : null,
60434
60555
  utc: true,
60435
60556
  };
@@ -60560,6 +60681,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60560
60681
  convertData = {
60561
60682
  type: 'static-text'
60562
60683
  };
60684
+ }else if(field.autonumber_enable_modify){
60685
+ convertData = {
60686
+ "type": "input-group",
60687
+ "body": [
60688
+ {
60689
+ "type": "input-text",
60690
+ "name": field.name
60691
+ },
60692
+ {
60693
+ "type": "button",
60694
+ "label": "自动获取",
60695
+ "actionType": "ajax",
60696
+ "api": {
60697
+ "url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
60698
+ "method": "post",
60699
+ "headers": {
60700
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
60701
+ },
60702
+ "adaptor": `
60703
+ payload.data["${field.name}"] = payload.data && payload.data.autonumber;
60704
+ delete payload.data.autonumber;
60705
+ return payload;
60706
+ `
60707
+ },
60708
+ "messages": {
60709
+ "success": "获取成功"
60710
+ }
60711
+ }
60712
+ ]
60713
+ };
60563
60714
  }
60564
60715
  break;
60565
60716
  case 'url':
@@ -60714,11 +60865,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60714
60865
  if(field.subFields){
60715
60866
  convertData = {
60716
60867
  type: 'steedos-input-table',
60717
- showIndex: true,
60718
60868
  editable: !readonly,
60719
60869
  addable: !readonly,
60720
60870
  removable: !readonly,
60721
- draggable: !readonly,
60722
60871
  fields: [],
60723
60872
  amis:{
60724
60873
  columnsTogglable: false
@@ -60770,9 +60919,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60770
60919
  if(field.is_wide || convertData.type === 'group'){
60771
60920
  convertData.className = 'col-span-2 m-0';
60772
60921
  }else {
60773
- convertData.className = 'm-1';
60922
+ convertData.className = 'm-0';
60774
60923
  }
60775
- if(readonly){
60924
+ if(readonly && ctx.mode !== 'edit'){
60776
60925
  convertData.className = `${convertData.className} border-b`;
60777
60926
  }
60778
60927
  if(readonly){
@@ -60795,6 +60944,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60795
60944
  }
60796
60945
  }
60797
60946
 
60947
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
60948
+ convertData.className = `${convertData.className || ''} hidden`;
60949
+ }
60950
+
60798
60951
  if(lodash.exports.isString(baseData.required)){
60799
60952
  if(baseData.required.startsWith("{{")){
60800
60953
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
@@ -60863,8 +61016,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
60863
61016
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60864
61017
  }
60865
61018
  if(_field.type === 'datetime'){
60866
- // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
60867
- _field.type = 'input-date-range';
61019
+ // 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
61020
+ // 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
61021
+ _field.type = 'input-datetime-range';
60868
61022
  _field.is_wide = true;
60869
61023
  fieldNamePrefix = `${fieldNamePrefix}between__`;
60870
61024
  }