TSK-1612: Delete number picker
This commit is contained in:
parent
a6535b408a
commit
84c6cd37b7
|
|
@ -1,11 +0,0 @@
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control input-text" name="number" type="number" [(ngModel)]="value" [required]="required">
|
|
||||||
<div class="input-group-btn-vertical">
|
|
||||||
<button type="button" (click)="increase()" data-toggle="tooltip" title="increase value" class="btn btn-default">
|
|
||||||
<span class="material-icons md-14 green-blue">arrow_drop_up</span>
|
|
||||||
</button>
|
|
||||||
<button type="button" (click)="decrease()" data-toggle="tooltip" title="decrease value" class="btn btn-default">
|
|
||||||
<span class="material-icons md-14 green-blue">arrow_drop_down</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
button {
|
|
||||||
font-size: 1px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group {
|
|
||||||
max-width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.input-group-btn-vertical {
|
|
||||||
position: relative;
|
|
||||||
white-space: nowrap;
|
|
||||||
vertical-align: middle;
|
|
||||||
display: table-cell;
|
|
||||||
}
|
|
||||||
.input-group-btn-vertical > .btn {
|
|
||||||
display: block;
|
|
||||||
float: none;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
padding: 1px;
|
|
||||||
margin-left: -1px;
|
|
||||||
position: relative;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
.input-group-btn-vertical > .btn:first-child {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
}
|
|
||||||
.input-group-btn-vertical > .btn:last-child {
|
|
||||||
margin-top: -3px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// small "hack" to remove the arrows in the input fields of type numbers
|
|
||||||
input[type='number']::-webkit-inner-spin-button,
|
|
||||||
input[type='number']::-webkit-outer-spin-button {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type='number'] {
|
|
||||||
-moz-appearance: textfield;
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
||||||
import { NumberPickerComponent } from './number-picker.component';
|
|
||||||
|
|
||||||
describe('NumberPickerComponent', () => {
|
|
||||||
let component: NumberPickerComponent;
|
|
||||||
let fixture: ComponentFixture<NumberPickerComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [NumberPickerComponent],
|
|
||||||
imports: [FormsModule, ReactiveFormsModule]
|
|
||||||
}).compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(NumberPickerComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
import { Component, OnInit, forwardRef, Input } from '@angular/core';
|
|
||||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'taskana-shared-number-picker',
|
|
||||||
templateUrl: './number-picker.component.html',
|
|
||||||
styleUrls: ['./number-picker.component.scss'],
|
|
||||||
providers: [
|
|
||||||
{
|
|
||||||
provide: NG_VALUE_ACCESSOR,
|
|
||||||
useExisting: forwardRef(() => NumberPickerComponent),
|
|
||||||
multi: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class NumberPickerComponent implements OnInit, ControlValueAccessor {
|
|
||||||
@Input() required = false;
|
|
||||||
|
|
||||||
// The internal data model
|
|
||||||
private innerValue: any = 0;
|
|
||||||
|
|
||||||
// Placeholders for the callbacks which are later provided
|
|
||||||
// by the Control Value Accessor
|
|
||||||
private onTouchedCallback: () => {};
|
|
||||||
private onChangeCallback: (_: any) => {};
|
|
||||||
|
|
||||||
ngOnInit() {}
|
|
||||||
|
|
||||||
// get accessor
|
|
||||||
get value(): any {
|
|
||||||
return this.innerValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set accessor including call the onchange callback
|
|
||||||
set value(v: any) {
|
|
||||||
if (v !== this.innerValue) {
|
|
||||||
this.innerValue = v;
|
|
||||||
this.onChangeCallback(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// From ControlValueAccessor interface
|
|
||||||
writeValue(value: any) {
|
|
||||||
if (value !== this.innerValue) {
|
|
||||||
this.innerValue = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// From ControlValueAccessor interface
|
|
||||||
registerOnChange(fn: any) {
|
|
||||||
this.onChangeCallback = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From ControlValueAccessor interface
|
|
||||||
registerOnTouched(fn: any) {
|
|
||||||
this.onTouchedCallback = fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
increase() {
|
|
||||||
if (!this.value) {
|
|
||||||
this.value = 0;
|
|
||||||
}
|
|
||||||
this.value += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
decrease() {
|
|
||||||
if (!this.value) {
|
|
||||||
this.value = 0;
|
|
||||||
}
|
|
||||||
this.value -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,7 +27,6 @@ import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatRadioModule } from '@angular/material/radio';
|
import { MatRadioModule } from '@angular/material/radio';
|
||||||
import { SortComponent } from './components/sort/sort.component';
|
import { SortComponent } from './components/sort/sort.component';
|
||||||
import { PaginationComponent } from './components/pagination/pagination.component';
|
import { PaginationComponent } from './components/pagination/pagination.component';
|
||||||
import { NumberPickerComponent } from './components/number-picker/number-picker.component';
|
|
||||||
import { ProgressSpinnerComponent } from './components/progress-spinner/progress-spinner.component';
|
import { ProgressSpinnerComponent } from './components/progress-spinner/progress-spinner.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -93,7 +92,6 @@ const DECLARATIONS = [
|
||||||
IconTypeComponent,
|
IconTypeComponent,
|
||||||
FieldErrorDisplayComponent,
|
FieldErrorDisplayComponent,
|
||||||
PaginationComponent,
|
PaginationComponent,
|
||||||
NumberPickerComponent,
|
|
||||||
ProgressSpinnerComponent,
|
ProgressSpinnerComponent,
|
||||||
ToastComponent,
|
ToastComponent,
|
||||||
DialogPopUpComponent,
|
DialogPopUpComponent,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue