@steedos-widgets/sortable 3.6.1 → 3.6.2-beta.10

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}}`
@@ -54742,9 +54746,9 @@ var frontend_display_type_is_split = "分栏视图";
54742
54746
  var frontend_display_as = "显示为";
54743
54747
  var frontend_record_sum = "个项目";
54744
54748
  var frontend_button_reload_tooltip = "刷新";
54745
- var frontend_button_search_tooltip = "筛选";
54749
+ var frontend_button_search_tooltip = "搜索";
54746
54750
  var frontend_fields_filter_button_search = "搜索";
54747
- var frontend_fields_filter_button_settings = "设置搜索项";
54751
+ var frontend_fields_filter_button_settings = "选择搜索项";
54748
54752
  var frontend_button_listview_control_tooltip = "列表视图控制";
54749
54753
  var frontend_button_listview_control_label = "列表视图控制";
54750
54754
  var frontend_listview_control_columns = "显示的列";
@@ -54943,16 +54947,17 @@ async function getQuickEditSchema(field, options){
54943
54947
  {
54944
54948
  actionType: "custom",
54945
54949
  script: `
54950
+ console.log("asdasd");
54946
54951
  let items = _.cloneDeep(event.data.items);
54947
54952
  let selectedItems = _.cloneDeep(event.data.selectedItems);
54948
54953
  if(event.data.isBatchEdit){
54949
54954
  selectedItems.forEach(function(selectedItem){
54950
54955
  selectedItem._display.${field.name} = event.data._display.${field.name};
54951
- doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
54956
+ doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "${options.objectName}" + "_display_" + selectedItem._index});
54952
54957
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
54953
54958
  })
54954
54959
  }else{
54955
- doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
54960
+ doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
54956
54961
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
54957
54962
  }
54958
54963
  `
@@ -55398,9 +55403,13 @@ async function getTableColumns(fields, options){
55398
55403
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55399
55404
  let className = "";
55400
55405
  if(field.wrap != true){
55401
- className += " whitespace-nowrap ";
55406
+ if(field.wrap != false && field.is_wide){
55407
+ className += " break-words ";
55408
+ }else {
55409
+ className += " whitespace-nowrap ";
55410
+ }
55402
55411
  }else {
55403
- className += " break-all ";
55412
+ className += " break-words ";
55404
55413
  }
55405
55414
  let columnItem;
55406
55415
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -55497,12 +55506,24 @@ async function getTableColumns(fields, options){
55497
55506
  if(field.type === 'textarea'){
55498
55507
  className += 'min-w-56';
55499
55508
  }
55500
- if(field.type === 'date'){
55501
- className += 'date-min-w';
55502
- }
55503
- if(field.type === 'datetime'){
55504
- className += 'datetime-min-w';
55509
+ // if(field.type === 'date'){
55510
+ // className += 'date-min-w';
55511
+ // }
55512
+ // if(field.type === 'datetime'){
55513
+ // className += 'datetime-min-w';
55514
+ // }
55515
+
55516
+ //field上的amis属性里的clssname需要单独判断类型合并
55517
+ if (typeof field.amis?.className == "object") {
55518
+ className = {
55519
+ [className]: "true",
55520
+ ...field.amis.className
55521
+ };
55522
+ } else if (typeof field.amis?.className == "string") {
55523
+ className = `${className} ${field.amis.className} `;
55505
55524
  }
55525
+ delete field.amis?.className;
55526
+
55506
55527
  if(!field.hidden && !field.extra){
55507
55528
  columnItem = Object.assign({}, {
55508
55529
  name: field.name,
@@ -55585,7 +55606,7 @@ function getMobileLines(tpls){
55585
55606
  }
55586
55607
  if(isLeft){
55587
55608
  // 左侧半行
55588
- lineChildrenClassName = "steedos-listview-item-left truncate";
55609
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
55589
55610
  if(item.field.is_wide){
55590
55611
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
55591
55612
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -55597,14 +55618,26 @@ function getMobileLines(tpls){
55597
55618
  }
55598
55619
  else {
55599
55620
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
55600
- lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
55621
+ lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
55622
+ }
55623
+ //支持字段amis属性配置classname,识别classname的类型,与原样式合并
55624
+ var className;
55625
+ if (typeof item.field.amis?.className == "object") {
55626
+ className = {
55627
+ [lineChildrenClassName]: "true",
55628
+ ...item.field.amis.className
55629
+ };
55630
+ } else if (typeof item.field.amis?.className == "string") {
55631
+ className = `${lineChildrenClassName} ${item.field.amis.className} `;
55632
+ } else {
55633
+ className = lineChildrenClassName;
55601
55634
  }
55602
55635
  lineChildren.push({
55603
55636
  "type": "tpl",
55604
55637
  "tpl": item.tpl,
55605
- "className": lineChildrenClassName
55638
+ className
55606
55639
  });
55607
-
55640
+
55608
55641
  if(item.field.is_wide){
55609
55642
  // 宽字段占整行
55610
55643
  isLeft = true;
@@ -55654,8 +55687,7 @@ async function getMobileTableColumns(fields, options){
55654
55687
  tpl = await getFieldTpl(field, options);
55655
55688
  }
55656
55689
  if(!tpl){
55657
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
55658
- tpl = `\${${field.name} | raw}`;
55690
+ tpl = `\${${field.name}}`;
55659
55691
  }
55660
55692
  if(!field.hidden && !field.extra){
55661
55693
  tpls.push({ field, tpl });
@@ -55668,7 +55700,7 @@ async function getMobileTableColumns(fields, options){
55668
55700
 
55669
55701
  let column = {
55670
55702
  name: nameField.name,
55671
- label: nameField.label,
55703
+ label: options.displayAs == 'split' ? '' : nameField.label,
55672
55704
  sortable: nameField.sortable,
55673
55705
  type: "button",
55674
55706
  level: "link",
@@ -55697,7 +55729,15 @@ async function getMobileTableColumns(fields, options){
55697
55729
  "actions": [
55698
55730
  {
55699
55731
  "script": `
