primekit 1.0.9 → 1.0.10
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 +25 -25
- package/ng-package.json +8 -0
- package/package.json +12 -25
- package/src/assets/images/empty-table.svg +25 -25
- package/src/lib/lib/atomix-alert/atomix-alert.component.css +67 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.html +7 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.spec.ts +154 -0
- package/src/lib/lib/atomix-alert/atomix-alert.component.ts +75 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.html +35 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.scss +72 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.spec.ts +210 -0
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.ts +70 -0
- package/src/lib/lib/atomix-button/atomix-button.component.css +70 -0
- package/src/lib/lib/atomix-button/atomix-button.component.html +20 -0
- package/src/lib/lib/atomix-button/atomix-button.component.spec.ts +135 -0
- package/src/lib/lib/atomix-button/atomix-button.component.ts +28 -0
- package/{lib/lib/atomix-button/atomix-button.models.d.ts → src/lib/lib/atomix-button/atomix-button.models.ts} +2 -2
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.css +5 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.html +20 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.spec.ts +145 -0
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.ts +71 -0
- package/src/lib/lib/atomix-card/atomix-card.component.css +4 -0
- package/src/lib/lib/atomix-card/atomix-card.component.html +3 -0
- package/src/lib/lib/atomix-card/atomix-card.component.spec.ts +63 -0
- package/src/lib/lib/atomix-card/atomix-card.component.ts +13 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.css +12 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.html +9 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.spec.ts +63 -0
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.ts +22 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.html +233 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.scss +266 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.spec.ts +1465 -0
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.ts +717 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.css +0 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.html +7 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.spec.ts +91 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.ts +17 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.css +25 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.html +37 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.spec.ts +178 -0
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.ts +89 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.css +0 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.html +0 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.spec.ts +128 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.ts +42 -0
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.ts +12 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.html +20 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.scss +7 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.spec.ts +169 -0
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.ts +41 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.html +21 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.scss +7 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.spec.ts +142 -0
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.ts +32 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.html +13 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.scss +14 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.spec.ts +112 -0
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.ts +28 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.html +20 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.scss +3 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.spec.ts +153 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.ts +28 -0
- package/src/lib/lib/atomix-form/atomix-form-chips/form.chips.models.ts +5 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.html +24 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.scss +15 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.spec.ts +156 -0
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.ts +36 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.html +33 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.scss +32 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.spec.ts +156 -0
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.ts +42 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.html +14 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.scss +0 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.spec.ts +104 -0
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.ts +24 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.html +16 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.scss +0 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.spec.ts +92 -0
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.ts +24 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.html +23 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.scss +3 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.spec.ts +126 -0
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.ts +26 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.html +17 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.scss +6 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.spec.ts +120 -0
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.ts +24 -0
- package/src/lib/lib/atomix-input/atomix-input.component.css +52 -0
- package/src/lib/lib/atomix-input/atomix-input.component.html +45 -0
- package/src/lib/lib/atomix-input/atomix-input.component.spec.ts +229 -0
- package/src/lib/lib/atomix-input/atomix-input.component.ts +64 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.css +12 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.html +17 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.spec.ts +173 -0
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.ts +62 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.html +47 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.scss +14 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.spec.ts +21 -0
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.ts +25 -0
- package/src/lib/lib/atomix-messages/messages.component.css +0 -0
- package/src/lib/lib/atomix-messages/messages.component.html +9 -0
- package/src/lib/lib/atomix-messages/messages.component.spec.ts +115 -0
- package/src/lib/lib/atomix-messages/messages.component.ts +17 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.css +19 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.html +24 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.spec.ts +98 -0
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.ts +36 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.css +0 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.html +7 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.spec.ts +116 -0
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.ts +37 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.css +49 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.html +68 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.spec.ts +282 -0
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.ts +119 -0
- package/{lib/lib/atomix-select-button/atomix-select-button-models.d.ts → src/lib/lib/atomix-select-button/atomix-select-button-models.ts} +4 -4
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.css +5 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.html +7 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.spec.ts +73 -0
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.ts +19 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.css +30 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.html +4 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.spec.ts +60 -0
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.ts +27 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.css +0 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.html +7 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.spec.ts +70 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.ts +13 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.html +9 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.scss +0 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.spec.ts +120 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.ts +32 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.css +0 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.html +26 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.spec.ts +106 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.ts +36 -0
- package/src/lib/lib/atomix-table/atomix-table.component.css +152 -0
- package/src/lib/lib/atomix-table/atomix-table.component.html +647 -0
- package/src/lib/lib/atomix-table/atomix-table.component.spec.ts +1648 -0
- package/src/lib/lib/atomix-table/atomix-table.component.ts +422 -0
- package/src/lib/lib/atomix-table/atomix-table.models.ts +39 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.css +0 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.html +6 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.spec.ts +47 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.ts +13 -0
- package/src/lib/lib/utils/prime-icons.util.spec.ts +21 -0
- package/src/lib/lib/utils/prime-icons.util.ts +11 -0
- package/src/lib/primekit.component.spec.ts +19 -0
- package/src/lib/primekit.component.ts +10 -0
- package/src/lib/primekit.module.spec.ts +155 -0
- package/src/lib/primekit.module.ts +183 -0
- package/src/lib/primekit.service.spec.ts +17 -0
- package/src/lib/primekit.service.ts +8 -0
- package/{public-api.d.ts → src/public-api.ts} +47 -37
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +10 -0
- package/esm2022/lib/lib/atomix-alert/atomix-alert.component.mjs +0 -76
- package/esm2022/lib/lib/atomix-autocomplete/atomix-autocomplete.component.mjs +0 -108
- package/esm2022/lib/lib/atomix-button/atomix-button.component.mjs +0 -49
- package/esm2022/lib/lib/atomix-button/atomix-button.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-calendar/atomix-calendar.component.mjs +0 -90
- package/esm2022/lib/lib/atomix-card/atomix-card.component.mjs +0 -24
- package/esm2022/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.mjs +0 -28
- package/esm2022/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.mjs +0 -648
- package/esm2022/lib/lib/atomix-divider/atomix-divider.component.mjs +0 -27
- package/esm2022/lib/lib/atomix-dropdown/atomix-dropdown.component.mjs +0 -105
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.mjs +0 -38
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.mjs +0 -67
- package/esm2022/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.mjs +0 -59
- package/esm2022/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.mjs +0 -54
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/form.chips.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.mjs +0 -70
- package/esm2022/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.mjs +0 -80
- package/esm2022/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.mjs +0 -46
- package/esm2022/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.mjs +0 -46
- package/esm2022/lib/lib/atomix-input/atomix-input.component.mjs +0 -94
- package/esm2022/lib/lib/atomix-input-switch/atomix-input-switch.component.mjs +0 -85
- package/esm2022/lib/lib/atomix-messages/messages.component.mjs +0 -33
- package/esm2022/lib/lib/atomix-pagination/atomix-pagination.component.mjs +0 -48
- package/esm2022/lib/lib/atomix-radio-button/atomix-radio-button.component.mjs +0 -50
- package/esm2022/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.mjs +0 -149
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button-models.mjs +0 -2
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button.component.mjs +0 -25
- package/esm2022/lib/lib/atomix-snackbar/atomix-snackbar.component.mjs +0 -29
- package/esm2022/lib/lib/atomix-spinner/atomix-spinner.component.mjs +0 -24
- package/esm2022/lib/lib/atomix-steps/atomix-steps.component.mjs +0 -41
- package/esm2022/lib/lib/atomix-tabMenu/atomix-tabMenu.component.mjs +0 -51
- package/esm2022/lib/lib/atomix-table/atomix-table.component.mjs +0 -454
- package/esm2022/lib/lib/atomix-table/atomix-table.models.mjs +0 -2
- package/esm2022/lib/lib/atomix-tag/atomix-tag.component.mjs +0 -24
- package/esm2022/lib/lib/utils/prime-icons.util.mjs +0 -10
- package/esm2022/lib/primekit.component.mjs +0 -11
- package/esm2022/lib/primekit.module.mjs +0 -313
- package/esm2022/lib/primekit.service.mjs +0 -14
- package/esm2022/primekit.mjs +0 -5
- package/esm2022/public-api.mjs +0 -43
- package/fesm2022/primekit.mjs +0 -3041
- package/fesm2022/primekit.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/lib/atomix-alert/atomix-alert.component.d.ts +0 -22
- package/lib/lib/atomix-autocomplete/atomix-autocomplete.component.d.ts +0 -34
- package/lib/lib/atomix-button/atomix-button.component.d.ts +0 -19
- package/lib/lib/atomix-calendar/atomix-calendar.component.d.ts +0 -27
- package/lib/lib/atomix-card/atomix-card.component.d.ts +0 -9
- package/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.d.ts +0 -12
- package/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.d.ts +0 -72
- package/lib/lib/atomix-divider/atomix-divider.component.d.ts +0 -12
- package/lib/lib/atomix-dropdown/atomix-dropdown.component.d.ts +0 -50
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.d.ts +0 -15
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.d.ts +0 -11
- package/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.d.ts +0 -25
- package/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.d.ts +0 -23
- package/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.d.ts +0 -18
- package/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.d.ts +0 -19
- package/lib/lib/atomix-form/atomix-form-chips/form.chips.models.d.ts +0 -5
- package/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.d.ts +0 -25
- package/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.d.ts +0 -28
- package/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.d.ts +0 -17
- package/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.d.ts +0 -17
- package/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.d.ts +0 -19
- package/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.d.ts +0 -17
- package/lib/lib/atomix-input/atomix-input.component.d.ts +0 -29
- package/lib/lib/atomix-input-switch/atomix-input-switch.component.d.ts +0 -30
- package/lib/lib/atomix-messages/messages.component.d.ts +0 -13
- package/lib/lib/atomix-pagination/atomix-pagination.component.d.ts +0 -19
- package/lib/lib/atomix-radio-button/atomix-radio-button.component.d.ts +0 -15
- package/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.d.ts +0 -60
- package/lib/lib/atomix-select-button/atomix-select-button.component.d.ts +0 -12
- package/lib/lib/atomix-snackbar/atomix-snackbar.component.d.ts +0 -12
- package/lib/lib/atomix-spinner/atomix-spinner.component.d.ts +0 -9
- package/lib/lib/atomix-steps/atomix-steps.component.d.ts +0 -19
- package/lib/lib/atomix-tabMenu/atomix-tabMenu.component.d.ts +0 -19
- package/lib/lib/atomix-table/atomix-table.component.d.ts +0 -119
- package/lib/lib/atomix-table/atomix-table.models.d.ts +0 -43
- package/lib/lib/atomix-tag/atomix-tag.component.d.ts +0 -9
- package/lib/lib/utils/prime-icons.util.d.ts +0 -3
- package/lib/primekit.component.d.ts +0 -5
- package/lib/primekit.module.d.ts +0 -70
- package/lib/primekit.service.d.ts +0 -6
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<label *ngIf="label" for="searchName">
|
|
2
|
+
{{ label }}
|
|
3
|
+
<span *ngIf="isLabelRequired" class="lib-error-asterisk">*</span>
|
|
4
|
+
</label>
|
|
5
|
+
|
|
6
|
+
<div [ngClass]="containerClass">
|
|
7
|
+
<div class="search-dropdown-container">
|
|
8
|
+
<input
|
|
9
|
+
[id]="searchName"
|
|
10
|
+
type="text"
|
|
11
|
+
pInputText
|
|
12
|
+
[value]="searchValue"
|
|
13
|
+
[attr.placeholder]="searchPlaceholder"
|
|
14
|
+
(input)="onSearchInput($event)"
|
|
15
|
+
(keydown.enter)="onSearchEnter()"
|
|
16
|
+
[ngClass]="searchClass + ' lib-input-field'"
|
|
17
|
+
autocomplete="new-password"
|
|
18
|
+
[disabled]="searchDisabled"
|
|
19
|
+
[type]="searchType"
|
|
20
|
+
#searchInputEl
|
|
21
|
+
class="search-input"
|
|
22
|
+
/>
|
|
23
|
+
<span>
|
|
24
|
+
<i
|
|
25
|
+
class="pi pi-times filter-dropdown-icon"
|
|
26
|
+
style="cursor: pointer"
|
|
27
|
+
(click)="clearSearchValue()"
|
|
28
|
+
*ngIf="!searchDisabled && searchIsCrossRequired && searchValue !== ''"
|
|
29
|
+
></i>
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<p-dropdown
|
|
34
|
+
[options]="dropdownOptions"
|
|
35
|
+
[(ngModel)]="dropdownSelected"
|
|
36
|
+
(onChange)="onDropdownChange($event)"
|
|
37
|
+
[name]="dropdownName"
|
|
38
|
+
[optionValue]="dropdownOptionValue"
|
|
39
|
+
[optionLabel]="dropdownOptionLabel"
|
|
40
|
+
[showClear]="dropdownShowClear"
|
|
41
|
+
[filter]="dropdownFilter"
|
|
42
|
+
[filterBy]="dropdownOptionLabel"
|
|
43
|
+
appendTo="body"
|
|
44
|
+
[disabled]="dropdownDisabled"
|
|
45
|
+
[styleClass]="dropdownStyleClass"
|
|
46
|
+
(onFilter)="onDropdownFilter($event)"
|
|
47
|
+
[placeholder]="dropdownPlaceholder"
|
|
48
|
+
class="search-dropdown"
|
|
49
|
+
>
|
|
50
|
+
<ng-template let-option pTemplate="item">
|
|
51
|
+
<div class="custom-item">
|
|
52
|
+
<i
|
|
53
|
+
[ngClass]="option.dropdownIcon"
|
|
54
|
+
class="dropdown-logo"
|
|
55
|
+
*ngIf="option.dropdownIcon"
|
|
56
|
+
></i>
|
|
57
|
+
<img
|
|
58
|
+
[alt]="option.dropdownImage"
|
|
59
|
+
[src]="option.dropdownImage"
|
|
60
|
+
*ngIf="option.dropdownImage"
|
|
61
|
+
class="dropdown-image"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<span>{{ option[dropdownOptionLabel] }}</span>
|
|
65
|
+
</div>
|
|
66
|
+
</ng-template>
|
|
67
|
+
</p-dropdown>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
ComponentFixture,
|
|
4
|
+
TestBed,
|
|
5
|
+
fakeAsync,
|
|
6
|
+
tick,
|
|
7
|
+
} from '@angular/core/testing';
|
|
8
|
+
import { AtomixSearchDropdownComponent } from './atomix-search-dropdown.component';
|
|
9
|
+
|
|
10
|
+
describe('AtomixSearchDropdownComponent', () => {
|
|
11
|
+
let component: AtomixSearchDropdownComponent;
|
|
12
|
+
let fixture: ComponentFixture<AtomixSearchDropdownComponent>;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
TestBed.configureTestingModule({
|
|
16
|
+
declarations: [AtomixSearchDropdownComponent],
|
|
17
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
18
|
+
}).overrideComponent(AtomixSearchDropdownComponent, {
|
|
19
|
+
set: {
|
|
20
|
+
template: '<div></div>',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
fixture = TestBed.createComponent(AtomixSearchDropdownComponent);
|
|
24
|
+
component = fixture.componentInstance;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should create', () => {
|
|
28
|
+
expect(component).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('search input bindings', () => {
|
|
32
|
+
it('should have default searchValue as empty string', () => {
|
|
33
|
+
expect(component.searchValue).toBe('');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should have default searchPlaceholder as "Search"', () => {
|
|
37
|
+
expect(component.searchPlaceholder).toBe('Search');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should have default searchType as "search"', () => {
|
|
41
|
+
expect(component.searchType).toBe('search');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should have default searchDisabled as false', () => {
|
|
45
|
+
expect(component.searchDisabled).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should have default searchLabel as empty string', () => {
|
|
49
|
+
expect(component.searchLabel).toBe('');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should have default searchIsLabelRequired as false', () => {
|
|
53
|
+
expect(component.searchIsLabelRequired).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should have default searchClass as empty string', () => {
|
|
57
|
+
expect(component.searchClass).toBe('');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should have default searchIsCrossRequired as true', () => {
|
|
61
|
+
expect(component.searchIsCrossRequired).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should have default searchName as empty string', () => {
|
|
65
|
+
expect(component.searchName).toBe('');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should accept searchValue input', () => {
|
|
69
|
+
component.searchValue = 'test query';
|
|
70
|
+
expect(component.searchValue).toBe('test query');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should accept searchPlaceholder input', () => {
|
|
74
|
+
component.searchPlaceholder = 'Type to search...';
|
|
75
|
+
expect(component.searchPlaceholder).toBe('Type to search...');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should accept searchDisabled input', () => {
|
|
79
|
+
component.searchDisabled = true;
|
|
80
|
+
expect(component.searchDisabled).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('dropdown input bindings', () => {
|
|
85
|
+
it('should have default dropdownOptions as empty array', () => {
|
|
86
|
+
expect(component.dropdownOptions).toEqual([]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should have default dropdownPlaceholder as "Column"', () => {
|
|
90
|
+
expect(component.dropdownPlaceholder).toBe('Column');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should have default dropdownOptionLabel as "display"', () => {
|
|
94
|
+
expect(component.dropdownOptionLabel).toBe('display');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should have default dropdownOptionValue as empty string', () => {
|
|
98
|
+
expect(component.dropdownOptionValue).toBe('');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should have default dropdownDisabled as false', () => {
|
|
102
|
+
expect(component.dropdownDisabled).toBe(false);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should have default dropdownShowClear as true', () => {
|
|
106
|
+
expect(component.dropdownShowClear).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should have default dropdownFilter as false', () => {
|
|
110
|
+
expect(component.dropdownFilter).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should have default dropdownLabel as empty string', () => {
|
|
114
|
+
expect(component.dropdownLabel).toBe('');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should have default dropdownIsLabelRequired as false', () => {
|
|
118
|
+
expect(component.dropdownIsLabelRequired).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should have default dropdownStyleClass as empty string', () => {
|
|
122
|
+
expect(component.dropdownStyleClass).toBe('');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should have default dropdownName as empty string', () => {
|
|
126
|
+
expect(component.dropdownName).toBe('');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should accept dropdownOptions input', () => {
|
|
130
|
+
const options = [
|
|
131
|
+
{ display: 'Option A', value: 'a' },
|
|
132
|
+
{ display: 'Option B', value: 'b' },
|
|
133
|
+
];
|
|
134
|
+
component.dropdownOptions = options;
|
|
135
|
+
expect(component.dropdownOptions).toEqual(options);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should accept dropdownSelected input', () => {
|
|
139
|
+
component.dropdownSelected = 'selectedValue';
|
|
140
|
+
expect(component.dropdownSelected).toBe('selectedValue');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('general input bindings', () => {
|
|
145
|
+
it('should have default label as empty string', () => {
|
|
146
|
+
expect(component.label).toBe('');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should have default isLabelRequired as false', () => {
|
|
150
|
+
expect(component.isLabelRequired).toBe(false);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should have default containerClass', () => {
|
|
154
|
+
expect(component.containerClass).toBe(
|
|
155
|
+
'billing-input-column-container search-filter-container'
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should accept containerClass input', () => {
|
|
160
|
+
component.containerClass = 'custom-class';
|
|
161
|
+
expect(component.containerClass).toBe('custom-class');
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe('search filtering', () => {
|
|
166
|
+
it('should update searchValue on onSearchInput', () => {
|
|
167
|
+
const mockEvent = { target: { value: 'hello' } } as unknown as Event;
|
|
168
|
+
component.onSearchInput(mockEvent);
|
|
169
|
+
expect(component.searchValue).toBe('hello');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should emit searchValueChange on onSearchInput when isCustomFilter is true', () => {
|
|
173
|
+
const emitSpy = jest.fn();
|
|
174
|
+
component.searchValueChange.subscribe(emitSpy);
|
|
175
|
+
component.isCustomFilter = true;
|
|
176
|
+
|
|
177
|
+
const mockEvent = {
|
|
178
|
+
target: { value: 'filter text' },
|
|
179
|
+
} as unknown as Event;
|
|
180
|
+
component.onSearchInput(mockEvent);
|
|
181
|
+
|
|
182
|
+
expect(emitSpy).toHaveBeenCalledWith('filter text');
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('should NOT emit searchValueChange on onSearchInput when isCustomFilter is falsy', () => {
|
|
186
|
+
const emitSpy = jest.fn();
|
|
187
|
+
component.searchValueChange.subscribe(emitSpy);
|
|
188
|
+
component.isCustomFilter = false;
|
|
189
|
+
|
|
190
|
+
const mockEvent = {
|
|
191
|
+
target: { value: 'filter text' },
|
|
192
|
+
} as unknown as Event;
|
|
193
|
+
component.onSearchInput(mockEvent);
|
|
194
|
+
|
|
195
|
+
expect(emitSpy).not.toHaveBeenCalled();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should emit searchValueChange on onSearchEnter', () => {
|
|
199
|
+
const emitSpy = jest.fn();
|
|
200
|
+
component.searchValueChange.subscribe(emitSpy);
|
|
201
|
+
component.searchValue = 'search term';
|
|
202
|
+
|
|
203
|
+
component.onSearchEnter();
|
|
204
|
+
|
|
205
|
+
expect(emitSpy).toHaveBeenCalledWith('search term');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should clear searchValue and emit on clearSearchValue', () => {
|
|
209
|
+
const emitSpy = jest.fn();
|
|
210
|
+
component.searchValueChange.subscribe(emitSpy);
|
|
211
|
+
component.searchValue = 'something';
|
|
212
|
+
|
|
213
|
+
component.clearSearchValue();
|
|
214
|
+
|
|
215
|
+
expect(component.searchValue).toBe('');
|
|
216
|
+
expect(emitSpy).toHaveBeenCalledWith('');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('dropdown selection emission', () => {
|
|
221
|
+
it('should emit dropdownValueChange with value and name on onDropdownChange', () => {
|
|
222
|
+
const emitSpy = jest.fn();
|
|
223
|
+
component.dropdownValueChange.subscribe(emitSpy);
|
|
224
|
+
component.dropdownName = 'testDropdown';
|
|
225
|
+
|
|
226
|
+
const mockEvent = { value: 'selectedOption' };
|
|
227
|
+
component.onDropdownChange(mockEvent);
|
|
228
|
+
|
|
229
|
+
expect(emitSpy).toHaveBeenCalledWith(['selectedOption', 'testDropdown']);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('should emit dropdownValueChange with null value when cleared', () => {
|
|
233
|
+
const emitSpy = jest.fn();
|
|
234
|
+
component.dropdownValueChange.subscribe(emitSpy);
|
|
235
|
+
component.dropdownName = 'myDropdown';
|
|
236
|
+
|
|
237
|
+
const mockEvent = { value: null };
|
|
238
|
+
component.onDropdownChange(mockEvent);
|
|
239
|
+
|
|
240
|
+
expect(emitSpy).toHaveBeenCalledWith([null, 'myDropdown']);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
describe('dropdown filter emission', () => {
|
|
245
|
+
it('should emit dropdownFilterChange after debounce when onDropdownFilter is called', fakeAsync(() => {
|
|
246
|
+
const emitSpy = jest.fn();
|
|
247
|
+
component.dropdownFilterChange.subscribe(emitSpy);
|
|
248
|
+
|
|
249
|
+
const mockFilterEvent = { filter: 'search term' } as any;
|
|
250
|
+
component.onDropdownFilter(mockFilterEvent);
|
|
251
|
+
|
|
252
|
+
tick(300);
|
|
253
|
+
|
|
254
|
+
expect(emitSpy).toHaveBeenCalledWith(mockFilterEvent);
|
|
255
|
+
}));
|
|
256
|
+
|
|
257
|
+
it('should debounce rapid filter calls', fakeAsync(() => {
|
|
258
|
+
const emitSpy = jest.fn();
|
|
259
|
+
component.dropdownFilterChange.subscribe(emitSpy);
|
|
260
|
+
|
|
261
|
+
const event1 = { filter: 'a' } as any;
|
|
262
|
+
const event2 = { filter: 'ab' } as any;
|
|
263
|
+
const event3 = { filter: 'abc' } as any;
|
|
264
|
+
|
|
265
|
+
component.onDropdownFilter(event1);
|
|
266
|
+
tick(100);
|
|
267
|
+
component.onDropdownFilter(event2);
|
|
268
|
+
tick(100);
|
|
269
|
+
component.onDropdownFilter(event3);
|
|
270
|
+
tick(300);
|
|
271
|
+
|
|
272
|
+
expect(emitSpy).toHaveBeenCalledTimes(1);
|
|
273
|
+
expect(emitSpy).toHaveBeenCalledWith(event3);
|
|
274
|
+
}));
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
describe('focusSearch', () => {
|
|
278
|
+
it('should not throw when searchInputEl is undefined', () => {
|
|
279
|
+
expect(() => component.focusSearch()).not.toThrow();
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
ElementRef,
|
|
7
|
+
ViewChild,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { DropdownFilterEvent } from 'primeng/dropdown';
|
|
10
|
+
import {
|
|
11
|
+
debounceTime,
|
|
12
|
+
distinctUntilChanged,
|
|
13
|
+
Subject,
|
|
14
|
+
Subscription,
|
|
15
|
+
} from 'rxjs';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'atomix-search-dropdown',
|
|
19
|
+
templateUrl: './atomix-search-dropdown.component.html',
|
|
20
|
+
styleUrls: ['./atomix-search-dropdown.component.css'],
|
|
21
|
+
})
|
|
22
|
+
export class AtomixSearchDropdownComponent {
|
|
23
|
+
@ViewChild('searchInputEl') searchInputEl!: ElementRef<HTMLInputElement>;
|
|
24
|
+
|
|
25
|
+
@Input() searchValue: string = '';
|
|
26
|
+
@Input() searchPlaceholder: string = 'Search';
|
|
27
|
+
@Input() searchType: string = 'search';
|
|
28
|
+
@Input() searchDisabled: boolean = false;
|
|
29
|
+
@Input() searchLabel: string = '';
|
|
30
|
+
@Input() searchIsLabelRequired: boolean = false;
|
|
31
|
+
@Input() searchClass: string = '';
|
|
32
|
+
@Input() searchIsCrossRequired: boolean = true;
|
|
33
|
+
@Input() searchName: string = '';
|
|
34
|
+
|
|
35
|
+
@Input() dropdownOptions: any[] = [];
|
|
36
|
+
@Input() dropdownSelected: any;
|
|
37
|
+
@Input() dropdownPlaceholder: string = 'Column';
|
|
38
|
+
@Input() dropdownOptionLabel: string = 'display';
|
|
39
|
+
@Input() dropdownOptionValue: string = '';
|
|
40
|
+
@Input() dropdownDisabled: boolean = false;
|
|
41
|
+
@Input() dropdownShowClear: boolean = true;
|
|
42
|
+
@Input() dropdownFilter: boolean = false;
|
|
43
|
+
@Input() dropdownLabel: string = '';
|
|
44
|
+
@Input() dropdownIsLabelRequired: boolean = false;
|
|
45
|
+
@Input() dropdownStyleClass: string = '';
|
|
46
|
+
@Input() dropdownName: string = '';
|
|
47
|
+
|
|
48
|
+
@Input() label: string = '';
|
|
49
|
+
@Input() isLabelRequired: boolean = false;
|
|
50
|
+
@Input() isCustomFilter?: boolean;
|
|
51
|
+
|
|
52
|
+
@Input() containerClass: string =
|
|
53
|
+
'billing-input-column-container search-filter-container';
|
|
54
|
+
|
|
55
|
+
@Output() searchValueChange = new EventEmitter<string>();
|
|
56
|
+
@Output() dropdownValueChange = new EventEmitter<any>();
|
|
57
|
+
@Output() dropdownFilterChange = new EventEmitter<DropdownFilterEvent>();
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The input from the user used to search dropdown list
|
|
61
|
+
*/
|
|
62
|
+
dropdownFilterValue = new Subject<DropdownFilterEvent>();
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The time in ms that it takes to register when user is done typing
|
|
66
|
+
*/
|
|
67
|
+
debounceTime = 300;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The trigger that uses the debounce time to create delay of when user types to actual filtering
|
|
71
|
+
*/
|
|
72
|
+
dropdownFilterTrigger = this.dropdownFilterValue.pipe(
|
|
73
|
+
debounceTime(this.debounceTime),
|
|
74
|
+
distinctUntilChanged()
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Subscription to trigger
|
|
79
|
+
*/
|
|
80
|
+
subscription: Subscription = new Subscription();
|
|
81
|
+
|
|
82
|
+
constructor() {
|
|
83
|
+
this.subscription.add(
|
|
84
|
+
this.dropdownFilterTrigger.subscribe(($event) => {
|
|
85
|
+
this.dropdownFilterChange.emit($event);
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
onSearchInput(event: Event): void {
|
|
91
|
+
const input = event.target as HTMLInputElement;
|
|
92
|
+
this.searchValue = input.value;
|
|
93
|
+
|
|
94
|
+
if (this.isCustomFilter) {
|
|
95
|
+
this.searchValueChange.emit(this.searchValue);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onSearchEnter(): void {
|
|
100
|
+
this.searchValueChange.emit(this.searchValue);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
clearSearchValue(): void {
|
|
104
|
+
this.searchValue = '';
|
|
105
|
+
this.searchValueChange.emit(this.searchValue);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
onDropdownChange(event: any): void {
|
|
109
|
+
this.dropdownValueChange.emit([event.value, this.dropdownName]);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
onDropdownFilter(event: DropdownFilterEvent): void {
|
|
113
|
+
this.dropdownFilterValue.next(event);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
focusSearch(): void {
|
|
117
|
+
this.searchInputEl?.nativeElement?.focus();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface SelectButtonStateOption {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export interface SelectButtonStateOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { AtomixSelectButtonComponent } from './atomix-select-button.component';
|
|
4
|
+
|
|
5
|
+
describe('AtomixSelectButtonComponent', () => {
|
|
6
|
+
let component: AtomixSelectButtonComponent;
|
|
7
|
+
let fixture: ComponentFixture<AtomixSelectButtonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [AtomixSelectButtonComponent],
|
|
12
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
13
|
+
});
|
|
14
|
+
fixture = TestBed.createComponent(AtomixSelectButtonComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('options input', () => {
|
|
23
|
+
it('should have default stateOptions as empty array', () => {
|
|
24
|
+
expect(component.stateOptions).toEqual([]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should have default value as empty string', () => {
|
|
28
|
+
expect(component.value).toBe('');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should accept stateOptions input', () => {
|
|
32
|
+
const options = [
|
|
33
|
+
{ label: 'Option A', value: 'A' },
|
|
34
|
+
{ label: 'Option B', value: 'B' },
|
|
35
|
+
{ label: 'Option C', value: 'C' },
|
|
36
|
+
];
|
|
37
|
+
component.stateOptions = options;
|
|
38
|
+
expect(component.stateOptions).toEqual(options);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should accept value input', () => {
|
|
42
|
+
component.value = 'B';
|
|
43
|
+
expect(component.value).toBe('B');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('selection change emission', () => {
|
|
48
|
+
it('should emit onOptionClick when optionClickHandler is called', () => {
|
|
49
|
+
const emitSpy = jest.fn();
|
|
50
|
+
component.onOptionClick.subscribe(emitSpy);
|
|
51
|
+
const event = { option: { label: 'Option A', value: 'A' } } as any;
|
|
52
|
+
|
|
53
|
+
component.optionClickHandler(event);
|
|
54
|
+
|
|
55
|
+
expect(emitSpy).toHaveBeenCalledWith(event);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should emit onOptionClick with the correct event payload', () => {
|
|
59
|
+
const emitSpy = jest.fn();
|
|
60
|
+
component.onOptionClick.subscribe(emitSpy);
|
|
61
|
+
const options = [
|
|
62
|
+
{ label: 'Active', value: 'active' },
|
|
63
|
+
{ label: 'Inactive', value: 'inactive' },
|
|
64
|
+
];
|
|
65
|
+
component.stateOptions = options;
|
|
66
|
+
|
|
67
|
+
const event = { option: options[1], index: 1 } as any;
|
|
68
|
+
component.optionClickHandler(event);
|
|
69
|
+
|
|
70
|
+
expect(emitSpy).toHaveBeenCalledWith(event);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { SelectButtonOptionClickEvent } from 'primeng/selectbutton';
|
|
3
|
+
import { SelectButtonStateOption } from './atomix-select-button-models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'atomix-select-button',
|
|
7
|
+
templateUrl: './atomix-select-button.component.html',
|
|
8
|
+
styleUrls: ['./atomix-select-button.component.css'],
|
|
9
|
+
})
|
|
10
|
+
export class AtomixSelectButtonComponent {
|
|
11
|
+
@Output() onOptionClick = new EventEmitter<SelectButtonOptionClickEvent>();
|
|
12
|
+
@Input() stateOptions: SelectButtonStateOption[] = [];
|
|
13
|
+
|
|
14
|
+
@Input() value: string = '';
|
|
15
|
+
|
|
16
|
+
optionClickHandler(event: SelectButtonOptionClickEvent) {
|
|
17
|
+
this.onOptionClick.emit(event);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.snackbar {
|
|
2
|
+
visibility: visible;
|
|
3
|
+
min-width: 250px;
|
|
4
|
+
background-color: #606060;
|
|
5
|
+
color: #fff;
|
|
6
|
+
text-align: center;
|
|
7
|
+
border-radius: 5px;
|
|
8
|
+
padding: 16px;
|
|
9
|
+
position: fixed;
|
|
10
|
+
left: 50%;
|
|
11
|
+
bottom: 30px;
|
|
12
|
+
transform: translateX(-50%);
|
|
13
|
+
font-size: 17px;
|
|
14
|
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
|
15
|
+
z-index: 99999999;
|
|
16
|
+
transition:
|
|
17
|
+
opacity 0.5s,
|
|
18
|
+
bottom 0.5s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.snackbar.show {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
bottom: 50px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.close-btn {
|
|
27
|
+
margin-left: 15px;
|
|
28
|
+
font-weight: bold;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { AtomixSnackbarComponent } from './atomix-snackbar.component';
|
|
4
|
+
|
|
5
|
+
describe('AtomixSnackbarComponent', () => {
|
|
6
|
+
let component: AtomixSnackbarComponent;
|
|
7
|
+
let fixture: ComponentFixture<AtomixSnackbarComponent>;
|
|
8
|
+
let mockCdr: { detectChanges: jest.Mock };
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
jest.useFakeTimers();
|
|
12
|
+
|
|
13
|
+
mockCdr = { detectChanges: jest.fn() };
|
|
14
|
+
|
|
15
|
+
TestBed.configureTestingModule({
|
|
16
|
+
declarations: [AtomixSnackbarComponent],
|
|
17
|
+
providers: [{ provide: ChangeDetectorRef, useValue: mockCdr }],
|
|
18
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
fixture = TestBed.createComponent(AtomixSnackbarComponent);
|
|
22
|
+
component = fixture.componentInstance;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
jest.useRealTimers();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should create', () => {
|
|
30
|
+
expect(component).toBeTruthy();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('showSnackbar', () => {
|
|
34
|
+
it('should set isVisible to true and set the message', () => {
|
|
35
|
+
component.showSnackbar('Item copied!');
|
|
36
|
+
|
|
37
|
+
expect(component.isVisible).toBe(true);
|
|
38
|
+
expect(component.message).toBe('Item copied!');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should set isVisible to false after 3000ms timeout', () => {
|
|
42
|
+
component.showSnackbar('Timeout test');
|
|
43
|
+
|
|
44
|
+
expect(component.isVisible).toBe(true);
|
|
45
|
+
|
|
46
|
+
jest.advanceTimersByTime(3000);
|
|
47
|
+
|
|
48
|
+
expect(component.isVisible).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('hideSnackbar', () => {
|
|
53
|
+
it('should set isVisible to false', () => {
|
|
54
|
+
component.isVisible = true;
|
|
55
|
+
component.hideSnackbar();
|
|
56
|
+
|
|
57
|
+
expect(component.isVisible).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|