ecabs-components 0.0.1 → 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.
Files changed (59) hide show
  1. package/README.md +24 -24
  2. package/esm2020/lib/base/directives/digits-only.directive.module.mjs +22 -0
  3. package/esm2020/lib/base/validation/validation.component.mjs +14 -102
  4. package/esm2020/lib/ecabs-input/ecabs-input.module.mjs +6 -6
  5. package/esm2020/lib/ecabs-select/ecabs-select.component.mjs +222 -0
  6. package/esm2020/lib/ecabs-select/ecabs-select.module.mjs +60 -0
  7. package/esm2020/lib/ecabs-textarea/ecabs-textarea.component.mjs +62 -0
  8. package/esm2020/lib/ecabs-textarea/ecabs-textarea.module.mjs +20 -0
  9. package/esm2020/lib/services/ecabs-components.service.mjs +32 -0
  10. package/esm2020/public-api.mjs +5 -1
  11. package/fesm2015/ecabs-components.mjs +404 -106
  12. package/fesm2015/ecabs-components.mjs.map +1 -1
  13. package/fesm2020/ecabs-components.mjs +402 -106
  14. package/fesm2020/ecabs-components.mjs.map +1 -1
  15. package/lib/base/directives/digits-only.directive.d.ts +3 -3
  16. package/lib/base/directives/digits-only.directive.module.d.ts +8 -0
  17. package/lib/base/validation/validation.component.d.ts +5 -3
  18. package/lib/ecabs-input/ecabs-input.module.d.ts +6 -6
  19. package/lib/ecabs-select/ecabs-select.component.d.ts +59 -0
  20. package/lib/ecabs-select/ecabs-select.module.d.ts +15 -0
  21. package/lib/ecabs-textarea/ecabs-textarea.component.d.ts +20 -0
  22. package/lib/ecabs-textarea/ecabs-textarea.module.d.ts +10 -0
  23. package/lib/services/ecabs-components.service.d.ts +16 -0
  24. package/package.json +3 -2
  25. package/public-api.d.ts +4 -0
  26. package/styles/material/overrides/_datepicker.scss +25 -1
  27. package/styles/material/overrides/_phone.scss +2 -2
  28. package/styles/scss/modules/_datepicker.scss +3 -3
  29. package/styles/scss/modules/_phone.scss +3 -1
  30. package/styles/scss/modules/_select.scss +16 -0
  31. package/lib/base/directives/digits-only.directive.ts +0 -129
  32. package/lib/base/element-base.ts +0 -72
  33. package/lib/base/element-wrapper/element-wrapper.component.html +0 -30
  34. package/lib/base/element-wrapper/element-wrapper.component.ts +0 -33
  35. package/lib/base/element-wrapper/element-wrapper.module.ts +0 -30
  36. package/lib/base/hint/hint.component.html +0 -1
  37. package/lib/base/hint/hint.component.scss +0 -0
  38. package/lib/base/hint/hint.component.ts +0 -12
  39. package/lib/base/hint/hint.module.ts +0 -13
  40. package/lib/base/validation/validation.component.html +0 -8
  41. package/lib/base/validation/validation.component.scss +0 -0
  42. package/lib/base/validation/validation.component.ts +0 -171
  43. package/lib/base/validation/validation.module.ts +0 -12
  44. package/lib/ecabs-buttons/ecabs-buttons.component.html +0 -18
  45. package/lib/ecabs-buttons/ecabs-buttons.component.ts +0 -54
  46. package/lib/ecabs-buttons/ecabs-buttons.module.ts +0 -13
  47. package/lib/ecabs-input/ecabs-input.component.html +0 -26
  48. package/lib/ecabs-input/ecabs-input.component.ts +0 -83
  49. package/lib/ecabs-input/ecabs-input.module.ts +0 -14
  50. package/lib/ecabs-loading/ecabs-loading.component.html +0 -7
  51. package/lib/ecabs-loading/ecabs-loading.component.spec.ts +0 -24
  52. package/lib/ecabs-loading/ecabs-loading.component.ts +0 -11
  53. package/lib/ecabs-loading/ecabs-loading.module.ts +0 -11
  54. package/lib/ecabs-loading/spinner/spinner.component.html +0 -5
  55. package/lib/ecabs-loading/spinner/spinner.component.scss +0 -61
  56. package/lib/ecabs-loading/spinner/spinner.component.spec.ts +0 -24
  57. package/lib/ecabs-loading/spinner/spinner.component.ts +0 -11
  58. package/public-api.ts +0 -7
  59. package/test.ts +0 -27
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, HostBinding, NgModule, EventEmitter, Output, Directive, HostListener } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, HostBinding, NgModule, EventEmitter, Output, Injectable, Directive, HostListener, ViewChild } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i2 from '@angular/material/button';
@@ -7,11 +7,19 @@ import { MatButtonModule } from '@angular/material/button';
7
7
  import * as i4 from '@angular/material/icon';
