Skip to content

Commit

Permalink
fix: debounce for config form not always working
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Jan 23, 2024
1 parent 869f721 commit 64ba20a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/app/util/adjust-to-live-formly-form.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FormlyFieldConfig } from '@ngx-formly/core';
import { isArray } from 'rxjs/internal-compatibility';

export const adjustToLiveFormlyForm = (
items: FormlyFieldConfig[],
Expand All @@ -10,7 +11,7 @@ export const adjustToLiveFormlyForm = (
type: 'toggle',
};
}
if (item.type === 'input') {
if (item.type === 'input' || item.type === 'textarea' || item.type === 'duration') {
return {
...item,
modelOptions: {
Expand All @@ -21,6 +22,27 @@ export const adjustToLiveFormlyForm = (
},
};
}

if (item.type === 'repeat' && isArray(item?.fieldGroup)) {
return {
...item,
fieldGroup: adjustToLiveFormlyForm(item?.fieldGroup),
};
}

if (
item.type === 'repeat' &&
item?.fieldArray?.fieldGroup &&
isArray(item.fieldArray.fieldGroup)
) {
return {
...item,
fieldArray: {
...item.fieldArray,
fieldGroup: adjustToLiveFormlyForm(item?.fieldArray?.fieldGroup),
},
};
}
return item;
});
};

0 comments on commit 64ba20a

Please sign in to comment.