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

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