From c8027b7079dd4182b510960f9138cda38cd407a1 Mon Sep 17 00:00:00 2001 From: Jonas Suter Date: Thu, 13 Apr 2023 19:35:57 +0200 Subject: [PATCH] removed flex layout dependency (replaced with css) --- packages/angular-material/package.json | 2 -- .../src/controls/autocomplete.renderer.ts | 14 ++++++++-- .../src/controls/boolean.renderer.ts | 18 ++++++++++--- .../src/controls/date.renderer.ts | 12 ++++++++- .../src/controls/number.renderer.ts | 12 ++++++++- .../src/controls/range.renderer.ts | 18 ++++++++++++- .../src/controls/text.renderer.ts | 12 ++++++++- .../src/controls/textarea.renderer.ts | 12 ++++++++- .../src/controls/toggle.renderer.ts | 8 +++++- .../src/layouts/array-layout.renderer.ts | 21 ++++++++++++--- .../layouts/categorization-layout.renderer.ts | 11 ++++++-- .../src/layouts/group-layout.renderer.ts | 20 ++++++++++++-- .../src/layouts/horizontal-layout.renderer.ts | 26 +++++++++++++++---- .../src/layouts/vertical-layout.renderer.ts | 21 +++++++++++++-- .../src/other/label.renderer.ts | 11 ++++++-- 15 files changed, 187 insertions(+), 31 deletions(-) diff --git a/packages/angular-material/package.json b/packages/angular-material/package.json index f0c3d4cf1..285ac1ff7 100644 --- a/packages/angular-material/package.json +++ b/packages/angular-material/package.json @@ -63,7 +63,6 @@ "@angular/cdk": "^14.2.0 || ^15.0.0", "@angular/common": "^14.2.0 || ^15.0.0", "@angular/core": "^14.2.0 || ^15.0.0", - "@angular/flex-layout": "^14.0.0-beta || ^15.0.0-beta", "@angular/forms": "^14.2.0 || ^15.0.0", "@angular/material": "^14.2.0 || ^15.0.0", "@angular/platform-browser": "^14.2.0 || ^15.0.0", @@ -83,7 +82,6 @@ "@angular/compiler": "^14.2.0", "@angular/compiler-cli": "^14.2.0", "@angular/core": "^14.2.0", - "@angular/flex-layout": "^14.0.0-beta || ^15.0.0-beta", "@angular/forms": "^14.2.0", "@angular/material": "^14.2.0", "@angular/platform-browser": "^14.2.0", diff --git a/packages/angular-material/src/controls/autocomplete.renderer.ts b/packages/angular-material/src/controls/autocomplete.renderer.ts index 1cb61acf8..a5581b3cc 100644 --- a/packages/angular-material/src/controls/autocomplete.renderer.ts +++ b/packages/angular-material/src/controls/autocomplete.renderer.ts @@ -64,7 +64,7 @@ import { startWith } from 'rxjs/operators'; @Component({ selector: 'AutocompleteControlRenderer', template: ` - + {{ label }} {{ error }} `, + styles: [ + `.d-none { + display: none; + } + .simple-flex-item { + flex: 1 1 0%; + box-sizing: border-box; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class AutocompleteControlRenderer extends JsonFormsControl { @Input() options: string[]; - + focused: boolean = false; filteredOptions: Observable; shouldFilter: boolean; diff --git a/packages/angular-material/src/controls/boolean.renderer.ts b/packages/angular-material/src/controls/boolean.renderer.ts index 06d9807d5..0ca23a9d2 100644 --- a/packages/angular-material/src/controls/boolean.renderer.ts +++ b/packages/angular-material/src/controls/boolean.renderer.ts @@ -30,10 +30,7 @@ import { isBooleanControl, RankedTester, rankWith } from '@jsonforms/core'; selector: 'BooleanControlRenderer', template: `
{{ error }}
`, + styles: [ + `.d-none { + display: none; + } + .boolean-control { + box-sizing: border-box; + display: flex; + flex-direction: column; + justify-content: 'center'; + height: 100%; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class BooleanControlRenderer extends JsonFormsControl { diff --git a/packages/angular-material/src/controls/date.renderer.ts b/packages/angular-material/src/controls/date.renderer.ts index 65040b22d..2b613ce0a 100644 --- a/packages/angular-material/src/controls/date.renderer.ts +++ b/packages/angular-material/src/controls/date.renderer.ts @@ -33,7 +33,7 @@ import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular'; @Component({ selector: 'DateControlRenderer', template: ` - + {{ label }} {{ error }} `, + styles: [ + `.d-none { + display: none; + } + .simple-flex-item { + flex: 1 1 0%; + box-sizing: border-box; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class DateControlRenderer extends JsonFormsControl { diff --git a/packages/angular-material/src/controls/number.renderer.ts b/packages/angular-material/src/controls/number.renderer.ts index 350b9894a..6a0b652a1 100644 --- a/packages/angular-material/src/controls/number.renderer.ts +++ b/packages/angular-material/src/controls/number.renderer.ts @@ -37,7 +37,7 @@ import merge from 'lodash/merge'; @Component({ selector: 'NumberControlRenderer', template: ` - + {{ label }} {{ error }} `, + styles: [ + `.d-none { + display: none; + } + .simple-flex-item { + flex: 1 1 0%; + box-sizing: border-box; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class NumberControlRenderer extends JsonFormsControl { diff --git a/packages/angular-material/src/controls/range.renderer.ts b/packages/angular-material/src/controls/range.renderer.ts index 1effc3f7f..67f48f738 100644 --- a/packages/angular-material/src/controls/range.renderer.ts +++ b/packages/angular-material/src/controls/range.renderer.ts @@ -29,7 +29,7 @@ import { isRangeControl, RankedTester, rankWith } from '@jsonforms/core'; @Component({ selector: 'RangeControlRenderer', template: ` -
+
@@ -48,6 +48,22 @@ import { isRangeControl, RankedTester, rankWith } from '@jsonforms/core'; {{ error }}
`, + styles: [ + ` + .range-control { + box-sizing: border-box; + display: flex; + flex-direction: column; + } + .d-none { + display: none; + } + .simple-flex-item { + flex: 1 1 0%; + box-sizing: border-box; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class RangeControlRenderer extends JsonFormsControl { diff --git a/packages/angular-material/src/controls/text.renderer.ts b/packages/angular-material/src/controls/text.renderer.ts index dde8fc2f5..72402a2f9 100644 --- a/packages/angular-material/src/controls/text.renderer.ts +++ b/packages/angular-material/src/controls/text.renderer.ts @@ -29,7 +29,7 @@ import { isStringControl, RankedTester, rankWith } from '@jsonforms/core'; @Component({ selector: 'TextControlRenderer', template: ` - + {{ label }} {{ error }} `, + styles: [ + `.d-none { + display: none; + } + .simple-flex-item { + flex: 1 1 0%; + box-sizing: border-box; + } + ` + ], changeDetection: ChangeDetectionStrategy.OnPush }) export class TextControlRenderer extends JsonFormsControl { diff --git a/packages/angular-material/src/controls/textarea.renderer.ts b/packages/angular-material/src/controls/textarea.renderer.ts index 21458ff62..20d0a2c6c 100644 --- a/packages/angular-material/src/controls/textarea.renderer.ts +++ b/packages/angular-material/src/controls/textarea.renderer.ts @@ -29,7 +29,7 @@ import { isMultiLineControl, RankedTester, rankWith } from '@jsonforms/core'; @Component({ selector: 'TextAreaRenderer', template: ` - + {{ label }}