From 09138a3602b01eb6fc763c4d3b824164cddbba92 Mon Sep 17 00:00:00 2001 From: ewandor Date: Tue, 7 Feb 2023 17:08:06 +0100 Subject: [PATCH] Ethetic modification of lists and foreign keys --- front/app/src/common/crud/crud.module.ts | 2 ++ .../src/common/crud/jsonschemas.service.ts | 2 +- front/app/src/common/crud/types/array.type.ts | 36 ++++++++++--------- .../src/common/crud/types/foreignkey.type.ts | 4 +-- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/front/app/src/common/crud/crud.module.ts b/front/app/src/common/crud/crud.module.ts index 537bf865..4f53e47d 100644 --- a/front/app/src/common/crud/crud.module.ts +++ b/front/app/src/common/crud/crud.module.ts @@ -16,6 +16,7 @@ import { DateTypeComponent } from "./types/date.type"; import { ApiService, CrudService } from "./crud.service"; import { CrudFormlyJsonschemaService } from "./crud-formly-jsonschema.service"; import { NgbModule} from "@ng-bootstrap/ng-bootstrap"; +import { allIcons, NgxBootstrapIconsModule } from "ngx-bootstrap-icons"; import { JsonschemasService } from "./jsonschemas.service"; import { MultiSchemaTypeComponent } from "./types/multischema.type"; import { ForeignkeyTypeComponent } from "./types/foreignkey.type"; @@ -49,6 +50,7 @@ import { DictionaryService } from "./types/dictionary.service"; HttpClientModule, FormsModule, NgbModule, + NgxBootstrapIconsModule.pick(allIcons), //BrowserAnimationsModule, ReactiveFormsModule, FormlyModule.forRoot({ diff --git a/front/app/src/common/crud/jsonschemas.service.ts b/front/app/src/common/crud/jsonschemas.service.ts index dcac005a..8e77742d 100644 --- a/front/app/src/common/crud/jsonschemas.service.ts +++ b/front/app/src/common/crud/jsonschemas.service.ts @@ -38,7 +38,7 @@ export class JsonschemasService { delete resource.properties[prop_name] } else if (this.is_reference(prop)) { this.resolveReference(resource, prop); - } else if (prop.hasOwnProperty('oneOf')) { + } else if (this.is_union(prop)) { for (let i in prop.oneOf) { this.resolveReference(resource, prop.oneOf[i]); } diff --git a/front/app/src/common/crud/types/array.type.ts b/front/app/src/common/crud/types/array.type.ts index eedad435..1f3b0382 100644 --- a/front/app/src/common/crud/types/array.type.ts +++ b/front/app/src/common/crud/types/array.type.ts @@ -7,36 +7,38 @@ import { FieldArrayType } from '@ngx-formly/core';

{{ props.description }}

- -
-
-
-
- {{ i + 1 }} +
+
+
+
+
+ {{ i + 1 }} +
+
+ + + +
+
+
+ +
-
- - - -
-
-
-
-
- +
`, }) export class ArrayTypeComponent extends FieldArrayType implements OnInit { colSm: string = "col-sm-6" + itemsPerRow = 2; ngOnInit() { if (this.field.props.hasOwnProperty('items-per-row')) { - this.colSm = `col-sm-${12 / this.field.props['items-per-row']}` + this.itemsPerRow = this.field.props['items-per-row'] } } diff --git a/front/app/src/common/crud/types/foreignkey.type.ts b/front/app/src/common/crud/types/foreignkey.type.ts index 53246017..57df1b7f 100644 --- a/front/app/src/common/crud/types/foreignkey.type.ts +++ b/front/app/src/common/crud/types/foreignkey.type.ts @@ -43,10 +43,10 @@ import {DictionaryService} from "./dictionary.service"; readonly="readonly" />
- +
- +