Skip to content
Snippets Groups Projects
Commit 38f8fe76 authored by mechtelm's avatar mechtelm
Browse files

Implement readonly

parent 8e583508
No related branches found
No related tags found
No related merge requests found
import { Component, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { MatInput } from '@angular/material/input'; import { MatInput } from '@angular/material/input';
import { MatButton } from '@angular/material/button';
import { FormElementComponent } from '../form-element-component.directive'; import { FormElementComponent } from '../form-element-component.directive';
import { SpellCorrectElement } from '../models/spell-correct-element'; import { SpellCorrectElement } from '../models/spell-correct-element';
...@@ -35,9 +36,20 @@ import { SpellCorrectElement } from '../models/spell-correct-element'; ...@@ -35,9 +36,20 @@ import { SpellCorrectElement } from '../models/spell-correct-element';
'::ng-deep app-spell-correct .small-input div.mat-form-field-infix {border-top: none; padding: 0.75em 0 0.25em 0;}' '::ng-deep app-spell-correct .small-input div.mat-form-field-infix {border-top: none; padding: 0.75em 0 0.25em 0;}'
] ]
}) })
export class SpellCorrectComponent extends FormElementComponent { export class SpellCorrectComponent extends FormElementComponent implements OnInit {
elementModel!: SpellCorrectElement; elementModel!: SpellCorrectElement;
@ViewChild(MatInput) inputElement!: MatInput; @ViewChild(MatInput) inputElement!: MatInput;
@ViewChild(MatButton) buttonElement!: MatButton;
ngOnInit(): void {
super.ngOnInit();
if (this.inputElement && this.elementModel.readOnly) {
this.inputElement.readonly = true;
}
if (this.buttonElement && this.elementModel.readOnly) {
this.buttonElement.disabled = true;
}
}
strikethrough(): boolean { strikethrough(): boolean {
if (this.inputElement) { if (this.inputElement) {
......
import {FontElement, SurfaceUIElement} from '../interfaces/UIElementInterfaces'; import { FontElement, SurfaceUIElement } from '../interfaces/UIElementInterfaces';
import { InputElement, UIElement} from './uI-element'; import { InputElement, UIElement } from './uI-element';
import {initFontElement, initSurfaceElement} from '../util/unit-interface-initializer'; import { initFontElement, initSurfaceElement } from '../util/unit-interface-initializer';
export class SpellCorrectElement extends InputElement implements FontElement, SurfaceUIElement { export class SpellCorrectElement extends InputElement implements FontElement, SurfaceUIElement {
bold: boolean = false; bold: boolean = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment