@stemy/ngx-dynamic-form 13.3.8 → 13.3.10

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.
@@ -668,9 +668,18 @@ class DynamicFormService extends DynamicFormService$1 {
668
668
  };
669
669
  const schema = this.schemas[name];
670
670
  const controls = await this.getFormModelForSchemaDef(schema, fieldSets, customizeModels);
671
+ const idFields = [
672
+ createFormInput("id", { hidden: true }),
673
+ createFormInput("_id", { hidden: true })
674
+ ].filter(t => !controls.some(c => c.id == t.id));
671
675
  const config = {
672
676
  id: "root",
673
- group: [...controls],
677
+ group: [
678
+ // -- Hidden id fields --
679
+ ...idFields,
680
+ // -- Main form controls --
681
+ ...controls
682
+ ],
674
683
  fieldSets
675
684
  };
676
685
  const root = await customizeModels({
@@ -931,7 +940,11 @@ class DynamicFormService extends DynamicFormService$1 {
931
940
  });
932
941
  }
933
942
  return new FormSelectSubject(async (selectModel, control) => {
934
- this.api.cache[property.endpoint] = this.api.cache[property.endpoint] || this.api.list(property.endpoint, this.api.makeListParams(1, -1)).then(result => {
943
+ const entries = Object.entries(control.root?.value || {});
944
+ const endpoint = entries.reduce((res, [key, value]) => {
945
+ return res.replace(new RegExp(`$${key}`, "gi"), `${value}`);
946
+ }, `${property.endpoint}`);
947
+ this.api.cache[endpoint] = this.api.cache[endpoint] || this.api.list(endpoint, this.api.makeListParams(1, -1)).then(result => {
935
948
  const items = ObjectUtils.isArray(result)
936
949
  ? result
937
950
  : (ObjectUtils.isArray(result.items) ? result.items : []);