@steedos-widgets/sortable 3.6.11-beta.5 → 3.6.11-beta.7

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.
@@ -58298,6 +58298,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58298
58298
  }
58299
58299
 
58300
58300
  const onChangeScript = `
58301
+ // console.log("==search=onChangeScript===");
58301
58302
  const scope = event.context.scoped;
58302
58303
  let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
58303
58304
  // let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
@@ -58313,14 +58314,13 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58313
58314
  }
58314
58315
  `;
58315
58316
 
58316
- // onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
58317
+ // 之前onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
58317
58318
  // 而点击回车按键又不会触发blur事件,所以只能每次回车事件中额外再执行一次onChangeScript
58318
58319
  // 等升级到amis 3.4+,blur事件换成change事件执行onChangeScript,就可以不用在onSearchScript中执行onChangeScript了
58320
+ // 基于amis3.6,已经不再用blur事件触发onChangeScript,所以这里把之前加上的onChangeScript去掉了,如果以后还要换blur来触发onChangeScript脚本的话,这里又要加回onChangeScript脚本
58319
58321
  const onSearchScript = `
58320
- ${onChangeScript}
58321
-
58322
58322
  // 下面的脚本只为解决点击搜索表单取消按钮,再重新在其中输入过滤条件但是不点击搜索按钮或回车按键触发搜索,此时在快速搜索框输入过滤条件按回车按键会把搜索表单中的过滤条件清空的问题
58323
- // const scope = event.context.scoped;
58323
+ const scope = event.context.scoped;
58324
58324
  // 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
58325
58325
  // 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
58326
58326
  let isLookup = event.data.isLookup;
@@ -58339,6 +58339,16 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58339
58339
  }, 500);
58340
58340
  `;
58341
58341
 
58342
+ // const onBlurScript = `
58343
+ // // 失去焦点事件触发搜索,先去掉,因为会有bug,见:[Bug]: 列表上快速搜索输入框输入内容后点击放大镜界面上列表未显示过滤后的内容 #6742
58344
+ // const value = event.data.value;
58345
+ // setTimeout(function(){
58346
+ // const scope = event.context.scoped;
58347
+ // const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
58348
+ // sb.handleSearch(value);
58349
+ // }, 500);
58350
+ // `;
58351
+
58342
58352
  return {
58343
58353
  "type": "tooltip-wrapper",
58344
58354
  "id": "steedos_crud_toolbar_quick_search",
@@ -58356,7 +58366,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58356
58366
  "name": keywordsSearchBoxName,
58357
58367
  "placeholder": "快捷搜索",
58358
58368
  "value": crudKeywords,
58359
- // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58369
+ "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
58360
58370
  "clearAndSubmit": true,
58361
58371
  "searchImediately": false,
58362
58372
  "onEvent": {
@@ -58368,14 +58378,22 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
58368
58378
  }
58369
58379
  ]
58370
58380
  },
58371
- "blur": { //这里把change事件换成blur是因为amis 3.2change事件中setData会卡,升级到3.4+后就可以换回change事件
58381
+ "change": { //amis 3.2change事件中setData会卡,升级到amis 3.4+应该不会再卡了,所以这里换回change事件,如果还是会卡就要考虑重新换成blur事件
58372
58382
  "actions": [
58373
58383
  {
58374
58384
  "actionType": "custom",
58375
58385
  "script": onChangeScript
58376
58386
  },
58377
58387
  ]
58378
- }
58388
+ },
58389
+ // "blur": {
58390
+ // "actions": [
58391
+ // {
58392
+ // "actionType": "custom",
58393
+ // "script": onBlurScript
58394
+ // },
58395
+ // ]
58396
+ // }
58379
58397
  }
58380
58398
  }
58381
58399
  ]
@@ -58400,59 +58418,64 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
58400
58418
  };
58401
58419
  }
58402
58420
  let toolbarReloadButton;
