@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.
package/dist/assets.json CHANGED
@@ -3,8 +3,8 @@
3
3
  {
4
4
  "package": "@steedos-widgets/sortable",
5
5
  "urls": [
6
- "https://unpkg.com/@steedos-widgets/sortable@3.6.1/dist/sortable.umd.js",
7
- "https://unpkg.com/@steedos-widgets/sortable@3.6.1/dist/sortable.umd.css"
6
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.2-beta.10/dist/sortable.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.2-beta.10/dist/sortable.umd.css"
8
8
  ],
9
9
  "library": "BuilderSortable"
10
10
  }
@@ -15,10 +15,10 @@
15
15
  "npm": {
16
16
  "package": "@steedos-widgets/sortable"
17
17
  },
18
- "url": "https://unpkg.com/@steedos-widgets/sortable@3.6.1/dist/meta.js",
18
+ "url": "https://unpkg.com/@steedos-widgets/sortable@3.6.2-beta.10/dist/meta.js",
19
19
  "urls": {
20
- "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.1/dist/meta.js",
21
- "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.1/dist/meta.js"
20
+ "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.2-beta.10/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.2-beta.10/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -53937,22 +53937,26 @@ 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
+ return value ? value : defaultDisplay;
53951
53955
  },
53952
53956
 
53953
53957
  setTabDisplayAs(tab_id, displayAs){
53954
53958
  const key = `tab_${tab_id}_display`;
53955
- localStorage.setItem(key, displayAs);
53959
+ sessionStorage.setItem(key, displayAs);
53956
53960
  },