8
8
  import { MatIconModule } from '@angular/material/icon';
9
9
  import * as i3 from '@angular/forms';
10
- import { NgControl, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
10
+ import { NgControl, NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
11
11
  import * as i5 from '@angular/material/tooltip';
12
12
  import { MatTooltipModule } from '@angular/material/tooltip';
13
13
  import { MatInputModule } from '@angular/material/input';
14
+ import * as i3$1 from '@angular/material/form-field';
14
15
  import { MatFormFieldModule } from '@angular/material/form-field';
16
+ import * as i7 from 'ngx-mat-select-search';
17
+ import { MatSelectSearchComponent, NgxMatSelectSearchModule } from 'ngx-mat-select-search';
18
+ import { ReplaySubject, Subscription, combineLatest, map, debounceTime } from 'rxjs';
19
+ import * as i4$1 from '@angular/material/select';
20
+ import { MatSelectModule, MAT_SELECT_SCROLL_STRATEGY } from '@angular/material/select';
21
+ import * as i5$1 from '@angular/material/core';
22
+ import { Overlay } from '@angular/cdk/overlay';
15
23
 
16
24
  class EcabsSpinnerComponent {
17
25
  constructor() {
@@ -233,101 +241,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
233
241
  type: Output
234
242
  }] } });
235
243
 
