@steedos-widgets/amis-object 3.6.2-beta.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.
@@ -5346,6 +5346,18 @@ async function getTableColumns$1(fields, options){
5346
5346
  if(field.type === 'datetime'){
5347
5347
  className += 'datetime-min-w';
5348
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
+
5349
5361
  if(!field.hidden && !field.extra){
5350
5362
  columnItem = Object.assign({}, {
5351
5363
  name: field.name,
@@ -5442,12 +5454,24 @@ function getMobileLines(tpls){
5442
5454
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
5443
5455
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
5444
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
+ }
5445
5469
  lineChildren.push({
5446
5470
  "type": "tpl",
5447
5471
  "tpl": item.tpl,
5448
- "className": lineChildrenClassName
5472
+ className
5449
5473
  });
5450
-
5474
+
5451
5475
  if(item.field.is_wide){
5452
5476
  // 宽字段占整行
5453
5477
  isLeft = true;
@@ -5497,8 +5521,7 @@ async function getMobileTableColumns(fields, options){
5497
5521
  tpl = await getFieldTpl(field, options);
5498
5522
  }
5499
5523
  if(!tpl){
5500
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
5501
- tpl = `\${${field.name} | raw}`;
5524
+ tpl = `\${${field.name}}`;
5502
5525
  }
5503
5526
  if(!field.hidden && !field.extra){
5504
5527
  tpls.push({ field, tpl });
@@ -5511,7 +5534,7 @@ async function getMobileTableColumns(fields, options){
5511
5534
 
5512
5535
  let column = {
5513
5536
  name: nameField.name,
5514
- label: nameField.label,
5537
+ label: options.displayAs == 'split' ? '' : nameField.label,
5515
5538
  sortable: nameField.sortable,
5516
5539
  type: "button",
5517
5540
  level: "link",
@@ -6171,6 +6194,13 @@ async function getTableApi(mainObject, fields, options){
6171
6194
  }
6172
6195
  // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
6173
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
+ }
6174
6204
  ${options.adaptor || ''}
6175
6205
  return payload;
6176
6206
  `;
@@ -11546,6 +11576,10 @@ async function getObjectCRUD(objectSchema, fields, options){
11546
11576
  const rowsDiff = _.cloneDeep(api.data.rowsDiff);
11547
11577
  rowsDiff.forEach(function (item, index) {
11548
11578
  for(key in item){
11579
+ // image、select等字段清空值后保存的空字符串转换为null。
11580
+ if(item[key] === ''){
11581
+ item[key] = null;
11582
+ }
11549
11583
  if(_.includes(imageNames, key)){
11550
11584
  if(typeof item[key] == "string"){
11551
11585
  const match = item[key].match(/\\/([^\\/]+)$/);
@@ -13938,9 +13972,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
13938
13972
  */
13939
13973
  if(enable_tree){
13940
13974
  const rows = _.map(payload.data.rows, (item)=>{
13941
- delete item.children;
13942
- delete item.parent;
13943
- return item;
13975
+ if (!item.children) {
13976
+ return { ...item, children: [] };
13977
+ } else {
13978
+ return item;
13979
+ }
13944
13980
  })
13945
13981
  payload.data.rows = rows;
13946
13982
  }