|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +import { ReactWrapperComponent } from '@angular-react/core'; |
| 5 | +import { |
| 6 | + ChangeDetectionStrategy, |
| 7 | + ChangeDetectorRef, |
| 8 | + Component, |
| 9 | + ElementRef, |
| 10 | + Input, |
| 11 | + Renderer2, |
| 12 | + ViewChild, |
| 13 | + EventEmitter, |
| 14 | + Output, |
| 15 | + OnInit, |
| 16 | +} from '@angular/core'; |
| 17 | +import { ISpinButtonProps } from 'office-ui-fabric-react/lib/SpinButton'; |
| 18 | + |
| 19 | +@Component({ |
| 20 | + selector: 'fab-spin-button', |
| 21 | + exportAs: 'fabSpinButton', |
| 22 | + template: ` |
| 23 | + <SpinButton |
| 24 | + #reactNode |
| 25 | + [componentRef]="componentRef" |
| 26 | + [defaultValue]="defaultValue" |
| 27 | + [value]="value" |
| 28 | + [min]="min" |
| 29 | + [max]="max" |
| 30 | + [step]="step" |
| 31 | + [ariaLabel]="ariaLabel" |
| 32 | + [title]="title" |
| 33 | + [disabled]="disabled" |
| 34 | + [className]="className" |
| 35 | + [label]="label" |
| 36 | + [labelPosition]="labelPosition" |
| 37 | + [iconProps]="iconProps" |
| 38 | + [incrementButtonIcon]="incrementButtonIcon" |
| 39 | + [decrementButtonIcon]="decrementButtonIcon" |
| 40 | + [styles]="styles" |
| 41 | + [getClassNames]="getClassNames" |
| 42 | + [upArrowButtonStyles]="upArrowButtonStyles" |
| 43 | + [downArrowButtonStyles]="downArrowButtonStyles" |
| 44 | + [theme]="theme" |
| 45 | + [incrementButtonAriaLabel]="incrementButtonAriaLabel" |
| 46 | + [decrementButtonAriaLabel]="decrementButtonAriaLabel" |
| 47 | + [precision]="precision" |
| 48 | + [ariaPositionInSet]="ariaPositionInSet" |
| 49 | + [ariaSetSize]="ariaSetSize" |
| 50 | + [ariaValueNow]="ariaValueNow" |
| 51 | + [ariaValueText]="ariaValueText" |
| 52 | + [keytipProps]="keytipProps" |
| 53 | + [Validate]="validate" |
| 54 | + [Increment]="increment" |
| 55 | + [Decrement]="decrement" |
| 56 | + (onFocus)="onFocus.emit($event)" |
| 57 | + (onBlur)="onBlur.emit($event)" |
| 58 | + > |
| 59 | + </SpinButton> |
| 60 | + `, |
| 61 | + styles: ['react-renderer'], |
| 62 | + changeDetection: ChangeDetectionStrategy.OnPush, |
| 63 | +}) |
| 64 | +export class FabSpinButtonComponent extends ReactWrapperComponent<ISpinButtonProps> { |
| 65 | + @ViewChild('reactNode') protected reactNodeRef: ElementRef; |
| 66 | + |
| 67 | + @Input() componentRef?: ISpinButtonProps['componentRef']; |
| 68 | + @Input() defaultValue?: ISpinButtonProps['defaultValue']; |
| 69 | + @Input() value?: ISpinButtonProps['value']; |
| 70 | + @Input() min?: ISpinButtonProps['min']; |
| 71 | + @Input() max?: ISpinButtonProps['max']; |
| 72 | + @Input() step?: ISpinButtonProps['step']; |
| 73 | + @Input() ariaLabel?: ISpinButtonProps['ariaLabel']; |
| 74 | + @Input() title?: ISpinButtonProps['title']; |
| 75 | + @Input() disabled?: ISpinButtonProps['disabled']; |
| 76 | + @Input() className?: ISpinButtonProps['className']; |
| 77 | + @Input() label: ISpinButtonProps['label']; |
| 78 | + @Input() labelPosition?: ISpinButtonProps['labelPosition']; |
| 79 | + @Input() iconProps?: ISpinButtonProps['iconProps']; |
| 80 | + @Input() incrementButtonIcon?: ISpinButtonProps['incrementButtonIcon']; |
| 81 | + @Input() decrementButtonIcon?: ISpinButtonProps['decrementButtonIcon']; |
| 82 | + @Input() styles?: ISpinButtonProps['styles']; |
| 83 | + @Input() getClassNames?: ISpinButtonProps['getClassNames']; |
| 84 | + @Input() upArrowButtonStyles?: ISpinButtonProps['upArrowButtonStyles']; |
| 85 | + @Input() downArrowButtonStyles?: ISpinButtonProps['downArrowButtonStyles']; |
| 86 | + @Input() theme?: ISpinButtonProps['theme']; |
| 87 | + @Input() incrementButtonAriaLabel?: ISpinButtonProps['incrementButtonAriaLabel']; |
| 88 | + @Input() decrementButtonAriaLabel?: ISpinButtonProps['decrementButtonAriaLabel']; |
| 89 | + @Input() precision?: ISpinButtonProps['precision']; |
| 90 | + @Input() ariaPositionInSet?: ISpinButtonProps['ariaPositionInSet']; |
| 91 | + @Input() ariaSetSize?: ISpinButtonProps['ariaSetSize']; |
| 92 | + @Input() ariaValueNow?: ISpinButtonProps['ariaValueNow']; |
| 93 | + @Input() ariaValueText?: ISpinButtonProps['ariaValueText']; |
| 94 | + @Input() keytipProps?: ISpinButtonProps['keytipProps']; |
| 95 | + |
| 96 | + @Input() validate?: ISpinButtonProps['onValidate']; |
| 97 | + @Input() increment?: ISpinButtonProps['onIncrement']; |
| 98 | + @Input() decrement?: ISpinButtonProps['onDecrement']; |
| 99 | + |
| 100 | + @Output() readonly onFocus = new EventEmitter<Event>(); |
| 101 | + @Output() readonly onBlur = new EventEmitter<Event>(); |
| 102 | + |
| 103 | + constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, renderer: Renderer2) { |
| 104 | + super(elementRef, changeDetectorRef, renderer); |
| 105 | + } |
| 106 | +} |
0 commit comments