@steedos-widgets/amis-lib 1.2.8 → 1.2.9-beta.1

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.umd.js CHANGED
@@ -2603,11 +2603,11 @@
2603
2603
  payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
2604
2604
  }
2605
2605
  const selfData = api.body.$self;
2606
- const filterFormSearchableFields = selfData.filterFormSearchableFields;
2607
2606
  const uiSchema = selfData.uiSchema;
2608
2607
  const fields = uiSchema.fields;
2609
- const searchableFields = [];
2610
-
2608
+ const filterFormSearchableFields = (selfData.filterFormSearchableFields || []).filter(function(item){
2609
+ return !!fields[item]
2610
+ });
2611
2611
  const resolveAll = function(values){
2612
2612
  payload.data = {
2613
2613
  "body": values
@@ -2622,21 +2622,7 @@
2622
2622
  return Promise.all(filterFormSearchableFields.map(function (item) {
2623
2623
  const field = _.clone(fields[item]);
2624
2624
  if (
2625
- field && !_.includes(
2626
- [
2627
- "grid",
2628
- "avatar",
2629
- "image",
2630
- "object",
2631
- "[object]",
2632
- "[Object]",
2633
- "[grid]",
2634
- "[text]",
2635
- "audio",
2636
- "file",
2637
- ],
2638
- field.type
2639
- )
2625
+ field && window.isFieldTypeSearchable(field.type)
2640
2626
  ) {
2641
2627
  delete field.defaultValue;
2642
2628
  delete field.required;
@@ -2995,9 +2981,27 @@
2995
2981
  "headers": {
2996
2982
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
2997
2983
  },
2998
- "data": null,
2984
+ "data": {
2985
+ "$self": "$$"
2986
+ },
2999
2987
  "requestAdaptor": "",
3000
- "adaptor": ""
2988
+ "adaptor": `
2989
+ if(payload.errors){
2990
+ payload.status = 2;
2991
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
2992
+ }
2993
+ const selfData = api.body.$self;
2994
+ const uiSchema = selfData.uiSchema;
2995
+ const fields = uiSchema.fields;
2996
+ const options = (payload.data?.options || []).filter(function(item){
2997
+ let field = fields[item.value];
2998
+ return !!field && window.isFieldTypeSearchable(field.type)
2999
+ });
3000
+ payload.data = {
3001
+ "options": options
3002
+ };
3003
+ return payload;
3004
+ `
3001
3005
  },
3002
3006
  "options": [],
3003
3007
  "required": true,
@@ -3695,9 +3699,9 @@ else{
3695
3699
  "icon": "fa fa-search",
3696
3700
  "type": "button",
3697
3701
  "badge": {
3698
- "offsetx": [
3699
- -2,
3700
- 2
3702
+ "offset": [
3703
+ -5,
3704
+ 1
3701
3705
  ],
3702
3706
  "size":8,
3703
3707
  "animation": true,
@@ -6224,6 +6228,29 @@ else{
6224
6228
  window.getFieldSearchable = getFieldSearchable;
6225
6229
  }
6226
6230
 
6231
+
6232
+ function isFieldTypeSearchable(fieldType) {
6233
+ return !___namespace.includes(
6234
+ [
6235
+ "grid",
6236
+ "avatar",
6237
+ "image",
6238
+ "object",
6239
+ "[object]",
6240
+ "[Object]",
6241
+ "[grid]",
6242
+ "[text]",
6243
+ "audio",
6244
+ "file",
6245
+ ],
6246
+ fieldType
6247
+ )
6248
+ }
6249
+
6250
+ if (typeof window != 'undefined') {
6251
+ window.isFieldTypeSearchable = isFieldTypeSearchable;
6252
+ }
6253
+
6227
6254
  var index = /*#__PURE__*/Object.freeze({
6228
6255
  __proto__: null,
6229
6256
  OMIT_FIELDS: OMIT_FIELDS,
@@ -6235,6 +6262,7 @@ else{
6235
6262
  getSelectFieldOptions: getSelectFieldOptions,
6236
6263
  convertSFieldToAmisField: convertSFieldToAmisField,
6237
6264
  getFieldSearchable: getFieldSearchable,
6265
+ isFieldTypeSearchable: isFieldTypeSearchable,
6238
6266
  getAmisStaticFieldType: getAmisStaticFieldType
6239
6267
  });
6240
6268