55700
- let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
55732
+ let cms_url = '';
55733
+ let value = event.data.versions[0];
55734
+ if(value){
55735
+ if(value.url){
55736
+ cms_url = value.url;
55737
+ }else{
55738
+ cms_url = "/api/files/files/"+value+"?download=true"
55739
+ }
55740
+ }
55701
55741
  Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55702
55742
  `,
55703
55743
  "actionType": "custom"
@@ -55813,7 +55853,8 @@ async function getTableOperation(ctx){
55813
55853
  label: " ",
55814
55854
  fixed: 'right',
55815
55855
  labelClassName: 'text-center',
55816
- className: 'text-center steedos-listview-operation w-10',
55856
+ //TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
55857
+ className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
55817
55858
  buttons: [
55818
55859
  {
55819
55860
  "type": "steedos-dropdown-button",
@@ -55909,7 +55950,7 @@ async function getTableSchema$1(fields, options){
55909
55950
  }
55910
55951
  return {
55911
55952
  mode: "cards",
55912
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55953
+ perPageAvailable: [20, 50, 100, 500],
55913
55954
  name: "thelist",
55914
55955
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55915
55956
  className: "",
@@ -55942,7 +55983,7 @@ async function getTableSchema$1(fields, options){
55942
55983
 
55943
55984
  return {
55944
55985
  mode: "table",
55945
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55986
+ perPageAvailable: [20, 50, 100, 500],
55946
55987
  name: "thelist",
55947
55988
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55948
55989
  className: "",
@@ -56068,7 +56109,7 @@ async function getListBody(fields, options){
56068
56109
 
56069
56110
  function getDefaultParams(options){
56070
56111
  return {
56071
- perPage: options.top || options.perPage || 10
56112
+ perPage: options.top || options.perPage || 20
56072
56113
  }
56073
56114
  }
56074
56115
 
@@ -56122,7 +56163,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
56122
56163
  "objectApiName": "\${objectName}",
56123
56164
  "recordId": "",
56124
56165
  "mode": "edit",
56125
- "layout": "normal"
56126
56166
  };
56127
56167
 
56128
56168
  if (payload && payload.schema) {
@@ -57906,14 +57946,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57906
57946
  {
57907
57947
  "type": "button",
57908
57948
  "label": instance.t('frontend_display_type_is_table'),
57909
- "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');",
57949
+ "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');",
57910
57950
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57911
57951
  "rightIconClassName": "m-l-sm"
57912
57952
  },
57913
57953
  {
57914
57954
  "type": "button",
57915
57955
  "label": instance.t('frontend_display_type_is_split'),
57916
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57956
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
57917
57957
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57918
57958
  "rightIconClassName": "m-l-sm"
57919
57959
  }
@@ -58056,7 +58096,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58056
58096
  {
58057
58097
  "type": "search-box",
58058
58098
  "name": keywordsSearchBoxName,
58059
- "placeholder": "搜索此列表",
58099
+ "placeholder": "快捷搜索",
58060
58100
  "value": crudKeywords,
58061
58101
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58062
58102
  "clearAndSubmit": true,
@@ -58260,7 +58300,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58260
58300
  // ]
58261
58301
  if(options.displayAs === 'split'){
58262
58302
  return [
58263
- "switch-per-page",
58303
+ {
58304
+ "type": "switch-per-page",
58305
+ "visibleOn": "${count >= 20}"
58306
+ },
58264
58307
  {
58265
58308
  "type": "pagination",
58266
58309
  "maxButtons": 5,
@@ -58282,7 +58325,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58282
58325
  else {
58283
58326
  if(options && options.isRelated){
58284
58327
  return [
58285
- "statistics",
58286
58328
  {
58287
58329
  "type": "pagination",
58288
58330
  "maxButtons": 10,
@@ -58295,7 +58337,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58295
58337
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
58296
58338
  const is_lookup = options.isLookup;
58297
58339
  const commonConfig = [
58298
- "statistics",
58299
58340
  {
58300
58341
  "type": "pagination",
58301
58342
  "maxButtons": 10,
@@ -58306,7 +58347,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58306
58347
  if (no_pagination && is_lookup) {
58307
58348
  return commonConfig;
58308
58349
  } else {
58309
- return ["switch-per-page", ...commonConfig];
58350
+ return [{
58351
+ "type": "switch-per-page",
58352
+ "visibleOn": "${count >= 20}"
58353
+ }, ...commonConfig];
58310
58354
  }
58311
58355
  }
58312
58356
  }
@@ -58406,8 +58450,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58406
58450
  /*
58407
58451
  * @Author: baozhoutao@steedos.com
58408
58452
  * @Date: 2022-07-05 15:55:39
58409
- * @LastEditors: liaodaxue
58410
- * @LastEditTime: 2023-10-20 11:38:25
58453
+ * @LastEditors: baozhoutao@steedos.com
58454
+ * @LastEditTime: 2024-01-16 11:14:34
58411
58455
  * @Description:
58412
58456
  */
58413
58457
 
@@ -59352,9 +59396,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
59352
59396
  */
59353
59397
  if(enable_tree){
59354
59398
  const rows = _.map(payload.data.rows, (item)=>{
59355
- delete item.children;
59356
- delete item.parent;
59357
- return item;
59399
+ if (!item.children) {
59400
+ return { ...item, children: [] };
59401
+ } else {
59402
+ return item;
59403
+ }
59358
59404
  })
59359
59405
  payload.data.rows = rows;
59360
59406
  }
@@ -59803,9 +59849,17 @@ async function lookupToAmis(field, readonly, ctx){
59803
59849
  }
59804
59850
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59805
59851
  if(readonly){
59806
- return {
59807
- type: getAmisStaticFieldType('picker', readonly),
59808
- tpl: getRelatedFieldTpl(field, ctx)
59852
+ if(field.reference_to){
59853
+ return {
59854
+ type: 'steedos-field',
59855
+ config: field,
59856
+ static: true
59857
+ }
59858
+ }else {
59859
+ return {
59860
+ type: getAmisStaticFieldType('picker', readonly),
59861
+ tpl: getRelatedFieldTpl(field, ctx)
59862
+ }
59809
59863
  }
59810
59864
  }
59811
59865
  if(field.reference_to && !lodash.exports.isString(field.reference_to) && !readonly){
@@ -60688,11 +60742,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60688
60742
  if(field.subFields){
60689
60743
  convertData = {
60690
60744
  type: 'steedos-input-table',
60691
- showIndex: true,
60692
60745
  editable: !readonly,
60693
60746
  addable: !readonly,
60694
60747
  removable: !readonly,
60695
- draggable: !readonly,
60696
60748
  fields: [],
60697
60749
  amis:{
60698
60750
  columnsTogglable: false
@@ -60744,7 +60796,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60744
60796
  if(field.is_wide || convertData.type === 'group'){
60745
60797
  convertData.className = 'col-span-2 m-0';
60746
60798
  }else {
60747
- convertData.className = 'm-1';
60799
+ convertData.className = 'm-0';
60748
60800
  }
60749
60801
  if(readonly){
60750
60802
  convertData.className = `${convertData.className} border-b`;
@@ -60769,6 +60821,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60769
60821
  }
60770
60822
  }
60771
60823
 
60824
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
60825
+ convertData.className = `${convertData.className || ''} hidden`;
60826
+ }
60827
+
60772
60828
  if(lodash.exports.isString(baseData.required)){
60773
60829
  if(baseData.required.startsWith("{{")){
60774
60830
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;