53957
53961
  getAppPath({formFactor, appId}){
53958
53962
  return `/app/${appId}`;
@@ -54106,7 +54110,7 @@ function getSelectMap(selectOptions){
54106
54110
 
54107
54111
  function getNameTplUrl(field, ctx){
54108
54112
  if(ctx.objectName === 'cms_files'){
54109
- return `\${context.rootUrl}/api/files/files/\${versions[0]}?download=true`
54113
+ return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
54110
54114
  }
54111
54115
  const href = Router.getObjectDetailPath({
54112
54116
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
@@ -54746,9 +54750,9 @@ var frontend_display_type_is_split = "分栏视图";
54746
54750
  var frontend_display_as = "显示为";
54747
54751
  var frontend_record_sum = "个项目";
54748
54752
  var frontend_button_reload_tooltip = "刷新";
54749
- var frontend_button_search_tooltip = "筛选";
54753
+ var frontend_button_search_tooltip = "搜索";
54750
54754
  var frontend_fields_filter_button_search = "搜索";
54751
- var frontend_fields_filter_button_settings = "设置搜索项";
54755
+ var frontend_fields_filter_button_settings = "选择搜索项";
54752
54756
  var frontend_button_listview_control_tooltip = "列表视图控制";
54753
54757
  var frontend_button_listview_control_label = "列表视图控制";
54754
54758
  var frontend_listview_control_columns = "显示的列";
@@ -54947,16 +54951,17 @@ async function getQuickEditSchema(field, options){
54947
54951
  {
54948
54952
  actionType: "custom",
54949
54953
  script: `
54954
+ console.log("asdasd");
54950
54955
  let items = _.cloneDeep(event.data.items);
54951
54956
  let selectedItems = _.cloneDeep(event.data.selectedItems);
54952
54957
  if(event.data.isBatchEdit){
54953
54958
  selectedItems.forEach(function(selectedItem){
54954
54959
  selectedItem._display.${field.name} = event.data._display.${field.name};
54955
- doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
54960
+ doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "${options.objectName}" + "_display_" + selectedItem._index});
54956
54961
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
54957
54962
  })
54958
54963
  }else{
54959
- doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
54964
+ doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
54960
54965
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
54961
54966
  }
54962
54967
  `
@@ -55402,9 +55407,13 @@ async function getTableColumns(fields, options){
55402
55407
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55403
55408
  let className = "";
55404
55409
  if(field.wrap != true){
55405
- className += " whitespace-nowrap ";
55410
+ if(field.wrap != false && field.is_wide){
55411
+ className += " break-words ";
55412
+ }else {
55413
+ className += " whitespace-nowrap ";
55414
+ }
55406
55415
  }else {
55407
- className += " break-all ";
55416
+ className += " break-words ";
55408
55417
  }
55409
55418
  let columnItem;
55410
55419
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -55501,12 +55510,24 @@ async function getTableColumns(fields, options){
55501
55510
  if(field.type === 'textarea'){
55502
55511
  className += 'min-w-56';
55503
55512
  }
55504
- if(field.type === 'date'){
55505
- className += 'date-min-w';
55506
- }
55507
- if(field.type === 'datetime'){
55508
- 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} `;
55509
55528
  }
55529
+ delete field.amis?.className;
55530
+
55510
55531
  if(!field.hidden && !field.extra){
55511
55532
  columnItem = Object.assign({}, {
55512
55533
  name: field.name,
@@ -55589,7 +55610,7 @@ function getMobileLines(tpls){
55589
55610
  }
55590
55611
  if(isLeft){
55591
55612
  // 左侧半行
55592
- lineChildrenClassName = "steedos-listview-item-left truncate";
55613
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
55593
55614
  if(item.field.is_wide){
55594
55615
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
55595
55616
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -55601,14 +55622,26 @@ function getMobileLines(tpls){
55601
55622
  }
55602
55623
  else {
55603
55624
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
55604
- 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;
55605
55638
  }
55606
55639
  lineChildren.push({
55607
55640
  "type": "tpl",
55608
55641
  "tpl": item.tpl,
55609
- "className": lineChildrenClassName
55642
+ className
55610
55643
  });
55611
-
55644
+
55612
55645
  if(item.field.is_wide){
55613
55646
  // 宽字段占整行
55614
55647
  isLeft = true;
@@ -55658,8 +55691,7 @@ async function getMobileTableColumns(fields, options){
55658
55691
  tpl = await getFieldTpl(field, options);
55659
55692
  }
55660
55693
  if(!tpl){
55661
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
55662
- tpl = `\${${field.name} | raw}`;
55694
+ tpl = `\${${field.name}}`;
55663
55695
  }
55664
55696
  if(!field.hidden && !field.extra){
55665
55697
  tpls.push({ field, tpl });
@@ -55672,7 +55704,7 @@ async function getMobileTableColumns(fields, options){
55672
55704
 
55673
55705
  let column = {
55674
55706
  name: nameField.name,
55675
- label: nameField.label,
55707
+ label: options.displayAs == 'split' ? '' : nameField.label,
55676
55708
  sortable: nameField.sortable,
55677
55709
  type: "button",
55678
55710
  level: "link",
@@ -55701,7 +55733,15 @@ async function getMobileTableColumns(fields, options){
55701
55733
  "actions": [
55702
55734
  {
55703
55735
  "script": `
55704
- 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
+ }
55705
55745
  Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
55706
55746
  `,
55707
55747
  "actionType": "custom"
@@ -55817,7 +55857,8 @@ async function getTableOperation(ctx){
55817
55857
  label: " ",
55818
55858
  fixed: 'right',
55819
55859
  labelClassName: 'text-center',
55820
- 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',
55821
55862
  buttons: [
55822
55863
  {
55823
55864
  "type": "steedos-dropdown-button",
@@ -55913,7 +55954,7 @@ async function getTableSchema$1(fields, options){
55913
55954
  }
55914
55955
  return {
55915
55956
  mode: "cards",
55916
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55957
+ perPageAvailable: [20, 50, 100, 500],
55917
55958
  name: "thelist",
55918
55959
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55919
55960
  className: "",
@@ -55946,7 +55987,7 @@ async function getTableSchema$1(fields, options){
55946
55987
 
55947
55988
  return {
55948
55989
  mode: "table",
55949
- perPageAvailable: [5, 10, 20, 50, 100, 500],
55990
+ perPageAvailable: [20, 50, 100, 500],
55950
55991
  name: "thelist",
55951
55992
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
55952
55993
  className: "",
@@ -56072,7 +56113,7 @@ async function getListBody(fields, options){
56072
56113
 
56073
56114
  function getDefaultParams(options){
56074
56115
  return {
56075
- perPage: options.top || options.perPage || 10
56116
+ perPage: options.top || options.perPage || 20
56076
56117
  }
56077
56118
  }
56078
56119
 
@@ -56126,7 +56167,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
56126
56167
  "objectApiName": "\${objectName}",
56127
56168
  "recordId": "",
56128
56169
  "mode": "edit",
56129
- "layout": "normal"
56130
56170
  };
56131
56171
 
56132
56172
  if (payload && payload.schema) {
@@ -57910,14 +57950,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
57910
57950
  {
57911
57951
  "type": "button",
57912
57952
  "label": instance.t('frontend_display_type_is_table'),
57913
- "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');",
57914
57954
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
57915
57955
  "rightIconClassName": "m-l-sm"
57916
57956
  },
57917
57957
  {
57918
57958
  "type": "button",
57919
57959
  "label": instance.t('frontend_display_type_is_split'),
57920
- "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);",
57921
57961
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
57922
57962
  "rightIconClassName": "m-l-sm"
57923
57963
  }
@@ -58060,7 +58100,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58060
58100
  {
58061
58101
  "type": "search-box",
58062
58102
  "name": keywordsSearchBoxName,
58063
- "placeholder": "搜索此列表",
58103
+ "placeholder": "快捷搜索",
58064
58104
  "value": crudKeywords,
58065
58105
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58066
58106
  "clearAndSubmit": true,
@@ -58264,7 +58304,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58264
58304
  // ]
58265
58305
  if(options.displayAs === 'split'){
58266
58306
  return [
58267
- "switch-per-page",
58307
+ {
58308
+ "type": "switch-per-page",
58309
+ "visibleOn": "${count >= 20}"
58310
+ },
58268
58311
  {
58269
58312
  "type": "pagination",
58270
58313
  "maxButtons": 5,
@@ -58286,7 +58329,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58286
58329
  else {
58287
58330
  if(options && options.isRelated){
58288
58331
  return [
58289
- "statistics",
58290
58332
  {
58291
58333
  "type": "pagination",
58292
58334
  "maxButtons": 10,
@@ -58299,7 +58341,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58299
58341
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
58300
58342
  const is_lookup = options.isLookup;
58301
58343
  const commonConfig = [
58302
- "statistics",
58303
58344
  {
58304
58345
  "type": "pagination",
58305
58346
  "maxButtons": 10,
@@ -58310,7 +58351,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
58310
58351
  if (no_pagination && is_lookup) {
58311
58352
  return commonConfig;
58312
58353
  } else {
58313
- return ["switch-per-page", ...commonConfig];
58354
+ return [{
58355
+ "type": "switch-per-page",
58356
+ "visibleOn": "${count >= 20}"
58357
+ }, ...commonConfig];
58314
58358
  }
58315
58359
  }
58316
58360
  }
@@ -58410,8 +58454,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58410
58454
  /*
58411
58455
  * @Author: baozhoutao@steedos.com
58412
58456
  * @Date: 2022-07-05 15:55:39
58413
- * @LastEditors: liaodaxue
58414
- * @LastEditTime: 2023-10-20 11:38:25
58457
+ * @LastEditors: baozhoutao@steedos.com
58458
+ * @LastEditTime: 2024-01-16 11:14:34
58415
58459
  * @Description:
58416
58460
  */
58417
58461
 
@@ -59356,9 +59400,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
59356
59400
  */
59357
59401
  if(enable_tree){
59358
59402
  const rows = _.map(payload.data.rows, (item)=>{
59359
- delete item.children;
59360
- delete item.parent;
59361
- return item;
59403
+ if (!item.children) {
59404
+ return { ...item, children: [] };
59405
+ } else {
59406
+ return item;
59407
+ }
59362
59408
  })
59363
59409
  payload.data.rows = rows;
59364
59410
  }
@@ -59807,9 +59853,17 @@ async function lookupToAmis(field, readonly, ctx){
59807
59853
  }
59808
59854
  // console.log(`lookupToAmis====`, field, readonly, ctx)
59809
59855
  if(readonly){
59810
- return {
59811
- type: getAmisStaticFieldType('picker', readonly),
59812
- 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
+ }
59813
59867
  }
59814
59868
  }
59815
59869
  if(field.reference_to && !lodash.exports.isString(field.reference_to) && !readonly){
@@ -60692,11 +60746,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60692
60746
  if(field.subFields){
60693
60747
  convertData = {
60694
60748
  type: 'steedos-input-table',
60695
- showIndex: true,
60696
60749
  editable: !readonly,
60697
60750
  addable: !readonly,
60698
60751
  removable: !readonly,
60699
- draggable: !readonly,
60700
60752
  fields: [],
60701
60753
  amis:{
60702
60754
  columnsTogglable: false
@@ -60748,7 +60800,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60748
60800
  if(field.is_wide || convertData.type === 'group'){
60749
60801
  convertData.className = 'col-span-2 m-0';
60750
60802
  }else {
60751
- convertData.className = 'm-1';
60803
+ convertData.className = 'm-0';
60752
60804
  }
60753
60805
  if(readonly){
60754
60806
  convertData.className = `${convertData.className} border-b`;
@@ -60773,6 +60825,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60773
60825
  }
60774
60826
  }
60775
60827
 
60828
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
60829
+ convertData.className = `${convertData.className || ''} hidden`;
60830
+ }
60831
+
60776
60832
  if(lodash.exports.isString(baseData.required)){
60777
60833
  if(baseData.required.startsWith("{{")){
60778
60834
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;