@cauca-911/material 21.0.1 → 21.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -24
- package/{src/assets → assets}/i18n/cauca/en-material.json +104 -104
- package/{src/assets → assets}/i18n/cauca/es-material.json +104 -104
- package/{src/assets → assets}/i18n/cauca/fr-material.json +106 -106
- package/fesm2022/cauca-911-material.mjs +4145 -0
- package/fesm2022/cauca-911-material.mjs.map +1 -0
- package/package.json +38 -23
- package/types/cauca-911-material.d.ts +745 -0
- package/.eslintrc.json +0 -79
- package/README_PACKAGE.md +0 -5
- package/cauca-911-material-21.0.0.tgz +0 -0
- package/karma.conf.js +0 -50
- package/ng-package.json +0 -7
- package/src/lib/cauca-material.component.html +0 -1
- package/src/lib/cauca-material.component.spec.ts +0 -29
- package/src/lib/cauca-material.component.ts +0 -12
- package/src/lib/cauca-material.service.spec.ts +0 -16
- package/src/lib/cauca-material.service.ts +0 -7
- package/src/lib/components/button/button.component.html +0 -52
- package/src/lib/components/button/button.component.scss +0 -6
- package/src/lib/components/button/button.component.spec.ts +0 -142
- package/src/lib/components/button/button.component.ts +0 -22
- package/src/lib/components/buttons/base-button.ts +0 -35
- package/src/lib/components/buttons/basic-button/basic-button.component.html +0 -5
- package/src/lib/components/buttons/basic-button/basic-button.component.scss +0 -12
- package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +0 -106
- package/src/lib/components/buttons/basic-button/basic-button.component.ts +0 -17
- package/src/lib/components/buttons/fab-button/fab-button.component.html +0 -3
- package/src/lib/components/buttons/fab-button/fab-button.component.scss +0 -12
- package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +0 -82
- package/src/lib/components/buttons/fab-button/fab-button.component.ts +0 -16
- package/src/lib/components/buttons/flat-button/flat-button.component.html +0 -5
- package/src/lib/components/buttons/flat-button/flat-button.component.scss +0 -12
- package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +0 -106
- package/src/lib/components/buttons/flat-button/flat-button.component.ts +0 -17
- package/src/lib/components/buttons/icon-button/icon-button.component.html +0 -3
- package/src/lib/components/buttons/icon-button/icon-button.component.scss +0 -23
- package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +0 -38
- package/src/lib/components/buttons/icon-button/icon-button.component.ts +0 -15
- package/src/lib/components/buttons/link-button/link-button.component.html +0 -1
- package/src/lib/components/buttons/link-button/link-button.component.scss +0 -3
- package/src/lib/components/buttons/link-button/link-button.component.spec.ts +0 -97
- package/src/lib/components/buttons/link-button/link-button.component.ts +0 -25
- package/src/lib/components/buttons/menu-item/menu-item.component.html +0 -5
- package/src/lib/components/buttons/menu-item/menu-item.component.scss +0 -6
- package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +0 -66
- package/src/lib/components/buttons/menu-item/menu-item.component.ts +0 -19
- package/src/lib/components/buttons/raised-button/raised-button.component.html +0 -5
- package/src/lib/components/buttons/raised-button/raised-button.component.scss +0 -12
- package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +0 -108
- package/src/lib/components/buttons/raised-button/raised-button.component.ts +0 -17
- package/src/lib/components/buttons/refresh-button/refresh-button.component.html +0 -1
- package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
- package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +0 -81
- package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +0 -19
- package/src/lib/components/buttons/round-button/round-button.component.html +0 -3
- package/src/lib/components/buttons/round-button/round-button.component.scss +0 -34
- package/src/lib/components/buttons/round-button/round-button.component.spec.ts +0 -26
- package/src/lib/components/buttons/round-button/round-button.component.ts +0 -14
- package/src/lib/components/buttons/stroked-button/stroked-button.component.html +0 -5
- package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +0 -23
- package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +0 -114
- package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +0 -17
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +0 -9
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +0 -7
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +0 -68
- package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +0 -155
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +0 -6
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +0 -25
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +0 -23
- package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +0 -23
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +0 -77
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +0 -124
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +0 -96
- package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +0 -228
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +0 -9
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +0 -15
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +0 -105
- package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +0 -48
- package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +0 -29
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +0 -14
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +0 -3
- package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +0 -87
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +0 -12
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +0 -3
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +0 -35
- package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +0 -57
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +0 -49
- package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +0 -56
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +0 -11
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +0 -4
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +0 -39
- package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +0 -20
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +0 -7
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +0 -41
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +0 -24
- package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +0 -67
- package/src/lib/components/deprecated-components/shared/models/menu-item.ts +0 -11
- package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +0 -5
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +0 -10
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +0 -14
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +0 -90
- package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +0 -41
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +0 -11
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +0 -29
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +0 -137
- package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +0 -47
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +0 -17
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +0 -14
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +0 -96
- package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +0 -40
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +0 -7
- package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +0 -5
- package/src/lib/components/dialogs/dialog-styles.css +0 -9
- package/src/lib/components/dialogs/dialog-styles.scss +0 -9
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +0 -10
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +0 -10
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +0 -91
- package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +0 -32
- package/src/lib/components/dialogs/services/dialog.service.spec.ts +0 -82
- package/src/lib/components/dialogs/services/dialog.service.ts +0 -107
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +0 -24
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +0 -22
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +0 -126
- package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +0 -66
- package/src/lib/components/inputs/color-picker/color-picker.component.html +0 -9
- package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
- package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +0 -29
- package/src/lib/components/inputs/color-picker/color-picker.component.ts +0 -111
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +0 -13
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +0 -80
- package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +0 -46
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +0 -40
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +0 -39
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +0 -135
- package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +0 -263
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +0 -6
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +0 -27
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +0 -90
- package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +0 -17
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +0 -5
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +0 -8
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +0 -98
- package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +0 -16
- package/src/lib/components/inputs/password/password-input/password-input.component.html +0 -11
- package/src/lib/components/inputs/password/password-input/password-input.component.scss +0 -12
- package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +0 -141
- package/src/lib/components/inputs/password/password-input/password-input.component.ts +0 -67
- package/src/lib/components/inputs/password/password-selection/password-selection.component.html +0 -15
- package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +0 -32
- package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +0 -138
- package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +0 -101
- package/src/lib/components/inputs/select-with-search/select-with-search.component.html +0 -19
- package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
- package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +0 -215
- package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +0 -108
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +0 -14
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +0 -48
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +0 -48
- package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +0 -19
- package/src/lib/components/layout/group-container/group-container.component.html +0 -6
- package/src/lib/components/layout/group-container/group-container.component.scss +0 -22
- package/src/lib/components/layout/group-container/group-container.component.spec.ts +0 -34
- package/src/lib/components/layout/group-container/group-container.component.ts +0 -14
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +0 -13
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +0 -27
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +0 -144
- package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +0 -52
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +0 -4
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +0 -10
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +0 -80
- package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +0 -28
- package/src/lib/components/layout/page-title/page-title.component.html +0 -28
- package/src/lib/components/layout/page-title/page-title.component.scss +0 -40
- package/src/lib/components/layout/page-title/page-title.component.spec.ts +0 -162
- package/src/lib/components/layout/page-title/page-title.component.ts +0 -28
- package/src/lib/components/layout/sections/main-section/main-section.component.html +0 -6
- package/src/lib/components/layout/sections/main-section/main-section.component.scss +0 -27
- package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +0 -42
- package/src/lib/components/layout/sections/main-section/main-section.component.ts +0 -13
- package/src/lib/components/layout/sections/section-column/section-column.component.html +0 -3
- package/src/lib/components/layout/sections/section-column/section-column.component.scss +0 -18
- package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +0 -35
- package/src/lib/components/layout/sections/section-column/section-column.component.ts +0 -12
- package/src/lib/components/layout/sections/section-field/section-field.component.html +0 -21
- package/src/lib/components/layout/sections/section-field/section-field.component.scss +0 -44
- package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +0 -74
- package/src/lib/components/layout/sections/section-field/section-field.component.ts +0 -22
- package/src/lib/components/list-paginator/list-paginator.component.html +0 -16
- package/src/lib/components/list-paginator/list-paginator.component.scss +0 -46
- package/src/lib/components/list-paginator/list-paginator.component.spec.ts +0 -248
- package/src/lib/components/list-paginator/list-paginator.component.ts +0 -81
- package/src/lib/components/misc/loading-error/loading-error.component.html +0 -11
- package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
- package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +0 -75
- package/src/lib/components/misc/loading-error/loading-error.component.ts +0 -18
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +0 -3
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +0 -43
- package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +0 -16
- package/src/lib/components/misc/snack-bar/snack-bar.component.html +0 -16
- package/src/lib/components/misc/snack-bar/snack-bar.component.scss +0 -84
- package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +0 -136
- package/src/lib/components/misc/snack-bar/snack-bar.component.ts +0 -39
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +0 -11
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +0 -67
- package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +0 -15
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +0 -11
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +0 -77
- package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +0 -17
- package/src/lib/components/presenters/badge/badge.component.html +0 -6
- package/src/lib/components/presenters/badge/badge.component.scss +0 -10
- package/src/lib/components/presenters/badge/badge.component.spec.ts +0 -41
- package/src/lib/components/presenters/badge/badge.component.ts +0 -18
- package/src/lib/components/presenters/icon/icon.component.scss +0 -9
- package/src/lib/components/presenters/icon/icon.component.spec.ts +0 -38
- package/src/lib/components/presenters/icon/icon.component.ts +0 -37
- package/src/lib/core/breadcrumb.service.spec.ts +0 -35
- package/src/lib/core/breadcrumb.service.ts +0 -24
- package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +0 -22
- package/src/lib/core/directives/auto-trim-and-lower.directive.ts +0 -19
- package/src/lib/core/directives/form-error/form-error.module.ts +0 -21
- package/src/lib/core/directives/form-error/has-error-root.directive.ts +0 -31
- package/src/lib/core/directives/form-error/has-error.directive.ts +0 -95
- package/src/lib/core/loading-state.service.spec.ts +0 -57
- package/src/lib/core/loading-state.service.ts +0 -44
- package/src/lib/core/models/breadcrumb-location.ts +0 -6
- package/src/lib/core/models/password-validation.ts +0 -20
- package/src/lib/core/validators/password/password-validator.spec.ts +0 -155
- package/src/lib/core/validators/password/password-validator.ts +0 -30
- package/src/lib/provide-cauca-material.ts +0 -10
- package/src/public-api.ts +0 -70
- package/src/test.ts +0 -17
- package/tsconfig.lib.json +0 -18
- package/tsconfig.lib.prod.json +0 -4
- package/tsconfig.spec.json +0 -17
- /package/{src/assets → assets}/images/loading.gif +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<div role="group" class="dropdown-chip-autocomplete-container">
|
|
2
|
-
|
|
3
|
-
<mat-chip-grid #chipGrid [disabled]="disabled">
|
|
4
|
-
|
|
5
|
-
@for (key of value; track key) {
|
|
6
|
-
<mat-chip highlighted [disabled]="disabled" (removed)="removeSelectedItem(key)" color="primary">
|
|
7
|
-
{{getValueDisplay(key)}}
|
|
8
|
-
@if (allowRemove) {
|
|
9
|
-
<mat-icon matChipRemove>cancel</mat-icon>
|
|
10
|
-
}
|
|
11
|
-
</mat-chip>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
<div class="input-wrapper">
|
|
15
|
-
<input
|
|
16
|
-
#chipInput
|
|
17
|
-
[(ngModel)]="searchValue"
|
|
18
|
-
[matAutocomplete]="auto"
|
|
19
|
-
[matChipInputFor]="chipGrid"
|
|
20
|
-
[matChipInputSeparatorKeyCodes]="separatorKeysCodes">
|
|
21
|
-
@if (value.length > 0 && canRemoveAll()) {
|
|
22
|
-
<mat-icon matPrefix class="clearAll" (click)="onClearAll();">clear</mat-icon>
|
|
23
|
-
}
|
|
24
|
-
<mat-icon matSuffix>arrow_drop_down</mat-icon>
|
|
25
|
-
</div>
|
|
26
|
-
</mat-chip-grid>
|
|
27
|
-
|
|
28
|
-
<mat-autocomplete #auto="matAutocomplete" panelWidth="500px" [class.full-width-field]="optionTemplate" (optionSelected)="selectItemOnAutocomplete($event)">
|
|
29
|
-
@for (item of filteredListAutoComplete | async; track item) {
|
|
30
|
-
<mat-option [value]="item[keyValue]" class="full-width-option">
|
|
31
|
-
@if (optionTemplate) {
|
|
32
|
-
<ng-container *ngTemplateOutlet="optionTemplate; context: {data: item}" />
|
|
33
|
-
} @else {
|
|
34
|
-
{{item[displayValue]}}
|
|
35
|
-
}
|
|
36
|
-
</mat-option>
|
|
37
|
-
}
|
|
38
|
-
</mat-autocomplete>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
span {
|
|
2
|
-
opacity: 0;
|
|
3
|
-
transition: opacity 200ms;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
:host.floating span {
|
|
7
|
-
opacity: 1;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
:host {
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
|
|
13
|
-
mat-icon {
|
|
14
|
-
align-self: center;
|
|
15
|
-
color: var(--mat-select-enabled-arrow-color);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
input.mat-mdc-chip-input {
|
|
19
|
-
flex: 1;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.input-wrapper {
|
|
24
|
-
flex: 1;
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: row;
|
|
27
|
-
gap: 8px;
|
|
28
|
-
align-items: center;
|
|
29
|
-
flex-wrap: nowrap;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.input-wrapper > input {
|
|
33
|
-
flex: 1;
|
|
34
|
-
min-width: 150px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.input-wrapper > mat-icon {
|
|
38
|
-
flex-shrink: 0;
|
|
39
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed, fakeAsync, flush } from '@angular/core/testing';
|
|
2
|
-
import { DropdownChipAutocompleteComponent } from './dropdown-chip-autocomplete.component';
|
|
3
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
4
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
-
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
|
6
|
-
import { FormsModule } from '@angular/forms';
|
|
7
|
-
|
|
8
|
-
describe('DropdownChipAutocompleteComponent', () => {
|
|
9
|
-
let component: DropdownChipAutocompleteComponent;
|
|
10
|
-
let fixture: ComponentFixture<DropdownChipAutocompleteComponent>;
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
TestBed.configureTestingModule({
|
|
14
|
-
imports: [
|
|
15
|
-
DropdownChipAutocompleteComponent,
|
|
16
|
-
MatAutocompleteModule,
|
|
17
|
-
MatChipsModule,
|
|
18
|
-
MatIconModule,
|
|
19
|
-
FormsModule
|
|
20
|
-
]
|
|
21
|
-
});
|
|
22
|
-
fixture = TestBed.createComponent(DropdownChipAutocompleteComponent);
|
|
23
|
-
component = fixture.componentInstance;
|
|
24
|
-
fixture.detectChanges();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should create', () => {
|
|
28
|
-
expect(component).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should call "onChange" when an item is selected from autocomplete', () => {
|
|
32
|
-
spyOn(component, 'onChange');
|
|
33
|
-
const event = {
|
|
34
|
-
option: { value: 'test 2' }
|
|
35
|
-
} as MatAutocompleteSelectedEvent;
|
|
36
|
-
|
|
37
|
-
component.selectItemOnAutocomplete(event);
|
|
38
|
-
|
|
39
|
-
expect(component.onChange).toHaveBeenCalled();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should call "onChange" when an item is removed from autocomplete', () => {
|
|
43
|
-
spyOn(component, 'onChange');
|
|
44
|
-
component.value = ['test'];
|
|
45
|
-
component.removeSelectedItem(0);
|
|
46
|
-
|
|
47
|
-
expect(component.onChange).toHaveBeenCalled();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should clear all value when "clear" beside the "arrow_drop_down" is click', () => {
|
|
51
|
-
spyOn(component, 'onClearAll');
|
|
52
|
-
component.value = ['test'];
|
|
53
|
-
fixture.detectChanges();
|
|
54
|
-
|
|
55
|
-
const clearAllIcon = fixture.nativeElement.querySelector('.clearAll');
|
|
56
|
-
clearAllIcon.click();
|
|
57
|
-
|
|
58
|
-
expect(component.onClearAll).toHaveBeenCalled();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should not display the remove all button when the props is false', () => {
|
|
62
|
-
fixture.componentRef.setInput('canRemoveAll', false);
|
|
63
|
-
component.value = ['test'];
|
|
64
|
-
fixture.detectChanges();
|
|
65
|
-
|
|
66
|
-
const clearAllIcon = fixture.nativeElement.querySelector('.clearAll');
|
|
67
|
-
expect(clearAllIcon).toBeNull();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should filter datasource when filter is changed', fakeAsync(() => {
|
|
71
|
-
component.keyValue = 'id';
|
|
72
|
-
component.displayValue = 'text';
|
|
73
|
-
component.listAutoComplete = [
|
|
74
|
-
{ id: '1', 'text': 'Patate' },
|
|
75
|
-
{ id: '2', 'text': 'Chou' },
|
|
76
|
-
{ id: '3', 'text': 'Hibou' },
|
|
77
|
-
{ id: '4', 'text': 'Genou' }
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
component.searchValue = 'Pat';
|
|
81
|
-
|
|
82
|
-
flush();
|
|
83
|
-
|
|
84
|
-
expect(component.searchValue).toBe('Pat');
|
|
85
|
-
component.filteredListAutoComplete.subscribe(filteredList => {
|
|
86
|
-
expect(filteredList.length).toBe(1);
|
|
87
|
-
expect(filteredList[0]).toBe(component.listAutoComplete[0]);
|
|
88
|
-
});
|
|
89
|
-
}));
|
|
90
|
-
|
|
91
|
-
it('should display everything when filter has been cleared', fakeAsync(() => {
|
|
92
|
-
component.keyValue = 'id';
|
|
93
|
-
component.displayValue = 'text';
|
|
94
|
-
component.listAutoComplete = [
|
|
95
|
-
{ id: '1', 'text': 'Patate' },
|
|
96
|
-
{ id: '2', 'text': 'Chou' },
|
|
97
|
-
{ id: '3', 'text': 'Hibou' },
|
|
98
|
-
{ id: '4', 'text': 'Genou' }
|
|
99
|
-
];
|
|
100
|
-
component.searchValue = 'Pat';
|
|
101
|
-
flush();
|
|
102
|
-
|
|
103
|
-
component.searchValue = '';
|
|
104
|
-
flush();
|
|
105
|
-
|
|
106
|
-
expect(component.searchValue).toBe('');
|
|
107
|
-
component.filteredListAutoComplete.subscribe(filteredList => {
|
|
108
|
-
expect(filteredList.length).toBe(component.listAutoComplete.length);
|
|
109
|
-
expect(filteredList[0]).toBe(component.listAutoComplete[0]);
|
|
110
|
-
});
|
|
111
|
-
}));
|
|
112
|
-
|
|
113
|
-
it('should not labelFloat when empty', () => {
|
|
114
|
-
expect(component.shouldLabelFloat).toBeFalsy();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should labelFloat when not empty', () => {
|
|
118
|
-
component.value = ['123'];
|
|
119
|
-
|
|
120
|
-
expect(component.shouldLabelFloat).toBeTruthy();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should not labelFloat when there is no search value', () => {
|
|
124
|
-
component.searchValue = '';
|
|
125
|
-
|
|
126
|
-
expect(component.shouldLabelFloat).toBeFalsy();
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should labelFloat when there is a search value', () => {
|
|
130
|
-
component.searchValue = 'a';
|
|
131
|
-
|
|
132
|
-
expect(component.shouldLabelFloat).toBeTruthy();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
});
|
package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
Component,
|
|
5
|
-
ContentChild,
|
|
6
|
-
DoCheck,
|
|
7
|
-
ElementRef,
|
|
8
|
-
EventEmitter,
|
|
9
|
-
HostBinding,
|
|
10
|
-
input,
|
|
11
|
-
Input,
|
|
12
|
-
OnDestroy,
|
|
13
|
-
Optional,
|
|
14
|
-
Output,
|
|
15
|
-
Self,
|
|
16
|
-
TemplateRef,
|
|
17
|
-
ViewChild
|
|
18
|
-
} from '@angular/core';
|
|
19
|
-
import { ControlValueAccessor, FormGroupDirective, FormsModule, NgControl, NgForm } from '@angular/forms';
|
|
20
|
-
import { MatAutocomplete, MatAutocompleteModule, MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
21
|
-
import { MatChip, MatChipGrid, MatChipInput, MatChipRemove } from '@angular/material/chips';
|
|
22
|
-
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
23
|
-
import { MatIcon } from '@angular/material/icon';
|
|
24
|
-
import { toLowerCaseAndWithoutDiacritics } from '@cauca-911/core';
|
|
25
|
-
import { Observable, Subject, map, startWith } from 'rxjs';
|
|
26
|
-
|
|
27
|
-
@Component({
|
|
28
|
-
selector: 'cauca-dropdown-chip-autocomplete',
|
|
29
|
-
templateUrl: './dropdown-chip-autocomplete.component.html',
|
|
30
|
-
styleUrls: ['./dropdown-chip-autocomplete.component.scss'],
|
|
31
|
-
providers: [{
|
|
32
|
-
provide: MatFormFieldControl,
|
|
33
|
-
useExisting: DropdownChipAutocompleteComponent,
|
|
34
|
-
}],
|
|
35
|
-
imports: [
|
|
36
|
-
MatChipGrid,
|
|
37
|
-
MatChip,
|
|
38
|
-
MatChipRemove,
|
|
39
|
-
FormsModule,
|
|
40
|
-
MatAutocompleteModule,
|
|
41
|
-
MatChipInput,
|
|
42
|
-
MatIcon,
|
|
43
|
-
CommonModule
|
|
44
|
-
]
|
|
45
|
-
})
|
|
46
|
-
export class DropdownChipAutocompleteComponent implements ControlValueAccessor, MatFormFieldControl<any[]>, OnDestroy, DoCheck {
|
|
47
|
-
@HostBinding('id')
|
|
48
|
-
public id = `cauca-dropdown-chip-autocomplete-${DropdownChipAutocompleteComponent.nextId++}`;
|
|
49
|
-
|
|
50
|
-
@ViewChild('auto') public matAutocomplete: MatAutocomplete;
|
|
51
|
-
@ViewChild('chipInput') public matChipInput: ElementRef<HTMLInputElement>;
|
|
52
|
-
@ViewChild(MatAutocompleteTrigger) public matAutocompletePanel: MatAutocompleteTrigger;
|
|
53
|
-
@Output() public clearAll: EventEmitter<void> = new EventEmitter<void>();
|
|
54
|
-
@Input() public listAutoComplete: object[] = [];
|
|
55
|
-
@Input() public keyValue = 'id';
|
|
56
|
-
@Input() public displayValue = 'name';
|
|
57
|
-
@Input() public allowRemove = true;
|
|
58
|
-
@Input() public ariaDescribedBy: string;
|
|
59
|
-
public canRemoveAll = input(true);
|
|
60
|
-
public hasOptionTemplate = input<boolean>(false);
|
|
61
|
-
@ContentChild(TemplateRef) public optionTemplate: TemplateRef<any>;
|
|
62
|
-
|
|
63
|
-
public stateChanges = new Subject<void>();
|
|
64
|
-
public static nextId = 0;
|
|
65
|
-
public focused = false;
|
|
66
|
-
public touched = false;
|
|
67
|
-
public errorState = false;
|
|
68
|
-
public controlType = 'dropdown-chip-autocomplete';
|
|
69
|
-
public separatorKeysCodes: any = ',';
|
|
70
|
-
public filteredListAutoComplete: Observable<object[]>;
|
|
71
|
-
|
|
72
|
-
private _required = false;
|
|
73
|
-
private _disabled = false;
|
|
74
|
-
private _placeholder: string;
|
|
75
|
-
private _searchValue: string = null;
|
|
76
|
-
private selectedValues: any[] = [];
|
|
77
|
-
|
|
78
|
-
public get searchValue(): string {
|
|
79
|
-
return this._searchValue;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public set searchValue(newValue: string) {
|
|
83
|
-
if (this._searchValue !== newValue && (typeof newValue === 'string') || newValue===null) {
|
|
84
|
-
this._searchValue = newValue;
|
|
85
|
-
this.stateChanges.next();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@HostBinding('class.floating')
|
|
90
|
-
public get shouldLabelFloat() {
|
|
91
|
-
return this.focused || !this.empty || !!this._searchValue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@Input()
|
|
95
|
-
public get value(): any[] {
|
|
96
|
-
return this.selectedValues;
|
|
97
|
-
}
|
|
98
|
-
public set value(values: any[]) {
|
|
99
|
-
this.selectedValues = values;
|
|
100
|
-
this.onChange(this.selectedValues);
|
|
101
|
-
this.stateChanges.next();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@Input()
|
|
105
|
-
public get required(): boolean {
|
|
106
|
-
return this._required;
|
|
107
|
-
}
|
|
108
|
-
public set required(req: BooleanInput) {
|
|
109
|
-
this._required = coerceBooleanProperty(req);
|
|
110
|
-
this.stateChanges.next();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@Input()
|
|
114
|
-
public get disabled(): boolean {
|
|
115
|
-
return this._disabled;
|
|
116
|
-
}
|
|
117
|
-
public set disabled(value: BooleanInput) {
|
|
118
|
-
this._disabled = coerceBooleanProperty(value);
|
|
119
|
-
this.stateChanges.next();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public get empty() {
|
|
123
|
-
return !this.selectedValues?.length;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@Input()
|
|
127
|
-
public get placeholder() {
|
|
128
|
-
return this._placeholder;
|
|
129
|
-
}
|
|
130
|
-
public set placeholder(plh) {
|
|
131
|
-
this._placeholder = plh;
|
|
132
|
-
this.stateChanges.next();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public constructor(
|
|
136
|
-
@Optional() @Self() public ngControl: NgControl,
|
|
137
|
-
@Optional() private readonly parentForm: NgForm,
|
|
138
|
-
@Optional() private readonly parentFormGroup: FormGroupDirective,
|
|
139
|
-
private readonly elementRef: ElementRef<HTMLElement>,
|
|
140
|
-
) {
|
|
141
|
-
elementRef.nativeElement.addEventListener('focusin', this.onFocusIn.bind(this));
|
|
142
|
-
elementRef.nativeElement.addEventListener('focusout', this.onFocusOut.bind(this));
|
|
143
|
-
if (this.ngControl != null) {
|
|
144
|
-
this.ngControl.valueAccessor = this;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.filteredListAutoComplete = this.stateChanges.pipe(
|
|
148
|
-
startWith(null),
|
|
149
|
-
map(() => this.filterSelectedItem())
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public ngDoCheck() {
|
|
154
|
-
if (this.ngControl) {
|
|
155
|
-
this.updateErrorState();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public ngOnDestroy() {
|
|
160
|
-
this.stateChanges.complete();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
public onChange = (_: any): void => {
|
|
164
|
-
// Do nothing for now
|
|
165
|
-
};
|
|
166
|
-
public onTouched = (): void => {
|
|
167
|
-
// Do nothing for now
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
public onFocusIn() {
|
|
171
|
-
if (!this.focused) {
|
|
172
|
-
this.focused = true;
|
|
173
|
-
this.stateChanges.next();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
public markAsClean(): void {
|
|
178
|
-
this.touched = false;
|
|
179
|
-
this.focused = false;
|
|
180
|
-
this.stateChanges.next();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public onFocusOut(event: FocusEvent) {
|
|
184
|
-
if (!this.elementRef.nativeElement.contains(event.relatedTarget as Element)) {
|
|
185
|
-
this.touched = true;
|
|
186
|
-
this.focused = false;
|
|
187
|
-
this.onTouched();
|
|
188
|
-
this.stateChanges.next();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public setDisabledState(isDisabled: boolean): void {
|
|
193
|
-
this.disabled = isDisabled;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
public setDescribedByIds(ids: string[]) {
|
|
197
|
-
const controlElement = this.elementRef.nativeElement.querySelector('.dropdown-chip-autocomplete-container');
|
|
198
|
-
controlElement.setAttribute('aria-describedby', ids.join(' '));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
public onContainerClick(event: MouseEvent) {
|
|
202
|
-
if ((event.target as Element).tagName.toLowerCase() != 'input') {
|
|
203
|
-
this.elementRef.nativeElement.querySelector('input').focus();
|
|
204
|
-
}
|
|
205
|
-
this.searchValue = null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
public writeValue(value: string[] | []): void {
|
|
209
|
-
this.value = value;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
public registerOnChange(fn: any): void {
|
|
213
|
-
this.onChange = fn;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
public registerOnTouched(fn: any): void {
|
|
217
|
-
this.onTouched = fn;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
public selectItemOnAutocomplete(e: MatAutocompleteSelectedEvent): void {
|
|
221
|
-
this.value = [].concat(this.selectedValues, e.option.value);
|
|
222
|
-
this.matChipInput.nativeElement.value = '';
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
public removeSelectedItem(key: any): void {
|
|
226
|
-
const index = this.selectedValues.indexOf(key);
|
|
227
|
-
|
|
228
|
-
if (index >= 0) {
|
|
229
|
-
this.selectedValues.splice(index, 1);
|
|
230
|
-
this.value = this.selectedValues;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
public getValueDisplay(key: any): string {
|
|
235
|
-
const selectedItem = this.listAutoComplete.find((item: object) => `${item[this.keyValue]}` === `${key}`);
|
|
236
|
-
return selectedItem ? selectedItem[this.displayValue] : '';
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
public onClearAll(): void {
|
|
240
|
-
this.matAutocompletePanel.closePanel();
|
|
241
|
-
this.value = [];
|
|
242
|
-
this.clearAll.emit();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
private updateErrorState() {
|
|
246
|
-
const parent = this.parentFormGroup || this.parentForm;
|
|
247
|
-
const oldState = this.errorState;
|
|
248
|
-
|
|
249
|
-
const newState = (this.ngControl?.invalid) && (this.touched || parent.submitted);
|
|
250
|
-
if (oldState !== newState) {
|
|
251
|
-
this.errorState = newState;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
private filterSelectedItem(): object[] {
|
|
256
|
-
const searchValue = toLowerCaseAndWithoutDiacritics(this.searchValue);
|
|
257
|
-
const filtered = this.listAutoComplete.filter((item: object) =>
|
|
258
|
-
!this.selectedValues.includes(item[this.keyValue])
|
|
259
|
-
&& toLowerCaseAndWithoutDiacritics(item[this.displayValue]).includes(searchValue));
|
|
260
|
-
return filtered;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
}
|
package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
@if (condition()) {
|
|
2
|
-
<mat-icon [ngClass]="disabled() ? 'disabled' : ''" class="green">check_circle</mat-icon>
|
|
3
|
-
}@else {
|
|
4
|
-
<mat-icon [ngClass]="disabled() ? 'disabled' : ''" class="red">cancel</mat-icon>
|
|
5
|
-
}
|
|
6
|
-
<label [ngClass]="disabled() ? 'disabled' : ''" class="body2" translate>{{label()}}</label>
|
package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: 8px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
mat-icon {
|
|
8
|
-
flex-shrink: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.green {
|
|
12
|
-
fill: #81C784;
|
|
13
|
-
color: #81C784;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.red {
|
|
17
|
-
fill: #E57373;
|
|
18
|
-
color: #E57373;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
label {
|
|
22
|
-
color: #000;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.disabled {
|
|
26
|
-
opacity: 0.5;
|
|
27
|
-
}
|
package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { PasswordCriteriaComponent } from './password-criteria.component';
|
|
4
|
-
import { HarnessLoader } from '@angular/cdk/testing';
|
|
5
|
-
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
|
6
|
-
import { MatIconHarness } from '@angular/material/icon/testing';
|
|
7
|
-
import { MockDirective, MockModule, ngMocks } from 'ng-mocks';
|
|
8
|
-
import { TranslateDirective, TranslateModule } from '@ngx-translate/core';
|
|
9
|
-
import { By } from '@angular/platform-browser';
|
|
10
|
-
import { MatIcon } from '@angular/material/icon';
|
|
11
|
-
|
|
12
|
-
describe('PasswordCriteriaComponent', () => {
|
|
13
|
-
let component: PasswordCriteriaComponent;
|
|
14
|
-
let fixture: ComponentFixture<PasswordCriteriaComponent>;
|
|
15
|
-
let loader: HarnessLoader;
|
|
16
|
-
|
|
17
|
-
const someLabel = 'A label!';
|
|
18
|
-
|
|
19
|
-
beforeEach(async () => {
|
|
20
|
-
await TestBed.configureTestingModule({
|
|
21
|
-
imports: [PasswordCriteriaComponent,
|
|
22
|
-
MockModule(TranslateModule)
|
|
23
|
-
],
|
|
24
|
-
declarations: [
|
|
25
|
-
MockDirective(TranslateDirective)
|
|
26
|
-
]
|
|
27
|
-
})
|
|
28
|
-
.compileComponents();
|
|
29
|
-
|
|
30
|
-
fixture = TestBed.createComponent(PasswordCriteriaComponent);
|
|
31
|
-
loader = TestbedHarnessEnvironment.loader(fixture);
|
|
32
|
-
component = fixture.componentInstance;
|
|
33
|
-
fixture.componentRef.setInput('label', someLabel);
|
|
34
|
-
fixture.detectChanges();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should create', () => {
|
|
38
|
-
expect(component).toBeTruthy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should show check circle icon when condition is met', async () => {
|
|
42
|
-
fixture.componentRef.setInput('condition', true);
|
|
43
|
-
fixture.detectChanges();
|
|
44
|
-
|
|
45
|
-
const icons = await loader.getAllHarnesses(MatIconHarness);
|
|
46
|
-
|
|
47
|
-
expect(icons.length).toBe(1);
|
|
48
|
-
expect(await icons[0].getName()).toBe('check_circle');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should show cancel icon when condition is not met', async () => {
|
|
52
|
-
fixture.componentRef.setInput('condition', false);
|
|
53
|
-
fixture.detectChanges();
|
|
54
|
-
|
|
55
|
-
const icons = await loader.getAllHarnesses(MatIconHarness);
|
|
56
|
-
|
|
57
|
-
expect(icons.length).toBe(1);
|
|
58
|
-
expect(await icons[0].getName()).toBe('cancel');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should show label', () => {
|
|
62
|
-
const label = fixture.debugElement.query(By.css('label'));
|
|
63
|
-
|
|
64
|
-
expect(label.properties.innerText).toBe(someLabel);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should disable icon and label when receiving disable and condition is false', async () => {
|
|
68
|
-
fixture.componentRef.setInput('disabled', true);
|
|
69
|
-
fixture.componentRef.setInput('condition', false);
|
|
70
|
-
fixture.detectChanges();
|
|
71
|
-
|
|
72
|
-
const icon = ngMocks.find<MatIcon>('mat-icon');
|
|
73
|
-
const label = ngMocks.find<HTMLLabelElement>('label');
|
|
74
|
-
|
|
75
|
-
expect(icon.classes.disabled).toBeDefined();
|
|
76
|
-
expect(label.classes.disabled).toBeDefined();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('should disable icon and label when receiving disable and condition is true', async () => {
|
|
80
|
-
fixture.componentRef.setInput('disabled', true);
|
|
81
|
-
fixture.componentRef.setInput('condition', true);
|
|
82
|
-
fixture.detectChanges();
|
|
83
|
-
|
|
84
|
-
const icon = ngMocks.find<MatIcon>('mat-icon');
|
|
85
|
-
const label = ngMocks.find<HTMLLabelElement>('label');
|
|
86
|
-
|
|
87
|
-
expect(icon.classes.disabled).toBeDefined();
|
|
88
|
-
expect(label.classes.disabled).toBeDefined();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgClass } from '@angular/common';
|
|
2
|
-
import { Component, InputSignal, input } from '@angular/core';
|
|
3
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'cauca-password-criteria',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [MatIconModule, TranslateModule, NgClass],
|
|
10
|
-
templateUrl: './password-criteria.component.html',
|
|
11
|
-
styleUrl: './password-criteria.component.scss'
|
|
12
|
-
})
|
|
13
|
-
export class PasswordCriteriaComponent {
|
|
14
|
-
public label: InputSignal<string> = input.required<string>();
|
|
15
|
-
public condition: InputSignal<boolean> = input(false);
|
|
16
|
-
public disabled: InputSignal<boolean> = input(false);
|
|
17
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<cauca-password-criteria [disabled]="disabled()" label="passwordEdition.minimumCharacters" [condition]="passwordValidation().hasMinimumCharacters"/>
|
|
2
|
-
<cauca-password-criteria [disabled]="disabled()" label="passwordEdition.minimumOneNumeric" [condition]="passwordValidation().hasMinimumNumeric"/>
|
|
3
|
-
<cauca-password-criteria [disabled]="disabled()" label="passwordEdition.minimumOneSpecialCharacter" [condition]="passwordValidation().hasSpecialCharacter"/>
|
|
4
|
-
<cauca-password-criteria [disabled]="disabled()" label="passwordEdition.needLowerAndUppercase" [condition]="passwordValidation().hasLowerAndUppercase"/>
|
|
5
|
-
<cauca-password-criteria [disabled]="disabled()" label="passwordEdition.equalPasswords" [condition]="passwordValidation().hasIdenticalPassword"/>
|