@steedos-widgets/amis-lib 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.
package/dist/index.esm.js CHANGED
@@ -1604,16 +1604,17 @@ async function getQuickEditSchema(field, options){
1604
1604
  {
1605
1605
  actionType: "custom",
1606
1606
  script: `
1607
+ console.log("asdasd");
1607
1608
  let items = _.cloneDeep(event.data.items);
1608
1609
  let selectedItems = _.cloneDeep(event.data.selectedItems);
1609
1610
  if(event.data.isBatchEdit){
1610
1611
  selectedItems.forEach(function(selectedItem){
1611
1612
  selectedItem._display.${field.name} = event.data._display.${field.name};
1612
- doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: ${options.objectName} + "_display_" + selectedItem._index});
1613
+ doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "${options.objectName}" + "_display_" + selectedItem._index});
1613
1614
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
1614
1615
  })
1615
1616
  }else{
1616
- doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: ${options.objectName} + "_display_" + event.data._index});
1617
+ doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "${options.objectName}" + "_display_" + event.data._index});
1617
1618
  doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
1618
1619
  }
1619
1620
  `
@@ -2164,6 +2165,18 @@ async function getTableColumns(fields, options){
2164
2165
  if(field.type === 'datetime'){
2165
2166
  className += 'datetime-min-w';
2166
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
+
2167
2180
  if(!field.hidden && !field.extra){
2168
2181
  columnItem = Object.assign({}, {
2169
2182
  name: field.name,
@@ -2260,12 +2273,24 @@ function getMobileLines(tpls){
2260
2273
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
2261
2274
  lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
2262
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
+ }
2263
2288
  lineChildren.push({
2264
2289
  "type": "tpl",
2265
2290
  "tpl": item.tpl,
2266
- "className": lineChildrenClassName
2291
+ className
2267
2292
  });
2268
-
2293
+
2269
2294
  if(item.field.is_wide){
2270
2295
  // 宽字段占整行
2271
2296
  isLeft = true;
@@ -2315,8 +2340,7 @@ async function getMobileTableColumns(fields, options){
2315
2340
  tpl = await getFieldTpl(field, options);
2316
2341
  }
2317
2342
  if(!tpl){
2318
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
2319
- tpl = `\${${field.name} | raw}`;
2343
+ tpl = `\${${field.name}}`;
2320
2344
  }
2321
2345
  if(!field.hidden && !field.extra){
2322
2346
  tpls.push({ field, tpl });
@@ -2329,7 +2353,7 @@ async function getMobileTableColumns(fields, options){
2329
2353
 
2330
2354
  let column = {
2331
2355
  name: nameField.name,
2332
- label: nameField.label,
2356
+ label: options.displayAs == 'split' ? '' : nameField.label,
2333
2357
  sortable: nameField.sortable,
2334
2358
  type: "button",
2335
2359
  level: "link",
@@ -2989,6 +3013,13 @@ async function getTableApi(mainObject, fields, options){
2989
3013
  }
2990
3014
  // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
2991
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
+ }
2992
3023
  ${options.adaptor || ''}
2993
3024
  return payload;
2994
3025
  `;
@@ -8364,6 +8395,10 @@ async function getObjectCRUD(objectSchema, fields, options){
8364
8395
  const rowsDiff = _.cloneDeep(api.data.rowsDiff);
8365
8396
  rowsDiff.forEach(function (item, index) {
8366
8397
  for(key in item){
8398
+ // image、select等字段清空值后保存的空字符串转换为null。
8399
+ if(item[key] === ''){
8400
+ item[key] = null;
8401
+ }
8367
8402
  if(_.includes(imageNames, key)){
8368
8403
  if(typeof item[key] == "string"){
8369
8404
  const match = item[key].match(/\\/([^\\/]+)$/);
@@ -10756,9 +10791,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
10756
10791
  */
10757
10792
  if(enable_tree){
10758
10793
  const rows = _.map(payload.data.rows, (item)=>{
10759
- delete item.children;
10760
- delete item.parent;
10761
- return item;
10794
+ if (!item.children) {
10795
+ return { ...item, children: [] };
10796
+ } else {
10797
+ return item;
10798
+ }
10762
10799
  })
10763
10800
  payload.data.rows = rows;
10764
10801
  }