Skip to content

Commit

Permalink
fix(editor): use the new process json schema
Browse files Browse the repository at this point in the history
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Apr 8, 2024
1 parent c4e3726 commit a3d19ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { TranslateService } from '@ngx-translate/core';
import { JSONSchema7, RecordService, orderedJsonSchema, processJsonSchema, removeEmptyValues } from '@rero/ng-core';
import { JSONSchema7, RecordService, processJsonSchema, removeEmptyValues } from '@rero/ng-core';
import { UserService } from '@rero/shared';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { ToastrService } from 'ngx-toastr';
Expand Down Expand Up @@ -88,7 +88,7 @@ export class UserIdEditorComponent implements OnInit {
if (schema != null) {
schema = processJsonSchema(schema.schema);
this.fields = [
this.formlyJsonschema.toFieldConfig(orderedJsonSchema(schema), {
this.formlyJsonschema.toFieldConfig(schema, {

// post process JSONSchema7 to FormlyFieldConfig conversion
map: (field: FormlyFieldConfig, jsonSchema: JSONSchema7) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { TranslateService } from '@ngx-translate/core';
import { RecordService, orderedJsonSchema, processJsonSchema } from '@rero/ng-core';
import { RecordService, processJsonSchema } from '@rero/ng-core';
import { ToastrService } from 'ngx-toastr';
import { Subscription } from 'rxjs';

Expand Down Expand Up @@ -101,7 +101,7 @@ export class AddEntityLocalFormComponent implements OnInit, OnDestroy {
schema = schema.oneOf.find((element: any) => element.properties.type.const === this.translatedType(selectedType));
// Deleting the oneOf key from the schema
delete schema.oneOf;
this.fields = [this.formlyJsonschema.toFieldConfig(orderedJsonSchema(schema), {
this.fields = [this.formlyJsonschema.toFieldConfig(schema, {
map: (field: FormlyFieldConfig) => {
// Put the value typed by the user in the corresponding field
if (this.populateFields.includes(String(field.key))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { TranslateService } from '@ngx-translate/core';
import { RecordService, orderedJsonSchema, removeEmptyValues } from '@rero/ng-core';
import { RecordService, processJsonSchema, removeEmptyValues } from '@rero/ng-core';
import { AppSettingsService, UserService } from '@rero/shared';
import { ToastrService } from 'ngx-toastr';
import { Subscription, forkJoin, of } from 'rxjs';
Expand Down Expand Up @@ -88,7 +88,7 @@ export class PatronProfilePersonalEditorComponent implements OnInit, OnDestroy {
if (schema) {
const disabledFields = this.appSettingsService.settings.userProfile.readOnlyFields;
this.fields = [
this.formlyJsonschema.toFieldConfig(orderedJsonSchema(schema.schema), {
this.formlyJsonschema.toFieldConfig(processJsonSchema(schema.schema), {

// post process JSONSchema7 to FormlyFieldConfig conversion
map: (field: FormlyFieldConfig, jsonSchema: any) => {
Expand Down

0 comments on commit a3d19ce

Please sign in to comment.