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,4 +1,6 @@
1
- .phone-input {
1
+ .ecabs-phone {
2
+ @include fontSize($font-size-lg);
3
+
2
4
  .ngx-mat-tel-input-container {
3
5
  position: relative;
4
6
  border-radius: $border-radius-base;
@@ -1,6 +1,10 @@
1
+ @import './../utilities/index';
2
+
1
3
  $border-radius: 0.25rem;
2
4
 
3
5
  .select {
6
+ @include fontSize($font-size-lg);
7
+
4
8
  border-radius: $border-radius;
5
9
  border: 1px solid var(--color-gray-500);
6
10
  padding: calc-rem(8) calc-rem(16);
@@ -19,3 +23,15 @@ $border-radius: 0.25rem;
19
23
  color: var(--color-black);
20
24
  }
21
25
  }
26
+
27
+ .mat-select-placeholder {
28
+ color: rgba(0, 0, 0, 0.42) !important;
29
+ -webkit-text-fill-color: rgba(0, 0, 0, 0.42) !important;
30
+ font-size: 18px !important;
31
+ line-height: 1.5rem !important;
32
+ font-family: $font-family-primary;
33
+ }
34
+
35
+ .mat-form-field-label{
36
+ display: none !important;
37
+ }
@@ -1,129 +0,0 @@
1
- import { Directive, ElementRef, HostListener, Input, OnInit } from '@angular/core';
2
-
3
- @Directive({
4
- selector: '[appDigitsOnly]',
5
- })
6
- export class DigitsOnlyDirective implements OnInit {
7
- @Input()
8
- digitsOnly = false;
9
-
10
- @Input()
11
- allowHyphen = false;
12
-
13
- @Input() decimal? = false;
14
- @Input() decimalSeparator? = '.';
15
- @Input() unit? = 0;
16
-
17
- inputElement: HTMLInputElement;
18
- minus = '-';
19
- minusCounter = 0;
20
- regex!: RegExp;
21
-
22
- private decimalCounter = 0;
23
- private readonly navigationKeys = [
24
- 'Backspace',
25
- 'Delete',
26
- 'Tab',
27
- 'Escape',
28
- 'Enter',
29
- 'Home',
30
- 'End',
31
- 'ArrowLeft',
32
- 'ArrowRight',
33
- 'Clear',
34
- 'Copy',
35
- 'Paste',
36
- ];
37
-
38
- constructor(public el: ElementRef) {
39
- this.inputElement = el.nativeElement;
40
- }
41
-
42
- @HostListener('keydown', ['$event'])
43
- onKeyDown(e: KeyboardEvent): void {
44
- if (this.digitsOnly) {
45
- if (
46
- this.navigationKeys.indexOf(e.key) > -1 || // Allow: navigation keys: backspace, delete, arrows etc.
47
- (e.key === 'a' && e.ctrlKey) || // Allow: Ctrl+A
48
- (e.key === 'c' && e.ctrlKey) || // Allow: Ctrl+C
49
- (e.key === 'v' && e.ctrlKey) || // Allow: Ctrl+V
50
- (e.key === 'x' && e.ctrlKey) || // Allow: Ctrl+X
51
- (e.key === 'a' && e.metaKey) || // Allow: Cmd+A (Mac)
52
- (e.key === 'c' && e.metaKey) || // Allow: Cmd+C (Mac)
53
- (e.key === 'v' && e.metaKey) || // Allow: Cmd+V (Mac)
54
- (e.key === 'x' && e.metaKey) || // Allow: Cmd+X (Mac)
55
- (this.decimal && e.key === this.decimalSeparator && this.decimalCounter < 1) || // Allow: only one decimal point
56
- (this.decimal && e.key === this.minus && this.minusCounter < 1) // Allow: only one minus
57
- ) {
58
- return;
59
- }
60
-
61
- // Ensure that it is a number and stop the keypress
62
- if (e.key === ' ' || !this.regex.test(e.key)) {
63
- e.preventDefault();
64
- }
65
- }
66
- }
67
-
68
- @HostListener('keyup', ['$event'])
69
- onKeyUp(): void {
70
- if (this.digitsOnly) {
71
- if (!this.decimal) {
72
- return;
73
- }
74
-
75
- this.decimalCounter = this.el.nativeElement.value.split(this.decimalSeparator).length - 1;
76
- this.minusCounter = this.el.nativeElement.value.split(this.minus).length - 1;
77
-
78
- if (isNaN(+this.inputElement.value)) {
79
- this.inputElement.value = this.sanitizeInput(this.inputElement.value);
80
- }
81
- }
82
- }
83
-
84
- @HostListener('paste', ['$event'])
85
- onPaste(event: ClipboardEvent): void {
86
- if (this.digitsOnly) {
87
- const pastedInput = event.clipboardData?.getData('text/plain') as string;
88
- this.pasteData(pastedInput);
89
- event.preventDefault();
90
- }
91
- }
92
-
93
- ngOnInit(): void {
94
- this.regex = new RegExp(this.allowHyphen ? '^[\\d -]+$' : '\\d');
95
- }
96
-
97
- private pasteData(pastedContent: string): void {
98
- const sanitizedContent = isNaN(+pastedContent) ? this.sanitizeInput(pastedContent) : pastedContent;
99
- const pasted = document.execCommand('insertText', false, sanitizedContent);
100
- if (!pasted) {
101
- const { selectionStart: start, selectionEnd: end } = this.inputElement;
102
- this.inputElement.setRangeText(sanitizedContent, start as number, end as number, 'end');
103
- }
104
- }
105
-
106
- private sanitizeInput(input: string): string {
107
- let result = '';
108
- if (this.decimal && this.isValidDecimal(input)) {
109
- const regex = new RegExp(`^[\d -${this.decimalSeparator}]+$`, 'g');
110
- result = input.replace(regex, '');
111
- } else {
112
- result = input.replace(`/${this.regex}/g`, '');
113
- }
114
-
115
- const maxLength = this.inputElement.maxLength;
116
-
117
- if (maxLength > 0) {
118
- // the input element has maxLength limit
119
- const allowedLength = maxLength - this.inputElement.value.length;
120
- result = allowedLength > 0 ? result.substring(0, allowedLength) : '';
121
- }
122
-
123
- return result;
124
- }
125
-
126
- private isValidDecimal(inputString: string): boolean {
127
- return inputString.split(this.decimalSeparator as string).length <= 2;
128
- }
129
- }
@@ -1,72 +0,0 @@
1
- import { Input, Output, EventEmitter, Component } from '@angular/core';
2
- import { AbstractControl, UntypedFormControl } from '@angular/forms';
3
-
4
- @Component({
5
- template: '',
6
- })
7
- export default class ElementBaseComponent {
8
- @Input() type!:string;
9
- @Input() name!:string;
10
- @Input() label!:string;
11
- @Input() placeholder = '';
12
- @Input() validationLabel!:string;
13
- @Input() disabled = false;
14
- @Input() showValidation = true;
15
- @Input() showValidationOnNotTouched = false;
16
- @Input() hideValidationMessage = false;
17
- @Input() iconClass = '';
18
- @Input() loading = false;
19
- @Input() showHint: boolean = false;
20
- @Input() maxLength!: number;
21
- @Input() tooltip!: string;
22
- @Input() showAsterisk: boolean = true;
23
-
24
- @Output() focused = new EventEmitter<any>();
25
- @Output() focusOuted = new EventEmitter<any>();
26
-
27
- control!: UntypedFormControl;
28
- required: boolean = false;
29
-
30
- getData(): any {
31
- return {
32
- type: this.type || 'text',
33
- label: this.label,
34
- placeholder: this.placeholder,
35
- validationLabel: this.validationLabel,
36
- disabled: this.disabled,
37
- showValidation: this.showValidation,
38
- showValidationOnNotTouched: this.showValidationOnNotTouched,
39
- hideValidationMessage: this.hideValidationMessage,
40
- iconClass: this.iconClass,
41
- control: this.control,
42
- loading: this.loading,
43
- showHint: this.showHint,
44
- maxLength: this.maxLength,
45
- tooltip: this.tooltip,
46
- name: this.name,
47
- required: this.isRequired(this.control),
48
- showAsterisk: this.showAsterisk,
49
- };
50
- }
51
-
52
- private isRequired = (ctrl: any): boolean => {
53
- if (ctrl?.validator) {
54
- const validator = ctrl.validator({} as AbstractControl);
55
- if (validator && validator['required']) {
56
- return true;
57
- }
58
- }
59
-
60
- if (ctrl?.['controls']) {
61
- for (const name in ctrl['controls']) {
62
- if (ctrl['controls'][name]) {
63
- if (this.isRequired(ctrl['controls'][name])) {
64
- return true;
65
- }
66
- }
67
- }
68
- }
69
-
70
- return false;
71
- };
72
- }
@@ -1,30 +0,0 @@
1
- <div
2
- class="form-field"
3
- [ngClass]="{
4
- 'form-field--invalid':
5
- data?.showValidation && (data?.control?.touched || data?.showValidationOnNotTouched) && data?.control?.invalid,
6
- disabled: data?.disabled,
7
- 'form-field--required': data?.required && data?.showAsterisk
8
- }"
9
- >
10
- <div>
11
- <label class="form-field__label" [attr.for]="data?.name" *ngIf="data?.label">
12
- <span [innerHTML]="data?.label"></span>
13
- <mat-icon class="icon" *ngIf="data?.tooltip" [matTooltip]="data?.tooltip">error_outline</mat-icon>
14
- </label>
15
- </div>
16
-
17
- <ng-content></ng-content>
18
-
19
- <ecabs-loading-spinner class="spinner" size="tiny" *ngIf="data.loading"></ecabs-loading-spinner>
20
-
21
- <app-hint [element]="data?.control" [showHint]="data?.showHint" [maxValue]="data?.maxLength"></app-hint>
22
-
23
- <app-validations-messages
24
- *ngIf="data?.showValidation && !data?.hideValidationMessage"
25
- [element]="data?.control"
26
- [label]="data?.label ? data?.label : data?.placeholder ? data.placeholder : data?.validationLabel"
27
- [showValidationOnNotTouched]="data?.showValidationOnNotTouched"
28
- >
29
- </app-validations-messages>
30
- </div>
@@ -1,33 +0,0 @@
1
- import { Component, Input, Output, EventEmitter } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-element-wrapper',
5
- templateUrl: './element-wrapper.component.html',
6
- })
7
- export class ElementWrapperComponent {
8
- @Input() data!:any;
9
- @Input() showCloseIcon!:boolean;
10
- @Input() focusedFlag!:any;
11
- @Input() showPassword!:boolean;
12
- @Input() control!:any;
13
- @Output() showHidePassword = new EventEmitter<any>();
14
- @Output() clear = new EventEmitter<any>();
15
- @Output() increase = new EventEmitter<any>();
16
- @Output() decrease = new EventEmitter<any>();
17
-
18
- showHidePasswordFn(event:any): void {
19
- this.showHidePassword.emit(event);
20
- }
21
-
22
- clearFn(): void {
23
- this.clear.emit();
24
- }
25
-
26
- increaseFn(): void {
27
- this.increase.emit();
28
- }
29
-
30
- decreaseFn(): void {
31
- this.decrease.emit();
32
- }
33
- }
@@ -1,30 +0,0 @@
1
-
2
- import { CommonModule } from '@angular/common';
3
- import { NgModule } from '@angular/core';
4
- import { FormsModule } from '@angular/forms';
5
- import { MatFormFieldModule } from '@angular/material/form-field';
6
- import { MatInputModule } from '@angular/material/input';
7
-
8
- import { HintModule } from '../hint/hint.module';
9
- import { ValidationModule } from '../validation/validation.module';
10
- import { ElementWrapperComponent } from './element-wrapper.component';
11
- import { MatIconModule } from '@angular/material/icon';
12
- import { MatTooltipModule } from '@angular/material/tooltip';
13
- import { EcabsLoadingModule } from '../../ecabs-loading/ecabs-loading.module';
14
-
15
- @NgModule({
16
- declarations: [ElementWrapperComponent],
17
- imports: [
18
- CommonModule,
19
- FormsModule,
20
- EcabsLoadingModule,
21
- ValidationModule,
22
- MatFormFieldModule,
23
- MatInputModule,
24
- MatIconModule,
25
- MatTooltipModule,
26
- HintModule,
27
- ],
28
- exports: [ElementWrapperComponent],
29
- })
30
- export class ElementWrapperModule {}
@@ -1 +0,0 @@
1
- <div class="hint" *ngIf="element && showHint">{{ element?.value?.length || 0 }}/{{ this.maxValue }}</div>
File without changes
@@ -1,12 +0,0 @@
1
- import { Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-hint',
5
- templateUrl: './hint.component.html',
6
- styleUrls: ['./hint.component.scss'],
7
- })
8
- export class HintComponent {
9
- @Input() element!:any;
10
- @Input() maxValue!:number;
11
- @Input() showHint = false;
12
- }
@@ -1,13 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { FormsModule } from '@angular/forms';
4
- import { MatFormFieldModule } from '@angular/material/form-field';
5
-
6
- import { HintComponent } from './hint.component';
7
-
8
- @NgModule({
9
- declarations: [HintComponent],
10
- imports: [CommonModule, FormsModule, MatFormFieldModule],
11
- exports: [HintComponent],
12
- })
13
- export class HintModule {}
@@ -1,8 +0,0 @@
1
- <div
2
- class="form-field__validation"
3
- *ngIf="element && (element?.touched || showValidationOnNotTouched) && element?.invalid"
4
- >
5
- <div class="form-field__validation__item" *ngFor="let item of element?.errors | keyvalue">
6
- {{ getMessageDetail(item.key) }}
7
- </div>
8
- </div>
File without changes
@@ -1,171 +0,0 @@
1
- import {
2
- Component,
3
- OnInit,
4
- Input,
5
- OnChanges,
6
- SimpleChanges,
7
- } from '@angular/core';
8
-
9
- @Component({
10
- selector: 'app-validations-messages',
11
- templateUrl: './validation.component.html',
12
- styleUrls: ['./validation.component.scss'],
13
- })
14
- export class ValidationComponent implements OnInit, OnChanges {
15
- @Input() element!: any;
16
- @Input() label!: string;
17
- @Input() showValidationOnNotTouched = false;
18
- @Input() updatedErrors!: { type: string; message: string }[];
19
- errorMessages: any[]=[];
20
-
21
- private _messages: any = {};
22
-
23
- get messages(): any {
24
- if (this.element) {
25
- for (const errorKey in this.element.errors) {
26
- for (const key in this.element.errors[errorKey]) {
27
- if (this._messages[errorKey]) {
28
- this._messages[errorKey] = this._messages[errorKey].replace(
29
- `[${key}]`,
30
- this.element.errors[errorKey][key]
31
- );
32
- }
33
- }
34
- }
35
- }
36
-
37
- return this._messages;
38
- }
39
-
40
- set messages(m) {
41
- this._messages = m;
42
- }
43
-
44
- constructor() {
45
- // this.errorMessages = [
46
- // {
47
- // type: 'required',
48
- // message: this.translateService.instant(
49
- // 'FORMS.VALIDATION.LABEL_REQUIRED'
50
- // ),
51
- // },
52
- // {
53
- // type: 'minlength',
54
- // message: this.translateService.instant('FORMS.VALIDATION.MIN_LENGTH'),
55
- // },
56
- // {
57
- // type: 'maxlength',
58
- // message: this.translateService.instant('FORMS.VALIDATION.MAX_LENGTH'),
59
- // },
60
- // {
61
- // type: 'min',
62
- // message: this.translateService.instant('FORMS.VALIDATION.MIN'),
63
- // },
64
- // {
65
- // type: 'max',
66
- // message: this.translateService.instant('FORMS.VALIDATION.MAX'),
67
- // },
68
- // {
69
- // type: 'minValue',
70
- // message: this.translateService.instant('FORMS.VALIDATION.MIN_VALUE'),
71
- // },
72
- // {
73
- // type: 'maxValue',
74
- // message: this.translateService.instant('FORMS.VALIDATION.MAX_VALUE'),
75
- // },
76
- // {
77
- // type: 'validatePhoneNumber',
78
- // message: this.translateService.instant(
79
- // 'FORMS.VALIDATION.VALIDATE_PHONE_NUMBER'
80
- // ),
81
- // },
82
- // {
83
- // type: 'pastDate',
84
- // message: this.translateService.instant('FORMS.VALIDATION.PAST_DATE'),
85
- // },
86
- // {
87
- // type: 'affectsError',
88
- // message: this.translateService.instant(
89
- // 'FORMS.VALIDATION.AFFECTS_ERROR'
90
- // ),
91
- // },
92
- // {
93
- // type: 'moreThan',
94
- // message: this.translateService.instant('FORMS.VALIDATION.MORE_THAN'),
95
- // },
96
- // {
97
- // type: 'lessThan',
98
- // message: this.translateService.instant('FORMS.VALIDATION.LESS_THAN'),
99
- // },
100
- // {
101
- // type: 'iban',
102
- // message: this.translateService.instant('FORMS.VALIDATION.INVALID'),
103
- // },
104
- // {
105
- // type: 'email',
106
- // message: this.translateService.instant('FORMS.VALIDATION.EMAIL'),
107
- // },
108
- // {
109
- // type: 'numberMoreThan',
110
- // message: this.translateService.instant(
111
- // 'FORMS.VALIDATION.VALUE_MORE_THAN'
112
- // ),
113
- // },
114
- // {
115
- // type: 'numberLessThan',
116
- // message: this.translateService.instant(
117
- // 'FORMS.VALIDATION.VALUE_LESS_THAN'
118
- // ),
119
- // },
120
- // {
121
- // type: 'outOfRange',
122
- // message: this.translateService.instant('FORMS.VALIDATION.OUT_OF_RANGE'),
123
- // },
124
- // {
125
- // type: 'iban',
126
- // message: this.translateService.instant('FORMS.VALIDATION.IBAN'),
127
- // },
128
- // {
129
- // type: 'timeIsAfter',
130
- // message: this.translateService.instant(
131
- // 'FORMS.VALIDATION.LESS_THAN_TIME'
132
- // ),
133
- // },
134
- // ];
135
- }
136
-
137
- ngOnChanges(changes: SimpleChanges): void {
138
- const { updatedErrors } = changes;
139
-
140
- if (
141
- updatedErrors &&
142
- updatedErrors.currentValue &&
143
- updatedErrors.currentValue.length > 0
144
- ) {
145
- for (const error of updatedErrors.currentValue) {
146
- this.messages[error.type] = error.message;
147
- }
148
- }
149
- }
150
-
151
- ngOnInit(): void {
152
- for (const error of this.errorMessages) {
153
- this.messages[error.type] = this.replaceTokens(error.message);
154
- }
155
- }
156
-
157
- replaceTokens(message: string): string {
158
- let retMessage: string;
159
- if (this.label) {
160
- retMessage = message.replace('[label]', this.label);
161
- } else {
162
- retMessage = message;
163
- }
164
-
165
- return retMessage;
166
- }
167
-
168
- getMessageDetail(key: any): string {
169
- return this.messages[key];
170
- }
171
- }
@@ -1,12 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { ValidationComponent } from './validation.component';
3
- import { FormsModule } from '@angular/forms';
4
- import { CommonModule } from '@angular/common';
5
- import { MatFormFieldModule } from '@angular/material/form-field';
6
-
7
- @NgModule({
8
- declarations: [ValidationComponent],
9
- imports: [CommonModule, FormsModule, MatFormFieldModule],
10
- exports: [ValidationComponent],
11
- })
12
- export class ValidationModule {}
@@ -1,18 +0,0 @@
1
- <button
2
- mat-button
3
- [ngClass]="{
4
- '!w-full': full,
5
- 'mat-stroked-button': stroked,
6
- 'mat-raised-button': raised
7
- }"
8
- [color]="color"
9
- [disabled]="disabled"
10
- [type]="type"
11
- [attr.form]="form"
12
- >
13
- <ecabs-loading-spinner size="tiny" *ngIf="loading"></ecabs-loading-spinner>
14
- <ng-container *ngIf="!loading">
15
- <ng-content select="mat-icon"></ng-content>
16
- <ng-content></ng-content>
17
- </ng-container>
18
- </button>
@@ -1,54 +0,0 @@
1
- import { Component, HostBinding, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import { ThemePalette } from '@angular/material/core';
3
-
4
- @Component({
5
- selector: 'ecabs-buttons',
6
- templateUrl: './ecabs-buttons.component.html',
7
- })
8
- export class ButtonsComponent implements OnInit, OnChanges {
9
- @Input()
10
- label!: string;
11
-
12
- @Input()
13
- disabled!: boolean;
14
-
15
- @Input()
16
- loading!: boolean;
17
-
18
- @Input()
19
- form!: string;
20
-
21
- @Input()
22
- size: 'default' | 'large' = 'default';
23
-
24
- @Input()
25
- type: 'button' | 'submit' = 'button';
26
-
27
- @Input() raised = false;
28
- @Input() stroked = false;
29
- @Input() full = false;
30
- @Input()
31
- color: ThemePalette | 'success' = 'primary';
32
-
33
- @HostBinding('style.width')
34
- borderWidth = '';
35
- @HostBinding('class')
36
- classAttr = '';
37
-
38
- ngOnInit(): void {
39
- if (this.full) {
40
- this.borderWidth = '100%';
41
- }
42
- }
43
-
44
- ngOnChanges(changes: SimpleChanges): void {
45
- const disabled = changes['disabled']?.currentValue !== undefined ? changes['disabled'].currentValue : this.disabled;
46
- const loading = changes['loading']?.currentValue !== undefined ? changes['loading'].currentValue : this.loading;
47
-
48
- if (disabled || loading) {
49
- this.classAttr = 'pointer-events-none';
50
- } else {
51
- this.classAttr = '';
52
- }
53
- }
54
- }
@@ -1,13 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { ButtonsComponent } from './ecabs-buttons.component';
4
- import { MatButtonModule } from '@angular/material/button';
5
- import { MatIconModule } from '@angular/material/icon';
6
- import { EcabsLoadingModule } from '../ecabs-loading/ecabs-loading.module';
7
-
8
- @NgModule({
9
- declarations: [ButtonsComponent],
10
- imports: [CommonModule, MatButtonModule, EcabsLoadingModule, MatIconModule],
11
- exports: [ButtonsComponent],
12
- })
13
- export class EcabsButtonsModule {}
@@ -1,26 +0,0 @@
1
- <app-element-wrapper [data]="getData()">
2
- <div class="form-field__input--wrapper">
3
- <input
4
- appDigitsOnly
5
- [digitsOnly]="digitsOnly"
6
- [decimal]="allowDecimal"
7
- [allowHyphen]="allowHyphen"
8
- class="form-field__input"
9
- [type]="type"
10
- [id]="name"
11
- [(ngModel)]="value"
12
- [placeholder]="placeholder"
13
- (blur)="onTouch()"
14
- [disabled]="disabled"
15
- [maxlength]="maxLength"
16
- [max]="max"
17
- [step]="step"
18
- (blur)="blurChange($event)"
19
- />
20
-
21
- <div class="form-field__input--suffix" *ngIf="type !== 'number'">
22
- <ng-content select="mat-icon"></ng-content>
23
- <ng-content select=".suffix"></ng-content>
24
- </div>
25
- </div>
26
- </app-element-wrapper>