@muraai/mnl-form 0.0.1-alpha-766df40 → 0.0.1-alpha-017a088

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.
@@ -5049,26 +5049,34 @@ class MnlFormComponent {
5049
5049
  this.totalTabs = 0;
5050
5050
  this.translateService.setDefaultLang('en');
5051
5051
  }
5052
+ ngOnChanges(changes) {
5053
+ if (changes['fields'] && this.fields) {
5054
+ this.initForm();
5055
+ }
5056
+ }
5052
5057
  ngOnInit() {
5053
- if (this.fields) {
5054
- this.applyReadonlyToFields(this.fields);
5055
- this.filterFieldGroupsByRolesAndCountries(this.fields);
5056
- this.form.updateValueAndValidity();
5057
- this.formPrepared = true;
5058
- this.getNumberOfActiveTabs(this.fields);
5059
- this.setAutocompleteSingleOptionByDefault(this.fields);
5060
- this.options = {
5061
- formState: {
5062
- ...this.options.formState,
5063
- showOldValues: this.showOldValues,
5064
- oldValues: this.oldValues,
5065
- helperModel: this.helperModel,
5066
- onHelperModelChange: this.onHelperModelChange.bind(this),
5067
- },
5068
- };
5069
- if (this.form.disabled) {
5070
- this.form.disable({ emitEvent: false });
5071
- }
5058
+ if (!this.formPrepared && this.fields) {
5059
+ this.initForm();
5060
+ }
5061
+ }
5062
+ initForm() {
5063
+ this.applyReadonlyToFields(this.fields);
5064
+ this.filterFieldGroupsByRolesAndCountries(this.fields);
5065
+ this.form.updateValueAndValidity();
5066
+ this.formPrepared = true;
5067
+ this.getNumberOfActiveTabs(this.fields);
5068
+ this.setAutocompleteSingleOptionByDefault(this.fields);
5069
+ this.options = {
5070
+ formState: {
5071
+ ...this.options?.formState,
5072
+ showOldValues: this.showOldValues,
5073
+ oldValues: this.oldValues,
5074
+ helperModel: this.helperModel,
5075
+ onHelperModelChange: this.onHelperModelChange.bind(this),
5076
+ },
5077
+ };
5078
+ if (this.form.disabled) {
5079
+ this.form.disable({ emitEvent: false });
5072
5080
  }
5073
5081
  }
5074
5082
  onModelChange(model) {
@@ -5177,7 +5185,7 @@ class MnlFormComponent {
5177
5185
  });
5178
5186
  }
5179
5187
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: MnlFormComponent, deps: [{ token: i1$3.TranslateService }, { token: ScoringService }], target: i0.ɵɵFactoryTarget.Component }); }
5180
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", type: MnlFormComponent, isStandalone: true, selector: "mnl-form", inputs: { readonly: "readonly", form: "form", fields: "fields", model: "model", helperModel: "helperModel", options: "options", userRoles: "userRoles", userCountries: "userCountries", oldValues: "oldValues", showOldValues: "showOldValues" }, outputs: { noOfTabs: "noOfTabs", scoreChange: "scoreChange", helperModelChange: "helperModelChange" }, ngImport: i0, template: "@if(formPrepared) {\n<formly-form\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\"\n (modelChange)=\"onModelChange($event)\"\n class=\"mnl-formly-form\"\n></formly-form>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CommonsModule }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.LegacyFormlyForm, selector: "formly-form" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: FormlyMatTextAreaModule }, { kind: "ngmodule", type: FormlyMatInputModule }, { kind: "ngmodule", type: FormlyMatCheckboxModule }, { kind: "ngmodule", type: FormlyMatRadioModule }] }); }
5188
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", type: MnlFormComponent, isStandalone: true, selector: "mnl-form", inputs: { readonly: "readonly", form: "form", fields: "fields", model: "model", helperModel: "helperModel", options: "options", userRoles: "userRoles", userCountries: "userCountries", oldValues: "oldValues", showOldValues: "showOldValues" }, outputs: { noOfTabs: "noOfTabs", scoreChange: "scoreChange", helperModelChange: "helperModelChange" }, usesOnChanges: true, ngImport: i0, template: "@if(formPrepared) {\n<formly-form\n [form]=\"form\"\n [fields]=\"fields\"\n [model]=\"model\"\n [options]=\"options\"\n (modelChange)=\"onModelChange($event)\"\n class=\"mnl-formly-form\"\n></formly-form>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CommonsModule }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.LegacyFormlyForm, selector: "formly-form" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: FormlyMatTextAreaModule }, { kind: "ngmodule", type: FormlyMatInputModule }, { kind: "ngmodule", type: FormlyMatCheckboxModule }, { kind: "ngmodule", type: FormlyMatRadioModule }] }); }
5181
5189
  }
5182
5190
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: MnlFormComponent, decorators: [{
5183
5191
  type: Component,