236
- class ValidationComponent {
244
+ class EcabsComponentsService {
237
245
  constructor() {
246
+ this.config = {
247
+ errorMessages: [
248
+ { type: 'required', message: '[label] is required' },
249
+ { type: 'minlength', message: '[label] should be atleast [requiredLength] character' },
250
+ { type: 'maxLength', message: '[label] should be maximum [requiredLength] character' },
251
+ { type: 'min', message: '[label] should be minmum [min]' },
252
+ { type: 'max', message: '[label] should be maximum [max]' },
253
+ { type: 'minValue', message: '[label] should be minmum [requiredMin]' },
254
+ { type: 'maxValue', message: '[label] should be maximum [requiredMax]' },
255
+ ],
256
+ };
257
+ }
258
+ setConfig(c) {
259
+ this.config.errorMessages = c.errorMessages;
260
+ }
261
+ getConfig() {
262
+ return this.config;
263
+ }
264
+ }
265
+ EcabsComponentsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
266
+ EcabsComponentsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsComponentsService, providedIn: 'root' });
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsComponentsService, decorators: [{
268
+ type: Injectable,
269
+ args: [{
270
+ providedIn: 'root',
271
+ }]
272
+ }], ctorParameters: function () { return []; } });
273
+
274
+ class ValidationComponent {
275
+ constructor(ecabsService) {
276
+ this.ecabsService = ecabsService;
238
277
  this.showValidationOnNotTouched = false;
239
- this.errorMessages = [];
240
278
  this._messages = {};
241
- // this.errorMessages = [
242
- // {
243
- // type: 'required',
244
- // message: this.translateService.instant(
245
- // 'FORMS.VALIDATION.LABEL_REQUIRED'
246
- // ),
247
- // },
248
- // {
249
- // type: 'minlength',
250
- // message: this.translateService.instant('FORMS.VALIDATION.MIN_LENGTH'),
251
- // },
252
- // {
253
- // type: 'maxlength',
254
- // message: this.translateService.instant('FORMS.VALIDATION.MAX_LENGTH'),
255
- // },
256
- // {
257
- // type: 'min',
258
- // message: this.translateService.instant('FORMS.VALIDATION.MIN'),
259
- // },
260
- // {
261
- // type: 'max',
262
- // message: this.translateService.instant('FORMS.VALIDATION.MAX'),
263
- // },
264
- // {
265
- // type: 'minValue',
266
- // message: this.translateService.instant('FORMS.VALIDATION.MIN_VALUE'),
267
- // },
268
- // {
269
- // type: 'maxValue',
270
- // message: this.translateService.instant('FORMS.VALIDATION.MAX_VALUE'),
271
- // },
272
- // {
273
- // type: 'validatePhoneNumber',
274
- // message: this.translateService.instant(
275
- // 'FORMS.VALIDATION.VALIDATE_PHONE_NUMBER'
276
- // ),
277
- // },
278
- // {
279
- // type: 'pastDate',
280
- // message: this.translateService.instant('FORMS.VALIDATION.PAST_DATE'),
281
- // },
282
- // {
283
- // type: 'affectsError',
284
- // message: this.translateService.instant(
285
- // 'FORMS.VALIDATION.AFFECTS_ERROR'
286
- // ),
287
- // },
288
- // {
289
- // type: 'moreThan',
290
- // message: this.translateService.instant('FORMS.VALIDATION.MORE_THAN'),
291
- // },
292
- // {
293
- // type: 'lessThan',
294
- // message: this.translateService.instant('FORMS.VALIDATION.LESS_THAN'),
295
- // },
296
- // {
297
- // type: 'iban',
298
- // message: this.translateService.instant('FORMS.VALIDATION.INVALID'),
299
- // },
300
- // {
301
- // type: 'email',
302
- // message: this.translateService.instant('FORMS.VALIDATION.EMAIL'),
303
- // },
304
- // {
305
- // type: 'numberMoreThan',
306
- // message: this.translateService.instant(
307
- // 'FORMS.VALIDATION.VALUE_MORE_THAN'
308
- // ),
309
- // },
310
- // {
311
- // type: 'numberLessThan',
312
- // message: this.translateService.instant(
313
- // 'FORMS.VALIDATION.VALUE_LESS_THAN'
314
- // ),
315
- // },
316
- // {
317
- // type: 'outOfRange',
318
- // message: this.translateService.instant('FORMS.VALIDATION.OUT_OF_RANGE'),
319
- // },
320
- // {
321
- // type: 'iban',
322
- // message: this.translateService.instant('FORMS.VALIDATION.IBAN'),
323
- // },
324
- // {
325
- // type: 'timeIsAfter',
326
- // message: this.translateService.instant(
327
- // 'FORMS.VALIDATION.LESS_THAN_TIME'
328
- // ),
329
- // },
330
- // ];
331
279
  }
332
280
  get messages() {
333
281
  if (this.element) {
@@ -344,6 +292,12 @@ class ValidationComponent {
344
292
  set messages(m) {
345
293
  this._messages = m;
346
294
  }
295
+ ngOnInit() {
296
+ this.config = this.ecabsService.getConfig();
297
+ for (let error of this.config.errorMessages) {
298
+ this.messages[error.type] = this.replaceTokens(error.message);
299
+ }
300
+ }
347
301
  ngOnChanges(changes) {
348
302
  const { updatedErrors } = changes;
349
303
  if (updatedErrors &&
@@ -354,11 +308,6 @@ class ValidationComponent {
354
308
  }
355
309
  }
356
310
  }
357
- ngOnInit() {
358
- for (const error of this.errorMessages) {
359
- this.messages[error.type] = this.replaceTokens(error.message);
360
- }
361
- }
362
311
  replaceTokens(message) {
363
312
  let retMessage;
364
313
  if (this.label) {
@@ -373,12 +322,12 @@ class ValidationComponent {
373
322
  return this.messages[key];
374
323
  }
375
324
  }
376
- ValidationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
325
+ ValidationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationComponent, deps: [{ token: EcabsComponentsService }], target: i0.ɵɵFactoryTarget.Component });
377
326
  ValidationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ValidationComponent, selector: "app-validations-messages", inputs: { element: "element", label: "label", showValidationOnNotTouched: "showValidationOnNotTouched", updatedErrors: "updatedErrors" }, usesOnChanges: true, ngImport: i0, template: "<div\r\n class=\"form-field__validation\"\r\n *ngIf=\"element && (element?.touched || showValidationOnNotTouched) && element?.invalid\"\r\n>\r\n <div class=\"form-field__validation__item\" *ngFor=\"let item of element?.errors | keyvalue\">\r\n {{ getMessageDetail(item.key) }}\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }] });
378
327
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationComponent, decorators: [{
379
328
  type: Component,
380
329
  args: [{ selector: 'app-validations-messages', template: "<div\r\n class=\"form-field__validation\"\r\n *ngIf=\"element && (element?.touched || showValidationOnNotTouched) && element?.invalid\"\r\n>\r\n <div class=\"form-field__validation__item\" *ngFor=\"let item of element?.errors | keyvalue\">\r\n {{ getMessageDetail(item.key) }}\r\n </div>\r\n</div>\r\n" }]
381
- }], ctorParameters: function () { return []; }, propDecorators: { element: [{
330
+ }], ctorParameters: function () { return [{ type: EcabsComponentsService }]; }, propDecorators: { element: [{
382
331
  type: Input
383
332
  }], label: [{
384
333
  type: Input
@@ -720,23 +669,370 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
720
669
  }]
721
670
  }] });
722
671
 
672
+ class DigitsOnlyDirectivesModule {
673
+ }
674
+ DigitsOnlyDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
675
+ DigitsOnlyDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirectivesModule, declarations: [DigitsOnlyDirective], imports: [CommonModule], exports: [DigitsOnlyDirective] });
676
+ DigitsOnlyDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirectivesModule, imports: [CommonModule] });
677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirectivesModule, decorators: [{
678
+ type: NgModule,
679
+ args: [{
680
+ imports: [CommonModule],
681
+ declarations: [
682
+ DigitsOnlyDirective,
683
+ ],
684
+ exports: [
685
+ DigitsOnlyDirective,
686
+ ],
687
+ }]
688
+ }] });
689
+
723
690
  class EcabsInputModule {
724
691
  }
