ecabs-components 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/esm2020/lib/base/directives/digits-only.directive.module.mjs +22 -0
- package/esm2020/lib/ecabs-input/ecabs-input.module.mjs +6 -6
- package/esm2020/lib/ecabs-select/ecabs-select.component.mjs +17 -5
- package/esm2020/lib/ecabs-select/ecabs-select.module.mjs +11 -4
- package/esm2020/lib/services/ecabs-components.service.mjs +1 -1
- package/fesm2015/ecabs-components.mjs +47 -11
- package/fesm2015/ecabs-components.mjs.map +1 -1
- package/fesm2020/ecabs-components.mjs +47 -11
- package/fesm2020/ecabs-components.mjs.map +1 -1
- package/lib/base/directives/digits-only.directive.d.ts +3 -3
- package/lib/base/directives/digits-only.directive.module.d.ts +8 -0
- package/lib/ecabs-input/ecabs-input.module.d.ts +6 -6
- package/lib/ecabs-select/ecabs-select.component.d.ts +5 -1
- package/lib/ecabs-select/ecabs-select.module.d.ts +4 -3
- package/package.json +2 -2
- package/styles/material/overrides/_datepicker.scss +25 -1
- package/styles/material/overrides/_phone.scss +2 -2
- package/styles/scss/modules/_datepicker.scss +3 -3
- package/styles/scss/modules/_phone.scss +3 -1
- package/styles/scss/modules/_select.scss +16 -0
- package/lib/base/directives/digits-only.directive.ts +0 -129
- package/lib/base/element-base.ts +0 -72
- package/lib/base/element-wrapper/element-wrapper.component.html +0 -30
- package/lib/base/element-wrapper/element-wrapper.component.ts +0 -33
- package/lib/base/element-wrapper/element-wrapper.module.ts +0 -30
- package/lib/base/hint/hint.component.html +0 -1
- package/lib/base/hint/hint.component.scss +0 -0
- package/lib/base/hint/hint.component.ts +0 -12
- package/lib/base/hint/hint.module.ts +0 -13
- package/lib/base/validation/validation.component.html +0 -8
- package/lib/base/validation/validation.component.scss +0 -0
- package/lib/base/validation/validation.component.ts +0 -84
- package/lib/base/validation/validation.module.ts +0 -12
- package/lib/ecabs-buttons/ecabs-buttons.component.html +0 -18
- package/lib/ecabs-buttons/ecabs-buttons.component.ts +0 -54
- package/lib/ecabs-buttons/ecabs-buttons.module.ts +0 -13
- package/lib/ecabs-input/ecabs-input.component.html +0 -26
- package/lib/ecabs-input/ecabs-input.component.ts +0 -83
- package/lib/ecabs-input/ecabs-input.module.ts +0 -14
- package/lib/ecabs-loading/ecabs-loading.component.html +0 -7
- package/lib/ecabs-loading/ecabs-loading.component.spec.ts +0 -24
- package/lib/ecabs-loading/ecabs-loading.component.ts +0 -11
- package/lib/ecabs-loading/ecabs-loading.module.ts +0 -11
- package/lib/ecabs-loading/spinner/spinner.component.html +0 -5
- package/lib/ecabs-loading/spinner/spinner.component.scss +0 -61
- package/lib/ecabs-loading/spinner/spinner.component.spec.ts +0 -24
- package/lib/ecabs-loading/spinner/spinner.component.ts +0 -11
- package/lib/ecabs-select/ecabs-select.component.html +0 -38
- package/lib/ecabs-select/ecabs-select.component.ts +0 -246
- package/lib/ecabs-select/ecabs-select.module.ts +0 -34
- package/lib/ecabs-textarea/ecabs-textarea.component.html +0 -13
- package/lib/ecabs-textarea/ecabs-textarea.component.ts +0 -61
- package/lib/ecabs-textarea/ecabs-textarea.module.ts +0 -12
- package/lib/services/ecabs-components.service.ts +0 -33
- package/public-api.ts +0 -11
- package/test.ts +0 -27
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { LoadingComponent } from './loading.component';
|
|
4
|
-
|
|
5
|
-
describe('LoadingComponent', () => {
|
|
6
|
-
let component: LoadingComponent;
|
|
7
|
-
let fixture: ComponentFixture<LoadingComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [LoadingComponent],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
fixture = TestBed.createComponent(LoadingComponent);
|
|
17
|
-
component = fixture.componentInstance;
|
|
18
|
-
fixture.detectChanges();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should create', () => {
|
|
22
|
-
expect(component).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'ecabs-ecabs-loading',
|
|
5
|
-
templateUrl: './ecabs-loading.component.html',
|
|
6
|
-
})
|
|
7
|
-
export class EcabsLoadingComponent {
|
|
8
|
-
@Input() loading = false;
|
|
9
|
-
@Input() backgroundColor = 'white';
|
|
10
|
-
@Input() size: 'large' | 'medium' | 'tiny' = 'medium';
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { EcabsLoadingComponent } from './ecabs-loading.component';
|
|
4
|
-
import { EcabsSpinnerComponent } from './spinner/spinner.component';
|
|
5
|
-
|
|
6
|
-
@NgModule({
|
|
7
|
-
declarations: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
8
|
-
imports: [CommonModule],
|
|
9
|
-
exports: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
10
|
-
})
|
|
11
|
-
export class EcabsLoadingModule {}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
line-height: 0;
|
|
3
|
-
}
|
|
4
|
-
@keyframes ldio-inner {
|
|
5
|
-
0% {
|
|
6
|
-
transform: translate(-50%, -50%) rotate(0deg);
|
|
7
|
-
}
|
|
8
|
-
100% {
|
|
9
|
-
transform: translate(-50%, -50%) rotate(360deg);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.loadingio-spinner-rolling {
|
|
14
|
-
width: 27px;
|
|
15
|
-
height: 27px;
|
|
16
|
-
display: inline-block;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
background: none;
|
|
19
|
-
.ldio-inner {
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
position: relative;
|
|
23
|
-
transform: translateZ(0) scale(1);
|
|
24
|
-
backface-visibility: hidden;
|
|
25
|
-
transform-origin: 0 0;
|
|
26
|
-
div {
|
|
27
|
-
position: absolute;
|
|
28
|
-
width: 9px;
|
|
29
|
-
height: 9px;
|
|
30
|
-
border: 4px solid #85a2b6;
|
|
31
|
-
border-top-color: transparent;
|
|
32
|
-
border-radius: 50%;
|
|
33
|
-
animation: ldio-inner 1s linear infinite;
|
|
34
|
-
top: 14px;
|
|
35
|
-
left: 14px;
|
|
36
|
-
box-sizing: content-box;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
&.medium {
|
|
40
|
-
width: 40px;
|
|
41
|
-
height: 40px;
|
|
42
|
-
.ldio-inner div {
|
|
43
|
-
width: 20px;
|
|
44
|
-
height: 20px;
|
|
45
|
-
border-width: 6px;
|
|
46
|
-
top: 19px;
|
|
47
|
-
left: 19px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
&.large {
|
|
51
|
-
width: 60px;
|
|
52
|
-
height: 60px;
|
|
53
|
-
.ldio-inner div {
|
|
54
|
-
width: 35px;
|
|
55
|
-
height: 35px;
|
|
56
|
-
border-width: 9px;
|
|
57
|
-
top: 29px;
|
|
58
|
-
left: 29px;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SpinnerComponent } from './spinner.component';
|
|
4
|
-
|
|
5
|
-
describe('SpinnerComponent', () => {
|
|
6
|
-
let component: SpinnerComponent;
|
|
7
|
-
let fixture: ComponentFixture<SpinnerComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [SpinnerComponent],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
fixture = TestBed.createComponent(SpinnerComponent);
|
|
17
|
-
component = fixture.componentInstance;
|
|
18
|
-
fixture.detectChanges();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should create', () => {
|
|
22
|
-
expect(component).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'ecabs-loading-spinner',
|
|
5
|
-
templateUrl: './spinner.component.html',
|
|
6
|
-
styleUrls: ['./spinner.component.scss'],
|
|
7
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
-
})
|
|
9
|
-
export class EcabsSpinnerComponent {
|
|
10
|
-
@Input() size: 'large' | 'medium' | 'tiny' = 'medium';
|
|
11
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<app-element-wrapper [data]="getData()">
|
|
2
|
-
<mat-form-field floatLabel="always" [ngClass]="{ disabled: useOnlyDisabledClass }">
|
|
3
|
-
<mat-select
|
|
4
|
-
[(ngModel)]="value"
|
|
5
|
-
(closed)="onTouch()"
|
|
6
|
-
appearance="outline"
|
|
7
|
-
[multiple]="multiple"
|
|
8
|
-
[disabled]="disabled"
|
|
9
|
-
[placeholder]="placeholder"
|
|
10
|
-
(selectionChange)="onSelectionChanged($event)"
|
|
11
|
-
>
|
|
12
|
-
<mat-select-trigger>
|
|
13
|
-
<span *ngIf="getAllSelectedChecked()">{{ 'All' }}</span>
|
|
14
|
-
<span *ngIf="!getAllSelectedChecked()"
|
|
15
|
-
>{{ val && multiple ? getLabel(val[0]) : getLabel(val) }}
|
|
16
|
-
<span *ngIf="multiple && value?.length > 1" class="additional-selection">
|
|
17
|
-
(+{{ useSelectAllOption && this.allSelected?.selected ? value?.length - 2 : value?.length - 1 }}
|
|
18
|
-
{{ (value?.length === 2 ? 'Other' : 'Others') }})
|
|
19
|
-
</span>
|
|
20
|
-
</span>
|
|
21
|
-
</mat-select-trigger>
|
|
22
|
-
<mat-option *ngIf="useSearchOption">
|
|
23
|
-
[formControl]="itemFilterCtrl"
|
|
24
|
-
<ngx-mat-select-search
|
|
25
|
-
[placeholderLabel]="searchFieldPlaceholder"
|
|
26
|
-
[noEntriesFoundLabel]="noEntriesFoundLabel"
|
|
27
|
-
></ngx-mat-select-search>
|
|
28
|
-
</mat-option>
|
|
29
|
-
<mat-option *ngIf="useNoneOption">{{ 'None' }}</mat-option>
|
|
30
|
-
<mat-option #allSelected *ngIf="useSelectAllOption" (click)="toggleAllSelection()" [value]="selectAllValue">{{
|
|
31
|
-
'All'
|
|
32
|
-
}}</mat-option>
|
|
33
|
-
<mat-option *ngFor="let item of filteredItems$ | async" [value]="item.value" (click)="togglePerOne()">
|
|
34
|
-
{{ item.label }}
|
|
35
|
-
</mat-option>
|
|
36
|
-
</mat-select>
|
|
37
|
-
</mat-form-field>
|
|
38
|
-
</app-element-wrapper>
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
Component,
|
|
4
|
-
EventEmitter,
|
|
5
|
-
Injector,
|
|
6
|
-
Input,
|
|
7
|
-
OnChanges,
|
|
8
|
-
OnDestroy,
|
|
9
|
-
OnInit,
|
|
10
|
-
Output,
|
|
11
|
-
SimpleChanges,
|
|
12
|
-
ViewChild,
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import {
|
|
15
|
-
UntypedFormControl,
|
|
16
|
-
NgControl,
|
|
17
|
-
NG_VALUE_ACCESSOR,
|
|
18
|
-
} from '@angular/forms';
|
|
19
|
-
import { MatOption } from '@angular/material/core';
|
|
20
|
-
import { MatSelectSearchComponent } from 'ngx-mat-select-search';
|
|
21
|
-
import {
|
|
22
|
-
combineLatest,
|
|
23
|
-
debounceTime,
|
|
24
|
-
map,
|
|
25
|
-
ReplaySubject,
|
|
26
|
-
Subscription,
|
|
27
|
-
} from 'rxjs';
|
|
28
|
-
import ElementBaseComponent from '../base/element-base';
|
|
29
|
-
|
|
30
|
-
@Component({
|
|
31
|
-
selector: 'ecabs-select',
|
|
32
|
-
templateUrl: './ecabs-select.component.html',
|
|
33
|
-
providers: [
|
|
34
|
-
{
|
|
35
|
-
provide: NG_VALUE_ACCESSOR,
|
|
36
|
-
useExisting: EcabsSelectComponent,
|
|
37
|
-
multi: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
})
|
|
41
|
-
export class EcabsSelectComponent
|
|
42
|
-
extends ElementBaseComponent
|
|
43
|
-
implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|
44
|
-
{
|
|
45
|
-
@Input() items!: { label: string; value: any }[];
|
|
46
|
-
@Input() multiple = false;
|
|
47
|
-
@Input() useNoneOption: boolean = false;
|
|
48
|
-
@Input() useOnlyDisabledClass = false;
|
|
49
|
-
@Input() searchFieldPlaceholder: string = 'Search';
|
|
50
|
-
@Input() useSearchOption = false;
|
|
51
|
-
@Input() useSelectAllOption = false;
|
|
52
|
-
@Input() setAllOptionAfterChosenAllItems = true;
|
|
53
|
-
@Input() selectAllValue: any = 0;
|
|
54
|
-
@Input() noEntriesFoundLabel = 'SELECT.NO_MATCHING_FOUND';
|
|
55
|
-
@Output() updateFilterItems: EventEmitter<string> =
|
|
56
|
-
new EventEmitter<string>();
|
|
57
|
-
@Output() selectionChange: EventEmitter<any> = new EventEmitter<any>();
|
|
58
|
-
|
|
59
|
-
@ViewChild('allSelected') allSelected!: MatOption;
|
|
60
|
-
@ViewChild(MatSelectSearchComponent)
|
|
61
|
-
matSelectSearchComponent!: MatSelectSearchComponent;
|
|
62
|
-
|
|
63
|
-
val!: any;
|
|
64
|
-
filteredItems$: ReplaySubject<{ label: string; value: any }[]> =
|
|
65
|
-
new ReplaySubject<{ label: string; value: any }[]>(1);
|
|
66
|
-
itemFilterCtrl = new UntypedFormControl();
|
|
67
|
-
isClearAll = false;
|
|
68
|
-
subscriptions = new Subscription();
|
|
69
|
-
get value(): any {
|
|
70
|
-
return this.val;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
set value(val) {
|
|
74
|
-
if (this.val !== val) {
|
|
75
|
-
this.val = val;
|
|
76
|
-
this.onChange(val);
|
|
77
|
-
this.onTouch(val);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
constructor(private injector: Injector) {
|
|
82
|
-
super();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
86
|
-
if (changes['items'] && changes['items'].currentValue) {
|
|
87
|
-
this.filteredItems$.next(changes['items'].currentValue.slice());
|
|
88
|
-
this.filterItems();
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
this.multiple &&
|
|
92
|
-
this.useSelectAllOption &&
|
|
93
|
-
this.allSelected?.selected
|
|
94
|
-
) {
|
|
95
|
-
setTimeout(() => {
|
|
96
|
-
this.control.patchValue([
|
|
97
|
-
...this.items.map((item) => item.value),
|
|
98
|
-
this.selectAllValue,
|
|
99
|
-
]);
|
|
100
|
-
}, 100);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
ngAfterViewInit(): void {
|
|
106
|
-
const ngControl: NgControl = this.injector.get(
|
|
107
|
-
NgControl,
|
|
108
|
-
null
|
|
109
|
-
) as NgControl;
|
|
110
|
-
|
|
111
|
-
if (ngControl) {
|
|
112
|
-
this.control = ngControl.control as UntypedFormControl;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (this.matSelectSearchComponent) {
|
|
116
|
-
this.matSelectSearchComponent._showNoEntriesFound$ = combineLatest([
|
|
117
|
-
this.itemFilterCtrl.valueChanges,
|
|
118
|
-
this.filteredItems$,
|
|
119
|
-
]).pipe(
|
|
120
|
-
map(
|
|
121
|
-
([value, items]) =>
|
|
122
|
-
this.matSelectSearchComponent.noEntriesFoundLabel &&
|
|
123
|
-
value &&
|
|
124
|
-
items.length === 0
|
|
125
|
-
)
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
ngOnInit(): void {
|
|
131
|
-
this.subscriptions.add(
|
|
132
|
-
this.itemFilterCtrl.valueChanges
|
|
133
|
-
.pipe(debounceTime(200))
|
|
134
|
-
.subscribe((value:any) => {
|
|
135
|
-
this.filterItems();
|
|
136
|
-
this.updateFilterItems.emit(value);
|
|
137
|
-
|
|
138
|
-
if (this.isClearAll) {
|
|
139
|
-
this.control.patchValue([]);
|
|
140
|
-
this.isClearAll = false;
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
147
|
-
onChange: any = () => {};
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
149
|
-
onTouch: any = () => {};
|
|
150
|
-
|
|
151
|
-
toggleAllSelection(): void {
|
|
152
|
-
if (this.allSelected.selected) {
|
|
153
|
-
this.control.patchValue([
|
|
154
|
-
...this.items.map((item) => item.value),
|
|
155
|
-
this.selectAllValue,
|
|
156
|
-
]);
|
|
157
|
-
} else {
|
|
158
|
-
this.control.patchValue([]);
|
|
159
|
-
this.isClearAll = true;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
togglePerOne(): void {
|
|
164
|
-
if (this.allSelected) {
|
|
165
|
-
if (this.allSelected.selected) {
|
|
166
|
-
this.allSelected.deselect();
|
|
167
|
-
}
|
|
168
|
-
if (
|
|
169
|
-
this.setAllOptionAfterChosenAllItems &&
|
|
170
|
-
this.control.value.length === this.items.length
|
|
171
|
-
) {
|
|
172
|
-
this.allSelected.select();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
this.isClearAll = false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
getAllSelectedChecked(): boolean {
|
|
179
|
-
return this.allSelected !== undefined && this.allSelected.selected;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
getLabel(val: any): string {
|
|
183
|
-
if (
|
|
184
|
-
this.useSelectAllOption &&
|
|
185
|
-
this.allSelected?.selected &&
|
|
186
|
-
this.items &&
|
|
187
|
-
this.items.length > 0
|
|
188
|
-
) {
|
|
189
|
-
return this.items[0].label;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (val !== undefined && this.items && this.items.length > 0) {
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
194
|
-
const item = this.items.find((item) => item.value === val);
|
|
195
|
-
|
|
196
|
-
return item ? item.label : '';
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return '';
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
writeValue(value: any): void {
|
|
203
|
-
this.value = value;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
registerOnChange(fn: any): void {
|
|
207
|
-
this.onChange = fn;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
registerOnTouched(fn: any): void {
|
|
211
|
-
this.onTouch = fn;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
ngOnDestroy(): void {
|
|
215
|
-
this.subscriptions.unsubscribe();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
onSelectionChanged($event: any): void {
|
|
219
|
-
this.selectionChange.emit($event);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
private filterItems(): void {
|
|
223
|
-
if (!this.items) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// get the search keyword
|
|
228
|
-
let search: string = this.itemFilterCtrl.value;
|
|
229
|
-
|
|
230
|
-
if (!search || search === '') {
|
|
231
|
-
this.filteredItems$.next(this.items.slice());
|
|
232
|
-
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
search = search.toLowerCase();
|
|
237
|
-
|
|
238
|
-
this.filteredItems$.next(
|
|
239
|
-
this.items && this.items.length > 0
|
|
240
|
-
? this.items.filter((item) =>
|
|
241
|
-
item.label.toLowerCase().includes(search.toLowerCase())
|
|
242
|
-
)
|
|
243
|
-
: []
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { ElementWrapperModule } from '../base/element-wrapper/element-wrapper.module';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
5
|
-
import { EcabsSelectComponent } from './ecabs-select.component';
|
|
6
|
-
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
|
7
|
-
import {
|
|
8
|
-
MAT_SELECT_SCROLL_STRATEGY,
|
|
9
|
-
MatSelectModule,
|
|
10
|
-
} from '@angular/material/select';
|
|
11
|
-
import { BlockScrollStrategy, Overlay } from '@angular/cdk/overlay';
|
|
12
|
-
|
|
13
|
-
@NgModule({
|
|
14
|
-
declarations: [EcabsSelectComponent],
|
|
15
|
-
imports: [
|
|
16
|
-
CommonModule,
|
|
17
|
-
ElementWrapperModule,
|
|
18
|
-
MatSelectModule,
|
|
19
|
-
FormsModule,
|
|
20
|
-
NgxMatSelectSearchModule,
|
|
21
|
-
],
|
|
22
|
-
exports: [EcabsSelectComponent],
|
|
23
|
-
providers: [
|
|
24
|
-
{
|
|
25
|
-
provide: MAT_SELECT_SCROLL_STRATEGY,
|
|
26
|
-
useFactory: scrollFactory,
|
|
27
|
-
deps: [Overlay],
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
})
|
|
31
|
-
export class EcabsSelectModule {}
|
|
32
|
-
export function scrollFactory(overlay: Overlay): () => BlockScrollStrategy {
|
|
33
|
-
return () => overlay.scrollStrategies.block();
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<app-element-wrapper [data]="getData()">
|
|
2
|
-
<textarea
|
|
3
|
-
class="form-field__textarea"
|
|
4
|
-
[id]="name"
|
|
5
|
-
[(ngModel)]="value"
|
|
6
|
-
[placeholder]="placeholder"
|
|
7
|
-
(blur)="onTouch()"
|
|
8
|
-
[disabled]="disabled"
|
|
9
|
-
[maxlength]="maxLength"
|
|
10
|
-
[rows]="rows"
|
|
11
|
-
>
|
|
12
|
-
</textarea>
|
|
13
|
-
</app-element-wrapper>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, Component, Injector, Input } from '@angular/core';
|
|
2
|
-
import { ControlValueAccessor, UntypedFormControl, NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
import ElementBaseComponent from '../base/element-base';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'ecabs-textarea',
|
|
7
|
-
templateUrl: './ecabs-textarea.component.html',
|
|
8
|
-
providers: [
|
|
9
|
-
{
|
|
10
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11
|
-
useExisting: EcabsTextareaComponent,
|
|
12
|
-
multi: true,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
})
|
|
16
|
-
export class EcabsTextareaComponent extends ElementBaseComponent implements ControlValueAccessor, AfterViewInit {
|
|
17
|
-
@Input()
|
|
18
|
-
rows!: number;
|
|
19
|
-
|
|
20
|
-
val!: string;
|
|
21
|
-
|
|
22
|
-
get value(): string {
|
|
23
|
-
return this.val;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
set value(val) {
|
|
27
|
-
if (val !== undefined && this.val !== val) {
|
|
28
|
-
this.val = val;
|
|
29
|
-
this.onChange(val);
|
|
30
|
-
this.onTouch(val);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
constructor(private injector: Injector) {
|
|
35
|
-
super();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ngAfterViewInit(): void {
|
|
39
|
-
const ngControl: NgControl = this.injector.get(NgControl, null) as NgControl;
|
|
40
|
-
if (ngControl) {
|
|
41
|
-
this.control = ngControl.control as UntypedFormControl;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
46
|
-
onChange: any = (): void => {};
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
|
-
onTouch: any = (): void => {};
|
|
49
|
-
|
|
50
|
-
writeValue(value: any): void {
|
|
51
|
-
this.value = value;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
registerOnChange(fn: any): void {
|
|
55
|
-
this.onChange = fn;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
registerOnTouched(fn: any): void {
|
|
59
|
-
this.onTouch = fn;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { EcabsTextareaComponent } from './ecabs-textarea.component';
|
|
4
|
-
import { ElementWrapperModule } from '../base/element-wrapper/element-wrapper.module';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
@NgModule({
|
|
8
|
-
declarations: [EcabsTextareaComponent],
|
|
9
|
-
imports: [CommonModule, ElementWrapperModule, FormsModule],
|
|
10
|
-
exports: [EcabsTextareaComponent],
|
|
11
|
-
})
|
|
12
|
-
export class EcabsTextAreaModule {}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Injectable({
|
|
4
|
-
providedIn: 'root',
|
|
5
|
-
})
|
|
6
|
-
export class EcabsComponentsService {
|
|
7
|
-
config: EcabsComponentsConfig = {
|
|
8
|
-
errorMessages: [
|
|
9
|
-
{ type: 'required', message: '[label] is required' },
|
|
10
|
-
{ type: 'minlength', message: '[label] should be atleast [requiredLength] character' },
|
|
11
|
-
{ type: 'maxLength', message: '[label] should be maximum [requiredLength] character' },
|
|
12
|
-
{ type: 'min', message: '[label] should be minmum [min]' },
|
|
13
|
-
{ type: 'max', message: '[label] should be maximum [max]' },
|
|
14
|
-
{ type: 'minValue', message: '[label] should be minmum [requiredMin]' },
|
|
15
|
-
{ type: 'maxValue', message: '[label] should be maximum [requiredMax]' },
|
|
16
|
-
],
|
|
17
|
-
};
|
|
18
|
-
constructor() {}
|
|
19
|
-
setConfig(c: EcabsComponentsConfig) {
|
|
20
|
-
this.config.errorMessages = c.errorMessages;
|
|
21
|
-
}
|
|
22
|
-
getConfig(): EcabsComponentsConfig {
|
|
23
|
-
return this.config;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface EcabsComponentsConfig {
|
|
28
|
-
errorMessages: ErrorMessage[];
|
|
29
|
-
}
|
|
30
|
-
export interface ErrorMessage {
|
|
31
|
-
type: string;
|
|
32
|
-
message: string;
|
|
33
|
-
}
|
package/public-api.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './lib/ecabs-buttons/ecabs-buttons.module';
|
|
2
|
-
export * from './lib/ecabs-buttons/ecabs-buttons.component';
|
|
3
|
-
export * from './lib/ecabs-loading/ecabs-loading.module';
|
|
4
|
-
export * from './lib/ecabs-loading/ecabs-loading.component';
|
|
5
|
-
export * from './lib/ecabs-loading/spinner/spinner.component';
|
|
6
|
-
export * from './lib/ecabs-input/ecabs-input.component';
|
|
7
|
-
export * from './lib/ecabs-input/ecabs-input.module';
|
|
8
|
-
export * from './lib/ecabs-select/ecabs-select.module';
|
|
9
|
-
export * from './lib/ecabs-select/ecabs-select.component';
|
|
10
|
-
export * from './lib/ecabs-textarea/ecabs-textarea.component';
|
|
11
|
-
export * from './lib/ecabs-textarea/ecabs-textarea.module';
|
package/test.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js';
|
|
4
|
-
import 'zone.js/testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: {
|
|
12
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
13
|
-
<T>(id: string): T;
|
|
14
|
-
keys(): string[];
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting(),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Then we find all the tests.
|
|
25
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
26
|
-
// And load the modules.
|
|
27
|
-
context.keys().forEach(context);
|