Skip to content

Commit 7579a22

Browse files
committed
Add plaintext edit
1 parent 31c18bb commit 7579a22

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

src/lib/components/components-map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { NgCheckbox } from './checkbox';
88
import { NgDial } from './dial';
99
import { NgImage } from './image';
1010
import { NgLineEdit } from './line-edit';
11+
import { NgPlainTextEdit } from './pline-text-edit';
1112

1213
export type Constructable<T> = new () => T;
1314
export type NgComponentClass = Constructable<NgComponent>;
@@ -28,5 +29,6 @@ export class ComponentsMap {
2829
this.map.set(NgDial.nodeName, NgDial);
2930
this.map.set(NgImage.nodeName, NgImage);
3031
this.map.set(NgLineEdit.nodeName, NgLineEdit);
32+
this.map.set(NgPlainTextEdit.nodeName, NgPlainTextEdit);
3133
}
3234
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { QPlainTextEdit } from '@nodegui/nodegui';
2+
import { NgComponent } from './component';
3+
import { RendererStyleFlags2 } from '@angular/core';
4+
5+
export class NgPlainTextEdit extends QPlainTextEdit implements NgComponent {
6+
public static nodeName = 'plaintextedit';
7+
public parent: any;
8+
9+
public appendChild(newChild: any): void {
10+
console.warn('plaintextedit do not have append child');
11+
}
12+
13+
public insertBefore(newChild: any, refChild: any) {}
14+
15+
public setNgAttribute(
16+
name: string,
17+
value: string,
18+
namespace?: string | null
19+
): void {}
20+
21+
public setProperty(name: string, value: boolean | string): void {
22+
switch (name) {
23+
case 'text':
24+
value ? this.setPlainText(value as string) : this.clear();
25+
break;
26+
case 'placeholderText':
27+
this.setPlaceholderText(value as string);
28+
break;
29+
case 'readOnly':
30+
this.setReadOnly(value as boolean);
31+
break;
32+
default:
33+
break;
34+
}
35+
}
36+
37+
public setStyle(
38+
style: string,
39+
value: any,
40+
flags?: RendererStyleFlags2
41+
): void {
42+
this.setInlineStyle(`${style}:${value}`);
43+
}
44+
45+
setValue(value: string): void {
46+
throw new Error('Method not implemented.');
47+
}
48+
removeAttribute(name: string, namespace?: string): void {
49+
throw new Error('Method not implemented.');
50+
}
51+
removeChild(oldChild: any): void {
52+
throw new Error('Method not implemented.');
53+
}
54+
removeClass(name: string): void {
55+
throw new Error('Method not implemented.');
56+
}
57+
removeStyle(style: string, flags?: RendererStyleFlags2): void {
58+
throw new Error('Method not implemented.');
59+
}
60+
}

0 commit comments

Comments
 (0)