|
| 1 | +import { QSpinBox } from '@nodegui/nodegui'; |
| 2 | +import { NgComponent } from './component'; |
| 3 | +import { RendererStyleFlags2 } from '@angular/core'; |
| 4 | + |
| 5 | +interface Range { |
| 6 | + minimum: number; |
| 7 | + maximum: number; |
| 8 | +} |
| 9 | + |
| 10 | +export class NgSpinnBox extends QSpinBox implements NgComponent { |
| 11 | + public static nodeName = 'spinbox'; |
| 12 | + public parent: any; |
| 13 | + |
| 14 | + public appendChild(newChild: any): void { |
| 15 | + throw new Error('Method not implemented.'); |
| 16 | + } |
| 17 | + |
| 18 | + public insertBefore(newChild: any, refChild: any) {} |
| 19 | + |
| 20 | + public setNgAttribute( |
| 21 | + name: string, |
| 22 | + value: string, |
| 23 | + namespace?: string | null |
| 24 | + ): void {} |
| 25 | + |
| 26 | + public setProperty( |
| 27 | + name: string, |
| 28 | + value: boolean | string | Range | number |
| 29 | + ): void { |
| 30 | + switch (name) { |
| 31 | + case 'prefix': |
| 32 | + this.setPrefix(value as string); |
| 33 | + break; |
| 34 | + case 'suffix': |
| 35 | + this.setSuffix(value as string); |
| 36 | + break; |
| 37 | + case 'singleStep': |
| 38 | + this.setSingleStep(value as number); |
| 39 | + break; |
| 40 | + case 'range': |
| 41 | + this.setRange((value as Range).minimum, (value as Range).maximum); |
| 42 | + break; |
| 43 | + case 'value': |
| 44 | + this.setValue(value as number); |
| 45 | + break; |
| 46 | + default: |
| 47 | + break; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + public setStyle( |
| 52 | + style: string, |
| 53 | + value: any, |
| 54 | + flags?: RendererStyleFlags2 |
| 55 | + ): void { |
| 56 | + this.setInlineStyle(`${style}:${value}`); |
| 57 | + } |
| 58 | + |
| 59 | + public setValue(value: number): void { |
| 60 | + super.setValue(value); |
| 61 | + } |
| 62 | + |
| 63 | + removeAttribute(name: string, namespace?: string): void { |
| 64 | + throw new Error('Method not implemented.'); |
| 65 | + } |
| 66 | + removeChild(oldChild: any): void { |
| 67 | + throw new Error('Method not implemented.'); |
| 68 | + } |
| 69 | + removeClass(name: string): void { |
| 70 | + throw new Error('Method not implemented.'); |
| 71 | + } |
| 72 | + removeStyle(style: string, flags?: RendererStyleFlags2): void { |
| 73 | + throw new Error('Method not implemented.'); |
| 74 | + } |
| 75 | +} |
0 commit comments