@steedos-widgets/sortable 3.6.2-beta.1 → 3.6.2-beta.11

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,26 @@ 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
+ return value ? value : defaultDisplay;
53947
53951
  },
53948
53952
 
53949
53953
  setTabDisplayAs(tab_id, displayAs){
53950
53954
  const key = `tab_${tab_id}_display`;
53951
- localStorage.setItem(key, displayAs);
53955
+ sessionStorage.setItem(key, displayAs);
53952
53956
  },
53953
53957
  getAppPath({formFactor, appId}){
53954
53958
  return `/app/${appId}`;
@@ -54102,7 +54106,7 @@ function getSelectMap(selectOptions){
54102
54106
 
54103
54107
  function getNameTplUrl(field, ctx){
54104
54108
  if(ctx.objectName === 'cms_files'){
54105
- return `\${context.rootUrl}/api/files/files/\${versions[0]}?download=true`
54109
+ return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
54106
54110
  }
54107
54111
  const href = Router.getObjectDetailPath({
54108
54112
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
@@ -54616,6 +54620,7 @@ var frontend_notifications$1 = "Notifications";
54616
54620
  var frontend_notifications_allread$1 = "Mark all as read";
54617
54621
  var frontend_notifications_allread_message$1 = "All marked as read";
54618
54622
  var frontend_profile$1 = "Profile";
54623
+ var switch_space$1 = "Switch Space";
54619
54624
  var frontend_about$1 = "About";
54620
54625
  var frontend_log_out$1 = "Log out";
54621
54626
  var frontend_listview_warning_start$1 = "The current ";
@@ -54703,6 +54708,7 @@ var en_us = {
54703
54708
  frontend_notifications_allread: frontend_notifications_allread$1,
54704
54709
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
54705
54710
  frontend_profile: frontend_profile$1,
54711
+ switch_space: switch_space$1,
54706
54712
  frontend_about: frontend_about$1,
54707
54713
  frontend_log_out: frontend_log_out$1,
54708
54714
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -54742,9 +54748,9 @@ var frontend_display_type_is_split = "分栏视图";
54742
54748
  var frontend_display_as = "显示为";
54743
54749
  var frontend_record_sum = "个项目";
54744
54750
  var frontend_button_reload_tooltip = "刷新";
54745
- var frontend_button_search_tooltip = "筛选";
54751
+ var frontend_button_search_tooltip = "搜索";
54746
54752
  var frontend_fields_filter_button_search = "搜索";
54747
- var frontend_fields_filter_button_settings = "设置搜索项";
54753
+ var frontend_fields_filter_button_settings = "选择搜索项";
54748
54754
  var frontend_button_listview_control_tooltip = "列表视图控制";
54749
54755
  var frontend_button_listview_control_label = "列表视图控制";
54750
54756
  var frontend_listview_control_columns = "显示的列";
@@ -54792,6 +54798,7 @@ var frontend_notifications = "通知";
54792
54798
  var frontend_notifications_allread = "全部标记为已读";
54793
54799
  var frontend_notifications_allread_message = "已全部标记为已读";
54794
54800
  var frontend_profile = "个人资料";
54801
+ var switch_space = "切换工作区";
54795
54802
  var frontend_about = "关于";
54796
54803
  var frontend_log_out = "注销";
54797
54804
  var frontend_listview_warning_start = "当前";
@@ -54880,6 +54887,7 @@ var zh_cn = {
54880
54887
  frontend_notifications_allread: frontend_notifications_allread,
54881
54888
  frontend_notifications_allread_message: frontend_notifications_allread_message,
54882
54889
  frontend_profile: frontend_profile,
54890
+ switch_space: switch_space,
54883
54891
  frontend_about: frontend_about,
54884
54892
  frontend_log_out: frontend_log_out,
54885
54893
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -55399,9 +55407,13 @@ async function getTableColumns(fields, options){
55399
55407
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55400
55408
  let className = "";
55401
55409
  if(field.wrap != true){
55402
- className += " whitespace-nowrap ";
55410
+ if(field.wrap != false && field.is_wide){
55411
+ className += " break-words ";
55412
+ }else {
55413
+ className += " whitespace-nowrap ";
55414
+ }
55403
55415
  }else {
55404
- className += " break-all ";
55416
+ className += " break-words ";
55405
55417
  }
55406
55418
  let columnItem;
55407
55419
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -55498,12 +55510,24 @@ async function getTableColumns(fields, options){
55498
55510
  if(field.type === 'textarea'){
55499
55511
  className += 'min-w-56';
55500
55512
  }
55501
- if(field.type === 'date'){
55502
- className += 'date-min-w';
55503
- }
55504
- if(field.type === 'datetime'){
55505
- className += 'datetime-min-w';
55513
+ // if(field.type === 'date'){
55514
+ // className += 'date-min-w';
55515
+ // }
55516
+ // if(field.type === 'datetime'){
55517
+ // className += 'datetime-min-w';
55518
+ // }
55519
+
55520
+ //field上的amis属性里的clssname需要单独判断类型合并
55521
+ if (typeof field.amis?.className == "object") {
55522
+ className = {
55523
+ [className]: "true",
55524
+ ...field.amis.className
55525
+ };
55526
+ } else if (typeof field.amis?.className == "string") {
55527
+ className = `${className} ${field.amis.className} `;
55506
55528
  }
55529
+ delete field.amis?.className;
55530
+
55507
55531
  if(!field.hidden && !field.extra){
55508
55532
  columnItem = Object.assign({}, {
55509
55533
  name: field.name,
@@ -55586,7 +55610,7 @@ function getMobileLines(tpls){
55586
55610
  }
55587
55611
  if(isLeft){
55588
55612
  // 左侧半行
55589
- lineChildrenClassName = "steedos-listview-item-left truncate";
55613
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
55590
55614
  if(item.field.is_wide){
55591
55615
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
55592
55616
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -55598,14 +55622,26 @@ function getMobileLines(tpls){
55598
55622
  }
55599
55623
  else {
55600
55624
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
55601
- lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
55625
+ lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
55626
+ }
55627
+ //支持字段amis属性配置classname,识别classname的类型,与原样式合并
55628
+ var className;
55629
+ if (typeof item.field.amis?.className == "object") {
55630
+ className = {
55631
+ [lineChildrenClassName]: "true",
55632
+ ...item.field.amis.className
55633
+ };
55634
+ } else if (typeof item.field.amis?.className == "string") {
55635
+ className = `${lineChildrenClassName} ${item.field.amis.className} `;
55636
+ } else {
55637
+ className = lineChildrenClassName;
55602
55638
  }
55603
55639
  lineChildren.push({
55604
55640
  "type": "tpl",
55605
55641
  "tpl": item.tpl,
55606
- "className": lineChildrenClassName
55642
+ className
55607
55643
  });
55608
-
55644
+
55609
55645
  if(item.field.is_wide){
55610
55646
  // 宽字段占整行
55611
55647
  isLeft = true;
@@ -55655,8 +55691,7 @@ async function getMobileTableColumns(fields, options){
55655
55691
  tpl = await getFieldTpl(field, options);
55656
55692
  }
55657
55693
  if(!tpl){
55658
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
55659
- tpl = `\${${field.name} | raw}`;
55694
+ tpl = `\${${field.name}}`;
55660
55695
  }
55661
55696
  if(!field.hidden && !field.extra){
55662
55697
  tpls.push({ field, tpl });
@@ -55669,7 +55704,7 @@ async function getMobileTableColumns(fields, options){
55669
55704
 
55670
55705
  let column = {
55671
55706
  name: nameField.name,
55672
- label: nameField.label,
55707
+ label: options.displayAs == 'split' ? '' : nameField.label,
55673
55708
  sortable: nameField.sortable,
55674
55709
  type: "button",
55675
55710
  level: "link",
@@ -55698,7 +55733,15 @@ async function getMobileTableColumns(fields, options){
55698
55733
  "actions": [
55699
55734
  {
55700
55735
  "script": `
55701
- let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
55736
+ let cms_url = '';
55737
+ let value = event.data.versions[0];
55738
+ if(value){
55739
+ if(value.url){
55740
+ cms_url = value.url;
55741
+ }else{
55742
+ cms_url = "/api/files/files/"+value+"?download=true"
55743
+ }
55744
+ }
55702
55745
  Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55703
55746
  `,
55704
55747
  "actionType": "custom"
@@ -55814,7 +55857,8 @@ async function getTableOperation(ctx){
55814
55857
  label: " ",
55815
55858
  fixed: 'right',
55816
55859
  labelClassName: 'text-center',
55817
- className: 'text-center steedos-listview-operation w-10',
55860
+ //TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
55861
+ className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
55818
55862
  buttons: [
55819
55863
  {
55820
55864
  "type": "steedos-dropdown-button",
@@ -55910,7 +55954,7 @@ async function getTableSchema$1(fields, options){
55910
55954
  }
55911
55955
  return {
55912
55956
  mode: "cards",
55913
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55957
+ perPageAvailable: [20, 50, 100, 500],
55914
55958
  name: "thelist",
55915
55959
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55916
55960
  className: "",
@@ -55943,7 +55987,7 @@ async function getTableSchema$1(fields, options){
55943
55987
 
55944
55988
  return {
55945
55989
  mode: "table",
55946
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55990
+ perPageAvailable: [20, 50, 100, 500],
55947
55991
  name: "thelist",
55948
55992
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55949
55993
  className: "",
@@ -56069,7 +56113,7 @@ async function getListBody(fields, options){
56069
56113
 
56070
56114
  function getDefaultParams(options){
56071
56115
  return {
56072
- perPage: options.top || options.perPage || 10
56116
+ perPage: options.top || options.perPage || 20
56073
56117
  }
56074
56118
  }
56075
56119
 
@@ -56123,7 +56167,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
56123
56167
  "objectApiName": "\${objectName}",
56124
56168
  "recordId": "",
56125
56169
  "mode": "edit",
56126
- "layout": "normal"
56127
56170
  };
56128
56171
 
56129
56172
  if (payload && payload.schema) {
@@ -57907,14 +57950,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57907
57950
  {
57908
57951
  "type": "button",
57909
57952
  "label": instance.t('frontend_display_type_is_table'),
57910
- "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');",
57953
+ "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');",
57911
57954
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57912
57955
  "rightIconClassName": "m-l-sm"
57913
57956
  },
57914
57957
  {
57915
57958
  "type": "button",
57916
57959
  "label": instance.t('frontend_display_type_is_split'),
57917
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57960
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57918
57961
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57919
57962
  "rightIconClassName": "m-l-sm"
57920
57963
  }
@@ -58057,7 +58100,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58057
58100
  {
58058
58101
  "type": "search-box",
58059
58102
  "name": keywordsSearchBoxName,
58060
- "placeholder": "搜索此列表",
58103
+ "placeholder": "快捷搜索",
58061
58104
  "value": crudKeywords,
58062
58105
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58063
58106
  "clearAndSubmit": true,
@@ -58261,7 +58304,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58261
58304
  // ]
58262
58305
  if(options.displayAs === 'split'){
58263
58306
  return [
58264
- "switch-per-page",
58307
+ {
58308
+ "type": "switch-per-page",
58309
+ "visibleOn": "${count >= 20}"
58310
+ },
58265
58311
  {
58266
58312
  "type": "pagination",
58267
58313
  "maxButtons": 5,
@@ -58283,7 +58329,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58283
58329
  else {
58284
58330
  if(options && options.isRelated){
58285
58331
  return [
58286
- "statistics",
58287
58332
  {
58288
58333
  "type": "pagination",
58289
58334
  "maxButtons": 10,
@@ -58296,7 +58341,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58296
58341
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
58297
58342
  const is_lookup = options.isLookup;
58298
58343
  const commonConfig = [
58299
- "statistics",
58300
58344
  {
58301
58345
  "type": "pagination",
58302
58346
  "maxButtons": 10,
@@ -58307,7 +58351,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58307
58351
  if (no_pagination && is_lookup) {
58308
58352
  return commonConfig;
58309
58353
  } else {
58310
- return ["switch-per-page", ...commonConfig];
58354
+ return [{
58355
+ "type": "switch-per-page",
58356
+ "visibleOn": "${count >= 20}"
58357
+ }, ...commonConfig];
58311
58358
  }
58312
58359
  }
58313
58360
  }
@@ -58407,8 +58454,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58407
58454
  /*
58408
58455
  * @Author: baozhoutao@steedos.com
58409
58456
  * @Date: 2022-07-05 15:55:39
58410
- * @LastEditors: liaodaxue
58411
- * @LastEditTime: 2023-10-20 11:38:25
58457
+ * @LastEditors: baozhoutao@steedos.com
58458
+ * @LastEditTime: 2024-01-16 11:14:34
58412
58459
  * @Description:
58413
58460
  */
58414
58461
 
@@ -59353,9 +59400,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
59353
59400
  */
59354
59401
  if(enable_tree){
59355
59402
  const rows = _.map(payload.data.rows, (item)=>{
59356
- delete item.children;
59357
- delete item.parent;
59358
- return item;
59403
+ if (!item.children) {
59404
+ return { ...item, children: [] };
59405
+ } else {
59406
+ return item;
59407
+ }
59359
59408
  })
59360
59409
  payload.data.rows = rows;
59361
59410
  }
@@ -59804,9 +59853,17 @@ async function lookupToAmis(field, readonly, ctx){
59804
59853
  }
59805
59854
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59806
59855
  if(readonly){
59807
- return {
59808
- type: getAmisStaticFieldType('picker', readonly),
59809
- tpl: getRelatedFieldTpl(field, ctx)
59856
+ if(field.reference_to){
59857
+ return {
59858
+ type: 'steedos-field',
59859
+ config: field,
59860
+ static: true
59861
+ }
59862
+ }else {
59863
+ return {
59864
+ type: getAmisStaticFieldType('picker', readonly),
59865
+ tpl: getRelatedFieldTpl(field, ctx)
59866
+ }
59810
59867
  }
59811
59868
  }
59812
59869
  if(field.reference_to && !lodash.exports.isString(field.reference_to) && !readonly){
@@ -60689,11 +60746,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60689
60746
  if(field.subFields){
60690
60747
  convertData = {
60691
60748
  type: 'steedos-input-table',
60692
- showIndex: true,
60693
60749
  editable: !readonly,
60694
60750
  addable: !readonly,
60695
60751
  removable: !readonly,
60696
- draggable: !readonly,
60697
60752
  fields: [],
60698
60753
  amis:{
60699
60754
  columnsTogglable: false
@@ -60745,7 +60800,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60745
60800
  if(field.is_wide || convertData.type === 'group'){
60746
60801
  convertData.className = 'col-span-2 m-0';
60747
60802
  }else {
60748
- convertData.className = 'm-1';
60803
+ convertData.className = 'm-0';
60749
60804
  }
60750
60805
  if(readonly){
60751
60806
  convertData.className = `${convertData.className} border-b`;
@@ -60770,6 +60825,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60770
60825
  }
60771
60826
  }
60772
60827
 
60828
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
60829
+ convertData.className = `${convertData.className || ''} hidden`;
60830
+ }
60831
+
60773
60832
  if(lodash.exports.isString(baseData.required)){
60774
60833
  if(baseData.required.startsWith("{{")){
60775
60834
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;