@stemy/ngx-dynamic-form 13.1.18 → 13.1.19

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.
@@ -729,6 +729,7 @@ class DynamicFormService extends DynamicFormService$1 {
729
729
  const subSchemas = findRefs(property).map(ref => this.schemas[ref]);
730
730
  return Object.assign(this.getFormControlConfig(property, schema), {
731
731
  groupFactory: () => mergeFormModels(subSchemas.map(s => this.getFormModelForSchemaDef(s, customizeModels))),
732
+ initialCount: property.initialCount || 0,
732
733
  sortable: property.sortable || false,
733
734
  useTabs: property.useTabs || false,
734
735
  addItem: property.addItem !== false,
@@ -853,10 +854,14 @@ class DynamicFormService extends DynamicFormService$1 {
853
854
  }
854
855
  return new FormSelectSubject(async (selectModel, control) => {
855
856
  this.api.cache[property.endpoint] = this.api.cache[property.endpoint] || this.api.list(property.endpoint, this.api.makeListParams(1, -1)).then(result => {
856
- return result.items.map(i => {
857
+ const items = ObjectUtils.isArray(result)
858
+ ? result
859
+ : (ObjectUtils.isArray(result.items) ? result.items : []);
860
+ return items.map(i => {
861
+ const item = ObjectUtils.isObject(i) ? i : { id: i };
857
862
  return {
858
- ...i,
859
- value: i.id || i._id, label: i[property.labelField] || i.label || i.id || i._id
863
+ ...item,
864
+ value: item.id || item._id, label: item[property.labelField] || item.label || item.id || item._id
860
865
  };
861
866
  });
862
867
  });