@steedos-widgets/amis-object 3.6.11-beta.4 → 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.
@@ -11436,6 +11436,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11436
11436
  }
11437
11437
 
11438
11438
  const onChangeScript = `
11439
+ // console.log("==search=onChangeScript===");
11439
11440
  const scope = event.context.scoped;
11440
11441
  let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
11441
11442
  // let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
@@ -11451,14 +11452,14 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11451
11452
  }
11452
11453
  `;
11453
11454
 
11454
- // onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
11455
+ // 之前onSearchScript中加上了onChangeScript中的脚本,是因为amis 3.2不能用change事件执行onChangeScript
11455
11456
  // 而点击回车按键又不会触发blur事件,所以只能每次回车事件中额外再执行一次onChangeScript
11456
11457
  // 等升级到amis 3.4+,blur事件换成change事件执行onChangeScript,就可以不用在onSearchScript中执行onChangeScript了
11458
+ // 基于amis3.6,已经不再用blur事件触发onChangeScript,所以这里把之前加上的onChangeScript去掉了,如果以后还要换blur来触发onChangeScript脚本的话,这里又要加回onChangeScript脚本
11457
11459
  const onSearchScript = `
11458
- ${onChangeScript}
11459
-
11460
+ // console.log("==search=onSearchScript===");
11460
11461
  // 下面的脚本只为解决点击搜索表单取消按钮,再重新在其中输入过滤条件但是不点击搜索按钮或回车按键触发搜索,此时在快速搜索框输入过滤条件按回车按键会把搜索表单中的过滤条件清空的问题
11461
- // const scope = event.context.scoped;
11462
+ const scope = event.context.scoped;
11462
11463
  // 如果点击过顶部搜索栏表单的取消按钮,会把此处event.data.__super.__super.__super中的搜索表单项的所有字段设置为null
11463
11464
  // 点击取消按钮后继续在表单项中输入过滤条件且最后没有点击回车按键或点击表单项搜索按钮的话,在快速搜索中点击回车按钮提交搜索会所顶部搜索表单中的字段值清空
11464
11465
  let isLookup = event.data.isLookup;
@@ -11477,6 +11478,14 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11477
11478
  }, 500);
11478
11479
  `;
11479
11480
 
11481
+ const onBlurScript = `
11482
+ // console.log("==search=onBlurScript===");
11483
+ // 失去焦点事件触发搜索
11484
+ const scope = event.context.scoped;
11485
+ const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
11486
+ sb.handleSearch();
11487
+ `;
11488
+
11480
11489
  return {
11481
11490
  "type": "tooltip-wrapper",
11482
11491
  "id": "steedos_crud_toolbar_quick_search",
@@ -11494,7 +11503,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11494
11503
  "name": keywordsSearchBoxName,
11495
11504
  "placeholder": "快捷搜索",
11496
11505
  "value": crudKeywords,
11497
- // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
11506
+ "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
11498
11507
  "clearAndSubmit": true,
11499
11508
  "searchImediately": false,
11500
11509
  "onEvent": {
@@ -11506,13 +11515,21 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11506
11515
  }
11507
11516
  ]
11508
11517
  },
11509
- "blur": { //这里把change事件换成blur是因为amis 3.2change事件中setData会卡,升级到3.4+后就可以换回change事件
11518
+ "change": { //amis 3.2change事件中setData会卡,升级到amis 3.4+应该不会再卡了,所以这里换回change事件,如果还是会卡就要考虑重新换成blur事件
11510
11519
  "actions": [
11511
11520
  {
11512
11521
  "actionType": "custom",
11513
11522
  "script": onChangeScript
11514
11523
  },
11515
11524
  ]
11525
+ },
11526
+ "blur": {
11527
+ "actions": [
11528
+ {
11529
+ "actionType": "custom",
11530
+ "script": onBlurScript
11531
+ },
11532
+ ]
11516
11533
  }
11517
11534
  }
11518
11535
  }
@@ -11538,59 +11555,67 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11538
11555
  };
11539
11556
  }
11540
11557
  let toolbarReloadButton;