725
692
  EcabsInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
726
- EcabsInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, declarations: [EcabsInputComponent, DigitsOnlyDirective], imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule], exports: [EcabsInputComponent] });
727
- EcabsInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule] });
693
+ EcabsInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, declarations: [EcabsInputComponent], imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule, DigitsOnlyDirectivesModule], exports: [EcabsInputComponent] });
694
+ EcabsInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule, DigitsOnlyDirectivesModule] });
728
695
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, decorators: [{
729
696
  type: NgModule,
730
697
  args: [{
731
- declarations: [EcabsInputComponent, DigitsOnlyDirective],
732
- imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule],
698
+ declarations: [EcabsInputComponent],
699
+ imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule, DigitsOnlyDirectivesModule],
733
700
  exports: [EcabsInputComponent],
734
701
  }]
735
702
  }] });
736
703
 
704
+ class EcabsSelectComponent extends ElementBaseComponent {
705
+ constructor(injector) {
706
+ super();
707
+ this.injector = injector;
708
+ this.multiple = false;
709
+ this.useNoneOption = false;
710
+ this.useOnlyDisabledClass = false;
711
+ this.searchFieldPlaceholder = 'Search';
712
+ this.useSearchOption = false;
713
+ this.useSelectAllOption = false;
714
+ this.setAllOptionAfterChosenAllItems = true;
715
+ this.selectAllValue = 0;
716
+ this.noEntriesFoundLabel = 'No matching found';
717
+ this.noneLabel = 'None';
718
+ this.allLabel = 'All';
719
+ this.otherLabel = 'Other';
720
+ this.othersLabel = 'Others';
721
+ this.updateFilterItems = new EventEmitter();
722
+ this.selectionChange = new EventEmitter();
723
+ this.filteredItems$ = new ReplaySubject(1);
724
+ this.itemFilterCtrl = new UntypedFormControl();
725
+ this.isClearAll = false;
726
+ this.subscriptions = new Subscription();
727
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
728
+ this.onChange = () => { };
729
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
730
+ this.onTouch = () => { };
731
+ }
732
+ get value() {
733
+ return this.val;
734
+ }
735
+ set value(val) {
736
+ if (this.val !== val) {
737
+ this.val = val;
738
+ this.onChange(val);
739
+ this.onTouch(val);
740
+ }
741
+ }
742
+ ngOnChanges(changes) {
743
+ if (changes['items'] && changes['items'].currentValue) {
744
+ this.filteredItems$.next(changes['items'].currentValue.slice());
745
+ this.filterItems();
746
+ if (this.multiple &&
747
+ this.useSelectAllOption &&
748
+ this.allSelected?.selected) {
749
+ setTimeout(() => {
750
+ this.control.patchValue([
751
+ ...this.items.map((item) => item.value),
752
+ this.selectAllValue,
753
+ ]);
754
+ }, 100);
755
+ }
756
+ }
757
+ }
758
+ ngAfterViewInit() {
759
+ const ngControl = this.injector.get(NgControl, null);
760
+ if (ngControl) {
761
+ this.control = ngControl.control;
762
+ }
763
+ if (this.matSelectSearchComponent) {
764
+ this.matSelectSearchComponent._showNoEntriesFound$ = combineLatest([
765
+ this.itemFilterCtrl.valueChanges,
766
+ this.filteredItems$,
767
+ ]).pipe(map(([value, items]) => this.matSelectSearchComponent.noEntriesFoundLabel &&
768
+ value &&
769
+ items.length === 0));
770
+ }
771
+ }
772
+ ngOnInit() {
773
+ this.subscriptions.add(this.itemFilterCtrl.valueChanges
774
+ .pipe(debounceTime(200))
775
+ .subscribe((value) => {
776
+ this.filterItems();
777
+ this.updateFilterItems.emit(value);
778
+ if (this.isClearAll) {
779
+ this.control.patchValue([]);
780
+ this.isClearAll = false;
781
+ }
782
+ }));
783
+ }
784
+ toggleAllSelection() {
785
+ if (this.allSelected.selected) {
786
+ this.control.patchValue([
787
+ ...this.items.map((item) => item.value),
788
+ this.selectAllValue,
789
+ ]);
790
+ }
791
+ else {
792
+ this.control.patchValue([]);
793
+ this.isClearAll = true;
794
+ }
795
+ }
796
+ togglePerOne() {
797
+ if (this.allSelected) {
798
+ if (this.allSelected.selected) {
799
+ this.allSelected.deselect();
800
+ }
801
+ if (this.setAllOptionAfterChosenAllItems &&
802
+ this.control.value.length === this.items.length) {
803
+ this.allSelected.select();
804
+ }
805
+ }
806
+ this.isClearAll = false;
807
+ }
808
+ getAllSelectedChecked() {
809
+ return this.allSelected !== undefined && this.allSelected.selected;
810
+ }
811
+ getLabel(val) {
812
+ if (this.useSelectAllOption &&
813
+ this.allSelected?.selected &&
814
+ this.items &&
815
+ this.items.length > 0) {
816
+ return this.items[0].label;
817
+ }
818
+ if (val !== undefined && this.items && this.items.length > 0) {
819
+ // eslint-disable-next-line @typescript-eslint/no-shadow
820
+ const item = this.items.find((item) => item.value === val);
821
+ return item ? item.label : '';
822
+ }
823
+ return '';
824
+ }
825
+ writeValue(value) {
826
+ this.value = value;
827
+ }
828
+ registerOnChange(fn) {
829
+ this.onChange = fn;
830
+ }
831
+ registerOnTouched(fn) {
832
+ this.onTouch = fn;
833
+ }
834
+ ngOnDestroy() {
835
+ this.subscriptions.unsubscribe();
836
+ }
837
+ onSelectionChanged($event) {
838
+ this.selectionChange.emit($event);
839
+ }
840
+ filterItems() {
841
+ if (!this.items) {
842
+ return;
843
+ }
844
+ // get the search keyword
845
+ let search = this.itemFilterCtrl.value;
846
+ if (!search || search === '') {
847
+ this.filteredItems$.next(this.items.slice());
848
+ return;
849
+ }
850
+ search = search.toLowerCase();
851
+ this.filteredItems$.next(this.items && this.items.length > 0
852
+ ? this.items.filter((item) => item.label.toLowerCase().includes(search.toLowerCase()))
853
+ : []);
854
+ }
855
+ }
856
+ EcabsSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
857
+ EcabsSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: EcabsSelectComponent, selector: "ecabs-select", inputs: { items: "items", multiple: "multiple", useNoneOption: "useNoneOption", useOnlyDisabledClass: "useOnlyDisabledClass", searchFieldPlaceholder: "searchFieldPlaceholder", useSearchOption: "useSearchOption", useSelectAllOption: "useSelectAllOption", setAllOptionAfterChosenAllItems: "setAllOptionAfterChosenAllItems", selectAllValue: "selectAllValue", noEntriesFoundLabel: "noEntriesFoundLabel", noneLabel: "noneLabel", allLabel: "allLabel", otherLabel: "otherLabel", othersLabel: "othersLabel" }, outputs: { updateFilterItems: "updateFilterItems", selectionChange: "selectionChange" }, providers: [
858
+ {
859
+ provide: NG_VALUE_ACCESSOR,
860
+ useExisting: EcabsSelectComponent,
861
+ multi: true,
862
+ },
863
+ ], viewQueries: [{ propertyName: "allSelected", first: true, predicate: ["allSelected"], descendants: true }, { propertyName: "matSelectSearchComponent", first: true, predicate: MatSelectSearchComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<app-element-wrapper [data]=\"getData()\">\r\n <mat-form-field [ngClass]=\"{ disabled: useOnlyDisabledClass }\">\r\n <mat-select\r\n [(ngModel)]=\"value\"\r\n (closed)=\"onTouch()\"\r\n appearance=\"outline\"\r\n [multiple]=\"multiple\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n (selectionChange)=\"onSelectionChanged($event)\"\r\n >\r\n <mat-select-trigger>\r\n <span *ngIf=\"getAllSelectedChecked()\">{{ allLabel }}</span>\r\n <span *ngIf=\"!getAllSelectedChecked()\"\r\n >{{ val && multiple ? getLabel(val[0]) : getLabel(val) }}\r\n <span *ngIf=\"multiple && value?.length > 1\" class=\"additional-selection\">\r\n (+{{ useSelectAllOption && this.allSelected.selected ? value?.length - 2 : value?.length - 1 }}\r\n {{ (value?.length === 2 ? otherLabel : othersLabel) }})\r\n </span>\r\n </span>\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"useSearchOption\">\r\n <ngx-mat-select-search\r\n [formControl]=\"itemFilterCtrl\"\r\n [placeholderLabel]=\"searchFieldPlaceholder\"\r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\r\n ></ngx-mat-select-search>\r\n </mat-option>\r\n <mat-option *ngIf=\"useNoneOption\">{{ noneLabel }}</mat-option>\r\n <mat-option #allSelected *ngIf=\"useSelectAllOption\" (click)=\"toggleAllSelection()\" [value]=\"selectAllValue\">{{\r\n allLabel\r\n }}</mat-option>\r\n <mat-option *ngFor=\"let item of filteredItems$ | async\" [value]=\"item.value\" (click)=\"togglePerOne()\">\r\n {{ item.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</app-element-wrapper>\r\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ElementWrapperComponent, selector: "app-element-wrapper", inputs: ["data", "showCloseIcon", "focusedFlag", "showPassword", "control"], outputs: ["showHidePassword", "clear", "increase", "decrease"] }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i4$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "directive", type: i4$1.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i7.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "indexAndLengthScreenReaderText", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toogleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti"], outputs: ["toggleAll"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
864
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectComponent, decorators: [{
865
+ type: Component,
866
+ args: [{ selector: 'ecabs-select', providers: [
867
+ {
868
+ provide: NG_VALUE_ACCESSOR,
869
+ useExisting: EcabsSelectComponent,
870
+ multi: true,
871
+ },
872
+ ], template: "<app-element-wrapper [data]=\"getData()\">\r\n <mat-form-field [ngClass]=\"{ disabled: useOnlyDisabledClass }\">\r\n <mat-select\r\n [(ngModel)]=\"value\"\r\n (closed)=\"onTouch()\"\r\n appearance=\"outline\"\r\n [multiple]=\"multiple\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n (selectionChange)=\"onSelectionChanged($event)\"\r\n >\r\n <mat-select-trigger>\r\n <span *ngIf=\"getAllSelectedChecked()\">{{ allLabel }}</span>\r\n <span *ngIf=\"!getAllSelectedChecked()\"\r\n >{{ val && multiple ? getLabel(val[0]) : getLabel(val) }}\r\n <span *ngIf=\"multiple && value?.length > 1\" class=\"additional-selection\">\r\n (+{{ useSelectAllOption && this.allSelected.selected ? value?.length - 2 : value?.length - 1 }}\r\n {{ (value?.length === 2 ? otherLabel : othersLabel) }})\r\n </span>\r\n </span>\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"useSearchOption\">\r\n <ngx-mat-select-search\r\n [formControl]=\"itemFilterCtrl\"\r\n [placeholderLabel]=\"searchFieldPlaceholder\"\r\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\r\n ></ngx-mat-select-search>\r\n </mat-option>\r\n <mat-option *ngIf=\"useNoneOption\">{{ noneLabel }}</mat-option>\r\n <mat-option #allSelected *ngIf=\"useSelectAllOption\" (click)=\"toggleAllSelection()\" [value]=\"selectAllValue\">{{\r\n allLabel\r\n }}</mat-option>\r\n <mat-option *ngFor=\"let item of filteredItems$ | async\" [value]=\"item.value\" (click)=\"togglePerOne()\">\r\n {{ item.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</app-element-wrapper>\r\n" }]
873
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { items: [{
874
+ type: Input
875
+ }], multiple: [{
876
+ type: Input
877
+ }], useNoneOption: [{
878
+ type: Input
879
+ }], useOnlyDisabledClass: [{
880
+ type: Input
881
+ }], searchFieldPlaceholder: [{
882
+ type: Input
883
+ }], useSearchOption: [{
884
+ type: Input
885
+ }], useSelectAllOption: [{
886
+ type: Input
887
+ }], setAllOptionAfterChosenAllItems: [{
888
+ type: Input
889
+ }], selectAllValue: [{
890
+ type: Input
891
+ }], noEntriesFoundLabel: [{
892
+ type: Input
893
+ }], noneLabel: [{
894
+ type: Input
895
+ }], allLabel: [{
896
+ type: Input
897
+ }], otherLabel: [{
898
+ type: Input
899
+ }], othersLabel: [{
900
+ type: Input
901
+ }], updateFilterItems: [{
902
+ type: Output
903
+ }], selectionChange: [{
904
+ type: Output
905
+ }], allSelected: [{
906
+ type: ViewChild,
907
+ args: ['allSelected']
908
+ }], matSelectSearchComponent: [{
909
+ type: ViewChild,
910
+ args: [MatSelectSearchComponent]
911
+ }] } });
912
+
913
+ class EcabsSelectModule {
914
+ }
915
+ EcabsSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
916
+ EcabsSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectModule, declarations: [EcabsSelectComponent], imports: [CommonModule,
917
+ ElementWrapperModule,
918
+ MatSelectModule,
919
+ MatFormFieldModule,
920
+ FormsModule,
921
+ NgxMatSelectSearchModule,
922
+ ReactiveFormsModule], exports: [EcabsSelectComponent] });
923
+ EcabsSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectModule, providers: [
924
+ {
925
+ provide: MAT_SELECT_SCROLL_STRATEGY,
926
+ useFactory: scrollFactory,
927
+ deps: [Overlay],
928
+ },
929
+ ], imports: [CommonModule,
930
+ ElementWrapperModule,
931
+ MatSelectModule,
932
+ MatFormFieldModule,
933
+ FormsModule,
934
+ NgxMatSelectSearchModule,
935
+ ReactiveFormsModule] });
936
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSelectModule, decorators: [{
937
+ type: NgModule,
938
+ args: [{
939
+ declarations: [EcabsSelectComponent],
940
+ imports: [
941
+ CommonModule,
942
+ ElementWrapperModule,
943
+ MatSelectModule,
944
+ MatFormFieldModule,
945
+ FormsModule,
946
+ NgxMatSelectSearchModule,
947
+ ReactiveFormsModule
948
+ ],
949
+ exports: [EcabsSelectComponent],
950
+ providers: [
951
+ {
952
+ provide: MAT_SELECT_SCROLL_STRATEGY,
953
+ useFactory: scrollFactory,
954
+ deps: [Overlay],
955
+ },
956
+ ],
957
+ }]
958
+ }] });
959
+ function scrollFactory(overlay) {
960
+ return () => overlay.scrollStrategies.block();
961
+ }
962
+
963
+ class EcabsTextareaComponent extends ElementBaseComponent {
964
+ constructor(injector) {
965
+ super();
966
+ this.injector = injector;
967
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
968
+ this.onChange = () => { };
969
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
970
+ this.onTouch = () => { };
971
+ }
972
+ get value() {
973
+ return this.val;
974
+ }
975
+ set value(val) {
976
+ if (val !== undefined && this.val !== val) {
977
+ this.val = val;
978
+ this.onChange(val);
979
+ this.onTouch(val);
980
+ }
981
+ }
982
+ ngAfterViewInit() {
983
+ const ngControl = this.injector.get(NgControl, null);
984
+ if (ngControl) {
985
+ this.control = ngControl.control;
986
+ }
987
+ }
988
+ writeValue(value) {
989
+ this.value = value;
990
+ }
991
+ registerOnChange(fn) {
992
+ this.onChange = fn;
993
+ }
994
+ registerOnTouched(fn) {
995
+ this.onTouch = fn;
996
+ }
997
+ }
998
+ EcabsTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextareaComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
999
+ EcabsTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: EcabsTextareaComponent, selector: "ecabs-textarea", inputs: { rows: "rows" }, providers: [
1000
+ {
1001
+ provide: NG_VALUE_ACCESSOR,
1002
+ useExisting: EcabsTextareaComponent,
1003
+ multi: true,
1004
+ },
1005
+ ], usesInheritance: true, ngImport: i0, template: "<app-element-wrapper [data]=\"getData()\">\r\n <textarea\r\n class=\"form-field__textarea\"\r\n [id]=\"name\"\r\n [(ngModel)]=\"value\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouch()\"\r\n [disabled]=\"disabled\"\r\n [maxlength]=\"maxLength\"\r\n [rows]=\"rows\"\r\n >\r\n </textarea>\r\n</app-element-wrapper>\r\n", dependencies: [{ kind: "component", type: ElementWrapperComponent, selector: "app-element-wrapper", inputs: ["data", "showCloseIcon", "focusedFlag", "showPassword", "control"], outputs: ["showHidePassword", "clear", "increase", "decrease"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
1006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextareaComponent, decorators: [{
1007
+ type: Component,
1008
+ args: [{ selector: 'ecabs-textarea', providers: [
1009
+ {
1010
+ provide: NG_VALUE_ACCESSOR,
1011
+ useExisting: EcabsTextareaComponent,
1012
+ multi: true,
1013
+ },
1014
+ ], template: "<app-element-wrapper [data]=\"getData()\">\r\n <textarea\r\n class=\"form-field__textarea\"\r\n [id]=\"name\"\r\n [(ngModel)]=\"value\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouch()\"\r\n [disabled]=\"disabled\"\r\n [maxlength]=\"maxLength\"\r\n [rows]=\"rows\"\r\n >\r\n </textarea>\r\n</app-element-wrapper>\r\n" }]
1015
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { rows: [{
1016
+ type: Input
1017
+ }] } });
1018
+
1019
+ class EcabsTextAreaModule {
1020
+ }
1021
+ EcabsTextAreaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1022
+ EcabsTextAreaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextAreaModule, declarations: [EcabsTextareaComponent], imports: [CommonModule, ElementWrapperModule, FormsModule], exports: [EcabsTextareaComponent] });
1023
+ EcabsTextAreaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextAreaModule, imports: [CommonModule, ElementWrapperModule, FormsModule] });
1024
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsTextAreaModule, decorators: [{
1025
+ type: NgModule,
1026
+ args: [{
1027
+ declarations: [EcabsTextareaComponent],
1028
+ imports: [CommonModule, ElementWrapperModule, FormsModule],
1029
+ exports: [EcabsTextareaComponent],
1030
+ }]
1031
+ }] });
1032
+
737
1033
  /**
738
1034
  * Generated bundle index. Do not edit.
739
1035
  */
740
1036
 
741
- export { ButtonsComponent, EcabsButtonsModule, EcabsInputComponent, EcabsInputModule, EcabsLoadingComponent, EcabsLoadingModule, EcabsSpinnerComponent };
1037
+ export { ButtonsComponent, EcabsButtonsModule, EcabsInputComponent, EcabsInputModule, EcabsLoadingComponent, EcabsLoadingModule, EcabsSelectComponent, EcabsSelectModule, EcabsSpinnerComponent, EcabsTextAreaModule, EcabsTextareaComponent, scrollFactory };
742
1038
  //# sourceMappingURL=ecabs-components.mjs.map