@steedos-widgets/amis-lib 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.
package/dist/index.esm.js CHANGED
@@ -2165,6 +2165,18 @@ async function getTableColumns(fields, options){
2165
2165
  if(field.type === 'datetime'){
2166
2166
  className += 'datetime-min-w';
2167
2167
  }
2168
+
2169
+ //field上的amis属性里的clssname需要单独判断类型合并
2170
+ if (typeof field.amis?.className == "object") {
2171
+ className = {
2172
+ [className]: "true",
2173
+ ...field.amis.className
2174
+ };
2175
+ } else if (typeof field.amis?.className == "string") {
2176
+ className = `${className} ${field.amis.className} `;
2177
+ }
2178
+ delete field.amis?.className;
2179
+
2168
2180
  if(!field.hidden && !field.extra){
2169
2181
  columnItem = Object.assign({}, {
2170
2182
  name: field.name,
@@ -2261,12 +2273,24 @@ function getMobileLines(tpls){
2261
2273
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
2262
2274
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
2263
2275
  }
2276
+ //支持字段amis属性配置classname,识别classname的类型,与原样式合并
2277
+ var className;
2278
+ if (typeof item.field.amis?.className == "object") {
2279
+ className = {
2280
+ [lineChildrenClassName]: "true",
2281
+ ...item.field.amis.className
2282
+ };
2283
+ } else if (typeof item.field.amis?.className == "string") {
2284
+ className = `${lineChildrenClassName} ${item.field.amis.className} `;
2285
+ } else {
2286
+ className = lineChildrenClassName;
2287
+ }
2264
2288
  lineChildren.push({
2265
2289
  "type": "tpl",
2266
2290
  "tpl": item.tpl,
2267
- "className": lineChildrenClassName
2291
+ className
2268
2292
  });
2269
-
2293
+
2270
2294
  if(item.field.is_wide){
2271
2295
  // 宽字段占整行
2272
2296
  isLeft = true;
@@ -2316,8 +2340,7 @@ async function getMobileTableColumns(fields, options){
2316
2340
  tpl = await getFieldTpl(field, options);
2317
2341
  }
2318
2342
  if(!tpl){
2319
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
2320
- tpl = `\${${field.name} | raw}`;
2343
+ tpl = `\${${field.name}}`;
2321
2344
  }
2322
2345
  if(!field.hidden && !field.extra){
2323
2346
  tpls.push({ field, tpl });
@@ -2330,7 +2353,7 @@ async function getMobileTableColumns(fields, options){
2330
2353
 
2331
2354
  let column = {
2332
2355
  name: nameField.name,
2333
- label: nameField.label,
2356
+ label: options.displayAs == 'split' ? '' : nameField.label,
2334
2357
  sortable: nameField.sortable,
2335
2358
  type: "button",
2336
2359
  level: "link",
@@ -2990,6 +3013,13 @@ async function getTableApi(mainObject, fields, options){
2990
3013
  }
2991
3014
  // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
2992
3015
  };
3016
+ const listviewComponent = $(".steedos-object-listview .antd-Table-table");
3017
+ const firstListviewComponent = listviewComponent && listviewComponent[0];
3018
+ if(firstListviewComponent){
3019
+ setTimeout(()=>{
3020
+ firstListviewComponent.scrollIntoView();
3021
+ }, 600);
3022
+ }
2993
3023
  ${options.adaptor || ''}
2994
3024
  return payload;
2995
3025
  `;
@@ -8365,6 +8395,10 @@ async function getObjectCRUD(objectSchema, fields, options){
8365
8395
  const rowsDiff = _.cloneDeep(api.data.rowsDiff);
8366
8396
  rowsDiff.forEach(function (item, index) {
8367
8397
  for(key in item){
8398
+ // image、select等字段清空值后保存的空字符串转换为null。
8399
+ if(item[key] === ''){
8400
+ item[key] = null;
8401
+ }
8368
8402
  if(_.includes(imageNames, key)){
8369
8403
  if(typeof item[key] == "string"){
8370
8404
  const match = item[key].match(/\\/([^\\/]+)$/);
@@ -10757,9 +10791,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
10757
10791
  */
10758
10792
  if(enable_tree){
10759
10793
  const rows = _.map(payload.data.rows, (item)=>{
10760
- delete item.children;
10761
- delete item.parent;
10762
- return item;
10794
+ if (!item.children) {
10795
+ return { ...item, children: [] };
10796
+ } else {
10797
+ return item;
10798
+ }
10763
10799
  })
10764
10800
  payload.data.rows = rows;
10765
10801
  }