11541
- if(formFactor === 'SMALL'){
11542
- // const onReloadScript = `
11543
- // const scope = event.context.scoped;
11544
- // var listView = scope.parent.getComponents().find(function(n){
11545
- // return n.props.type === "crud";
11546
- // });
11547
- // listView.handleChangePage(1);
11548
- // `;
11549
- // toolbarReloadButton = {
11550
- // // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
11551
- // "type": "button",
11552
- // "align": "right",
11553
- // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11554
- // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11555
- // "tooltipPlacement": "top",
11556
- // "className": "bg-white p-2 rounded text-gray-500",
11557
- // "label": "",
11558
- // "icon": "fa fa-sync",
11559
- // "visibleOn": "${!showFieldsFilter}",
11560
- // "onEvent": {
11561
- // "click": {
11562
- // "actions": [
11563
- // {
11564
- // "actionType": "custom",
11565
- // "script": onReloadScript
11566
- // }
11567
- // ]
11568
- // }
11569
- // },
11570
- // };
11558
+ const onReloadScript = `
11559
+ // const scope = event.context.scoped;
11560
+ // var listView = scope.parent.getComponents().find(function(n){
11561
+ // return n.props.type === "crud";
11562
+ // });
11563
+ // listView.handleChangePage(1);
11571
11564
 
11572
- // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
11573
- toolbarReloadButton = {
11574
- "type": "reload",
11575
- "align": "right",
11576
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11577
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11578
- "tooltip":"",
11579
- "tooltipPlacement": "top",
11580
- "className": "bg-white p-2 rounded text-gray-500"
11581
- };
11582
- }
11583
- else {
11584
- toolbarReloadButton = {
11585
- "type": "reload",
11586
- "align": "right",
11587
- //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11588
- // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11589
- "tooltip":"",
11590
- "tooltipPlacement": "top",
11591
- "className": "bg-white p-2 rounded text-gray-500"
11592
- };
11593
- }
11565
+
11566
+ // 触发搜索,而不是reload,因为快速搜索输入框失去焦点已经会触发搜索了,这里用reload的话,会有bug
11567
+ // 不加setTimeout的话,快速搜索输入框失去焦点再触发此脚本还是有问题
11568
+ setTimeout(function(){
11569
+ const scope = event.context.scoped;
11570
+ const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
11571
+ sb.handleSearch();
11572
+ }, 500);
11573
+ `;
11574
+ toolbarReloadButton = {
11575
+ // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
11576
+ "type": "button",
11577
+ "align": "right",
11578
+ //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11579
+ // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11580
+ "tooltipPlacement": "top",
11581
+ "className": "bg-white p-2 rounded text-gray-500",
11582
+ "label": "",
11583
+ "icon": "fa fa-sync",
11584
+ // "visibleOn": "${!showFieldsFilter}",
11585
+ "onEvent": {
11586
+ "click": {
11587
+ "actions": [
11588
+ {
11589
+ "actionType": "custom",
11590
+ "script": onReloadScript
11591
+ }
11592
+ ]
11593
+ }
11594
+ },
11595
+ };
11596
+ // if(formFactor === 'SMALL'){
11597
+ // // 后续如果换成加载更多按钮的翻页模式的话,不可以直接使用下面的reload,需要换成上面的自定义脚本模式
11598
+ // toolbarReloadButton = {
11599
+ // "type": "reload",
11600
+ // "align": "right",
11601
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11602
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11603
+ // "tooltip":"",
11604
+ // "tooltipPlacement": "top",
11605
+ // "className": "bg-white p-2 rounded text-gray-500"
11606
+ // };
11607
+ // }
11608
+ // else{
11609
+ // toolbarReloadButton = {
11610
+ // "type": "reload",
11611
+ // "align": "right",
11612
+ // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11613
+ // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11614
+ // "tooltip":"",
11615
+ // "tooltipPlacement": "top",
11616
+ // "className": "bg-white p-2 rounded text-gray-500"
11617
+ // };
11618
+ // }
11594
11619
  let toolbarFilter;
11595
11620
  if(filterVisible){
11596
11621
  toolbarFilter ={
@@ -14429,6 +14454,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
14429
14454
  }
14430
14455
  }
14431
14456
 
14457
+ // amis@3.6.3和6.3.0如果不配置 trackExpression监听当前字段值变化,那么当前lookup字段(比如T)作为其它lookup字段(比如F)autoFill自动填充的目标字段的话,
14458
+ // F字段值变更后,虽然会自动填充值到T字段中,但是并不会触发T字段的source接口重新请求,这会造成T字段被填充后,可能会显示为字段id而不是label了,见issue:https://github.com/steedos/steedos-platform/issues/6601
14459
+ // amis@6.2.2不需要配置trackExpression不会有#6601所示问题,但是更高版本6.3.0也会有,所以这里只能加上trackExpression避开相关bug。
14460
+ source.trackExpression = `\${${field.name}}`;
14461
+
14432
14462
  source.data.$term = "$term";
14433
14463
  source.data.$self = "$$";
14434
14464
 
@@ -15317,8 +15347,8 @@ if(typeof window != 'undefined'){
15317
15347
  /*
15318
15348
  * @Author: baozhoutao@steedos.com
15319
15349
  * @Date: 2023-01-13 17:27:54
15320
- * @LastEditors: liaodaxue
15321
- * @LastEditTime: 2024-02-04 17:29:54
15350
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
15351
+ * @LastEditTime: 2024-04-11 14:14:43
15322
15352
  * @Description:
15323
15353
  */
15324
15354
 
@@ -15394,12 +15424,12 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
15394
15424
  "receiver": "${context.rootUrl}/s3/images",
15395
15425
  "name": field.name,
15396
15426
  "options": {
15397
- "menu": {
15398
- "insert": {
15399
- "title": "Insert",
15400
- "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
15401
- }
15402
- },
15427
+ // "menu": {
15428
+ // "insert": {
15429
+ // "title": "Insert",
15430
+ // "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
15431
+ // }
15432
+ // },
15403
15433
  "plugins": [
15404
15434
  "autoresize"
15405
15435
  ],
@@ -15415,13 +15445,14 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
15415
15445
  "type": "input-rich-text",
15416
15446
  "receiver": "${context.rootUrl}/s3/images",
15417
15447
  "options":{
15418
- "menu": {
15419
- "insert": {
15420
- "title": "Insert",
15421
- "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
15422
- }
15423
- },
15424
- "statusbar": false
15448
+ // "menu": {
15449
+ // "insert": {
15450
+ // "title": "Insert",
15451
+ // "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
15452
+ // }
15453
+ // },
15454
+ "statusbar": false,
15455
+ "menubar": false
15425
15456
  },
15426
15457
  "name": field.name
15427
15458
  }
@@ -15617,7 +15648,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15617
15648
  if(_$1__namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
15618
15649
  return;
15619
15650
  }
15620
- const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, required: _$1__namespace.has(ctx, 'required') ? ctx.required : field.required};
15651
+ const baseData = {name: ctx.fieldNamePrefix ? `${ctx.fieldNamePrefix}${field.name}` : field.name, label: field.label, labelRemark: field.inlineHelpText, description: field.description, required: _$1__namespace.has(ctx, 'required') ? ctx.required : field.required};
15621
15652
  let convertData = {
15622
15653
  };
15623
15654
  // if(_.includes(OMIT_FIELDS, field.name)){