@steedos-widgets/amis-object 3.6.1 → 3.6.2-beta.2

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.
@@ -4785,16 +4785,17 @@ async function getQuickEditSchema(field, options){
4785
4785
  {
4786
4786
  actionType: "custom",
4787
4787
  script: `
4788
+ console.log("asdasd");
4788
4789
  let items = _.cloneDeep(event.data.items);
4789
4790
  let selectedItems = _.cloneDeep(event.data.selectedItems);
4790
4791
  if(event.data.isBatchEdit){
4791
4792
  selectedItems.forEach(function(selectedItem){
4792
4793
  selectedItem._display.${field.name} = event.data._display.${field.name};
4793
- doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
4794
+ doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "${options.objectName}" + "_display_" + selectedItem._index});
4794
4795
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
4795
4796
  })
4796
4797
  }else{
4797
- doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
4798
+ doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
4798
4799
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
4799
4800
  }
4800
4801
  `
@@ -5345,6 +5346,18 @@ async function getTableColumns$1(fields, options){
5345
5346
  if(field.type === 'datetime'){
5346
5347
  className += 'datetime-min-w';
5347
5348
  }
5349
+
5350
+ //field上的amis属性里的clssname需要单独判断类型合并
5351
+ if (typeof field.amis?.className == "object") {
5352
+ className = {
5353
+ [className]: "true",
5354
+ ...field.amis.className
5355
+ };
5356
+ } else if (typeof field.amis?.className == "string") {
5357
+ className = `${className} ${field.amis.className} `;
5358
+ }
5359
+ delete field.amis?.className;
5360
+
5348
5361
  if(!field.hidden && !field.extra){
5349
5362
  columnItem = Object.assign({}, {
5350
5363
  name: field.name,
@@ -5441,12 +5454,24 @@ function getMobileLines(tpls){
5441
5454
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
5442
5455
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
5443
5456
  }
5457
+ //支持字段amis属性配置classname,识别classname的类型,与原样式合并
5458
+ var className;
5459
+ if (typeof item.field.amis?.className == "object") {
5460
+ className = {
5461
+ [lineChildrenClassName]: "true",
5462
+ ...item.field.amis.className
5463
+ };
5464
+ } else if (typeof item.field.amis?.className == "string") {
5465
+ className = `${lineChildrenClassName} ${item.field.amis.className} `;
5466
+ } else {
5467
+ className = lineChildrenClassName;
5468
+ }
5444
5469
  lineChildren.push({
5445
5470
  "type": "tpl",
5446
5471
  "tpl": item.tpl,
5447
- "className": lineChildrenClassName
5472
+ className
5448
5473
  });
5449
-
5474
+
5450
5475
  if(item.field.is_wide){
5451
5476
  // 宽字段占整行
5452
5477
  isLeft = true;
@@ -5496,8 +5521,7 @@ async function getMobileTableColumns(fields, options){
5496
5521
  tpl = await getFieldTpl(field, options);
5497
5522
  }
5498
5523
  if(!tpl){
5499
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
5500
- tpl = `\${${field.name} | raw}`;
5524
+ tpl = `\${${field.name}}`;
5501
5525
  }
5502
5526
  if(!field.hidden && !field.extra){
5503
5527
  tpls.push({ field, tpl });
@@ -5510,7 +5534,7 @@ async function getMobileTableColumns(fields, options){
5510
5534
 
5511
5535
  let column = {
5512
5536
  name: nameField.name,
5513
- label: nameField.label,
5537
+ label: options.displayAs == 'split' ? '' : nameField.label,
5514
5538
  sortable: nameField.sortable,
5515
5539
  type: "button",
5516
5540
  level: "link",
@@ -6170,6 +6194,13 @@ async function getTableApi(mainObject, fields, options){
6170
6194
  }
6171
6195
  // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
6172
6196
  };
6197
+ const listviewComponent = $(".steedos-object-listview .antd-Table-table");
6198
+ const firstListviewComponent = listviewComponent && listviewComponent[0];
6199
+ if(firstListviewComponent){
6200
+ setTimeout(()=>{
6201
+ firstListviewComponent.scrollIntoView();
6202
+ }, 600);
6203
+ }
6173
6204
  ${options.adaptor || ''}
6174
6205
  return payload;
6175
6206
  `;
@@ -11545,6 +11576,10 @@ async function getObjectCRUD(objectSchema, fields, options){
11545
11576
  const rowsDiff = _.cloneDeep(api.data.rowsDiff);
11546
11577
  rowsDiff.forEach(function (item, index) {
11547
11578
  for(key in item){
11579
+ // image、select等字段清空值后保存的空字符串转换为null。
11580
+ if(item[key] === ''){
11581
+ item[key] = null;
11582
+ }
11548
11583
  if(_.includes(imageNames, key)){
11549
11584
  if(typeof item[key] == "string"){
11550
11585
  const match = item[key].match(/\\/([^\\/]+)$/);
@@ -13937,9 +13972,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
13937
13972
  */
13938
13973
  if(enable_tree){
13939
13974
  const rows = _.map(payload.data.rows, (item)=>{
13940
- delete item.children;
13941
- delete item.parent;
13942
- return item;
13975
+ if (!item.children) {
13976
+ return { ...item, children: [] };
13977
+ } else {
13978
+ return item;
13979
+ }
13943
13980
  })
13944
13981
  payload.data.rows = rows;
13945
13982
  }