@steedos-widgets/amis-lib 1.2.6-beta.12 → 1.2.6-beta.14

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
@@ -2905,8 +2905,8 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
2905
2905
  },
2906
2906
  {
2907
2907
  "type": "dropdown-button",
2908
- "className": "",
2909
- "label": "\${uiSchema.list_views[listName].label}",
2908
+ "className": "",
2909
+ "label": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
2910
2910
  "rightIcon": "fa fa-caret-down",
2911
2911
  "size": "sm",
2912
2912
  "hideCaret": true,
@@ -3314,7 +3314,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
3314
3314
  "icon": "fa fa-table-columns",
3315
3315
  "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
3316
3316
  "align": "right",
3317
- "visibleOn": "${window:innerWidth > 768}",
3317
+ "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
3318
3318
  "buttons": [
3319
3319
  {
3320
3320
  "label": "显示为",
@@ -4655,6 +4655,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
4655
4655
  ...ctx
4656
4656
  });
4657
4657
 
4658
+ pickerSchema.affixHeader = false;
4659
+
4658
4660
  var headerToolbarItems = [];
4659
4661
  const isMobile = window.innerWidth < 768;
4660
4662
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user" && !isMobile){
@@ -4672,14 +4674,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
4672
4674
  pickerSchema.headerToolbar.push(new_button);
4673
4675
  }
4674
4676
  pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
4675
- //TODO: 等待放大镜bug修复,if会去掉,始终显示放大镜
4676
- if(referenceTo.objectName != "space_users" || field.reference_to_field != "user"){
4677
- if (ctx.filterVisible !== false) {
4678
- pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4679
- isLookup: true,
4680
- ...ctx
4681
- });
4682
- }
4677
+ if (ctx.filterVisible !== false) {
4678
+ pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
4679
+ isLookup: true,
4680
+ ...ctx
4681
+ });
4683
4682
  }
4684
4683
  pickerSchema.data = Object.assign({}, pickerSchema.data, {
4685
4684
  "&": "$$",
@@ -4925,8 +4924,10 @@ async function lookupToAmis(field, readonly, ctx){
4925
4924
 
4926
4925
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
4927
4926
  if(ctx.idsDependOn || field.amis){
4927
+ // ids人员点选模式
4928
4928
  return await lookupToAmisIdsPicker(field, readonly, ctx);
4929
4929
  }
4930
+ // 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
4930
4931
  // return await lookupToAmisSelectUser(field, readonly, ctx);
4931
4932
  }
4932
4933
 
@@ -5027,6 +5028,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
5027
5028
  top: top,
5028
5029
  ...ctx
5029
5030
  });
5031
+
5032
+ pickerSchema.affixHeader = false;
5033
+
5030
5034
  }
5031
5035
 
5032
5036
  const data = {
@@ -5056,7 +5060,6 @@ async function getIdsPickerSchema(field, readonly, ctx){
5056
5060
  if(readonly){
5057
5061
  data.tpl = await getLookupTpl(field, ctx);
5058
5062
  }
5059
-
5060
5063
  return data;
5061
5064
  }
5062
5065
 
@@ -5886,6 +5889,12 @@ function getReadonlyFormAdaptor(object, fields){
5886
5889
  // })
5887
5890
 
5888
5891
  return `
5892
+ if(payload.data.data.length === 0){
5893
+ return {
5894
+ status: 2,
5895
+ msg: "无法找到记录"
5896
+ }
5897
+ }
5889
5898
  if(payload.data.data){
5890
5899
  var data = payload.data.data[0];
5891
5900
  var gridAndObjectFieldsName = ${JSON.stringify(gridAndObjectFieldsName)};
@@ -6033,7 +6042,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
6033
6042
 
6034
6043
  return {
6035
6044
  method: "post",
6036
- url: getApi$2(),
6045
+ url: getApi$2() + '&objectName=${objectName}' ,
6037
6046
  // sendOn: "!!this.recordId",
6038
6047
  cache: API_CACHE,
6039
6048
  requestAdaptor: `
@@ -6553,7 +6562,8 @@ async function getObjectForm(objectSchema, ctx){
6553
6562
  "eventName": `@data.changed.${objectSchema.name}`
6554
6563
  },
6555
6564
  "data": {
6556
- "objectName": `${objectSchema.name}`
6565
+ "objectName": `${objectSchema.name}`,
6566
+ "displayAs": "${displayAs}"
6557
6567
  }
6558
6568
  },
6559
6569
  {
@@ -6653,7 +6663,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6653
6663
  data: {
6654
6664
  objectName: "${event.data.__objectName}",
6655
6665
  record: "${event.data.__record}"
6656
- }
6666
+ },
6667
+ expression: "${event.data.__response.error != true}"
6657
6668
  },
6658
6669
  {
6659
6670
  "actionType": "setValue",
@@ -6661,7 +6672,8 @@ async function getObjectDetail(objectSchema, recordId, ctx){
6661
6672
  value: {
6662
6673
  "recordLoaded": true,
6663
6674
  }
6664
- }
6675
+ },
6676
+ expression: "${event.data.__response.error != true}"
6665
6677
  }
6666
6678
  ]
6667
6679
  }
@@ -7222,7 +7234,11 @@ async function getTableApi(mainObject, fields, options){
7222
7234
  filters = systemFilters;
7223
7235
  };
7224
7236
  if(api.data.$self.additionalFilters){
7225
- userFilters.push(api.data.$self.additionalFilters)
7237
+ if(_.isString(api.data.$self.additionalFilters)){
7238
+ userFilters.push(eval(api.data.$self.additionalFilters))
7239
+ }else{
7240
+ userFilters.push(api.data.$self.additionalFilters)
7241
+ }
7226
7242
  }
7227
7243
 
7228
7244
  if(api.data.$self._isRelated){
@@ -7255,7 +7271,7 @@ async function getTableApi(mainObject, fields, options){
7255
7271
  if(_.isEmpty(filters)){
7256
7272
  filters = userFilters;
7257
7273
  }else{
7258
- filters.push(userFilters)
7274
+ filters = [filters, 'and', userFilters]
7259
7275
  }
7260
7276
  }
7261
7277
  api.data = {
@@ -8330,7 +8346,7 @@ async function getRelatedListSchema(
8330
8346
  * @Author: baozhoutao@steedos.com
8331
8347
  * @Date: 2022-07-05 15:55:39
8332
8348
  * @LastEditors: baozhoutao@steedos.com
8333
- * @LastEditTime: 2023-04-17 15:26:17
8349
+ * @LastEditTime: 2023-04-28 11:11:29
8334
8350
  * @Description:
8335
8351
  */
8336
8352
 
@@ -8528,6 +8544,9 @@ async function getListSchema(
8528
8544
  ctx = {}
8529
8545
  ) {
8530
8546
  const uiSchema = await getUISchema(objectName);
8547
+ if(!uiSchema){
8548
+ return {}
8549
+ }
8531
8550
  const listView = find(
8532
8551
  uiSchema.list_views,
8533
8552
  (listView, name) => {