@tacdaed/fragments 1.0.0-beta.2 → 1.0.0-beta.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 +3 -3
- package/fesm2022/tacdaed-fragments.mjs +8928 -0
- package/fesm2022/tacdaed-fragments.mjs.map +1 -0
- package/index.d.ts +3929 -0
- package/package.json +29 -22
- package/ng-package.json +0 -25
- package/src/lib/components/accordion/accordion.component.html +0 -103
- package/src/lib/components/accordion/accordion.component.scss +0 -382
- package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
- package/src/lib/components/accordion/accordion.component.ts +0 -211
- package/src/lib/components/accordion/accordion.type.ts +0 -82
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
- package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
- package/src/lib/components/button/button.component.html +0 -57
- package/src/lib/components/button/button.component.scss +0 -445
- package/src/lib/components/button/button.component.spec.ts +0 -99
- package/src/lib/components/button/button.component.ts +0 -143
- package/src/lib/components/button/button.type.ts +0 -7
- package/src/lib/components/card/card.component.html +0 -44
- package/src/lib/components/card/card.component.scss +0 -114
- package/src/lib/components/card/card.component.spec.ts +0 -65
- package/src/lib/components/card/card.component.ts +0 -21
- package/src/lib/components/card/card.type.ts +0 -3
- package/src/lib/components/code-block/code-block.component.html +0 -55
- package/src/lib/components/code-block/code-block.component.scss +0 -122
- package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
- package/src/lib/components/code-block/code-block.component.ts +0 -302
- package/src/lib/components/code-block/code-block.interface.ts +0 -28
- package/src/lib/components/code-block/code-block.type.ts +0 -73
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
- package/src/lib/components/input/input-base.ts +0 -187
- package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
- package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
- package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
- package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
- package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
- package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
- package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
- package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
- package/src/lib/components/input/input-consts.ts +0 -132
- package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
- package/src/lib/components/input/input-date/input-date.component.html +0 -41
- package/src/lib/components/input/input-date/input-date.component.scss +0 -95
- package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
- package/src/lib/components/input/input-date/input-date.component.ts +0 -359
- package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
- package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
- package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
- package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
- package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
- package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
- package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
- package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
- package/src/lib/components/input/input-interface.ts +0 -8
- package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
- package/src/lib/components/input/input-number/input-number.component.html +0 -51
- package/src/lib/components/input/input-number/input-number.component.scss +0 -140
- package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
- package/src/lib/components/input/input-number/input-number.component.ts +0 -343
- package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
- package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
- package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
- package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
- package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
- package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
- package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
- package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
- package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
- package/src/lib/components/input/input-text/input-text.component.html +0 -71
- package/src/lib/components/input/input-text/input-text.component.scss +0 -118
- package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
- package/src/lib/components/input/input-text/input-text.component.ts +0 -215
- package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
- package/src/lib/components/input/input-time/input-time.component.html +0 -92
- package/src/lib/components/input/input-time/input-time.component.scss +0 -191
- package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
- package/src/lib/components/input/input-time/input-time.component.ts +0 -691
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
- package/src/lib/components/input/input-type.ts +0 -18
- package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
- package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
- package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
- package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
- package/src/lib/components/input/input.pipe.ts +0 -14
- package/src/lib/components/layout/container/container.component.html +0 -1
- package/src/lib/components/layout/container/container.component.scss +0 -33
- package/src/lib/components/layout/container/container.component.ts +0 -32
- package/src/lib/components/layout/container/container.type.ts +0 -1
- package/src/lib/components/layout/divider/divider.component.html +0 -1
- package/src/lib/components/layout/divider/divider.component.scss +0 -60
- package/src/lib/components/layout/divider/divider.component.ts +0 -38
- package/src/lib/components/layout/divider/divider.type.ts +0 -2
- package/src/lib/components/layout/section/section.component.html +0 -21
- package/src/lib/components/layout/section/section.component.scss +0 -43
- package/src/lib/components/layout/section/section.component.ts +0 -33
- package/src/lib/components/layout/section/section.type.ts +0 -2
- package/src/lib/components/layout/separator/separator.component.html +0 -9
- package/src/lib/components/layout/separator/separator.component.scss +0 -52
- package/src/lib/components/layout/separator/separator.component.ts +0 -25
- package/src/lib/components/layout/separator/separator.type.ts +0 -1
- package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
- package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
- package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
- package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
- package/src/lib/components/loader/loader.type.ts +0 -2
- package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
- package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
- package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
- package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
- package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
- package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
- package/src/lib/components/loader/spinner/spinner.component.html +0 -20
- package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
- package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
- package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
- package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
- package/src/lib/components/modal/modal.component.html +0 -47
- package/src/lib/components/modal/modal.component.scss +0 -139
- package/src/lib/components/modal/modal.component.spec.ts +0 -60
- package/src/lib/components/modal/modal.component.ts +0 -83
- package/src/lib/components/modal/modal.type.ts +0 -9
- package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
- package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
- package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
- package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
- package/src/lib/components/morph/morph.abstract.ts +0 -13
- package/src/lib/components/pagination/pagination.interface.ts +0 -4
- package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
- package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
- package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
- package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
- package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
- package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
- package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
- package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
- package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
- package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
- package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
- package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
- package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
- package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
- package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
- package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
- package/src/lib/components/side-nav/side-nav.component.html +0 -101
- package/src/lib/components/side-nav/side-nav.component.scss +0 -295
- package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
- package/src/lib/components/side-nav/side-nav.component.ts +0 -18
- package/src/lib/components/side-nav/side-nav.type.ts +0 -28
- package/src/lib/components/snackbar/snackbar.component.html +0 -33
- package/src/lib/components/snackbar/snackbar.component.scss +0 -195
- package/src/lib/components/snackbar/snackbar.component.ts +0 -112
- package/src/lib/components/snackbar/snackbar.type.ts +0 -27
- package/src/lib/components/status/chip/chip.component.html +0 -51
- package/src/lib/components/status/chip/chip.component.scss +0 -149
- package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
- package/src/lib/components/status/chip/chip.component.ts +0 -83
- package/src/lib/components/status/chip/chip.type.ts +0 -42
- package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
- package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
- package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
- package/src/lib/components/status/pill/pill.component.html +0 -40
- package/src/lib/components/status/pill/pill.component.scss +0 -113
- package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
- package/src/lib/components/status/pill/pill.component.ts +0 -83
- package/src/lib/components/status/pill/pill.type.ts +0 -42
- package/src/lib/components/status/status.interface.ts +0 -57
- package/src/lib/components/status/status.type.ts +0 -62
- package/src/lib/components/status/tag/tag.component.html +0 -39
- package/src/lib/components/status/tag/tag.component.scss +0 -140
- package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
- package/src/lib/components/status/tag/tag.component.ts +0 -83
- package/src/lib/components/status/tag/tag.type.ts +0 -42
- package/src/lib/components/stepper/stepper.component.html +0 -83
- package/src/lib/components/stepper/stepper.component.scss +0 -196
- package/src/lib/components/stepper/stepper.component.ts +0 -482
- package/src/lib/components/stepper/stepper.type.ts +0 -60
- package/src/lib/components/table/table.component.html +0 -438
- package/src/lib/components/table/table.component.scss +0 -259
- package/src/lib/components/table/table.component.spec.ts +0 -117
- package/src/lib/components/table/table.component.ts +0 -215
- package/src/lib/components/table/table.enum.ts +0 -4
- package/src/lib/components/table/table.function.ts +0 -47
- package/src/lib/components/table/table.interface.ts +0 -143
- package/src/lib/components/table/table.pipe.ts +0 -62
- package/src/lib/components/table/table.type.ts +0 -15
- package/src/lib/components/tabs/tabs.component.html +0 -88
- package/src/lib/components/tabs/tabs.component.scss +0 -305
- package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
- package/src/lib/components/tabs/tabs.component.ts +0 -282
- package/src/lib/components/tabs/tabs.type.ts +0 -81
- package/src/lib/components/title-bar/title-bar.component.html +0 -21
- package/src/lib/components/title-bar/title-bar.component.scss +0 -139
- package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
- package/src/lib/components/title-bar/title-bar.component.ts +0 -13
- package/src/lib/components/toast/toast.component.html +0 -36
- package/src/lib/components/toast/toast.component.scss +0 -241
- package/src/lib/components/toast/toast.component.ts +0 -165
- package/src/lib/components/toast/toast.type.ts +0 -37
- package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
- package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
- package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
- package/src/lib/consts/country-prefix.ts +0 -244
- package/src/lib/directives/tooltip/popover.directive.ts +0 -274
- package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
- package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
- package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
- package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
- package/src/lib/interfaces/common.interfaces.ts +0 -4
- package/src/lib/pipes/chunk.pipe.ts +0 -16
- package/src/lib/pipes/safe-html.pipe.ts +0 -14
- package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
- package/src/lib/types/base.types.ts +0 -23
- package/src/lib/types/common.types.ts +0 -98
- package/src/lib/types/form.types.ts +0 -5
- package/src/lib/utils/common.utils.ts +0 -53
- package/src/lib/utils/date.utils.ts +0 -474
- package/src/lib/utils/number.utils.ts +0 -16
- package/src/lib/utils/uuid.utils.ts +0 -39
- package/src/public-api.ts +0 -114
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -9
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { InputTextComponent } from './input-text.component';
|
|
4
|
-
|
|
5
|
-
describe('InputTextComponent', () => {
|
|
6
|
-
let fixture: ComponentFixture<InputTextComponent>;
|
|
7
|
-
let component: InputTextComponent;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [InputTextComponent]
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
|
|
14
|
-
fixture = TestBed.createComponent(InputTextComponent);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders label when provided', () => {
|
|
19
|
-
component.label = 'Username';
|
|
20
|
-
|
|
21
|
-
fixture.detectChanges();
|
|
22
|
-
|
|
23
|
-
const label = fixture.debugElement.query(By.css('label'));
|
|
24
|
-
expect(label.nativeElement.textContent).toContain('Username');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('toggles password visibility', () => {
|
|
28
|
-
component.type = 'password';
|
|
29
|
-
|
|
30
|
-
fixture.detectChanges();
|
|
31
|
-
|
|
32
|
-
const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
|
|
33
|
-
expect(input.type).toBe('password');
|
|
34
|
-
|
|
35
|
-
const toggleBtn = fixture.debugElement.query(By.css('.frg-input__toggle-password'));
|
|
36
|
-
toggleBtn.nativeElement.click();
|
|
37
|
-
fixture.detectChanges();
|
|
38
|
-
|
|
39
|
-
expect(input.type).toBe('text');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('updates value on input', () => {
|
|
43
|
-
const onChangeSpy = jasmine.createSpy('onChange');
|
|
44
|
-
component.registerOnChange(onChangeSpy);
|
|
45
|
-
|
|
46
|
-
fixture.detectChanges();
|
|
47
|
-
|
|
48
|
-
const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
|
|
49
|
-
input.value = 'hello';
|
|
50
|
-
input.dispatchEvent(new Event('input'));
|
|
51
|
-
|
|
52
|
-
expect(component.value).toBe('hello');
|
|
53
|
-
expect(onChangeSpy).toHaveBeenCalledWith('hello');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
3
|
-
import { Validators } from '@angular/forms';
|
|
4
|
-
import { InputBase } from '../input-base';
|
|
5
|
-
import { DEFAULT_INPUT_TEXT_ERROR_MESSAGES, DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES } from '../input-consts';
|
|
6
|
-
import { InputTextType } from '../input-type';
|
|
7
|
-
import { InputValidationComponent } from '../input-validation/input-validation.component';
|
|
8
|
-
import { InputRequiredLabelPipe } from '../input.pipe';
|
|
9
|
-
import { phoneNumberValidator, strictEmailValidator, strictPhoneNumberValidator, strictUrlValidator, urlValidator } from './input-text-validators';
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'frg-input-text',
|
|
13
|
-
imports: [InputRequiredLabelPipe, NgTemplateOutlet, InputValidationComponent],
|
|
14
|
-
templateUrl: './input-text.component.html',
|
|
15
|
-
styleUrl: './input-text.component.scss',
|
|
16
|
-
})
|
|
17
|
-
export class InputTextComponent extends InputBase<string> implements OnInit {
|
|
18
|
-
/**
|
|
19
|
-
* @inheritdoc
|
|
20
|
-
*/
|
|
21
|
-
@Input() public override label: string = '';
|
|
22
|
-
/**
|
|
23
|
-
* @inheritdoc
|
|
24
|
-
*/
|
|
25
|
-
@Input() public override placeholder: string = '';
|
|
26
|
-
/**
|
|
27
|
-
* @inheritdoc
|
|
28
|
-
*/
|
|
29
|
-
@Input() public override required: boolean = false;
|
|
30
|
-
/**
|
|
31
|
-
* @inheritdoc
|
|
32
|
-
*/
|
|
33
|
-
@Input() public override showValidation: boolean = true;
|
|
34
|
-
/**
|
|
35
|
-
* @inheritdoc
|
|
36
|
-
*/
|
|
37
|
-
@Input() public override errorMessages: Record<string, string> = {};
|
|
38
|
-
/**
|
|
39
|
-
* The type of the input element.
|
|
40
|
-
* Can be 'text', 'password', 'email', 'tel', etc.
|
|
41
|
-
* Defaults to 'text'.
|
|
42
|
-
*
|
|
43
|
-
* @see InputTextType
|
|
44
|
-
*/
|
|
45
|
-
@Input() public type: InputTextType = 'text';
|
|
46
|
-
/**
|
|
47
|
-
* Enables strict mode for email validation.
|
|
48
|
-
* When set to true, the email validator will use a more stringent pattern.
|
|
49
|
-
* Defaults to false.
|
|
50
|
-
*/
|
|
51
|
-
@Input() public validatorStrictMode: boolean = false;
|
|
52
|
-
|
|
53
|
-
protected override get errorList(): string[] {
|
|
54
|
-
if (!this.control?.errors) return [];
|
|
55
|
-
const errors = this.control.errors;
|
|
56
|
-
return Object.keys(errors).map(key => {
|
|
57
|
-
if (this.errorMessages[key]) {
|
|
58
|
-
return this.errorMessages[key];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (key === 'minlength' && errors[key]?.requiredLength) {
|
|
62
|
-
return `Minimum length is ${errors[key].requiredLength} characters.`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (key === 'maxlength' && errors[key]?.requiredLength) {
|
|
66
|
-
return `Maximum length is ${errors[key].requiredLength} characters.`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return DEFAULT_INPUT_TEXT_ERROR_MESSAGES[key] || 'Invalid field.';
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Handles the blur event on the input element.
|
|
75
|
-
* Marks the control as touched.
|
|
76
|
-
*/
|
|
77
|
-
public override onBlur(): void {
|
|
78
|
-
this.onTouched();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Handles the input event on the input element.
|
|
83
|
-
* Updates the value and notifies the form control.
|
|
84
|
-
*/
|
|
85
|
-
public override onInput(event: Event): void {
|
|
86
|
-
const input = event.target as HTMLInputElement;
|
|
87
|
-
this.value = input.value;
|
|
88
|
-
this.onChange(this.value);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @inheritdoc
|
|
93
|
-
*/
|
|
94
|
-
public override ngOnInit(): void {
|
|
95
|
-
super.ngOnInit();
|
|
96
|
-
if (this.type === 'email' && this.control) {
|
|
97
|
-
this.validateEmail();
|
|
98
|
-
}
|
|
99
|
-
if (this.type === 'tel' && this.control) {
|
|
100
|
-
this.validatePhoneNumber();
|
|
101
|
-
}
|
|
102
|
-
if (this.type === 'url' && this.control){
|
|
103
|
-
this.validateUrl();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @inheritdoc
|
|
109
|
-
*/
|
|
110
|
-
protected updateView(_value: string | null): void {
|
|
111
|
-
// Handled by Angular binding
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @inheritdoc
|
|
116
|
-
*/
|
|
117
|
-
protected updateDisabledState(_isDisabled: boolean): void {
|
|
118
|
-
// Handled by Angular binding
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Indicates whether the password is visible or hidden.
|
|
123
|
-
*
|
|
124
|
-
* Used only when the input type is 'password'.
|
|
125
|
-
*/
|
|
126
|
-
protected showPassword: boolean = false;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Determines the actual input type to be used in the template.
|
|
130
|
-
* If the type is 'password', it toggles between 'text' and 'password'
|
|
131
|
-
* based on the showPassword property.
|
|
132
|
-
*
|
|
133
|
-
* @returns The input type as a string.
|
|
134
|
-
*/
|
|
135
|
-
public get inputType(): string {
|
|
136
|
-
if (this.type === 'password') {
|
|
137
|
-
return this.showPassword ? 'text' : 'password';
|
|
138
|
-
}
|
|
139
|
-
return this.type;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Returns warning messages. Consumers may pass arbitrary warnings via `warningMessages`.
|
|
144
|
-
* Falls back to DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES or a generic message.
|
|
145
|
-
*/
|
|
146
|
-
protected override get warningList(): string[] {
|
|
147
|
-
return Object.keys(this.warningMessages).map(key => {
|
|
148
|
-
return (
|
|
149
|
-
this.warningMessages[key] ||
|
|
150
|
-
DEFAULT_INPUT_TEXT_WARNINGS_MESSAGES[key] ||
|
|
151
|
-
''
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Returns whether any warnings are active.
|
|
158
|
-
*/
|
|
159
|
-
protected get hasWarning(): boolean {
|
|
160
|
-
return this.warningList.length > 0;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Toggles the visibility of the password input field.
|
|
165
|
-
* This method switches the input type between 'text' and 'password'.
|
|
166
|
-
*
|
|
167
|
-
* Used only when the input type is 'password'.
|
|
168
|
-
*/
|
|
169
|
-
protected toggleShowPassword(): void {
|
|
170
|
-
this.showPassword = !this.showPassword;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Adds email validator to the control if the type is 'email'.
|
|
175
|
-
* This ensures that the input value is a valid email address.
|
|
176
|
-
*/
|
|
177
|
-
private validateEmail(): void {
|
|
178
|
-
const existingValidators = this.control?.validator
|
|
179
|
-
? [this.control.validator]
|
|
180
|
-
: [];
|
|
181
|
-
|
|
182
|
-
this.control?.setValidators([
|
|
183
|
-
...existingValidators,
|
|
184
|
-
this.validatorStrictMode ? strictEmailValidator() : Validators.email
|
|
185
|
-
]);
|
|
186
|
-
|
|
187
|
-
this.control?.updateValueAndValidity();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private validatePhoneNumber(): void {
|
|
191
|
-
const existingValidators = this.control?.validator
|
|
192
|
-
? [this.control.validator]
|
|
193
|
-
: [];
|
|
194
|
-
|
|
195
|
-
this.control?.setValidators([
|
|
196
|
-
...existingValidators,
|
|
197
|
-
this.validatorStrictMode ? strictPhoneNumberValidator() : phoneNumberValidator()
|
|
198
|
-
]);
|
|
199
|
-
|
|
200
|
-
this.control?.updateValueAndValidity();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private validateUrl(): void {
|
|
204
|
-
const existingValidators = this.control?.validator
|
|
205
|
-
? [this.control.validator]
|
|
206
|
-
: [];
|
|
207
|
-
|
|
208
|
-
this.control?.setValidators([
|
|
209
|
-
...existingValidators,
|
|
210
|
-
this.validatorStrictMode ? strictUrlValidator() : urlValidator()
|
|
211
|
-
]);
|
|
212
|
-
|
|
213
|
-
this.control?.updateValueAndValidity();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms";
|
|
2
|
-
import { parseTimeToMinutes } from "../../../utils/date.utils";
|
|
3
|
-
|
|
4
|
-
export function minTime(min: string): ValidatorFn {
|
|
5
|
-
return (control: AbstractControl): ValidationErrors | null => {
|
|
6
|
-
const value = control.value as string | null;
|
|
7
|
-
if (!value) return null;
|
|
8
|
-
|
|
9
|
-
const minMinutes = parseTimeToMinutes(min);
|
|
10
|
-
const valueMinutes = parseTimeToMinutes(value);
|
|
11
|
-
|
|
12
|
-
if (minMinutes === null || valueMinutes === null) {
|
|
13
|
-
return { invalidFormat: true };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (valueMinutes < minMinutes) {
|
|
17
|
-
return { min: true };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return null;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function maxTime(max: string): ValidatorFn {
|
|
25
|
-
return (control: AbstractControl): ValidationErrors | null => {
|
|
26
|
-
const value = control.value as string | null;
|
|
27
|
-
if (!value) return null;
|
|
28
|
-
|
|
29
|
-
const maxMinutes = parseTimeToMinutes(max);
|
|
30
|
-
const valueMinutes = parseTimeToMinutes(value);
|
|
31
|
-
|
|
32
|
-
if (maxMinutes === null || valueMinutes === null) {
|
|
33
|
-
return { invalidFormat: true };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (valueMinutes > maxMinutes) {
|
|
37
|
-
return { max: true };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return null;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<div class="frg-input__wrapper"
|
|
2
|
-
[class.input-error]="hasError"
|
|
3
|
-
[class.input-warning]="hasWarning"
|
|
4
|
-
>
|
|
5
|
-
@if(label){
|
|
6
|
-
<label [for]="id + '-full'">{{ label | inputRequiredLabel: required }}</label>
|
|
7
|
-
}
|
|
8
|
-
<div class="frg-input__field">
|
|
9
|
-
@if(format.includes('HH') || format.includes('hh')) {
|
|
10
|
-
<ng-container *ngTemplateOutlet="timeControl; context:{partial:'hour', min:minHour, max:maxHour, placeholder: format.includes('HH') ? 'HH' : 'hh'}"></ng-container>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@if(format.includes('mm')) {
|
|
14
|
-
<span class="colon-seprator">:</span>
|
|
15
|
-
<ng-container *ngTemplateOutlet="timeControl; context:{partial:'minute', min:minMinute, max:maxMinute, placeholder:'mm'}"></ng-container>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@if(format.includes('ss')) {
|
|
19
|
-
<span class="colon-seprator">:</span>
|
|
20
|
-
<ng-container *ngTemplateOutlet="timeControl; context:{partial:'second', min:minSecond, max:maxSecond, placeholder:'ss'}"></ng-container>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@if(format.includes('a')) {
|
|
24
|
-
<div class="frg-input__time__container frg-input__time__meridiem">
|
|
25
|
-
<input
|
|
26
|
-
[id]="id + '-meridiem'"
|
|
27
|
-
[attr.data-partialTime]="'meridiem'"
|
|
28
|
-
type="checkbox"
|
|
29
|
-
tabindex="0"
|
|
30
|
-
role="switch"
|
|
31
|
-
[checked]="formatTime(value, 'meridiem') === 'PM'"
|
|
32
|
-
aria-checked="{{ formatTime(value, 'meridiem') === 'PM' }}"
|
|
33
|
-
placeholder="AM/PM"
|
|
34
|
-
[required]="required"
|
|
35
|
-
[disabled]="disabled"
|
|
36
|
-
(blur)="onBlur($event)"
|
|
37
|
-
(focus)="onFocus($event)"
|
|
38
|
-
(change)="onInput($event)"
|
|
39
|
-
(keydown.enter)="onKeydown($event)"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
<span class="focus-line"></span>
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
<input type="text" [id]="id + '-full'" [value]="value" hidden />
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
@if(showValidation) {
|
|
50
|
-
<frg-input-validation
|
|
51
|
-
[errorList]="errorList"
|
|
52
|
-
[warningList]="warningList"
|
|
53
|
-
[isFormInvalid]="hasError"
|
|
54
|
-
></frg-input-validation>
|
|
55
|
-
}
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<ng-template #timeControl let-partial="partial" let-min="min" let-max="max" let-placeholder="placeholder">
|
|
59
|
-
<div class="frg-input__time__container" [ngClass]="'frg-input__time__' + partial">
|
|
60
|
-
<button
|
|
61
|
-
type="button"
|
|
62
|
-
class="frg-input__time__arrow frg-input__time__arrow--increment"
|
|
63
|
-
(click)="increase(partial)"
|
|
64
|
-
aria-label="Increase value"
|
|
65
|
-
>
|
|
66
|
-
<span class="fas fa-chevron-up"></span>
|
|
67
|
-
</button>
|
|
68
|
-
<input
|
|
69
|
-
[id]="id + '-' + partial"
|
|
70
|
-
[attr.data-partialTime]="partial"
|
|
71
|
-
type="number"
|
|
72
|
-
[placeholder]="placeholder"
|
|
73
|
-
[min]="min"
|
|
74
|
-
[max]="max"
|
|
75
|
-
[required]="required"
|
|
76
|
-
[disabled]="disabled"
|
|
77
|
-
[value]="formatTime(value, partial) !== placeholder ? formatTime(value, partial) : ''"
|
|
78
|
-
(blur)="onBlur($event)"
|
|
79
|
-
(focus)="onFocus($event)"
|
|
80
|
-
(input)="onInput($event)"
|
|
81
|
-
/>
|
|
82
|
-
<span class="focus-line"></span>
|
|
83
|
-
<button
|
|
84
|
-
type="button"
|
|
85
|
-
class="frg-input__time__arrow frg-input__time__arrow--decrement"
|
|
86
|
-
(click)="decrease(partial)"
|
|
87
|
-
aria-label="Decrease value"
|
|
88
|
-
>
|
|
89
|
-
<span class="fas fa-chevron-down"></span>
|
|
90
|
-
</button>
|
|
91
|
-
</div>
|
|
92
|
-
</ng-template>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use './../../../../../assets/styles/scss/variables' as *;
|
|
3
|
-
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
|
|
7
|
-
input::-webkit-outer-spin-button,
|
|
8
|
-
input::-webkit-inner-spin-button {
|
|
9
|
-
-webkit-appearance: none;
|
|
10
|
-
margin: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.frg-input {
|
|
14
|
-
&__wrapper {
|
|
15
|
-
position: relative;
|
|
16
|
-
box-sizing: border-box;
|
|
17
|
-
|
|
18
|
-
label {
|
|
19
|
-
font-size: $font-size-xs;
|
|
20
|
-
color: $input-text-color;
|
|
21
|
-
display: block;
|
|
22
|
-
padding: $input-padding;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.input-error label {
|
|
26
|
-
color: $color-danger;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&.input-warning label {
|
|
30
|
-
color: $color-warning;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&__field {
|
|
35
|
-
display: inline-flex;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
|
|
39
|
-
input[type="number"],
|
|
40
|
-
input[type="number"]:focus,
|
|
41
|
-
input[type="number"]:focus-visible {
|
|
42
|
-
border: none;
|
|
43
|
-
outline: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
input[type="number"] {
|
|
47
|
-
background: transparent;
|
|
48
|
-
text-align: center;
|
|
49
|
-
padding: 0.5rem 0;
|
|
50
|
-
letter-spacing: .1rem;
|
|
51
|
-
font-size: $font-size-md;
|
|
52
|
-
font-weight: 600;
|
|
53
|
-
color: $color-dark-soft;
|
|
54
|
-
display: block;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.partial-label {
|
|
58
|
-
display: block;
|
|
59
|
-
font-size: $font-size-xs;
|
|
60
|
-
text-transform: capitalize;
|
|
61
|
-
width: 100%;
|
|
62
|
-
text-align: center;
|
|
63
|
-
color: $color-dark-soft;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.colon-seprator {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
justify-content: center;
|
|
70
|
-
font-size: $font-size-md;
|
|
71
|
-
font-weight: 600;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&__time {
|
|
76
|
-
&__container {
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
align-items: center;
|
|
80
|
-
|
|
81
|
-
.focus-line {
|
|
82
|
-
display: block;
|
|
83
|
-
width: 50%;
|
|
84
|
-
margin: 0 auto;
|
|
85
|
-
height: 2px;
|
|
86
|
-
background-color: $color-primary;
|
|
87
|
-
transform: scaleX(0);
|
|
88
|
-
transform-origin: left center;
|
|
89
|
-
transition: transform 0.2s ease, background-color 0.2s ease;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&:focus-within .focus-line {
|
|
93
|
-
transform: scaleX(1);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.frg-input__wrapper.input-error & .focus-line {
|
|
97
|
-
background-color: $color-danger;
|
|
98
|
-
transform: scaleX(1);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.frg-input__wrapper.input-warning & .focus-line {
|
|
102
|
-
background-color: $color-warning;
|
|
103
|
-
transform: scaleX(1);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
&__meridiem {
|
|
108
|
-
position: relative;
|
|
109
|
-
width: 3.5rem;
|
|
110
|
-
height: 1.5rem;
|
|
111
|
-
|
|
112
|
-
input[type="checkbox"] {
|
|
113
|
-
appearance: none;
|
|
114
|
-
-webkit-appearance: none;
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
border-radius: 0.25rem;
|
|
118
|
-
background-color: $color-light-soft;
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
position: relative;
|
|
121
|
-
overflow: hidden;
|
|
122
|
-
transition: background-color 0.25s ease;
|
|
123
|
-
|
|
124
|
-
&:focus {
|
|
125
|
-
outline: none;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&:focus-visible {
|
|
129
|
-
outline-offset: 0.25rem;
|
|
130
|
-
outline: 2px solid $color-dark-neutral;
|
|
131
|
-
box-shadow: 0 0 0 2px rgba($color-primary, 0.2);
|
|
132
|
-
|
|
133
|
-
.frg-input__wrapper.input-error & {
|
|
134
|
-
outline-color: $color-danger;
|
|
135
|
-
box-shadow: 0 0 0 2px rgba($color-danger, 0.2);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.frg-input__wrapper.input-warning & {
|
|
139
|
-
outline-color: $color-warning;
|
|
140
|
-
box-shadow: 0 0 0 2px rgba($color-warning, 0.2);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
&:before,
|
|
145
|
-
&:after {
|
|
146
|
-
content: "AM";
|
|
147
|
-
position: absolute;
|
|
148
|
-
top: 50%;
|
|
149
|
-
left: 50%;
|
|
150
|
-
transform: translate(-50%, -50%);
|
|
151
|
-
font-size: $font-size-md;
|
|
152
|
-
font-weight: 600;
|
|
153
|
-
color: $color-dark-neutral;
|
|
154
|
-
transition: transform 0.25s ease, opacity 0.25s ease;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&:after {
|
|
158
|
-
content: "PM";
|
|
159
|
-
opacity: 0;
|
|
160
|
-
transform: translate(-50%, 150%);
|
|
161
|
-
color: $color-light;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&:checked {
|
|
165
|
-
background-color: $color-primary;
|
|
166
|
-
|
|
167
|
-
&:before {
|
|
168
|
-
transform: translate(-50%, -150%);
|
|
169
|
-
opacity: 0;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
&:after {
|
|
173
|
-
transform: translate(-50%, -50%);
|
|
174
|
-
opacity: 1;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&__arrow {
|
|
181
|
-
background: transparent;
|
|
182
|
-
color: $color-dark-neutral;
|
|
183
|
-
border: none;
|
|
184
|
-
display: block;
|
|
185
|
-
width: 100%;
|
|
186
|
-
padding: 0 0.5rem;
|
|
187
|
-
cursor: pointer;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { InputTimeComponent } from './input-time.component';
|
|
4
|
-
|
|
5
|
-
describe('InputTimeComponent', () => {
|
|
6
|
-
let fixture: ComponentFixture<InputTimeComponent>;
|
|
7
|
-
let component: InputTimeComponent;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [InputTimeComponent]
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
|
|
14
|
-
fixture = TestBed.createComponent(InputTimeComponent);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders hour and minute inputs', () => {
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
|
|
21
|
-
const hour = fixture.debugElement.query(By.css('input[id$="-hour"]'));
|
|
22
|
-
const minute = fixture.debugElement.query(By.css('input[id$="-minute"]'));
|
|
23
|
-
|
|
24
|
-
expect(hour).toBeTruthy();
|
|
25
|
-
expect(minute).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('increments hour when clicking the first increment button', () => {
|
|
29
|
-
component.value = '10:15';
|
|
30
|
-
|
|
31
|
-
fixture.detectChanges();
|
|
32
|
-
|
|
33
|
-
const buttons = fixture.debugElement.queryAll(By.css('.frg-input__time__arrow--increment'));
|
|
34
|
-
buttons[0].nativeElement.click();
|
|
35
|
-
fixture.detectChanges();
|
|
36
|
-
|
|
37
|
-
expect(component.value).toBe('11:15');
|
|
38
|
-
});
|
|
39
|
-
});
|