@tacdaed/fragments 1.0.0-beta.1 → 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 +4 -20
- 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,187 +0,0 @@
|
|
|
1
|
-
import { Directive, OnInit, inject } from '@angular/core';
|
|
2
|
-
import { ControlValueAccessor, FormControl, NgControl } from '@angular/forms';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Base class for input components, providing common functionality for form controls.
|
|
6
|
-
* This class implements ControlValueAccessor to integrate with Angular forms.
|
|
7
|
-
* Subclasses must implement the abstract methods to update the view and disabled state.
|
|
8
|
-
* It also provides properties for label, placeholder, required state, and error handling.
|
|
9
|
-
* The errorMessages property can be customized to provide specific validation messages.
|
|
10
|
-
* The hasError getter can be used in templates to conditionally display error messages.
|
|
11
|
-
* Subclasses should call super.ngOnInit() if they override ngOnInit().
|
|
12
|
-
*
|
|
13
|
-
* @see ControlValueAccessor
|
|
14
|
-
*/
|
|
15
|
-
@Directive()
|
|
16
|
-
export abstract class InputBase<T> implements ControlValueAccessor, OnInit {
|
|
17
|
-
/**
|
|
18
|
-
* Unique identifier for the input element.
|
|
19
|
-
*/
|
|
20
|
-
id: string = crypto.randomUUID();
|
|
21
|
-
/**
|
|
22
|
-
* The current value of the input element.
|
|
23
|
-
*/
|
|
24
|
-
value: T | null = null;
|
|
25
|
-
/**
|
|
26
|
-
* Indicates whether the input element is disabled.
|
|
27
|
-
*/
|
|
28
|
-
disabled: boolean = false;
|
|
29
|
-
/**
|
|
30
|
-
* The label for the input element.
|
|
31
|
-
*/
|
|
32
|
-
label: string = '';
|
|
33
|
-
/**
|
|
34
|
-
* The placeholder text for the input element.
|
|
35
|
-
*/
|
|
36
|
-
placeholder: string = '';
|
|
37
|
-
/**
|
|
38
|
-
* Indicates whether the input element is required.
|
|
39
|
-
* If true, a visual indicator is shown next to the label.
|
|
40
|
-
*/
|
|
41
|
-
required: boolean = false;
|
|
42
|
-
/**
|
|
43
|
-
* The FormControl associated with this input element.
|
|
44
|
-
*/
|
|
45
|
-
control: FormControl | null = null;
|
|
46
|
-
/**
|
|
47
|
-
* Indicates whether to show validation messages.
|
|
48
|
-
* If false, validation messages will be hidden.
|
|
49
|
-
* Default is true.
|
|
50
|
-
*/
|
|
51
|
-
showValidation: boolean = true;
|
|
52
|
-
/**
|
|
53
|
-
* The NgControl associated with this input element, if any.
|
|
54
|
-
* This is injected to link the component with Angular forms.
|
|
55
|
-
*/
|
|
56
|
-
protected ngControl: NgControl | null = null;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Holds the registered callback function to notify when the value changes.
|
|
60
|
-
*/
|
|
61
|
-
protected onChange: (value: T | null) => void = () => {};
|
|
62
|
-
/**
|
|
63
|
-
* Holds the registered callback function to notify when the input is touched.
|
|
64
|
-
*/
|
|
65
|
-
protected onTouched: () => void = () => {};
|
|
66
|
-
|
|
67
|
-
constructor() {
|
|
68
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
69
|
-
if (this.ngControl) {
|
|
70
|
-
this.ngControl.valueAccessor = this;
|
|
71
|
-
this.control = this.ngControl.control as FormControl;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @inheritdoc
|
|
77
|
-
*/
|
|
78
|
-
ngOnInit(): void {
|
|
79
|
-
if (this.ngControl && !this.control) {
|
|
80
|
-
this.control = this.ngControl.control as FormControl;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @inheritdoc
|
|
86
|
-
*/
|
|
87
|
-
writeValue(value: T): void {
|
|
88
|
-
this.value = value;
|
|
89
|
-
this.updateView(value);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @inheritdoc
|
|
94
|
-
*/
|
|
95
|
-
registerOnChange(fn: (value: T | null) => void): void {
|
|
96
|
-
this.onChange = fn;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @inheritdoc
|
|
101
|
-
*/
|
|
102
|
-
registerOnTouched(fn: () => void): void {
|
|
103
|
-
this.onTouched = fn;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @inheritdoc
|
|
108
|
-
*/
|
|
109
|
-
setDisabledState(isDisabled: boolean): void {
|
|
110
|
-
this.disabled = isDisabled;
|
|
111
|
-
this.updateDisabledState(isDisabled);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Indicates whether the input has validation errors and has been touched.
|
|
116
|
-
* This is used to conditionally display error messages in the template.
|
|
117
|
-
* @return True if the input has errors and has been touched, false otherwise.
|
|
118
|
-
*/
|
|
119
|
-
get hasError(): boolean {
|
|
120
|
-
return !!this.control?.errors && !!this.control?.touched;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Updates the view to reflect the current value.
|
|
125
|
-
* This method should be implemented by subclasses to update the specific input element.
|
|
126
|
-
* @param value The new value to set in the view.
|
|
127
|
-
*/
|
|
128
|
-
protected abstract updateView(value: T | null): void;
|
|
129
|
-
/**
|
|
130
|
-
* Updates the disabled state of the input element in the view.
|
|
131
|
-
* This method should be implemented by subclasses to update the specific input element.
|
|
132
|
-
* @param isDisabled True if the input should be disabled, false otherwise.
|
|
133
|
-
*/
|
|
134
|
-
protected abstract updateDisabledState(isDisabled: boolean): void;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Handles blur event.
|
|
138
|
-
* Subclasses can override to provide custom behavior.
|
|
139
|
-
* Default implementation does nothing.
|
|
140
|
-
*/
|
|
141
|
-
protected onBlur(_: FocusEvent): void {}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Handles focus event.
|
|
145
|
-
* Subclasses can override to provide custom behavior.
|
|
146
|
-
* Default implementation does nothing.
|
|
147
|
-
*/
|
|
148
|
-
protected onFocus(_: FocusEvent): void {}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Handles input event.
|
|
152
|
-
* Subclasses can override to provide custom behavior.
|
|
153
|
-
* Default implementation does nothing.
|
|
154
|
-
*/
|
|
155
|
-
protected onInput(_: Event): void { }
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* A mapping of validation error keys to user-friendly error messages.
|
|
159
|
-
* This can be customized to provide specific messages for different validation errors.
|
|
160
|
-
* By default, it uses the DEFAULT_ERROR_MESSAGES constant.
|
|
161
|
-
* If a specific error key is not found in this mapping, a generic message is used.
|
|
162
|
-
*/
|
|
163
|
-
protected errorMessages: Record<string, string> = {};
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* A mapping of validation warnning keys to user-friendly warnning messages.
|
|
167
|
-
* This can be customized to provide specific messages for different validation warnnings.
|
|
168
|
-
* By default, it uses the DEFAULT_WARNING_MESSAGES constant.
|
|
169
|
-
* If a specific warnning key is not found in this mapping, a generic message is used.
|
|
170
|
-
*/
|
|
171
|
-
protected warningMessages: Record<string, string> = {};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Returns the list of error messages for the input.
|
|
175
|
-
*
|
|
176
|
-
* This property should be implemented by subclasses to provide
|
|
177
|
-
* the current validation errors as an array of strings.
|
|
178
|
-
*/
|
|
179
|
-
protected abstract get errorList(): string[];
|
|
180
|
-
/**
|
|
181
|
-
* Returns the list of error messages for the input.
|
|
182
|
-
*
|
|
183
|
-
* This property should be implemented by subclasses to provide
|
|
184
|
-
* the current validation errors as an array of strings.
|
|
185
|
-
*/
|
|
186
|
-
protected abstract get warningList(): string[] | undefined;
|
|
187
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<div class="frg-calendar" tabindex="-1">
|
|
2
|
-
<div class="frg-calendar__head">
|
|
3
|
-
<button class="frg__" href="javascript:void(0);" (click)="changeMonth(currentMonth - 1)">
|
|
4
|
-
<span class="visually-hidden">Previous Page</span>
|
|
5
|
-
<span class="fas fa-angle-left" aria-hidden="true"></span>
|
|
6
|
-
</button>
|
|
7
|
-
<button class="frg-calendar__month" (click)="openMonthSelection()">
|
|
8
|
-
{{month}}
|
|
9
|
-
</button>
|
|
10
|
-
@if((hasMonthSelectionOpen$ | async)){
|
|
11
|
-
<div class="frg-date-selection">
|
|
12
|
-
<div class="frg-date-selection__month">
|
|
13
|
-
<ul class="frg-date-selection__month__list">
|
|
14
|
-
@for(month of months; let i = $index; track $index){
|
|
15
|
-
<li class="frg-date-selection__month__item-list"
|
|
16
|
-
[class.selected-month]="isSelectedYearOrMonth(i + 1, currentMonth)"
|
|
17
|
-
>
|
|
18
|
-
<button (click)="selectMonth($event, i + 1)">
|
|
19
|
-
{{month}}
|
|
20
|
-
</button>
|
|
21
|
-
</li>
|
|
22
|
-
}
|
|
23
|
-
</ul>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
}
|
|
27
|
-
<button class="frg-calendar__year" (click)="openYearSelection()">
|
|
28
|
-
{{year}}
|
|
29
|
-
</button>
|
|
30
|
-
@if((hasYearSelectionOpen$ | async)){
|
|
31
|
-
<div class="frg-date-selection">
|
|
32
|
-
<div class="frg-date-selection__year">
|
|
33
|
-
<ul class="frg-date-selection__year__list">
|
|
34
|
-
@for(year of years; track $index){
|
|
35
|
-
<li class="frg-date-selection__year__item-list"
|
|
36
|
-
[class.selected-year]="isSelectedYearOrMonth(year, currentYear)"
|
|
37
|
-
>
|
|
38
|
-
<button (click)="selectYear($event, year)">
|
|
39
|
-
{{year}}
|
|
40
|
-
</button>
|
|
41
|
-
</li>
|
|
42
|
-
}
|
|
43
|
-
</ul>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
}
|
|
47
|
-
<button href="javascript:void(0);" (click)="changeMonth(currentMonth + 1)">
|
|
48
|
-
<span class="visually-hidden">Next Page</span>
|
|
49
|
-
<span class="fas fa-angle-right" aria-hidden="true"></span>
|
|
50
|
-
</button>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="frg-calendar__body">
|
|
53
|
-
<div class="frg-calendar__week-day">
|
|
54
|
-
@for (dayName of weekDays; track $index) {
|
|
55
|
-
<span>{{dayName}}</span>
|
|
56
|
-
}
|
|
57
|
-
</div>
|
|
58
|
-
@for (week of calendarDays | chunk:7; track $index) {
|
|
59
|
-
<div class="frg-calendar__week">
|
|
60
|
-
@for (day of week; track $index){
|
|
61
|
-
<span class="frg-calendar__day"
|
|
62
|
-
[class.other-month]="day.getMonth() !== currentMonth - 1"
|
|
63
|
-
[class.current-date]="isToday(day)"
|
|
64
|
-
[class.selected-date]="isSelected(day, selectedValue)"
|
|
65
|
-
[class.disabled-date]="isDisabled(day)"
|
|
66
|
-
>
|
|
67
|
-
<button type="button" class="frg-calendar__day-button"
|
|
68
|
-
(click)="onSelectDate($event, day)">
|
|
69
|
-
{{ day.getDate() }}
|
|
70
|
-
</button>
|
|
71
|
-
</span>
|
|
72
|
-
}
|
|
73
|
-
</div>
|
|
74
|
-
}
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use './../../../../../assets/styles/scss/variables' as *;
|
|
3
|
-
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
|
|
7
|
-
.frg-calendar {
|
|
8
|
-
display: grid;
|
|
9
|
-
background-color: $color-light;
|
|
10
|
-
color: $color-dark-neutral;
|
|
11
|
-
box-shadow: $box-shadow-md;
|
|
12
|
-
border-radius: .2rem;
|
|
13
|
-
padding: .5rem;
|
|
14
|
-
margin-top: .3rem;
|
|
15
|
-
font-family: $input-font-family;
|
|
16
|
-
|
|
17
|
-
&__head {
|
|
18
|
-
display: inline-flex;
|
|
19
|
-
position: relative;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
|
|
23
|
-
button {
|
|
24
|
-
background: transparent;
|
|
25
|
-
border: none;
|
|
26
|
-
color: $color-dark-neutral;
|
|
27
|
-
padding: .25rem;
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
background: $color-primary-dark;
|
|
31
|
-
color: $color-light;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&__body {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
gap: 0.25rem;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&__week-day {
|
|
43
|
-
padding: .25rem 0;
|
|
44
|
-
font-size: 0.75rem;
|
|
45
|
-
text-align: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&__week,
|
|
49
|
-
&__week-day {
|
|
50
|
-
display: grid;
|
|
51
|
-
grid-template-columns: repeat(7, 1fr);
|
|
52
|
-
gap: 0.25rem;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&__day {
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
align-items: center;
|
|
59
|
-
min-height: 2rem;
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
background-color: $color-primary;
|
|
63
|
-
color: $color-light;
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&__day.current-date {
|
|
69
|
-
background-color: $color-primary-light;
|
|
70
|
-
color: $color-light;
|
|
71
|
-
text-decoration: underline;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&__day.other-month {
|
|
75
|
-
opacity: 0.5;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&__day.selected-date {
|
|
79
|
-
background-color: $color-primary;
|
|
80
|
-
color: $color-light;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&__day.disabled-date, &__day.disabled-date button {
|
|
84
|
-
text-decoration: line-through;
|
|
85
|
-
pointer-events: none;
|
|
86
|
-
&:hover, button:hover {
|
|
87
|
-
cursor: not-allowed;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
&__day-button {
|
|
92
|
-
background: inherit;
|
|
93
|
-
color: inherit;
|
|
94
|
-
border: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&__footer {
|
|
98
|
-
/**TODO**/
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.frg-date-selection {
|
|
103
|
-
position: absolute;
|
|
104
|
-
overflow-y: scroll;
|
|
105
|
-
max-height: 250px;
|
|
106
|
-
right: 1rem;
|
|
107
|
-
top: 2rem;
|
|
108
|
-
border-radius: .1rem;
|
|
109
|
-
background: $color-light;
|
|
110
|
-
box-shadow: $box-shadow-sm;
|
|
111
|
-
z-index: 1;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
scrollbar-width: thin;
|
|
115
|
-
scrollbar-color: $color-primary transparent;
|
|
116
|
-
|
|
117
|
-
&__year {
|
|
118
|
-
|
|
119
|
-
&__list {
|
|
120
|
-
list-style: none;
|
|
121
|
-
padding: 0;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
&__item-list {
|
|
125
|
-
|
|
126
|
-
& button {
|
|
127
|
-
padding: .5rem 1rem;
|
|
128
|
-
width: 100%;
|
|
129
|
-
|
|
130
|
-
&:hover {
|
|
131
|
-
background-color: $color-primary-light;
|
|
132
|
-
color: $color-light;
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&__item-list.selected-year {
|
|
139
|
-
background-color: $color-primary;
|
|
140
|
-
color: $color-light;
|
|
141
|
-
|
|
142
|
-
& button {
|
|
143
|
-
color: $color-light;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
&__month {
|
|
149
|
-
|
|
150
|
-
&__list {
|
|
151
|
-
list-style: none;
|
|
152
|
-
padding: 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
&__item-list {
|
|
156
|
-
& button {
|
|
157
|
-
padding: .5rem 1rem;
|
|
158
|
-
width: 100%;
|
|
159
|
-
|
|
160
|
-
&:hover {
|
|
161
|
-
background-color: $color-primary;
|
|
162
|
-
color: $color-light;
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&__item-list.selected-month {
|
|
170
|
-
background-color: $color-primary;
|
|
171
|
-
color: $color-light;
|
|
172
|
-
|
|
173
|
-
& button {
|
|
174
|
-
color: $color-light;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { InputCalendarComponent } from './input-calendar.component';
|
|
4
|
-
|
|
5
|
-
describe('InputCalendarComponent', () => {
|
|
6
|
-
let fixture: ComponentFixture<InputCalendarComponent>;
|
|
7
|
-
let component: InputCalendarComponent;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [InputCalendarComponent]
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
|
|
14
|
-
fixture = TestBed.createComponent(InputCalendarComponent);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders week day headers', () => {
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
|
|
21
|
-
const headers = fixture.debugElement.queryAll(By.css('.frg-calendar__week-day span'));
|
|
22
|
-
expect(headers.length).toBe(7);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('emits selectDate when a day is clicked', () => {
|
|
26
|
-
const emitSpy = spyOn(component.selectDate, 'emit');
|
|
27
|
-
|
|
28
|
-
fixture.detectChanges();
|
|
29
|
-
|
|
30
|
-
const dayButton = fixture.debugElement.query(By.css('.frg-calendar__day-button'));
|
|
31
|
-
dayButton.nativeElement.click();
|
|
32
|
-
|
|
33
|
-
expect(emitSpy).toHaveBeenCalled();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('toggles month selection', () => {
|
|
37
|
-
fixture.detectChanges();
|
|
38
|
-
|
|
39
|
-
const monthButton = fixture.debugElement.query(By.css('.frg-calendar__month'));
|
|
40
|
-
monthButton.nativeElement.click();
|
|
41
|
-
|
|
42
|
-
expect(component.hasMonthSelectionOpen$.value).toBeTrue();
|
|
43
|
-
});
|
|
44
|
-
});
|