primekit 1.0.11 → 1.0.13
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/esm2022/lib/lib/atomix-alert/atomix-alert.component.mjs +76 -0
- package/esm2022/lib/lib/atomix-autocomplete/atomix-autocomplete.component.mjs +108 -0
- package/esm2022/lib/lib/atomix-button/atomix-button.component.mjs +49 -0
- package/esm2022/lib/lib/atomix-button/atomix-button.models.mjs +2 -0
- package/esm2022/lib/lib/atomix-calendar/atomix-calendar.component.mjs +90 -0
- package/esm2022/lib/lib/atomix-card/atomix-card.component.mjs +24 -0
- package/esm2022/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.mjs +28 -0
- package/esm2022/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.mjs +717 -0
- package/esm2022/lib/lib/atomix-divider/atomix-divider.component.mjs +27 -0
- package/esm2022/lib/lib/atomix-dropdown/atomix-dropdown.component.mjs +105 -0
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.mjs +38 -0
- package/esm2022/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.mjs +2 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.mjs +67 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.mjs +59 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.mjs +48 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.mjs +54 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-chips/form.chips.models.mjs +2 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.mjs +70 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.mjs +80 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.mjs +48 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.mjs +48 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.mjs +46 -0
- package/esm2022/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.mjs +46 -0
- package/esm2022/lib/lib/atomix-input/atomix-input.component.mjs +94 -0
- package/esm2022/lib/lib/atomix-input-switch/atomix-input-switch.component.mjs +85 -0
- package/esm2022/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.mjs +44 -0
- package/esm2022/lib/lib/atomix-messages/messages.component.mjs +33 -0
- package/esm2022/lib/lib/atomix-pagination/atomix-pagination.component.mjs +48 -0
- package/esm2022/lib/lib/atomix-radio-button/atomix-radio-button.component.mjs +50 -0
- package/esm2022/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.mjs +149 -0
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button-models.mjs +2 -0
- package/esm2022/lib/lib/atomix-select-button/atomix-select-button.component.mjs +25 -0
- package/esm2022/lib/lib/atomix-snackbar/atomix-snackbar.component.mjs +29 -0
- package/esm2022/lib/lib/atomix-spinner/atomix-spinner.component.mjs +24 -0
- package/esm2022/lib/lib/atomix-steps/atomix-steps.component.mjs +41 -0
- package/esm2022/lib/lib/atomix-tabMenu/atomix-tabMenu.component.mjs +51 -0
- package/esm2022/lib/lib/atomix-table/atomix-table.component.mjs +454 -0
- package/esm2022/lib/lib/atomix-table/atomix-table.models.mjs +2 -0
- package/esm2022/lib/lib/atomix-tag/atomix-tag.component.mjs +24 -0
- package/esm2022/lib/lib/utils/prime-icons.util.mjs +10 -0
- package/esm2022/lib/primekit.component.mjs +11 -0
- package/esm2022/lib/primekit.module.mjs +322 -0
- package/esm2022/lib/primekit.service.mjs +14 -0
- package/esm2022/primekit.mjs +5 -0
- package/esm2022/public-api.mjs +44 -0
- package/fesm2022/primekit.mjs +3158 -0
- package/fesm2022/primekit.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/lib/atomix-alert/atomix-alert.component.d.ts +22 -0
- package/lib/lib/atomix-autocomplete/atomix-autocomplete.component.d.ts +34 -0
- package/lib/lib/atomix-button/atomix-button.component.d.ts +19 -0
- package/{src/lib/lib/atomix-button/atomix-button.models.ts → lib/lib/atomix-button/atomix-button.models.d.ts} +2 -2
- package/lib/lib/atomix-calendar/atomix-calendar.component.d.ts +27 -0
- package/lib/lib/atomix-card/atomix-card.component.d.ts +9 -0
- package/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.d.ts +12 -0
- package/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.d.ts +79 -0
- package/lib/lib/atomix-divider/atomix-divider.component.d.ts +12 -0
- package/lib/lib/atomix-dropdown/atomix-dropdown.component.d.ts +50 -0
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.d.ts +15 -0
- package/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.d.ts +11 -0
- package/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.d.ts +25 -0
- package/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.d.ts +23 -0
- package/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.d.ts +18 -0
- package/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.d.ts +19 -0
- package/lib/lib/atomix-form/atomix-form-chips/form.chips.models.d.ts +5 -0
- package/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.d.ts +25 -0
- package/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.d.ts +28 -0
- package/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.d.ts +17 -0
- package/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.d.ts +17 -0
- package/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.d.ts +19 -0
- package/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.d.ts +17 -0
- package/lib/lib/atomix-input/atomix-input.component.d.ts +29 -0
- package/lib/lib/atomix-input-switch/atomix-input-switch.component.d.ts +30 -0
- package/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.d.ts +16 -0
- package/lib/lib/atomix-messages/messages.component.d.ts +13 -0
- package/lib/lib/atomix-pagination/atomix-pagination.component.d.ts +19 -0
- package/lib/lib/atomix-radio-button/atomix-radio-button.component.d.ts +15 -0
- package/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.d.ts +60 -0
- package/{src/lib/lib/atomix-select-button/atomix-select-button-models.ts → lib/lib/atomix-select-button/atomix-select-button-models.d.ts} +4 -4
- package/lib/lib/atomix-select-button/atomix-select-button.component.d.ts +12 -0
- package/lib/lib/atomix-snackbar/atomix-snackbar.component.d.ts +12 -0
- package/lib/lib/atomix-spinner/atomix-spinner.component.d.ts +9 -0
- package/lib/lib/atomix-steps/atomix-steps.component.d.ts +19 -0
- package/lib/lib/atomix-tabMenu/atomix-tabMenu.component.d.ts +19 -0
- package/lib/lib/atomix-table/atomix-table.component.d.ts +119 -0
- package/lib/lib/atomix-table/atomix-table.models.d.ts +43 -0
- package/lib/lib/atomix-tag/atomix-tag.component.d.ts +9 -0
- package/lib/lib/utils/prime-icons.util.d.ts +3 -0
- package/lib/primekit.component.d.ts +5 -0
- package/lib/primekit.module.d.ts +72 -0
- package/lib/primekit.service.d.ts +6 -0
- package/package.json +28 -15
- package/{src/public-api.ts → public-api.d.ts} +38 -47
- package/src/assets/images/empty-table.svg +25 -25
- package/ng-package.json +0 -8
- package/src/lib/lib/atomix-alert/atomix-alert.component.css +0 -67
- package/src/lib/lib/atomix-alert/atomix-alert.component.html +0 -7
- package/src/lib/lib/atomix-alert/atomix-alert.component.spec.ts +0 -154
- package/src/lib/lib/atomix-alert/atomix-alert.component.ts +0 -75
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.html +0 -35
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.scss +0 -72
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.spec.ts +0 -210
- package/src/lib/lib/atomix-autocomplete/atomix-autocomplete.component.ts +0 -70
- package/src/lib/lib/atomix-button/atomix-button.component.css +0 -70
- package/src/lib/lib/atomix-button/atomix-button.component.html +0 -20
- package/src/lib/lib/atomix-button/atomix-button.component.spec.ts +0 -135
- package/src/lib/lib/atomix-button/atomix-button.component.ts +0 -28
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.css +0 -5
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.html +0 -20
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.spec.ts +0 -145
- package/src/lib/lib/atomix-calendar/atomix-calendar.component.ts +0 -71
- package/src/lib/lib/atomix-card/atomix-card.component.css +0 -4
- package/src/lib/lib/atomix-card/atomix-card.component.html +0 -3
- package/src/lib/lib/atomix-card/atomix-card.component.spec.ts +0 -63
- package/src/lib/lib/atomix-card/atomix-card.component.ts +0 -13
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.css +0 -12
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.html +0 -9
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.spec.ts +0 -63
- package/src/lib/lib/atomix-confirmation-dialog/atomix-confirmation-dialog.component.ts +0 -22
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.html +0 -233
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.scss +0 -266
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.spec.ts +0 -1465
- package/src/lib/lib/atomix-daterange-calendar/atomix-daterange-calendar.component.ts +0 -717
- package/src/lib/lib/atomix-divider/atomix-divider.component.css +0 -0
- package/src/lib/lib/atomix-divider/atomix-divider.component.html +0 -7
- package/src/lib/lib/atomix-divider/atomix-divider.component.spec.ts +0 -91
- package/src/lib/lib/atomix-divider/atomix-divider.component.ts +0 -17
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.css +0 -25
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.html +0 -37
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.spec.ts +0 -178
- package/src/lib/lib/atomix-dropdown/atomix-dropdown.component.ts +0 -89
- 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 +0 -128
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.component.ts +0 -42
- package/src/lib/lib/atomix-dynamic-dialog/atomix-dynamic-dialog.models.ts +0 -12
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.html +0 -20
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.scss +0 -7
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.spec.ts +0 -169
- package/src/lib/lib/atomix-form/atomix-form-autocomplete/atomix-form-autocomplete.component.ts +0 -41
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.html +0 -21
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.scss +0 -7
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.spec.ts +0 -142
- package/src/lib/lib/atomix-form/atomix-form-calendar/atomix-form-calendar.component.ts +0 -32
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.html +0 -13
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.scss +0 -14
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.spec.ts +0 -112
- package/src/lib/lib/atomix-form/atomix-form-checkbox/atomix-form-checkbox.component.ts +0 -28
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.html +0 -20
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.scss +0 -3
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.spec.ts +0 -153
- package/src/lib/lib/atomix-form/atomix-form-chips/atomix-form-chips.component.ts +0 -28
- package/src/lib/lib/atomix-form/atomix-form-chips/form.chips.models.ts +0 -5
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.html +0 -24
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.scss +0 -15
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.spec.ts +0 -156
- package/src/lib/lib/atomix-form/atomix-form-dropdown/atomix-form-dropdown.component.ts +0 -36
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.html +0 -33
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.scss +0 -32
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.spec.ts +0 -156
- package/src/lib/lib/atomix-form/atomix-form-input-component/atomix-form-input-component.component.ts +0 -42
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.html +0 -14
- 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 +0 -104
- package/src/lib/lib/atomix-form/atomix-form-inputmask-component/atomix-form-inputmask-component.component.ts +0 -24
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.html +0 -16
- 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 +0 -92
- package/src/lib/lib/atomix-form/atomix-form-password-component/atomix-form-password-component.component.ts +0 -24
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.html +0 -23
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.scss +0 -3
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.spec.ts +0 -126
- package/src/lib/lib/atomix-form/atomix-form-radio-button/atomix-radio-button.component.ts +0 -26
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.html +0 -17
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.scss +0 -6
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.spec.ts +0 -120
- package/src/lib/lib/atomix-form/atomix-form-textarea/atomix-form-textarea.component.ts +0 -24
- package/src/lib/lib/atomix-input/atomix-input.component.css +0 -52
- package/src/lib/lib/atomix-input/atomix-input.component.html +0 -45
- package/src/lib/lib/atomix-input/atomix-input.component.spec.ts +0 -229
- package/src/lib/lib/atomix-input/atomix-input.component.ts +0 -64
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.css +0 -12
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.html +0 -17
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.spec.ts +0 -173
- package/src/lib/lib/atomix-input-switch/atomix-input-switch.component.ts +0 -62
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.html +0 -47
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.scss +0 -14
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.spec.ts +0 -21
- package/src/lib/lib/atomix-loading-overlay/atomix-loading-overlay.component.ts +0 -25
- package/src/lib/lib/atomix-messages/messages.component.css +0 -0
- package/src/lib/lib/atomix-messages/messages.component.html +0 -9
- package/src/lib/lib/atomix-messages/messages.component.spec.ts +0 -115
- package/src/lib/lib/atomix-messages/messages.component.ts +0 -17
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.css +0 -19
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.html +0 -24
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.spec.ts +0 -98
- package/src/lib/lib/atomix-pagination/atomix-pagination.component.ts +0 -36
- 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 +0 -7
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.spec.ts +0 -116
- package/src/lib/lib/atomix-radio-button/atomix-radio-button.component.ts +0 -37
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.css +0 -49
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.html +0 -68
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.spec.ts +0 -282
- package/src/lib/lib/atomix-search-dropdown/atomix-search-dropdown.component.ts +0 -119
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.css +0 -5
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.html +0 -7
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.spec.ts +0 -73
- package/src/lib/lib/atomix-select-button/atomix-select-button.component.ts +0 -19
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.css +0 -30
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.html +0 -4
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.spec.ts +0 -60
- package/src/lib/lib/atomix-snackbar/atomix-snackbar.component.ts +0 -27
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.css +0 -0
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.html +0 -7
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.spec.ts +0 -70
- package/src/lib/lib/atomix-spinner/atomix-spinner.component.ts +0 -13
- package/src/lib/lib/atomix-steps/atomix-steps.component.html +0 -9
- package/src/lib/lib/atomix-steps/atomix-steps.component.scss +0 -0
- package/src/lib/lib/atomix-steps/atomix-steps.component.spec.ts +0 -120
- package/src/lib/lib/atomix-steps/atomix-steps.component.ts +0 -32
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.css +0 -0
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.html +0 -26
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.spec.ts +0 -106
- package/src/lib/lib/atomix-tabMenu/atomix-tabMenu.component.ts +0 -36
- package/src/lib/lib/atomix-table/atomix-table.component.css +0 -152
- package/src/lib/lib/atomix-table/atomix-table.component.html +0 -647
- package/src/lib/lib/atomix-table/atomix-table.component.spec.ts +0 -1648
- package/src/lib/lib/atomix-table/atomix-table.component.ts +0 -422
- package/src/lib/lib/atomix-table/atomix-table.models.ts +0 -39
- package/src/lib/lib/atomix-tag/atomix-tag.component.css +0 -0
- package/src/lib/lib/atomix-tag/atomix-tag.component.html +0 -6
- package/src/lib/lib/atomix-tag/atomix-tag.component.spec.ts +0 -47
- package/src/lib/lib/atomix-tag/atomix-tag.component.ts +0 -13
- package/src/lib/lib/utils/prime-icons.util.spec.ts +0 -21
- package/src/lib/lib/utils/prime-icons.util.ts +0 -11
- package/src/lib/primekit.component.spec.ts +0 -19
- package/src/lib/primekit.component.ts +0 -10
- package/src/lib/primekit.module.spec.ts +0 -155
- package/src/lib/primekit.module.ts +0 -183
- package/src/lib/primekit.service.spec.ts +0 -17
- package/src/lib/primekit.service.ts +0 -8
- package/tsconfig.lib.json +0 -13
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -10
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
.lib-error-asterisk {
|
|
2
|
-
color: red;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.filter-dropdown-icon {
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 50%;
|
|
8
|
-
right: 10px;
|
|
9
|
-
transform: translateY(-50%);
|
|
10
|
-
z-index: 1;
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
color: #6c757d;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.filter-dropdown-icon-left {
|
|
16
|
-
right: 40px; /* Move left to make space for search icon on right */
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.search-icon.with-label,
|
|
20
|
-
.filter-dropdown-icon.with-label {
|
|
21
|
-
top: 88%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.search-icon {
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 50%;
|
|
27
|
-
transform: translateY(-50%);
|
|
28
|
-
z-index: 1;
|
|
29
|
-
color: var(--primary-text-color) !important;
|
|
30
|
-
font-size: 1rem;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.search-icon-left {
|
|
34
|
-
left: 10px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.search-icon-right {
|
|
38
|
-
right: 0px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.with-search-icon-left {
|
|
42
|
-
padding-left: 30px !important;
|
|
43
|
-
padding-right: 30px !important;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.with-search-icon-right {
|
|
47
|
-
padding-right: 60px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
::ng-deep .lib-input-field {
|
|
51
|
-
border-radius: var(--global-border-radius);
|
|
52
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<label *ngIf="label" for="name"
|
|
2
|
-
>{{ label }}
|
|
3
|
-
<span *ngIf="isLabelRequired" class="lib-error-asterisk">*</span></label
|
|
4
|
-
>
|
|
5
|
-
|
|
6
|
-
<i
|
|
7
|
-
class="pi pi-search search-icon"
|
|
8
|
-
[ngClass]="
|
|
9
|
-
(searchIconPosition === 'left' ? 'search-icon-left' : 'search-icon-right') +
|
|
10
|
-
(label ? ' with-label' : '')
|
|
11
|
-
"
|
|
12
|
-
*ngIf="withSearchIcon"
|
|
13
|
-
(click)="onEnter()"
|
|
14
|
-
></i>
|
|
15
|
-
|
|
16
|
-
<input
|
|
17
|
-
[id]="name"
|
|
18
|
-
type="text"
|
|
19
|
-
pInputText
|
|
20
|
-
[value]="value"
|
|
21
|
-
[attr.placeholder]="placeholder"
|
|
22
|
-
(input)="onInput($event)"
|
|
23
|
-
(keydown.enter)="onEnter()"
|
|
24
|
-
[ngClass]="
|
|
25
|
-
class +
|
|
26
|
-
' lib-input-field' +
|
|
27
|
-
(withSearchIcon ? ' with-search-icon-' + searchIconPosition : '') +
|
|
28
|
-
(isCrossRequired ? ' with-cross-icon' : '')
|
|
29
|
-
"
|
|
30
|
-
autocomplete="new-password"
|
|
31
|
-
[disabled]="disabled"
|
|
32
|
-
[type]="type"
|
|
33
|
-
#inputEl
|
|
34
|
-
/>
|
|
35
|
-
<i
|
|
36
|
-
class="pi pi-times filter-dropdown-icon"
|
|
37
|
-
[ngClass]="
|
|
38
|
-
(withSearchIcon && searchIconPosition === 'right'
|
|
39
|
-
? 'filter-dropdown-icon-left'
|
|
40
|
-
: '') + (label ? ' with-label' : '')
|
|
41
|
-
"
|
|
42
|
-
style="cursor: pointer"
|
|
43
|
-
(click)="clearValue()"
|
|
44
|
-
*ngIf="isCrossRequired && value !== ''"
|
|
45
|
-
></i>
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { AtomixInputComponent } from './atomix-input.component';
|
|
4
|
-
|
|
5
|
-
describe('AtomixInputComponent', () => {
|
|
6
|
-
let component: AtomixInputComponent;
|
|
7
|
-
let fixture: ComponentFixture<AtomixInputComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [AtomixInputComponent],
|
|
12
|
-
schemas: [NO_ERRORS_SCHEMA],
|
|
13
|
-
});
|
|
14
|
-
fixture = TestBed.createComponent(AtomixInputComponent);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('input bindings', () => {
|
|
23
|
-
it('should have default placeholder as empty string', () => {
|
|
24
|
-
expect(component.placeholder).toBe('');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should accept placeholder input', () => {
|
|
28
|
-
component.placeholder = 'Enter value';
|
|
29
|
-
fixture.detectChanges();
|
|
30
|
-
expect(component.placeholder).toBe('Enter value');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should have default type as text', () => {
|
|
34
|
-
expect(component.type).toBe('text');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should accept type input', () => {
|
|
38
|
-
component.type = 'password';
|
|
39
|
-
fixture.detectChanges();
|
|
40
|
-
expect(component.type).toBe('password');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should have default label as empty string', () => {
|
|
44
|
-
expect(component.label).toBe('');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should accept label input', () => {
|
|
48
|
-
component.label = 'Username';
|
|
49
|
-
fixture.detectChanges();
|
|
50
|
-
expect(component.label).toBe('Username');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should have default disabled as false', () => {
|
|
54
|
-
expect(component.disabled).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should accept disabled input', () => {
|
|
58
|
-
component.disabled = true;
|
|
59
|
-
fixture.detectChanges();
|
|
60
|
-
expect(component.disabled).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should have default value as empty string', () => {
|
|
64
|
-
expect(component.value).toBe('');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should accept value input', () => {
|
|
68
|
-
component.value = 'test value';
|
|
69
|
-
fixture.detectChanges();
|
|
70
|
-
expect(component.value).toBe('test value');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should have default name as empty string', () => {
|
|
74
|
-
expect(component.name).toBe('');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should accept name input', () => {
|
|
78
|
-
component.name = 'email';
|
|
79
|
-
fixture.detectChanges();
|
|
80
|
-
expect(component.name).toBe('email');
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should have default withSearchIcon as false', () => {
|
|
84
|
-
expect(component.withSearchIcon).toBe(false);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should accept withSearchIcon input', () => {
|
|
88
|
-
component.withSearchIcon = true;
|
|
89
|
-
fixture.detectChanges();
|
|
90
|
-
expect(component.withSearchIcon).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should have default searchIconPosition as right', () => {
|
|
94
|
-
expect(component.searchIconPosition).toBe('right');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should accept searchIconPosition input', () => {
|
|
98
|
-
component.searchIconPosition = 'left';
|
|
99
|
-
fixture.detectChanges();
|
|
100
|
-
expect(component.searchIconPosition).toBe('left');
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('should have default isCrossRequired as true', () => {
|
|
104
|
-
expect(component.isCrossRequired).toBe(true);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should accept isCrossRequired input', () => {
|
|
108
|
-
component.isCrossRequired = false;
|
|
109
|
-
fixture.detectChanges();
|
|
110
|
-
expect(component.isCrossRequired).toBe(false);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should have default isLabelRequired as false', () => {
|
|
114
|
-
expect(component.isLabelRequired).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should accept isLabelRequired input', () => {
|
|
118
|
-
component.isLabelRequired = true;
|
|
119
|
-
fixture.detectChanges();
|
|
120
|
-
expect(component.isLabelRequired).toBe(true);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('value change emission', () => {
|
|
125
|
-
it('should emit changeValueHandler on input', () => {
|
|
126
|
-
const emitSpy = jest.fn();
|
|
127
|
-
component.changeValueHandler.subscribe(emitSpy);
|
|
128
|
-
|
|
129
|
-
const mockEvent = { target: { value: 'hello' } } as unknown as Event;
|
|
130
|
-
component.onInput(mockEvent);
|
|
131
|
-
|
|
132
|
-
expect(emitSpy).toHaveBeenCalledWith('hello');
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should update value property on input', () => {
|
|
136
|
-
const mockEvent = { target: { value: 'world' } } as unknown as Event;
|
|
137
|
-
component.onInput(mockEvent);
|
|
138
|
-
|
|
139
|
-
expect(component.value).toBe('world');
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('should emit valueChange on enter', () => {
|
|
143
|
-
const emitSpy = jest.fn();
|
|
144
|
-
component.valueChange.subscribe(emitSpy);
|
|
145
|
-
|
|
146
|
-
component.value = 'search term';
|
|
147
|
-
component.onEnter();
|
|
148
|
-
|
|
149
|
-
expect(emitSpy).toHaveBeenCalledWith('search term');
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should clear value and emit on clearValue', () => {
|
|
153
|
-
const changeEmitSpy = jest.fn();
|
|
154
|
-
const valueChangeEmitSpy = jest.fn();
|
|
155
|
-
component.changeValueHandler.subscribe(changeEmitSpy);
|
|
156
|
-
component.valueChange.subscribe(valueChangeEmitSpy);
|
|
157
|
-
|
|
158
|
-
component.value = 'some text';
|
|
159
|
-
component.clearValue();
|
|
160
|
-
|
|
161
|
-
expect(component.value).toBe('');
|
|
162
|
-
expect(changeEmitSpy).toHaveBeenCalledWith('');
|
|
163
|
-
expect(valueChangeEmitSpy).toHaveBeenCalledWith('');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should emit valueChange with empty string when search is cleared', () => {
|
|
167
|
-
const emitSpy = jest.fn();
|
|
168
|
-
component.valueChange.subscribe(emitSpy);
|
|
169
|
-
|
|
170
|
-
component.value = 'existing';
|
|
171
|
-
const mockEvent = { target: { value: '' } } as unknown as Event;
|
|
172
|
-
component.onSearchClear(mockEvent);
|
|
173
|
-
|
|
174
|
-
expect(component.value).toBe('');
|
|
175
|
-
expect(emitSpy).toHaveBeenCalledWith('');
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('should not emit valueChange when search input is not empty', () => {
|
|
179
|
-
const emitSpy = jest.fn();
|
|
180
|
-
component.valueChange.subscribe(emitSpy);
|
|
181
|
-
|
|
182
|
-
component.value = 'existing';
|
|
183
|
-
const mockEvent = { target: { value: 'still typing' } } as unknown as Event;
|
|
184
|
-
component.onSearchClear(mockEvent);
|
|
185
|
-
|
|
186
|
-
expect(component.value).toBe('existing');
|
|
187
|
-
expect(emitSpy).not.toHaveBeenCalled();
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe('ngAfterViewInit', () => {
|
|
192
|
-
it('should call focus on inputEl when autofocus is true', () => {
|
|
193
|
-
jest.useFakeTimers();
|
|
194
|
-
component.autofocus = true;
|
|
195
|
-
component.inputEl = { nativeElement: { focus: jest.fn() } } as any;
|
|
196
|
-
|
|
197
|
-
component.ngAfterViewInit();
|
|
198
|
-
jest.runAllTimers();
|
|
199
|
-
|
|
200
|
-
expect(component.inputEl.nativeElement.focus).toHaveBeenCalled();
|
|
201
|
-
jest.useRealTimers();
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('should not call focus when autofocus is false', () => {
|
|
205
|
-
jest.useFakeTimers();
|
|
206
|
-
component.autofocus = false;
|
|
207
|
-
component.inputEl = { nativeElement: { focus: jest.fn() } } as any;
|
|
208
|
-
|
|
209
|
-
component.ngAfterViewInit();
|
|
210
|
-
jest.runAllTimers();
|
|
211
|
-
|
|
212
|
-
expect(component.inputEl.nativeElement.focus).not.toHaveBeenCalled();
|
|
213
|
-
jest.useRealTimers();
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe('focus', () => {
|
|
218
|
-
it('should call focus on the native input element', () => {
|
|
219
|
-
component.inputEl = { nativeElement: { focus: jest.fn() } } as any;
|
|
220
|
-
component.focus();
|
|
221
|
-
expect(component.inputEl.nativeElement.focus).toHaveBeenCalled();
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('should handle undefined inputEl gracefully', () => {
|
|
225
|
-
component.inputEl = undefined as any;
|
|
226
|
-
expect(() => component.focus()).not.toThrow();
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
Input,
|
|
4
|
-
Output,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
ElementRef,
|
|
7
|
-
ViewChild,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'atomix-input',
|
|
12
|
-
templateUrl: './atomix-input.component.html',
|
|
13
|
-
styleUrls: ['./atomix-input.component.css'],
|
|
14
|
-
})
|
|
15
|
-
export class AtomixInputComponent {
|
|
16
|
-
@ViewChild('inputEl') inputEl!: ElementRef<HTMLInputElement>;
|
|
17
|
-
@Input() value: string = '';
|
|
18
|
-
@Input() name: string = '';
|
|
19
|
-
@Input() type: string = 'text';
|
|
20
|
-
@Input() placeholder: string = '';
|
|
21
|
-
@Output() valueChange = new EventEmitter<string>();
|
|
22
|
-
@Input() withSearchIcon: boolean = false;
|
|
23
|
-
@Input() searchIconPosition: 'left' | 'right' = 'right';
|
|
24
|
-
@Input() iconName: string = '';
|
|
25
|
-
@Input() containerClass: string = '';
|
|
26
|
-
@Input() class: string = '';
|
|
27
|
-
@Input() disabled: boolean = false;
|
|
28
|
-
@Input() isCrossRequired: boolean = true;
|
|
29
|
-
@Input() label: string = '';
|
|
30
|
-
@Input() isLabelRequired: boolean = false;
|
|
31
|
-
@Input() autofocus: boolean = false;
|
|
32
|
-
@Output() changeValueHandler = new EventEmitter<string>();
|
|
33
|
-
|
|
34
|
-
ngAfterViewInit(): void {
|
|
35
|
-
if (this.autofocus) {
|
|
36
|
-
// Timeout ensures input is available in the DOM
|
|
37
|
-
setTimeout(() => this.inputEl?.nativeElement?.focus());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onInput(event: Event): void {
|
|
42
|
-
const input = event.target as HTMLInputElement;
|
|
43
|
-
this.value = input.value;
|
|
44
|
-
this.changeValueHandler.emit(this.value);
|
|
45
|
-
}
|
|
46
|
-
onEnter(): void {
|
|
47
|
-
this.valueChange.emit(this.value);
|
|
48
|
-
}
|
|
49
|
-
clearValue(): void {
|
|
50
|
-
this.value = '';
|
|
51
|
-
this.changeValueHandler.emit(this.value);
|
|
52
|
-
this.onEnter();
|
|
53
|
-
}
|
|
54
|
-
onSearchClear(event: Event) {
|
|
55
|
-
const input = event.target as HTMLInputElement;
|
|
56
|
-
if (input.value === '') {
|
|
57
|
-
this.value = '';
|
|
58
|
-
this.valueChange.emit('');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
focus(): void {
|
|
62
|
-
this.inputEl?.nativeElement?.focus();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<p-inputSwitch
|
|
2
|
-
[(ngModel)]="value"
|
|
3
|
-
[trueValue]="trueValue"
|
|
4
|
-
[falseValue]="falseValue"
|
|
5
|
-
[style]="style"
|
|
6
|
-
[styleClass]="styleClass"
|
|
7
|
-
[tabindex]="tabindex"
|
|
8
|
-
[inputId]="inputId"
|
|
9
|
-
[attr.name]="name"
|
|
10
|
-
[disabled]="disabled"
|
|
11
|
-
[readonly]="readonly"
|
|
12
|
-
[ariaLabel]="ariaLabel"
|
|
13
|
-
[ariaLabelledBy]="ariaLabelledBy"
|
|
14
|
-
[autofocus]="autofocus"
|
|
15
|
-
(onChange)="handleChange($event)"
|
|
16
|
-
(onBlur)="onTouched()"
|
|
17
|
-
></p-inputSwitch>
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { AtomixInputSwitchComponent } from './atomix-input-switch.component';
|
|
4
|
-
|
|
5
|
-
describe('AtomixInputSwitchComponent', () => {
|
|
6
|
-
let component: AtomixInputSwitchComponent;
|
|
7
|
-
let fixture: ComponentFixture<AtomixInputSwitchComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [AtomixInputSwitchComponent],
|
|
12
|
-
schemas: [NO_ERRORS_SCHEMA],
|
|
13
|
-
});
|
|
14
|
-
fixture = TestBed.createComponent(AtomixInputSwitchComponent);
|
|
15
|
-
component = fixture.componentInstance;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('input bindings', () => {
|
|
23
|
-
it('should have default disabled as false', () => {
|
|
24
|
-
expect(component.disabled).toBe(false);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should accept disabled input', () => {
|
|
28
|
-
component.disabled = true;
|
|
29
|
-
expect(component.disabled).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should have default readonly as false', () => {
|
|
33
|
-
expect(component.readonly).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should accept readonly input', () => {
|
|
37
|
-
component.readonly = true;
|
|
38
|
-
expect(component.readonly).toBe(true);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should have default trueValue as true', () => {
|
|
42
|
-
expect(component.trueValue).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should accept custom trueValue', () => {
|
|
46
|
-
component.trueValue = 'yes';
|
|
47
|
-
expect(component.trueValue).toBe('yes');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should have default falseValue as false', () => {
|
|
51
|
-
expect(component.falseValue).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should accept custom falseValue', () => {
|
|
55
|
-
component.falseValue = 'no';
|
|
56
|
-
expect(component.falseValue).toBe('no');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should have default value as false', () => {
|
|
60
|
-
expect(component.value).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should have default autofocus as false', () => {
|
|
64
|
-
expect(component.autofocus).toBe(false);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should accept style input', () => {
|
|
68
|
-
component.style = { width: '100px' };
|
|
69
|
-
expect(component.style).toEqual({ width: '100px' });
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should accept styleClass input', () => {
|
|
73
|
-
component.styleClass = 'custom-class';
|
|
74
|
-
expect(component.styleClass).toBe('custom-class');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should accept inputId input', () => {
|
|
78
|
-
component.inputId = 'my-switch';
|
|
79
|
-
expect(component.inputId).toBe('my-switch');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should accept name input', () => {
|
|
83
|
-
component.name = 'toggle';
|
|
84
|
-
expect(component.name).toBe('toggle');
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe('toggle value emission', () => {
|
|
89
|
-
it('should set value to trueValue when toggled on', () => {
|
|
90
|
-
component.handleChange({ checked: true } as any);
|
|
91
|
-
expect(component.value).toBe(true);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('should set value to falseValue when toggled off', () => {
|
|
95
|
-
component.value = true;
|
|
96
|
-
component.handleChange({ checked: false } as any);
|
|
97
|
-
expect(component.value).toBe(false);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('should call onChange with the new value when toggled', () => {
|
|
101
|
-
const onChangeSpy = jest.fn();
|
|
102
|
-
component.registerOnChange(onChangeSpy);
|
|
103
|
-
|
|
104
|
-
component.handleChange({ checked: true } as any);
|
|
105
|
-
|
|
106
|
-
expect(onChangeSpy).toHaveBeenCalledWith(true);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should call onTouched when toggled', () => {
|
|
110
|
-
const onTouchedSpy = jest.fn();
|
|
111
|
-
component.registerOnTouched(onTouchedSpy);
|
|
112
|
-
|
|
113
|
-
component.handleChange({ checked: true } as any);
|
|
114
|
-
|
|
115
|
-
expect(onTouchedSpy).toHaveBeenCalled();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('should use custom trueValue/falseValue when toggled', () => {
|
|
119
|
-
const onChangeSpy = jest.fn();
|
|
120
|
-
component.registerOnChange(onChangeSpy);
|
|
121
|
-
component.trueValue = 'active';
|
|
122
|
-
component.falseValue = 'inactive';
|
|
123
|
-
|
|
124
|
-
component.handleChange({ checked: true } as any);
|
|
125
|
-
expect(component.value).toBe('active');
|
|
126
|
-
expect(onChangeSpy).toHaveBeenCalledWith('active');
|
|
127
|
-
|
|
128
|
-
component.handleChange({ checked: false } as any);
|
|
129
|
-
expect(component.value).toBe('inactive');
|
|
130
|
-
expect(onChangeSpy).toHaveBeenCalledWith('inactive');
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe('ControlValueAccessor', () => {
|
|
135
|
-
it('should write value via writeValue', () => {
|
|
136
|
-
component.writeValue(true);
|
|
137
|
-
expect(component.value).toBe(true);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('should set falseValue when writeValue receives null', () => {
|
|
141
|
-
component.falseValue = 'off';
|
|
142
|
-
component.writeValue(null);
|
|
143
|
-
expect(component.value).toBe('off');
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('should set falseValue when writeValue receives undefined', () => {
|
|
147
|
-
component.writeValue(undefined);
|
|
148
|
-
expect(component.value).toBe(false);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('should set disabled state via setDisabledState', () => {
|
|
152
|
-
component.setDisabledState(true);
|
|
153
|
-
expect(component.disabled).toBe(true);
|
|
154
|
-
|
|
155
|
-
component.setDisabledState(false);
|
|
156
|
-
expect(component.disabled).toBe(false);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('should register onChange function', () => {
|
|
160
|
-
const fn = jest.fn();
|
|
161
|
-
component.registerOnChange(fn);
|
|
162
|
-
component.onChange('test');
|
|
163
|
-
expect(fn).toHaveBeenCalledWith('test');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should register onTouched function', () => {
|
|
167
|
-
const fn = jest.fn();
|
|
168
|
-
component.registerOnTouched(fn);
|
|
169
|
-
component.onTouched();
|
|
170
|
-
expect(fn).toHaveBeenCalled();
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Component, Input, forwardRef } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
ControlValueAccessor,
|
|
4
|
-
NG_VALUE_ACCESSOR,
|
|
5
|
-
FormControl,
|
|
6
|
-
} from '@angular/forms';
|
|
7
|
-
import { InputSwitchChangeEvent } from 'primeng/inputswitch';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'atomix-inputSwitch',
|
|
11
|
-
templateUrl: './atomix-input-switch.component.html',
|
|
12
|
-
styleUrls: ['./atomix-input-switch.component.css'],
|
|
13
|
-
providers: [
|
|
14
|
-
{
|
|
15
|
-
provide: NG_VALUE_ACCESSOR,
|
|
16
|
-
useExisting: forwardRef(() => AtomixInputSwitchComponent),
|
|
17
|
-
multi: true,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
})
|
|
21
|
-
export class AtomixInputSwitchComponent implements ControlValueAccessor {
|
|
22
|
-
@Input() style?: { [key: string]: any };
|
|
23
|
-
@Input() styleClass?: string;
|
|
24
|
-
@Input() tabindex?: number;
|
|
25
|
-
@Input() inputId?: string;
|
|
26
|
-
@Input() name?: string;
|
|
27
|
-
@Input() disabled = false;
|
|
28
|
-
@Input() readonly = false;
|
|
29
|
-
@Input() trueValue: any = true;
|
|
30
|
-
@Input() falseValue: any = false;
|
|
31
|
-
@Input() ariaLabel?: string;
|
|
32
|
-
@Input() ariaLabelledBy?: string;
|
|
33
|
-
@Input() autofocus = false;
|
|
34
|
-
@Input() formControl?: FormControl;
|
|
35
|
-
|
|
36
|
-
value: any = false;
|
|
37
|
-
|
|
38
|
-
onChange = (_: any) => {};
|
|
39
|
-
onTouched = () => {};
|
|
40
|
-
|
|
41
|
-
writeValue(value: any): void {
|
|
42
|
-
this.value = value ?? this.falseValue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
registerOnChange(fn: any): void {
|
|
46
|
-
this.onChange = fn;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
registerOnTouched(fn: any): void {
|
|
50
|
-
this.onTouched = fn;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
setDisabledState(disabled: boolean): void {
|
|
54
|
-
this.disabled = disabled;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
handleChange(event: InputSwitchChangeEvent) {
|
|
58
|
-
this.value = event.checked ? this.trueValue : this.falseValue;
|
|
59
|
-
this.onChange(this.value);
|
|
60
|
-
this.onTouched();
|
|
61
|
-
}
|
|
62
|
-
}
|