58403
- if(formFactor === 'SMALL'){
58404
- // const onReloadScript = `
58405
- // const scope = event.context.scoped;
58406
- // var listView = scope.parent.getComponents().find(function(n){
58407
- // return n.props.type === "crud";
58408
- // });
58409
- // listView.handleChangePage(1);
58410
- // `;
58411
- // toolbarReloadButton = {
58412
- // // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
58413
- // "type": "button",
58414
- // "align": "right",
58415
- // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58416
- // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58417
- // "tooltipPlacement": "top",
58418
- // "className": "bg-white p-2 rounded text-gray-500",
58419
- // "label": "",
58420
- // "icon": "fa fa-sync",
58421
- // "visibleOn": "${!showFieldsFilter}",
58422
- // "onEvent": {
58423
- // "click": {
58424
- // "actions": [
58425
- // {
58426
- // "actionType": "custom",
58427
- // "script": onReloadScript
58428
- // }
58429
- // ]
58430
- // }
58431
- // },
58432
- // };
58421
+ const onReloadScript = `
58422
+ // const scope = event.context.scoped;
58423
+ // var listView = scope.parent.getComponents().find(function(n){
58424
+ // return n.props.type === "crud";
58425
+ // });
58426
+ // listView.handleChangePage(1);
58433
58427
 
58434
- // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
58435
- toolbarReloadButton = {
58436
- "type": "reload",
58437
- "align": "right",
58438
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58439
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58440
- "tooltip":"",
58441
- "tooltipPlacement": "top",
58442
- "className": "bg-white p-2 rounded text-gray-500"
58443
- };
58444
- }
58445
- else {
58446
- toolbarReloadButton = {
58447
- "type": "reload",
58448
- "align": "right",
58449
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58450
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58451
- "tooltip":"",
58452
- "tooltipPlacement": "top",
58453
- "className": "bg-white p-2 rounded text-gray-500"
58454
- };
58455
- }
58428
+
58429
+ // 触发搜索,而不是reload,因为使用search-box可以在amissdk是3.6.3-patch.8+实现快速搜索输入框中过滤条件变更时再点刷新可以自动跳转到第一页面
58430
+ const scope = event.context.scoped;
58431
+ const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
58432
+ sb.handleSearch();
58433
+ `;
58434
+ toolbarReloadButton = {
58435
+ // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
58436
+ "type": "button",
58437
+ "align": "right",
58438
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58439
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58440
+ "tooltipPlacement": "top",
58441
+ "className": "bg-white p-2 rounded text-gray-500",
58442
+ "label": "",
58443
+ "icon": "fa fa-sync",
58444
+ // "visibleOn": "${!showFieldsFilter}",
58445
+ "onEvent": {
58446
+ "click": {
58447
+ "actions": [
58448
+ {
58449
+ "actionType": "custom",
58450
+ "script": onReloadScript
58451
+ }
58452
+ ]
58453
+ }
58454
+ },
58455
+ };
58456
+ // if(formFactor === 'SMALL'){
58457
+ // // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
58458
+ // toolbarReloadButton = {
58459
+ // "type": "reload",
58460
+ // "align": "right",
58461
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58462
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58463
+ // "tooltip":"",
58464
+ // "tooltipPlacement": "top",
58465
+ // "className": "bg-white p-2 rounded text-gray-500"
58466
+ // };
58467
+ // }
58468
+ // else{
58469
+ // toolbarReloadButton = {
58470
+ // "type": "reload",
58471
+ // "align": "right",
58472
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
58473
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
58474
+ // "tooltip":"",
58475
+ // "tooltipPlacement": "top",
58476
+ // "className": "bg-white p-2 rounded text-gray-500"
58477
+ // };
58478
+ // }
58456
58479
  let toolbarFilter;
58457
58480
  if(filterVisible){
58458
58481
  toolbarFilter ={
@@ -59583,6 +59606,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
59583
59606
  }
59584
59607
  }
59585
59608
 
59609
+ // amis@3.6.3和6.3.0如果不配置 trackExpression监听当前字段值变化,那么当前lookup字段(比如T)作为其它lookup字段(比如F)autoFill自动填充的目标字段的话,
59610
+ // F字段值变更后,虽然会自动填充值到T字段中,但是并不会触发T字段的source接口重新请求,这会造成T字段被填充后,可能会显示为字段id而不是label了,见issue:https://github.com/steedos/steedos-platform/issues/6601
59611
+ // amis@6.2.2不需要配置trackExpression不会有#6601所示问题,但是更高版本6.3.0也会有,所以这里只能加上trackExpression避开相关bug。
59612
+ source.trackExpression = `\${${field.name}}`;
59613
+
59586
59614
  source.data.$term = "$term";
59587
59615
  source.data.$self = "$$";
59588
59616
 
@@ -60661,7 +60689,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
60661
60689
  if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
60662
60690
  return;
60663
60691
  }
60664
- const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: lodash.exports.has(ctx, 'required') ? ctx.required : field.required};
60692
+ const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, description: field.description, required: lodash.exports.has(ctx, 'required') ? ctx.required : field.required};
60665
60693
  let convertData = {
60666
60694
  };
60667
60695
  // if(_.includes(OMIT_FIELDS, field.name)){