@steedos-widgets/amis-object 6.3.12-beta.13 → 6.3.12-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.
@@ -5067,7 +5067,6 @@ async function getQuickEditSchema(object, columnField, options){
5067
5067
  {
5068
5068
  actionType: "custom",
5069
5069
  script: `
5070
- console.log("asdasd");
5071
5070
  let items = _.cloneDeep(event.data.items);
5072
5071
  let selectedItems = _.cloneDeep(event.data.selectedItems);
5073
5072
  if(event.data.isBatchEdit){
@@ -6608,6 +6607,11 @@ async function getTableApi(mainObject, fields, options){
6608
6607
  }, 600);
6609
6608
  }
6610
6609
  }
6610
+
6611
+ // 列表搜索和快速搜索,有时在某些操作情况下还是会造成crud接口请求使用的过滤条件是上次的,这里强制把正确的过滤条件返回到crud,详细规则见:https://github.com/steedos/steedos-platform/issues/7112
6612
+ // lookup字段的弹出列表搜索不受这里影响,因为lookup字段的弹出列表搜索是单独的接口请求
6613
+ payload.data.__changedFilterFormValues = api.context.__changedFilterFormValues;
6614
+ payload.data.__changedSearchBoxValues = api.context.__changedSearchBoxValues;
6611
6615
  ${options.adaptor || ''}
6612
6616
  return payload;
6613
6617
  `;
@@ -9352,6 +9356,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
9352
9356
  });
9353
9357
  // 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取,因为本地存储中的过滤条件自动填充到表单上时filterForm.getValues()拿不到。
9354
9358
  let filterFormValues = event.data;
9359
+ filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
9360
+ const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
9355
9361
  // 同步__changedFilterFormValues中的值
9356
9362
  // crud && crud.setData({__changedFilterFormValues: {}});
9357
9363
  let __changedFilterFormValuesKey = "__changedFilterFormValues";
@@ -9364,7 +9370,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
9364
9370
  }
9365
9371
  if(crud){
9366
9372
  let crudData = crud.getData();
9367
- crudData[__changedFilterFormValuesKey] = filterFormValues;
9373
+ crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
9368
9374
  crud.setData(crudData);
9369
9375
  }
9370
9376
  filterForm.handleFormSubmit(event);
@@ -12127,7 +12133,6 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
12127
12133
  }
12128
12134
 
12129
12135
  const onChangeScript = `
12130
- // console.log("==search=onChangeScript===");
12131
12136
  const scope = event.context.scoped;
12132
12137
  let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
12133
12138
  // let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
@@ -12498,8 +12503,26 @@ async function getObjectFilter(objectSchema, fields, options) {
12498
12503
  let filterFormService = SteedosUI.getClosestAmisComponentByType(filterForm.context, "service");
12499
12504
  // 使用event.data的话,并不能拿到本地存储中的过滤条件,所以需要从filterFormService中取。
12500
12505
  let filterFormValues = filterFormService.getData();
12506
+ filterFormValues = JSON.parse(JSON.stringify(filterFormValues)); //只取当层数据域中数据,去除__super层数据
12501
12507
  let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
12502
12508
  let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
12509
+ const changedFilterFormValues = _.pickBy(filterFormValues, function(n,k){return /^__searchable__/.test(k);});
12510
+ // 这里不用crudService而用crud是因为lookup字段弹出的列表中的crudService中的变量无法传入crud的发送适配器中
12511
+ // crud && crud.setData({__changedFilterFormValues: changedFilterFormValues});
12512
+ let __changedFilterFormValuesKey = "__changedFilterFormValues";
12513
+ if(isLookup && __lookupField){
12514
+ let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
12515
+ if(__lookupField.reference_to_field){
12516
+ lookupTag += "__" + __lookupField.reference_to_field;
12517
+ }
12518
+ __changedFilterFormValuesKey += lookupTag;
12519
+ }
12520
+ if(crud){
12521
+ let crudData = crud.getData();
12522
+ crudData[__changedFilterFormValuesKey] = changedFilterFormValues;
12523
+ crud.setData(crudData);
12524
+ }
12525
+
12503
12526
  let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service", {name: "service_object_table_crud"});
12504
12527
  crudService && crudService.setData({isFieldsFilterEmpty});
12505
12528
  `;
@@ -15411,6 +15434,20 @@ async function lookupToAmisPicker(field, readonly, ctx){
15411
15434
  });
15412
15435
  payload.data.rows = updatedResult;
15413
15436
  }
15437
+ let __changedFilterFormValuesKey = "__changedFilterFormValues";
15438
+ let __lookupField = api.data.$self.__lookupField;
15439
+ if(__lookupField){
15440
+ let lookupTag = "__lookup__" + __lookupField.name + "__" + __lookupField.reference_to;
15441
+ if(__lookupField.reference_to_field){
15442
+ lookupTag += "__" + __lookupField.reference_to_field;
15443
+ }
15444
+ __changedFilterFormValuesKey += lookupTag;
15445
+ }
15446
+ let __changedFilterFormValues = api.context[__changedFilterFormValuesKey] || {};
15447
+ let __changedSearchBoxValues = api.context.__changedSearchBoxValues || {};
15448
+ // 列表搜索和快速搜索,有时在某些操作情况下还是会造成crud接口请求使用的过滤条件是上次的,这里强制把正确的过滤条件返回到crud,详细规则见:https://github.com/steedos/steedos-platform/issues/7112
15449
+ payload.data[__changedFilterFormValuesKey] = __changedFilterFormValues;
15450
+ payload.data.__changedSearchBoxValues = __changedSearchBoxValues;
15414
15451
  return payload;
15415
15452
  `;
15416
15453
  if(field.optionsFunction || field._optionsFunction){
@@ -27987,6 +28024,7 @@ function generateRandomString(length) {
27987
28024
  // 通用函数生成器
27988
28025
  var createFieldFunction = function (type) {
27989
28026
  return function (props) { return __awaiter(void 0, void 0, void 0, function () {
28027
+ var schema;
27990
28028
  var _a;
27991
28029
  return __generator(this, function (_b) {
27992
28030
  switch (_b.label) {
@@ -28049,22 +28087,13 @@ var createFieldFunction = function (type) {
28049
28087
  };
28050
28088
  }
28051
28089
  }
28052
- return [4 /*yield*/, AmisSteedosField(props)
28053
- // {
28054
- // type: "steedos-field",
28055
- // config: Object.assign({}, props.config || {}, {
28056
- // type: type
28057
- // })
28058
- // };
28059
- ];
28060
- case 1: return [2 /*return*/, _b.sent()
28061
- // {
28062
- // type: "steedos-field",
28063
- // config: Object.assign({}, props.config || {}, {
28064
- // type: type
28065
- // })
28066
- // };
28067
- ];
28090
+ return [4 /*yield*/, AmisSteedosField(props)];
28091
+ case 1:
28092
+ schema = _b.sent();
28093
+ if (_$1.has(props, '$$editor')) {
28094
+ delete schema.visibleOn;
28095
+ }
28096
+ return [2 /*return*/, schema];
28068
28097
  }
28069
28098
  });
28070
28099
  }); };