@bravobit/bb-foundation 0.33.0 → 0.40.0
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/auth/lib/auth.config.d.ts +5 -0
- package/auth/lib/auth.interceptor.d.ts +2 -2
- package/auth/lib/auth.module.d.ts +1 -4
- package/auth/lib/auth.service.d.ts +2 -2
- package/auth/lib/directives/authenticated.directive.d.ts +11 -4
- package/auth/lib/guards/anonymous.guard.d.ts +2 -15
- package/auth/lib/guards/authenticated.guard.d.ts +2 -15
- package/auth/lib/interfaces/config.interface.d.ts +2 -1
- package/auth/public_api.d.ts +1 -0
- package/collections/lib/collections.module.d.ts +12 -3
- package/collections/lib/components/collections-actions/collections-actions.component.d.ts +10 -0
- package/collections/lib/components/collections-grid/collections-grid.component.d.ts +18 -0
- package/collections/lib/components/collections-pager/collections-pager.component.d.ts +15 -14
- package/collections/lib/components/collections-table/collections-table.component.d.ts +24 -0
- package/collections/lib/components/collections-table-label/collections-table-label.component.d.ts +11 -0
- package/collections/lib/components/collections-table-sorting/collections-table-sorting.component.d.ts +18 -0
- package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +9 -5
- package/collections/lib/directives/collections-data-row.directive.d.ts +14 -0
- package/collections/lib/directives/collections-data.directive.d.ts +14 -0
- package/collections/lib/directives/collections-empty.directive.d.ts +14 -0
- package/collections/lib/directives/collections-error.directive.d.ts +14 -0
- package/collections/lib/directives/collections-initial.directive.d.ts +11 -0
- package/collections/lib/directives/collections-item.directive.d.ts +14 -0
- package/collections/public_api.d.ts +11 -1
- package/dashboard/lib/dashboard/dashboard.component.d.ts +5 -8
- package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +3 -5
- package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +1 -1
- package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +4 -7
- package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +3 -5
- package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +6 -11
- package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +2 -2
- package/dashboard/lib/dashboard.module.d.ts +1 -4
- package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +1 -1
- package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +2 -2
- package/dialog/lib/dialog-container/dialog-container.component.d.ts +2 -2
- package/dialog/lib/dialog-header/dialog-header.component.d.ts +1 -1
- package/dialog/lib/dialog-link/dialog-link.component.d.ts +1 -1
- package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +1 -1
- package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +2 -2
- package/dialog/lib/dialog.config.d.ts +3 -0
- package/dialog/lib/dialog.insertion.d.ts +1 -1
- package/dialog/lib/dialog.interfaces.d.ts +2 -0
- package/dialog/lib/dialog.module.d.ts +2 -4
- package/dialog/lib/directives/confirm.directive.d.ts +13 -0
- package/dialog/public_api.d.ts +2 -0
- package/elements/lib/avatar/avatar.component.d.ts +2 -1
- package/elements/lib/button/button.component.d.ts +12 -14
- package/elements/lib/checkbox/checkbox.component.d.ts +29 -22
- package/elements/lib/checkbox-group/checkbox-group.component.d.ts +13 -0
- package/elements/lib/date-picker/date-picker.component.d.ts +17 -10
- package/elements/lib/directives/addon.directive.d.ts +2 -2
- package/elements/lib/directives/extra-error-controls.directive.d.ts +13 -0
- package/elements/lib/directives/form-submit.directive.d.ts +1 -1
- package/elements/lib/directives/form-submitter.directive.d.ts +1 -1
- package/elements/lib/directives/image-upload.directive.d.ts +1 -1
- package/elements/lib/directives/input.directive.d.ts +9 -31
- package/elements/lib/elements.config.d.ts +84 -0
- package/elements/lib/elements.module.d.ts +20 -102
- package/elements/lib/file-picker/file-picker.component.d.ts +14 -10
- package/elements/lib/form-control/form-control.component.d.ts +8 -9
- package/elements/lib/form-error/form-error.component.d.ts +12 -9
- package/elements/lib/form-group/form-group.component.d.ts +4 -7
- package/elements/lib/icon/icon.component.d.ts +4 -4
- package/elements/lib/image-picker/image-picker.component.d.ts +9 -9
- package/elements/lib/multi-file-control/multi-file-control.component.d.ts +58 -0
- package/elements/lib/pipes/date.pipe.d.ts +9 -0
- package/elements/lib/pipes/file-image.pipe.d.ts +1 -1
- package/elements/lib/pipes/file-size.pipe.d.ts +1 -1
- package/elements/lib/pipes/relative-time.pipe.d.ts +1 -1
- package/elements/lib/radio-button/radio-button.component.d.ts +18 -0
- package/elements/lib/radio-group/radio-group.component.d.ts +38 -0
- package/elements/lib/spinner/spinner.component.d.ts +4 -7
- package/elements/public_api.d.ts +8 -3
- package/esm2022/auth/lib/auth.config.mjs +16 -0
- package/esm2022/auth/lib/auth.interceptor.mjs +10 -7
- package/esm2022/auth/lib/auth.module.mjs +9 -19
- package/esm2022/auth/lib/auth.service.mjs +22 -13
- package/esm2022/auth/lib/directives/authenticated.directive.mjs +45 -11
- package/esm2022/auth/lib/guards/anonymous.guard.mjs +27 -51
- package/esm2022/auth/lib/guards/authenticated.guard.mjs +30 -54
- package/esm2022/auth/lib/helpers/jwt.helper.mjs +2 -2
- package/esm2022/auth/lib/interfaces/config.interface.mjs +2 -3
- package/esm2022/auth/public_api.mjs +2 -1
- package/esm2022/collections/lib/collections.module.mjs +53 -23
- package/esm2022/collections/lib/components/collections-actions/collections-actions.component.mjs +39 -0
- package/esm2022/collections/lib/components/collections-grid/collections-grid.component.mjs +52 -0
- package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +51 -60
- package/esm2022/collections/lib/components/collections-table/collections-table.component.mjs +86 -0
- package/esm2022/collections/lib/components/collections-table-label/collections-table-label.component.mjs +33 -0
- package/esm2022/collections/lib/components/collections-table-sorting/collections-table-sorting.component.mjs +62 -0
- package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +10 -7
- package/esm2022/collections/lib/directives/collections-data-row.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-data.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-empty.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-error.directive.mjs +26 -0
- package/esm2022/collections/lib/directives/collections-initial.directive.mjs +22 -0
- package/esm2022/collections/lib/directives/collections-item.directive.mjs +26 -0
- package/esm2022/collections/public_api.mjs +12 -2
- package/esm2022/combobox/combobox/combobox-container.directive.mjs +3 -3
- package/esm2022/combobox/combobox/combobox.component.mjs +6 -6
- package/esm2022/combobox/combobox-label.directive.mjs +3 -3
- package/esm2022/combobox/combobox-option.directive.mjs +3 -3
- package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +5 -5
- package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +17 -24
- package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +12 -15
- package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +7 -8
- package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +20 -15
- package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +15 -14
- package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +20 -27
- package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +6 -10
- package/esm2022/dashboard/lib/dashboard.module.mjs +30 -27
- package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +6 -6
- package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +12 -15
- package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +10 -7
- package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +5 -6
- package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +5 -5
- package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +7 -7
- package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +11 -7
- package/esm2022/dialog/lib/dialog.config.mjs +8 -0
- package/esm2022/dialog/lib/dialog.insertion.mjs +6 -5
- package/esm2022/dialog/lib/dialog.interfaces.mjs +3 -1
- package/esm2022/dialog/lib/dialog.module.mjs +17 -25
- package/esm2022/dialog/lib/dialog.service.mjs +8 -5
- package/esm2022/dialog/lib/directives/confirm.directive.mjs +50 -0
- package/esm2022/dialog/public_api.mjs +3 -1
- package/esm2022/elements/lib/avatar/avatar.component.mjs +15 -14
- package/esm2022/elements/lib/button/button.component.mjs +37 -32
- package/esm2022/elements/lib/checkbox/checkbox.component.mjs +86 -47
- package/esm2022/elements/lib/checkbox-group/checkbox-group.component.mjs +36 -0
- package/esm2022/elements/lib/date-picker/date-picker.component.mjs +64 -51
- package/esm2022/elements/lib/directives/addon.directive.mjs +11 -13
- package/esm2022/elements/lib/directives/extra-error-controls.directive.mjs +43 -0
- package/esm2022/elements/lib/directives/form-submit.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/form-submitter.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/image-upload.directive.mjs +6 -5
- package/esm2022/elements/lib/directives/input.directive.mjs +21 -110
- package/esm2022/elements/lib/elements.config.mjs +42 -0
- package/esm2022/elements/lib/elements.module.mjs +38 -77
- package/esm2022/elements/lib/file-picker/file-picker.component.mjs +36 -24
- package/esm2022/elements/lib/form-control/form-control.component.mjs +21 -24
- package/esm2022/elements/lib/form-error/form-error.component.mjs +35 -60
- package/esm2022/elements/lib/form-group/form-group.component.mjs +15 -12
- package/esm2022/elements/lib/icon/icon.component.mjs +19 -24
- package/esm2022/elements/lib/image-picker/image-picker.component.mjs +33 -19
- package/esm2022/elements/lib/multi-file-control/multi-file-control.component.mjs +165 -0
- package/esm2022/elements/lib/pipes/date.pipe.mjs +30 -0
- package/esm2022/elements/lib/pipes/file-image.pipe.mjs +6 -5
- package/esm2022/elements/lib/pipes/file-size.pipe.mjs +6 -5
- package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +6 -5
- package/esm2022/elements/lib/radio-button/radio-button.component.mjs +59 -0
- package/esm2022/elements/lib/radio-group/radio-group.component.mjs +102 -0
- package/esm2022/elements/lib/spinner/spinner.component.mjs +12 -13
- package/esm2022/elements/public_api.mjs +9 -4
- package/esm2022/http/lib/http.config.mjs +18 -0
- package/esm2022/http/lib/http.interfaces.mjs +4 -2
- package/esm2022/http/lib/http.module.mjs +9 -22
- package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +9 -5
- package/esm2022/http/lib/interceptors/error.interceptor.mjs +10 -6
- package/esm2022/http/public_api.mjs +2 -1
- package/esm2022/lib/core/miscellaneous/coercion.mjs +5 -0
- package/esm2022/lib/core/services/exif.service.mjs +3 -3
- package/esm2022/lib/core/services/file-loader.service.mjs +3 -3
- package/esm2022/lib/core/services/files.service.mjs +3 -3
- package/esm2022/lib/core/services/image-converter.service.mjs +3 -3
- package/esm2022/lib/core/services/languages.service.mjs +3 -3
- package/esm2022/lib/core/services/network.service.mjs +3 -3
- package/esm2022/lib/core/services/patch.service.mjs +3 -3
- package/esm2022/localize/lib/interfaces/config.interfaces.mjs +2 -7
- package/esm2022/localize/lib/interfaces/functions.interfaces.mjs +6 -6
- package/esm2022/localize/lib/localizations/dutch.localization.mjs +19 -1
- package/esm2022/localize/lib/localizations/english.localization.mjs +19 -1
- package/esm2022/localize/lib/localize.config.mjs +43 -0
- package/esm2022/localize/lib/localize.module.mjs +10 -54
- package/esm2022/localize/lib/localize.pipe.mjs +6 -5
- package/esm2022/localize/lib/localize.service.mjs +26 -13
- package/esm2022/localize/lib/localize.tokens.mjs +18 -0
- package/esm2022/localize/lib/transforms/interpolate.transform.mjs +3 -2
- package/esm2022/localize/lib/transforms/plural.transform.mjs +5 -3
- package/esm2022/localize/lib/transforms/reference.transform.mjs +5 -3
- package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +6 -10
- package/esm2022/localize/lib/views/localize-template.directive.mjs +6 -5
- package/esm2022/localize/public_api.mjs +3 -3
- package/esm2022/masking/lib/directives/currency-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/date-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/input-mask.directive.mjs +6 -5
- package/esm2022/masking/lib/masking.module.mjs +6 -6
- package/esm2022/masking/lib/masking.service.mjs +3 -3
- package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +7 -9
- package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +8 -8
- package/esm2022/notifications/lib/notifications.config.mjs +8 -0
- package/esm2022/notifications/lib/notifications.interfaces.mjs +3 -1
- package/esm2022/notifications/lib/notifications.module.mjs +8 -18
- package/esm2022/notifications/lib/notifications.service.mjs +14 -8
- package/esm2022/notifications/public_api.mjs +2 -1
- package/esm2022/permissions/lib/directives/permission.directive.mjs +6 -5
- package/esm2022/permissions/lib/guards/permission.guard.mjs +23 -54
- package/esm2022/permissions/lib/permissions.config.mjs +20 -0
- package/esm2022/permissions/lib/permissions.interface.mjs +3 -1
- package/esm2022/permissions/lib/permissions.module.mjs +9 -23
- package/esm2022/permissions/lib/permissions.service.mjs +8 -5
- package/esm2022/permissions/public_api.mjs +2 -1
- package/esm2022/public_api.mjs +2 -10
- package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +12 -13
- package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +21 -36
- package/esm2022/recaptcha/lib/recaptcha.config.mjs +8 -0
- package/esm2022/recaptcha/lib/recaptcha.module.mjs +8 -8
- package/esm2022/recaptcha/public_api.mjs +2 -1
- package/esm2022/select/bravobit-bb-foundation-select.mjs +5 -0
- package/esm2022/select/lib/select/select.component.mjs +210 -0
- package/esm2022/select/lib/select-label.directive.mjs +17 -0
- package/esm2022/select/lib/select-option-group.directive.mjs +17 -0
- package/esm2022/select/lib/select-option.directive.mjs +17 -0
- package/esm2022/select/lib/select.module.mjs +35 -0
- package/esm2022/select/public_api.mjs +6 -0
- package/esm2022/storage/lib/storage.service.mjs +3 -3
- package/esm2022/storage/lib/strategies/polyfill-storage.strategy.mjs +2 -5
- package/esm2022/table/lib/components/table/table.component.mjs +21 -22
- package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +5 -5
- package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +14 -14
- package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +15 -17
- package/esm2022/table/lib/table.module.mjs +23 -21
- package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +11 -17
- package/esm2022/tooltip/lib/tooltip.directive.mjs +17 -27
- package/esm2022/tooltip/lib/tooltip.module.mjs +7 -22
- package/esm2022/tooltip/public_api.mjs +2 -2
- package/esm2022/utils/lib/directives/autosize.directive.mjs +9 -7
- package/esm2022/utils/lib/directives/focus-trap.directive.mjs +6 -5
- package/esm2022/utils/lib/directives/focus.directive.mjs +6 -5
- package/esm2022/utils/lib/directives/template.directive.mjs +6 -5
- package/esm2022/utils/lib/utils.module.mjs +6 -6
- package/fesm2022/bravobit-bb-foundation-auth.mjs +140 -175
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +451 -106
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-combobox.mjs +18 -18
- package/fesm2022/bravobit-bb-foundation-combobox.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +106 -116
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +125 -70
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +1652 -1378
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +38 -27
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +310 -264
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +23 -20
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +67 -62
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +54 -72
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +44 -54
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +288 -0
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -0
- package/fesm2022/bravobit-bb-foundation-storage.mjs +4 -7
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +67 -66
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +31 -61
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +28 -23
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +27 -144
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/http/lib/http.config.d.ts +5 -0
- package/http/lib/http.interfaces.d.ts +3 -0
- package/http/lib/http.module.d.ts +2 -6
- package/http/public_api.d.ts +1 -0
- package/lib/core/miscellaneous/coercion.d.ts +2 -0
- package/localize/lib/interfaces/config.interfaces.d.ts +1 -1
- package/localize/lib/interfaces/functions.interfaces.d.ts +0 -2
- package/localize/lib/localizations/dutch.localization.d.ts +18 -0
- package/localize/lib/localizations/english.localization.d.ts +18 -0
- package/localize/lib/localize.config.d.ts +6 -0
- package/localize/lib/localize.module.d.ts +2 -7
- package/localize/lib/localize.pipe.d.ts +1 -1
- package/localize/lib/localize.service.d.ts +4 -4
- package/localize/lib/localize.tokens.d.ts +11 -0
- package/localize/lib/views/localize-string/localize-string.component.d.ts +1 -1
- package/localize/lib/views/localize-template.directive.d.ts +1 -1
- package/localize/public_api.d.ts +2 -2
- package/masking/lib/directives/currency-mask.directive.d.ts +1 -1
- package/masking/lib/directives/date-mask.directive.d.ts +1 -1
- package/masking/lib/directives/input-mask.directive.d.ts +1 -1
- package/masking/lib/masking.module.d.ts +1 -1
- package/notifications/lib/notifications-item/notifications-item.component.d.ts +1 -1
- package/notifications/lib/notifications-list/notifications-list.component.d.ts +1 -1
- package/notifications/lib/notifications.config.d.ts +3 -0
- package/notifications/lib/notifications.interfaces.d.ts +2 -1
- package/notifications/lib/notifications.module.d.ts +1 -5
- package/notifications/public_api.d.ts +1 -0
- package/package.json +28 -33
- package/permissions/lib/directives/permission.directive.d.ts +1 -1
- package/permissions/lib/guards/permission.guard.d.ts +3 -15
- package/permissions/lib/permissions.config.d.ts +3 -0
- package/permissions/lib/permissions.interface.d.ts +2 -1
- package/permissions/lib/permissions.module.d.ts +1 -1
- package/permissions/public_api.d.ts +1 -0
- package/public_api.d.ts +1 -9
- package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +4 -7
- package/recaptcha/lib/recaptcha-loader.service.d.ts +9 -13
- package/recaptcha/lib/recaptcha.config.d.ts +3 -0
- package/recaptcha/lib/recaptcha.module.d.ts +2 -2
- package/recaptcha/public_api.d.ts +1 -0
- package/{theming → select}/index.d.ts +1 -1
- package/select/lib/select/select.component.d.ts +75 -0
- package/select/lib/select-label.directive.d.ts +8 -0
- package/select/lib/select-option-group.directive.d.ts +8 -0
- package/select/lib/select-option.directive.d.ts +8 -0
- package/select/lib/select.module.d.ts +10 -0
- package/select/public_api.d.ts +5 -0
- package/styles/colors.scss +20 -0
- package/styles/grid.scss +98 -0
- package/styles/reset.scss +65 -0
- package/styles/theme.scss +88 -0
- package/table/lib/components/table/table.component.d.ts +4 -6
- package/table/lib/components/table-cell/table-cell.component.d.ts +1 -1
- package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +4 -7
- package/table/lib/components/table-pager/table-pager.component.d.ts +4 -8
- package/table/lib/table.module.d.ts +1 -5
- package/tooltip/lib/tooltip-container/tooltip-container.component.d.ts +3 -4
- package/tooltip/lib/tooltip.directive.d.ts +8 -17
- package/tooltip/lib/tooltip.module.d.ts +2 -5
- package/tooltip/public_api.d.ts +1 -1
- package/utils/lib/directives/autosize.directive.d.ts +2 -1
- package/utils/lib/directives/focus-trap.directive.d.ts +1 -1
- package/utils/lib/directives/focus.directive.d.ts +1 -1
- package/utils/lib/directives/template.directive.d.ts +1 -1
- package/utils/lib/utils.module.d.ts +1 -1
- package/auth/lib/directives/abstract.directive.d.ts +0 -12
- package/collections/lib/components/collections.directive.d.ts +0 -17
- package/controls/index.d.ts +0 -5
- package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +0 -51
- package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +0 -23
- package/controls/lib/checkbox/checkbox.module.d.ts +0 -10
- package/controls/lib/control-error/control-error/control-error.animation.d.ts +0 -1
- package/controls/lib/control-error/control-error/control-error.component.d.ts +0 -17
- package/controls/lib/control-error/control-error-submit.directive.d.ts +0 -15
- package/controls/lib/control-error/control-error.defaults.d.ts +0 -2
- package/controls/lib/control-error/control-error.interface.d.ts +0 -12
- package/controls/lib/control-error/control-error.module.d.ts +0 -9
- package/controls/lib/control-error/control-error.utils.d.ts +0 -3
- package/controls/lib/controls.interfaces.d.ts +0 -4
- package/controls/lib/controls.module.d.ts +0 -14
- package/controls/lib/form-control/form-control/form-control.component.d.ts +0 -29
- package/controls/lib/form-control/form-control-addon/form-control-addon.component.d.ts +0 -6
- package/controls/lib/form-control/form-control-input.directive.d.ts +0 -35
- package/controls/lib/form-control/form-control.module.d.ts +0 -12
- package/controls/lib/radio/radio-button/radio-button.component.d.ts +0 -24
- package/controls/lib/radio/radio-group/radio-group.component.d.ts +0 -53
- package/controls/lib/radio/radio.module.d.ts +0 -11
- package/controls/lib/toggle/toggle/toggle.component.d.ts +0 -45
- package/controls/lib/toggle/toggle-group/toggle-group.component.d.ts +0 -23
- package/controls/lib/toggle/toggle.module.d.ts +0 -10
- package/controls/public_api.d.ts +0 -20
- package/elements/lib/dropdown/dropdown.component.d.ts +0 -21
- package/elements/lib/tag/tag.component.d.ts +0 -7
- package/esm2022/auth/lib/directives/abstract.directive.mjs +0 -40
- package/esm2022/collections/lib/components/collections.directive.mjs +0 -43
- package/esm2022/controls/bravobit-bb-foundation-controls.mjs +0 -5
- package/esm2022/controls/lib/checkbox/checkbox/checkbox.component.mjs +0 -178
- package/esm2022/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +0 -68
- package/esm2022/controls/lib/checkbox/checkbox.module.mjs +0 -20
- package/esm2022/controls/lib/control-error/control-error/control-error.animation.mjs +0 -14
- package/esm2022/controls/lib/control-error/control-error/control-error.component.mjs +0 -63
- package/esm2022/controls/lib/control-error/control-error-submit.directive.mjs +0 -47
- package/esm2022/controls/lib/control-error/control-error.defaults.mjs +0 -26
- package/esm2022/controls/lib/control-error/control-error.interface.mjs +0 -3
- package/esm2022/controls/lib/control-error/control-error.module.mjs +0 -19
- package/esm2022/controls/lib/control-error/control-error.utils.mjs +0 -20
- package/esm2022/controls/lib/controls.interfaces.mjs +0 -2
- package/esm2022/controls/lib/controls.module.mjs +0 -62
- package/esm2022/controls/lib/form-control/form-control/form-control.component.mjs +0 -79
- package/esm2022/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +0 -22
- package/esm2022/controls/lib/form-control/form-control-input.directive.mjs +0 -124
- package/esm2022/controls/lib/form-control/form-control.module.mjs +0 -34
- package/esm2022/controls/lib/radio/radio-button/radio-button.component.mjs +0 -75
- package/esm2022/controls/lib/radio/radio-group/radio-group.component.mjs +0 -168
- package/esm2022/controls/lib/radio/radio.module.mjs +0 -21
- package/esm2022/controls/lib/toggle/toggle/toggle.component.mjs +0 -153
- package/esm2022/controls/lib/toggle/toggle-group/toggle-group.component.mjs +0 -62
- package/esm2022/controls/lib/toggle/toggle.module.mjs +0 -20
- package/esm2022/controls/public_api.mjs +0 -21
- package/esm2022/elements/lib/dropdown/dropdown.component.mjs +0 -100
- package/esm2022/elements/lib/tag/tag.component.mjs +0 -18
- package/esm2022/lib/core/mixins/can-disable.mjs +0 -16
- package/esm2022/lib/core/mixins/can-hide-errors.mjs +0 -16
- package/esm2022/lib/core/mixins/can-load.mjs +0 -16
- package/esm2022/lib/core/mixins/constructor.mjs +0 -2
- package/esm2022/lib/core/mixins/has-error.mjs +0 -16
- package/esm2022/lib/core/mixins/is-focused.mjs +0 -16
- package/esm2022/lib/core/mixins/is-grouped.mjs +0 -16
- package/esm2022/lib/core/mixins/is-readonly.mjs +0 -16
- package/esm2022/lib/core/mixins/is-required.mjs +0 -16
- package/esm2022/localize/lib/interfaces/transforms.interfaces.mjs +0 -3
- package/esm2022/localize/lib/locale.token.mjs +0 -14
- package/esm2022/theming/bravobit-bb-foundation-theming.mjs +0 -5
- package/esm2022/theming/lib/themes/checkbox-group.theme.mjs +0 -17
- package/esm2022/theming/lib/themes/checkbox.theme.mjs +0 -35
- package/esm2022/theming/lib/themes/control-error.theme.mjs +0 -11
- package/esm2022/theming/lib/themes/form-control-addon.theme.mjs +0 -6
- package/esm2022/theming/lib/themes/form-control.theme.mjs +0 -45
- package/esm2022/theming/lib/themes/radio-button.theme.mjs +0 -29
- package/esm2022/theming/lib/themes/radio-group.theme.mjs +0 -20
- package/esm2022/theming/lib/themes/toggle-group.theme.mjs +0 -17
- package/esm2022/theming/lib/themes/toggle.theme.mjs +0 -28
- package/esm2022/theming/lib/theming.data.mjs +0 -90
- package/esm2022/theming/lib/theming.directive.mjs +0 -38
- package/esm2022/theming/lib/theming.interface.mjs +0 -2
- package/esm2022/theming/lib/theming.module.mjs +0 -16
- package/esm2022/theming/lib/utils/theming.variable.mjs +0 -41
- package/esm2022/theming/public_api.mjs +0 -10
- package/fesm2022/bravobit-bb-foundation-controls.mjs +0 -1191
- package/fesm2022/bravobit-bb-foundation-controls.mjs.map +0 -1
- package/fesm2022/bravobit-bb-foundation-theming.mjs +0 -381
- package/fesm2022/bravobit-bb-foundation-theming.mjs.map +0 -1
- package/lib/core/mixins/can-disable.d.ts +0 -6
- package/lib/core/mixins/can-hide-errors.d.ts +0 -6
- package/lib/core/mixins/can-load.d.ts +0 -6
- package/lib/core/mixins/constructor.d.ts +0 -1
- package/lib/core/mixins/has-error.d.ts +0 -6
- package/lib/core/mixins/is-focused.d.ts +0 -6
- package/lib/core/mixins/is-grouped.d.ts +0 -6
- package/lib/core/mixins/is-readonly.d.ts +0 -6
- package/lib/core/mixins/is-required.d.ts +0 -6
- package/localize/lib/interfaces/transforms.interfaces.d.ts +0 -3
- package/localize/lib/locale.token.d.ts +0 -3
- package/theming/lib/themes/checkbox-group.theme.d.ts +0 -16
- package/theming/lib/themes/checkbox.theme.d.ts +0 -32
- package/theming/lib/themes/control-error.theme.d.ts +0 -9
- package/theming/lib/themes/form-control-addon.theme.d.ts +0 -5
- package/theming/lib/themes/form-control.theme.d.ts +0 -32
- package/theming/lib/themes/radio-button.theme.d.ts +0 -26
- package/theming/lib/themes/radio-group.theme.d.ts +0 -17
- package/theming/lib/themes/toggle-group.theme.d.ts +0 -16
- package/theming/lib/themes/toggle.theme.d.ts +0 -25
- package/theming/lib/theming.data.d.ts +0 -17
- package/theming/lib/theming.directive.d.ts +0 -13
- package/theming/lib/theming.interface.d.ts +0 -34
- package/theming/lib/theming.module.d.ts +0 -7
- package/theming/lib/utils/theming.variable.d.ts +0 -16
- package/theming/public_api.d.ts +0 -9
|
@@ -1,120 +1,65 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, ViewEncapsulation, HostListener, Directive, Optional, Host, Input, InjectionToken, EventEmitter, forwardRef, ViewChild, Output, Self, Inject, ContentChild, numberAttribute, Pipe, HostBinding, LOCALE_ID, NgModule } from '@angular/core';
|
|
3
|
-
import { trigger, transition, style, animate } from '@angular/animations';
|
|
4
|
-
import * as i8 from 'rxjs';
|
|
5
|
-
import { BehaviorSubject, fromEvent, merge, EMPTY, combineLatest, of, Subscription } from 'rxjs';
|
|
6
|
-
import * as i1 from '@angular/common';
|
|
7
|
-
import { formatDate, CommonModule } from '@angular/common';
|
|
8
|
-
import * as i1$1 from '@bravobit/bb-foundation';
|
|
9
|
-
import { mixinDisabled, mixinLoad, mixinGrouped, mixinFocused, mixinReadonly, mixinRequired, mixinError, mixinHideErrors } from '@bravobit/bb-foundation';
|
|
10
|
-
import * as i2 from '@angular/forms';
|
|
11
|
-
import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, Validators, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
12
1
|
import { map, startWith, distinctUntilChanged, shareReplay, tap, delay } from 'rxjs/operators';
|
|
13
|
-
import * as
|
|
14
|
-
import {
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, Optional, Self, InjectionToken, Input, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, Output, booleanAttribute, ContentChild, Host, HostBinding, numberAttribute, HostListener, Pipe, LOCALE_ID, inject, forwardRef, ViewChild, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
4
|
+
import * as i2$1 from 'rxjs';
|
|
5
|
+
import { fromEvent, merge, EMPTY, BehaviorSubject, combineLatest, of, Subscription } from 'rxjs';
|
|
6
|
+
import * as i1 from '@angular/forms';
|
|
7
|
+
import { NgControl, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
15
8
|
import * as i1$2 from '@bravobit/bb-foundation/localize';
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
9
|
+
import { BbLocalize, Localize, BbLocalizeTemplate, BbLocalizeString, LOCALIZE_ID } from '@bravobit/bb-foundation/localize';
|
|
10
|
+
import { AsyncPipe, formatDate, NgTemplateOutlet } from '@angular/common';
|
|
11
|
+
import { BbTemplate } from '@bravobit/bb-foundation/utils';
|
|
12
|
+
import * as i1$1 from '@bravobit/bb-foundation';
|
|
13
|
+
import { parseDate } from '@bravobit/bb-foundation';
|
|
14
|
+
import * as i2 from '@angular/cdk/platform';
|
|
18
15
|
import * as i3 from '@angular/platform-browser';
|
|
19
|
-
import {
|
|
16
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
20
17
|
|
|
21
|
-
class
|
|
22
|
-
constructor(
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
this.visible$ = new BehaviorSubject(false);
|
|
18
|
+
class BbFormSubmit {
|
|
19
|
+
constructor(_host, _formDirective) {
|
|
20
|
+
this._host = _host;
|
|
21
|
+
this._formDirective = _formDirective;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
ngOnInit() {
|
|
24
|
+
// Submit changes.
|
|
25
|
+
const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(map(() => true));
|
|
26
|
+
// Reactive form submit changes.
|
|
27
|
+
const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
|
|
28
|
+
// Reset changes.
|
|
29
|
+
const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(map(() => false));
|
|
30
|
+
// Listen to the submit status.
|
|
31
|
+
this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
submit() {
|
|
34
|
+
this._formDirective?.ngSubmit?.emit();
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (this._elementRef?.nativeElement?.contains(target)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
return this.close();
|
|
36
|
+
reset() {
|
|
37
|
+
return this.nativeElement?.reset();
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
trigger('dropdownMenuAnimation', [
|
|
45
|
-
transition(':enter', [
|
|
46
|
-
// 1. Set the initial state.
|
|
47
|
-
style({ opacity: 0, transform: 'scale(0.9)' }),
|
|
48
|
-
// 2. Start the animation to show the item.
|
|
49
|
-
animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
|
|
50
|
-
]),
|
|
51
|
-
transition(':leave', [
|
|
52
|
-
// 1. Set the initial state.
|
|
53
|
-
style({ opacity: 1, transform: 'scale(1)' }),
|
|
54
|
-
// 2. Start the animation to hide the item.
|
|
55
|
-
animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
|
|
56
|
-
])
|
|
57
|
-
])
|
|
58
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
59
|
-
}
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbDropdown, decorators: [{
|
|
61
|
-
type: Component,
|
|
62
|
-
args: [{ selector: 'bb-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-dropdown' }, preserveWhitespaces: false, animations: [
|
|
63
|
-
trigger('dropdownMenuAnimation', [
|
|
64
|
-
transition(':enter', [
|
|
65
|
-
// 1. Set the initial state.
|
|
66
|
-
style({ opacity: 0, transform: 'scale(0.9)' }),
|
|
67
|
-
// 2. Start the animation to show the item.
|
|
68
|
-
animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 1, transform: 'scale(1)' }))
|
|
69
|
-
]),
|
|
70
|
-
transition(':leave', [
|
|
71
|
-
// 1. Set the initial state.
|
|
72
|
-
style({ opacity: 1, transform: 'scale(1)' }),
|
|
73
|
-
// 2. Start the animation to hide the item.
|
|
74
|
-
animate('80ms cubic-bezier(0, 0, .2, 1)', style({ opacity: 0, transform: 'scale(0.9)' }))
|
|
75
|
-
])
|
|
76
|
-
])
|
|
77
|
-
], template: "<button (click)=\"toggle()\"\n [class.opened]=\"visible$ | async\"\n type=\"button\">\n <ng-content></ng-content>\n</button>\n\n<div *ngIf=\"visible$ | async\"\n [@dropdownMenuAnimation]=\"true\"\n class=\"bb-dropdown-menu\"\n role=\"list\">\n <ng-content select=\"[bbDropdownItem], hr\"></ng-content>\n</div>\n", styles: [".bb-dropdown{position:relative;display:inline-block}.bb-dropdown.right>.bb-dropdown-menu{right:0;left:auto;transform-origin:top right}.bb-dropdown-menu{left:0;top:100%;padding:0;z-index:10;display:block;margin:10px 0 0;border-radius:4px;position:absolute;list-style-type:none;background-color:#fff;border:1px solid #cccccc;transform-origin:top left;box-shadow:0 0 6px #0000001a}.bb-dropdown-menu:after{width:0;top:-5px;height:0;right:5px;content:\"\";position:absolute;border-style:solid;border-width:0 10px 5px 10px;border-color:transparent transparent #d9d9d9 transparent}.bb-dropdown-menu>hr{margin:0;height:1px;border:none;background-color:#ccc}.bb-dropdown-item{width:100%;border:none;line-height:1;display:block;cursor:pointer;text-align:left;font-weight:500;-webkit-user-select:none;user-select:none;padding:12px 20px;white-space:nowrap;text-decoration:none;color:#676767!important;background-color:transparent;transition:background-color .25s cubic-bezier(0,0,.2,1)}.bb-dropdown-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.bb-dropdown-item:hover{background-color:#f6f6f6}.bb-dropdown-item:focus{box-shadow:0 0 0 3px #dce0e980}.bb-dropdown-item:active{background-color:#f0f0f0}\n"] }]
|
|
78
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { onDocumentClick: [{
|
|
79
|
-
type: HostListener,
|
|
80
|
-
args: ['document:click', ['$event.target']]
|
|
81
|
-
}] } });
|
|
82
|
-
class BbDropdownItem {
|
|
83
|
-
constructor(_parent) {
|
|
84
|
-
this._parent = _parent;
|
|
85
|
-
// Inputs.
|
|
86
|
-
this.closeOnClick = true;
|
|
39
|
+
get nativeElement() {
|
|
40
|
+
return this._host?.nativeElement;
|
|
87
41
|
}
|
|
88
|
-
|
|
89
|
-
if (!this.
|
|
90
|
-
return;
|
|
42
|
+
reactiveSubmitChanges() {
|
|
43
|
+
if (!this._formDirective) {
|
|
44
|
+
return EMPTY;
|
|
91
45
|
}
|
|
92
|
-
this.
|
|
46
|
+
return this._formDirective.ngSubmit.pipe(map(() => true));
|
|
93
47
|
}
|
|
94
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
95
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormSubmit, deps: [{ token: i0.ElementRef }, { token: i1.FormGroupDirective, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
49
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbFormSubmit, isStandalone: true, selector: "form", exportAs: ["bbForm"], ngImport: i0 }); }
|
|
96
50
|
}
|
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormSubmit, decorators: [{
|
|
98
52
|
type: Directive,
|
|
99
53
|
args: [{
|
|
100
|
-
selector: '
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
54
|
+
selector: 'form',
|
|
55
|
+
exportAs: 'bbForm',
|
|
56
|
+
standalone: true
|
|
104
57
|
}]
|
|
105
|
-
}], ctorParameters: () => [{ type:
|
|
58
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.FormGroupDirective, decorators: [{
|
|
106
59
|
type: Optional
|
|
107
60
|
}, {
|
|
108
|
-
type:
|
|
109
|
-
}] }]
|
|
110
|
-
type: Input
|
|
111
|
-
}], onClick: [{
|
|
112
|
-
type: HostListener,
|
|
113
|
-
args: ['click']
|
|
114
|
-
}] } });
|
|
115
|
-
|
|
116
|
-
const ELEMENTS_ICONS = new InjectionToken('elements_icons');
|
|
117
|
-
const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
|
|
61
|
+
type: Self
|
|
62
|
+
}] }] });
|
|
118
63
|
|
|
119
64
|
class BbFormSubmitter {
|
|
120
65
|
constructor() {
|
|
@@ -127,298 +72,98 @@ class BbFormSubmitter {
|
|
|
127
72
|
reset() {
|
|
128
73
|
this.submitted$.next(false);
|
|
129
74
|
}
|
|
130
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
131
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormSubmitter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
76
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbFormSubmitter, isStandalone: true, selector: "[bbFormSubmitter]", exportAs: ["bbFormSubmitter"], ngImport: i0 }); }
|
|
132
77
|
}
|
|
133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormSubmitter, decorators: [{
|
|
134
79
|
type: Directive,
|
|
135
80
|
args: [{
|
|
136
81
|
selector: '[bbFormSubmitter]',
|
|
137
|
-
exportAs: 'bbFormSubmitter'
|
|
82
|
+
exportAs: 'bbFormSubmitter',
|
|
83
|
+
standalone: true
|
|
138
84
|
}]
|
|
139
85
|
}] });
|
|
140
86
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const BbSpinnerMixinBase = mixinDisabled(BbSpinnerBase);
|
|
144
|
-
class BbSpinner extends BbSpinnerMixinBase {
|
|
145
|
-
constructor() {
|
|
146
|
-
super(...arguments);
|
|
147
|
-
// Inputs.
|
|
148
|
-
this.color = '#303f9f';
|
|
149
|
-
this.alt = 'Loading...';
|
|
150
|
-
}
|
|
151
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbSpinner, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
152
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: BbSpinner, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: "disabled" }, host: { classAttribute: "bb-spinner" }, usesInheritance: true, ngImport: i0, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
153
|
-
}
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbSpinner, decorators: [{
|
|
155
|
-
type: Component,
|
|
156
|
-
args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, inputs: ['color', 'alt', 'disabled'], preserveWhitespaces: false, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{color:#565656;padding:20px 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#ffffff26}.bb-spinner.inverse .bb-spinner-content{color:#ffffff80}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:20px;height:20px;min-width:20px;min-height:20px}.bb-spinner.small .bb-spinner-loader{border-width:2px}.bb-spinner.small .bb-spinner-content{font-size:12px}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px}.bb-spinner.medium .bb-spinner-loader{border-width:4px}.bb-spinner.medium .bb-spinner-content{font-size:16px}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:100px;height:100px;min-width:100px;min-height:100px}.bb-spinner.large .bb-spinner-loader{border-width:6px}.bb-spinner.large .bb-spinner-content{font-size:20px}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-left:10px;margin-top:0}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:10px}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:4px solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:60px;height:60px;min-width:60px;min-height:60px;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-size:16px;margin-top:10px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
157
|
-
}], propDecorators: { color: [{
|
|
158
|
-
type: Input
|
|
159
|
-
}], alt: [{
|
|
160
|
-
type: Input
|
|
161
|
-
}] } });
|
|
162
|
-
|
|
163
|
-
class BbButtonBase {
|
|
164
|
-
constructor(_elementRef) {
|
|
165
|
-
this._elementRef = _elementRef;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const BbButtonMixinBase = mixinDisabled(mixinLoad(BbButtonBase));
|
|
169
|
-
class BbButton extends BbButtonMixinBase {
|
|
170
|
-
get nativeElement() {
|
|
171
|
-
return this._elementRef.nativeElement;
|
|
172
|
-
}
|
|
173
|
-
constructor(_elementRef) {
|
|
174
|
-
super(_elementRef);
|
|
175
|
-
}
|
|
176
|
-
focus() {
|
|
177
|
-
this.nativeElement && this.nativeElement.focus();
|
|
178
|
-
}
|
|
179
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
180
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: BbButton, selector: "button[bb-button]", inputs: { disabled: "disabled", loading: "loading" }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
181
|
-
}
|
|
182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbButton, decorators: [{
|
|
183
|
-
type: Component,
|
|
184
|
-
args: [{ selector: 'button[bb-button]', exportAs: 'bbButton', host: {
|
|
185
|
-
'class': 'bb-button',
|
|
186
|
-
'[class.loading]': 'loading',
|
|
187
|
-
'[attr.disabled]': 'disabled || loading || null'
|
|
188
|
-
}, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
|
|
189
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
190
|
-
class BbAnchor extends BbButton {
|
|
191
|
-
constructor(_elementRef) {
|
|
192
|
-
super(_elementRef);
|
|
193
|
-
}
|
|
194
|
-
stopDisabledEvents(event) {
|
|
195
|
-
// If the button is not disabled (and not loading) let all events pass.
|
|
196
|
-
if (!this.disabled && !this.loading) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
// If the button is disabled and/or loading stop
|
|
200
|
-
// the event from bubbling up.
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
event.stopImmediatePropagation();
|
|
203
|
-
}
|
|
204
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
205
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: BbAnchor, selector: "a[bb-button]", inputs: { disabled: "disabled", loading: "loading", tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
206
|
-
}
|
|
207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbAnchor, decorators: [{
|
|
208
|
-
type: Component,
|
|
209
|
-
args: [{ selector: 'a[bb-button]', exportAs: 'bbButton, bbAnchor', host: {
|
|
210
|
-
'class': 'bb-button',
|
|
211
|
-
'[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
|
|
212
|
-
'[attr.disabled]': 'disabled || loading || null',
|
|
213
|
-
'[attr.aria-disabled]': '(disabled || loading).toString()',
|
|
214
|
-
'(click)': 'stopDisabledEvents($event)'
|
|
215
|
-
}, inputs: ['disabled', 'loading'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bb-spinner [class.visible]=\"loading\"\n class=\"bb-button-spinner small\">\n</bb-spinner>\n\n<ng-content></ng-content>\n", styles: [".bb-button{height:38px;padding:0 8px;cursor:pointer;font-size:16px;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;border-radius:4px;text-align:center;align-items:center;display:inline-flex;text-decoration:none;justify-content:center;background-color:#fff;color:#2d3c4d!important;border:1px solid #d4d8e1;transition-duration:.2s;box-shadow:0 6px 6px -6px #0000001a;transition-timing-function:cubic-bezier(0,0,.2,1);transition-property:padding-left,background-color,box-shadow}.bb-button:hover{background-color:#fcfcfb}.bb-button:focus,.bb-button:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #dce0e980}.bb-button.full{width:100%}.bb-button.full.loading{padding-left:42px}.bb-button.primary{border-color:#2f2b85;color:#fff!important;background-color:#5b53ff}.bb-button.primary:hover{background-color:#564ee6}.bb-button.primary:focus,.bb-button.primary:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #5b53ff80}.bb-button.destructive{border-color:#8f2020;color:#fff!important;background-color:#d32f2f}.bb-button.destructive:hover{background-color:#c32929}.bb-button.destructive:focus,.bb-button.destructive:active{box-shadow:0 6px 6px -6px #0000001a,0 0 0 3px #d32f2f80}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{opacity:.4;cursor:default;box-shadow:none}.bb-button-spinner{width:0;opacity:0;overflow:hidden;visibility:hidden;padding:0!important;transition:width .2s cubic-bezier(0,0,.2,1),opacity .1s cubic-bezier(0,0,.2,1)}.bb-button-spinner.visible{opacity:1;width:20px;margin-right:8px;visibility:visible}.bb-button.loading.full>.bb-button-spinner{left:8px;margin-right:0;position:absolute}\n"] }]
|
|
216
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { tabIndex: [{
|
|
217
|
-
type: Input
|
|
218
|
-
}] } });
|
|
87
|
+
const ELEMENTS_ICONS = new InjectionToken('elements_icons');
|
|
88
|
+
const ELEMENTS_ERRORS = new InjectionToken('elements_errors');
|
|
219
89
|
|
|
220
|
-
class
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this._converter = _converter;
|
|
227
|
-
// Inputs.
|
|
228
|
-
this.label = null;
|
|
229
|
-
this.placeholder = null;
|
|
230
|
-
this.styleDimensions = null;
|
|
231
|
-
this.cropDimensions = null;
|
|
232
|
-
// Form.
|
|
233
|
-
this._value$ = new BehaviorSubject(null);
|
|
234
|
-
this.valueChange = new EventEmitter();
|
|
235
|
-
this.onTouchedCallback = () => {
|
|
236
|
-
};
|
|
237
|
-
this.onChangeCallback = () => {
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
get value() {
|
|
241
|
-
return this._value$.getValue();
|
|
242
|
-
}
|
|
243
|
-
set value(value) {
|
|
244
|
-
this._value$.next(value);
|
|
245
|
-
this.valueChange.emit(value);
|
|
90
|
+
class BbExtraErrorControls {
|
|
91
|
+
constructor() {
|
|
92
|
+
// State.
|
|
93
|
+
this.changes = new BehaviorSubject(null);
|
|
94
|
+
// Subscriptions.
|
|
95
|
+
this._subscription = null;
|
|
246
96
|
}
|
|
247
|
-
|
|
248
|
-
|
|
97
|
+
set extraControls(controls) {
|
|
98
|
+
this.handle(controls);
|
|
249
99
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const file = event.target.files[0];
|
|
253
|
-
// Check if the file exists.
|
|
254
|
-
if (!file || this.disabled) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
try {
|
|
258
|
-
this.value = await this._converter.toDataUri(file, this.cropDimensions);
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
this.value = null;
|
|
262
|
-
}
|
|
263
|
-
this.onChangeCallback(this.value);
|
|
264
|
-
if (this.fileInput && this.fileInput.nativeElement) {
|
|
265
|
-
this.fileInput.nativeElement.value = '';
|
|
266
|
-
}
|
|
100
|
+
ngOnDestroy() {
|
|
101
|
+
this._subscription?.unsubscribe();
|
|
267
102
|
}
|
|
268
|
-
|
|
269
|
-
|
|
103
|
+
handle(controls) {
|
|
104
|
+
this._subscription?.unsubscribe();
|
|
105
|
+
if (controls.length <= 0) {
|
|
270
106
|
return;
|
|
271
107
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
writeValue(value) {
|
|
279
|
-
this.value = value;
|
|
280
|
-
}
|
|
281
|
-
registerOnChange(method) {
|
|
282
|
-
this.onChangeCallback = method;
|
|
283
|
-
}
|
|
284
|
-
registerOnTouched(method) {
|
|
285
|
-
this.onTouchedCallback = method;
|
|
286
|
-
}
|
|
287
|
-
setDisabledState(isDisabled) {
|
|
288
|
-
this.disabled = isDisabled;
|
|
289
|
-
}
|
|
290
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
291
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: BbImagePicker, selector: "bb-image-picker", inputs: { grouped: "grouped", disabled: "disabled", label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:#0003 url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
292
|
-
}
|
|
293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbImagePicker, decorators: [{
|
|
294
|
-
type: Component,
|
|
295
|
-
args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
296
|
-
'class': 'bb-image-picker',
|
|
297
|
-
'[class.disabled]': 'disabled',
|
|
298
|
-
'[class.grouped]': 'grouped'
|
|
299
|
-
}, inputs: ['grouped', 'disabled'], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbImagePicker), multi: true }], preserveWhitespaces: false, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n<button *ngIf=\"label as labelText\"\n (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n</button>\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:20px}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;border-radius:4px;align-items:center;justify-content:center;background:#0003 url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:10px}\n"] }]
|
|
300
|
-
}], ctorParameters: () => [{ type: i1$1.ImageConverter }], propDecorators: { fileInput: [{
|
|
301
|
-
type: ViewChild,
|
|
302
|
-
args: ['fileInput', { static: true }]
|
|
303
|
-
}], label: [{
|
|
304
|
-
type: Input
|
|
305
|
-
}], placeholder: [{
|
|
306
|
-
type: Input
|
|
307
|
-
}], styleDimensions: [{
|
|
308
|
-
type: Input
|
|
309
|
-
}], cropDimensions: [{
|
|
310
|
-
type: Input
|
|
311
|
-
}], value: [{
|
|
312
|
-
type: Input
|
|
313
|
-
}], valueChange: [{
|
|
314
|
-
type: Output
|
|
315
|
-
}] } });
|
|
316
|
-
|
|
317
|
-
class BbFormSubmit {
|
|
318
|
-
constructor(_host, _formDirective) {
|
|
319
|
-
this._host = _host;
|
|
320
|
-
this._formDirective = _formDirective;
|
|
321
|
-
}
|
|
322
|
-
ngOnInit() {
|
|
323
|
-
// Submit changes.
|
|
324
|
-
const regularSubmitChanges$ = fromEvent(this.nativeElement, 'submit').pipe(map(() => true));
|
|
325
|
-
// Reactive form submit changes.
|
|
326
|
-
const reactiveSubmitChanges$ = this.reactiveSubmitChanges();
|
|
327
|
-
// Reset changes.
|
|
328
|
-
const resetChanges$ = fromEvent(this.nativeElement, 'reset').pipe(map(() => false));
|
|
329
|
-
// Listen to the submit status.
|
|
330
|
-
this.submitStatus$ = merge(regularSubmitChanges$, reactiveSubmitChanges$, resetChanges$).pipe(startWith(false), distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
331
|
-
}
|
|
332
|
-
submit() {
|
|
333
|
-
this._formDirective?.ngSubmit?.emit();
|
|
334
|
-
}
|
|
335
|
-
reset() {
|
|
336
|
-
return this.nativeElement?.reset();
|
|
337
|
-
}
|
|
338
|
-
get nativeElement() {
|
|
339
|
-
return this._host?.nativeElement;
|
|
340
|
-
}
|
|
341
|
-
reactiveSubmitChanges() {
|
|
342
|
-
if (!this._formDirective) {
|
|
343
|
-
return EMPTY;
|
|
344
|
-
}
|
|
345
|
-
return this._formDirective.ngSubmit.pipe(map(() => true));
|
|
108
|
+
const validationErrors$ = controls.map(control => {
|
|
109
|
+
return control.valueChanges.pipe(map(_ => control?.errors));
|
|
110
|
+
});
|
|
111
|
+
const errors$ = combineLatest(validationErrors$).pipe(map(validationErrors => validationErrors.find(error => !!error)), distinctUntilChanged());
|
|
112
|
+
this._subscription = errors$
|
|
113
|
+
.subscribe(errors => this.changes.next(errors ?? null));
|
|
346
114
|
}
|
|
347
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
348
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbExtraErrorControls, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
116
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbExtraErrorControls, isStandalone: true, selector: "[bbExtraErrorControls]", inputs: { extraControls: ["bbExtraErrorControls", "extraControls"] }, ngImport: i0 }); }
|
|
349
117
|
}
|
|
350
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbExtraErrorControls, decorators: [{
|
|
351
119
|
type: Directive,
|
|
352
120
|
args: [{
|
|
353
|
-
selector: '
|
|
354
|
-
|
|
121
|
+
selector: '[bbExtraErrorControls]',
|
|
122
|
+
standalone: true
|
|
355
123
|
}]
|
|
356
|
-
}],
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}] }] });
|
|
124
|
+
}], propDecorators: { extraControls: [{
|
|
125
|
+
type: Input,
|
|
126
|
+
args: [{ alias: 'bbExtraErrorControls' }]
|
|
127
|
+
}] } });
|
|
361
128
|
|
|
362
129
|
class BbFormError {
|
|
363
|
-
|
|
364
|
-
set control(value) {
|
|
365
|
-
this._ngControl = value;
|
|
366
|
-
}
|
|
367
|
-
get control() {
|
|
368
|
-
return this._ngControl;
|
|
369
|
-
}
|
|
370
|
-
constructor(_form, _control, _formSubmitter, _errors) {
|
|
130
|
+
constructor(_form, _ngControl, _formSubmitter, _extraErrorControls, _errors) {
|
|
371
131
|
this._form = _form;
|
|
372
|
-
this.
|
|
132
|
+
this._ngControl = _ngControl;
|
|
373
133
|
this._formSubmitter = _formSubmitter;
|
|
134
|
+
this._extraErrorControls = _extraErrorControls;
|
|
374
135
|
this._errors = _errors;
|
|
136
|
+
// Readonly data.
|
|
137
|
+
this.errorsMap = this._errors.reduce((previous, current) => ({ ...previous, ...current }), {});
|
|
138
|
+
// Inputs.
|
|
139
|
+
this.control = null;
|
|
375
140
|
// Outputs.
|
|
376
141
|
this.errorChange = new EventEmitter();
|
|
377
|
-
// Subscriptions.
|
|
378
|
-
this._ngControl = null;
|
|
379
142
|
}
|
|
380
143
|
ngOnInit() {
|
|
381
|
-
|
|
144
|
+
this.setControl();
|
|
145
|
+
this.setError();
|
|
146
|
+
}
|
|
147
|
+
setControl() {
|
|
382
148
|
if (!this.control) {
|
|
383
|
-
this.control = this.
|
|
149
|
+
this.control = this._ngControl;
|
|
384
150
|
}
|
|
385
|
-
|
|
151
|
+
}
|
|
152
|
+
setError() {
|
|
386
153
|
const submitStatus$ = this.submitStatusChanges();
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
// Whenever the user submitted the form we want to
|
|
390
|
-
// listen for any error changes.
|
|
391
|
-
this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => {
|
|
392
|
-
// If not submitted return null.
|
|
393
|
-
if (!submitted) {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
// Return the error if submitted.
|
|
397
|
-
return error;
|
|
398
|
-
}), tap(value => this.errorChange.emit(value)));
|
|
154
|
+
const errorChanges$ = this.getErrors().pipe(map(errors => this.formatError(errors)), distinctUntilChanged(), map(error => typeof error === 'string' ? { token: error } : error));
|
|
155
|
+
this.error$ = combineLatest([submitStatus$, errorChanges$]).pipe(map(([submitted, error]) => submitted ? error : null), tap(value => this.errorChange.emit(value)));
|
|
399
156
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return null;
|
|
404
|
-
}
|
|
405
|
-
// Get the first error in the errors.
|
|
406
|
-
const [errorName] = Object.keys(errors);
|
|
407
|
-
const error = errors[errorName];
|
|
408
|
-
// Validate the error exists.
|
|
157
|
+
formatError(errors) {
|
|
158
|
+
const [errorName] = Object.keys(errors ?? {});
|
|
159
|
+
const error = errors?.[errorName];
|
|
409
160
|
if (!error) {
|
|
410
161
|
return null;
|
|
411
162
|
}
|
|
412
|
-
|
|
413
|
-
// access the functions by a key-lookup.
|
|
414
|
-
const errorFunctions = this._errors.reduce((previous, current) => ({ ...previous, ...current }), {});
|
|
415
|
-
// Get the error function.
|
|
416
|
-
const errorFunction = errorFunctions[errorName] || errorFunctions['unknown'];
|
|
417
|
-
// Validate the error function exists.
|
|
163
|
+
const errorFunction = this.errorsMap?.[errorName] ?? this.errorsMap?.['unknown'];
|
|
418
164
|
if (!errorFunction) {
|
|
419
165
|
return null;
|
|
420
166
|
}
|
|
421
|
-
// Return the parsed error.
|
|
422
167
|
return errorFunction(error);
|
|
423
168
|
}
|
|
424
169
|
submitStatusChanges() {
|
|
@@ -438,29 +183,25 @@ class BbFormError {
|
|
|
438
183
|
}
|
|
439
184
|
return this._formSubmitter.submitted$.pipe(distinctUntilChanged());
|
|
440
185
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (!this.control.statusChanges) {
|
|
446
|
-
return EMPTY;
|
|
447
|
-
}
|
|
448
|
-
return this.control.statusChanges.pipe(startWith(this.control.status), delay(0));
|
|
186
|
+
getErrors() {
|
|
187
|
+
const error$ = (this.control?.statusChanges ?? of(null)).pipe(startWith(this.control?.status), map(_ => this.control?.errors ?? null), delay(0));
|
|
188
|
+
const extraError$ = this._extraErrorControls?.changes?.asObservable() ?? of(null);
|
|
189
|
+
return combineLatest([error$, extraError$]).pipe(map(([error, extraError]) => error ?? extraError ?? null), distinctUntilChanged());
|
|
449
190
|
}
|
|
450
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
451
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
191
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormError, deps: [{ token: BbFormSubmit, optional: true }, { token: i1.NgControl, optional: true }, { token: BbFormSubmitter, optional: true }, { token: BbExtraErrorControls, optional: true }, { token: ELEMENTS_ERRORS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
192
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbFormError, isStandalone: true, selector: "bb-form-error", inputs: { control: "control" }, outputs: { errorChange: "errorChange" }, host: { classAttribute: "bb-form-error" }, ngImport: i0, template: "@if (error$ | async; as error) {\n @if (error?.token | bbLocalize:{optional: true, data: error?.data}; as message) {\n <p class=\"bb-form-error-message\">{{ message }}</p>\n }\n}\n", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: BbLocalize, name: "bbLocalize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
452
193
|
}
|
|
453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormError, decorators: [{
|
|
454
195
|
type: Component,
|
|
455
|
-
args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
456
|
-
'class': 'bb-form-error'
|
|
457
|
-
}, preserveWhitespaces: false, template: "<ng-container *ngIf=\"error$ | async as error\">\n <p *ngIf=\"error?.token | bbLocalize:{optional: true, data: error?.data} as message\"\n class=\"bb-form-error-message\">\n {{ message }}\n </p>\n</ng-container>", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;font-size:13px;margin-top:4px}\n"] }]
|
|
196
|
+
args: [{ selector: 'bb-form-error', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-form-error' }, preserveWhitespaces: false, standalone: true, imports: [AsyncPipe, BbLocalize], template: "@if (error$ | async; as error) {\n @if (error?.token | bbLocalize:{optional: true, data: error?.data}; as message) {\n <p class=\"bb-form-error-message\">{{ message }}</p>\n }\n}\n", styles: [".bb-form-error{display:block}.bb-form-error-message{color:#c23934;display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem}\n"] }]
|
|
458
197
|
}], ctorParameters: () => [{ type: BbFormSubmit, decorators: [{
|
|
459
198
|
type: Optional
|
|
460
|
-
}] }, { type:
|
|
199
|
+
}] }, { type: i1.NgControl, decorators: [{
|
|
461
200
|
type: Optional
|
|
462
201
|
}] }, { type: BbFormSubmitter, decorators: [{
|
|
463
202
|
type: Optional
|
|
203
|
+
}] }, { type: BbExtraErrorControls, decorators: [{
|
|
204
|
+
type: Optional
|
|
464
205
|
}] }, { type: undefined, decorators: [{
|
|
465
206
|
type: Optional
|
|
466
207
|
}, {
|
|
@@ -472,39 +213,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
472
213
|
type: Output
|
|
473
214
|
}] } });
|
|
474
215
|
|
|
475
|
-
let nextUniqueId$
|
|
476
|
-
class
|
|
477
|
-
}
|
|
478
|
-
const BbFormControlMixinBase = mixinDisabled(mixinFocused(mixinReadonly(mixinGrouped(mixinRequired(mixinError(mixinHideErrors(BbFormControlBase)))))));
|
|
479
|
-
class BbFormControl extends BbFormControlMixinBase {
|
|
216
|
+
let nextUniqueId$3 = 0;
|
|
217
|
+
class BbFormControl {
|
|
480
218
|
constructor() {
|
|
481
|
-
|
|
219
|
+
// Readonly data.
|
|
220
|
+
this.labelId = `bb-form-control-${nextUniqueId$3++}`;
|
|
482
221
|
// Inputs.
|
|
483
222
|
this.label = null;
|
|
484
223
|
this.hint = null;
|
|
485
|
-
|
|
486
|
-
this.
|
|
487
|
-
//
|
|
488
|
-
this.
|
|
224
|
+
this.grouped = false;
|
|
225
|
+
this.hideErrors = false;
|
|
226
|
+
// State.
|
|
227
|
+
this.error = false;
|
|
489
228
|
}
|
|
490
229
|
onErrorChange(error) {
|
|
491
230
|
this.error = !!error;
|
|
492
231
|
}
|
|
493
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
494
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormControl, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
233
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbFormControl, isStandalone: true, selector: "bb-form-control", inputs: { label: "label", hint: "hint", grouped: ["grouped", "grouped", booleanAttribute], hideErrors: ["hideErrors", "hideErrors", booleanAttribute] }, host: { properties: { "class.grouped": "grouped", "class.error": "error" }, classAttribute: "bb-form-control" }, queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true }], ngImport: i0, template: "<!-- Label of the form control. -->\n@if (label; as labelContent) {\n <label [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n@if (!hideErrors) {\n <bb-form-error [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n </bb-form-error>\n}\n\n<!-- The form control hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-form-control{color:#111;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control>.bb-form-control-container>*.bb-prefix{margin-left:.5rem}.bb-form-control>.bb-form-control-container>*.bb-suffix{margin-right:.5rem}.bb-form-control.grouped{margin-bottom:1.5rem}.bb-form-control.small{max-width:15rem}.bb-form-control.medium{max-width:30rem}.bb-form-control.large{max-width:45rem}.bb-form-control:has(input:required,textarea:required,select:required)>.bb-form-control-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,textarea:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){border-color:#757e8a;box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-form-control-box-shadow)}.bb-form-control-container:has(input:not(:disabled):read-only,textarea:not(:disabled):read-only){cursor:default;border-style:dotted;border-color:#bdc4c9}.bb-form-control-container:has(input:disabled,textarea:disabled,select:disabled){cursor:default;pointer-events:none;color:gray;background-color:#e6e6e6}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#b51c1c}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#ea7b7b}.bb-form-control.error>.bb-form-control-container,.bb-form-control.error>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,textarea:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){border:1px solid hsl(0,73%,30%);background-color:#f8d3d3;box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-form-control-container:has(select):after{top:0;right:0;bottom:0;content:\"\";width:1.5rem;display:flex;height:2.5rem;min-width:1.5rem;position:absolute;pointer-events:none;background-repeat:no-repeat;background-size:.75rem .375rem;background-position:calc(100% - .5rem) center;background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 6\"%3E%3Cpath fill=\"%23D8D8D8\" fill-rule=\"evenodd\" d=\"m6 6 6-6H0z\"/%3E%3C/svg%3E')}.bb-form-control-container{width:100%;display:flex;color:#111;overflow:hidden;position:relative;align-items:center;border-radius:.5rem;background-color:#fff;transition-duration:.25s;border:1px solid hsl(213,8%,74%);transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d1d1d1;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:inherit;font-size:1rem;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:2.5rem;padding:0 .5rem}.bb-form-control-container>select{padding-right:2rem}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:.5rem}.bb-form-control-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-form-control-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
495
234
|
}
|
|
496
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormControl, decorators: [{
|
|
497
236
|
type: Component,
|
|
498
237
|
args: [{ selector: 'bb-form-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
499
238
|
'class': 'bb-form-control',
|
|
500
|
-
'[class.readonly]': 'readonly',
|
|
501
|
-
'[class.required]': 'required',
|
|
502
|
-
'[class.disabled]': 'disabled',
|
|
503
|
-
'[class.focused]': 'focused',
|
|
504
239
|
'[class.grouped]': 'grouped',
|
|
505
|
-
'[class.arrow]': 'arrow',
|
|
506
240
|
'[class.error]': 'error'
|
|
507
|
-
},
|
|
241
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbTemplate, BbFormError], template: "<!-- Label of the form control. -->\n@if (label; as labelContent) {\n <label [attr.for]=\"labelId\"\n class=\"bb-form-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<!-- The input with the addons. -->\n<div class=\"bb-form-control-container\">\n <ng-content select=\"[bbPrefix]\"></ng-content>\n <ng-content select=\"[bbInput]\"></ng-content>\n <ng-content select=\"[bbSuffix]\"></ng-content>\n</div>\n\n<!-- The error component. -->\n@if (!hideErrors) {\n <bb-form-error [control]=\"ngControl\"\n (errorChange)=\"onErrorChange($event)\">\n </bb-form-error>\n}\n\n<!-- The form control hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-form-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-form-control{color:#111;display:block}.bb-form-control>.bb-form-control-container>*.bb-prefix,.bb-form-control>.bb-form-control-container>*.bb-suffix{color:#b4b4b4;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control>.bb-form-control-container>*.bb-prefix{margin-left:.5rem}.bb-form-control>.bb-form-control-container>*.bb-suffix{margin-right:.5rem}.bb-form-control.grouped{margin-bottom:1.5rem}.bb-form-control.small{max-width:15rem}.bb-form-control.medium{max-width:30rem}.bb-form-control.large{max-width:45rem}.bb-form-control:has(input:required,textarea:required,select:required)>.bb-form-control-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,textarea:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){border-color:#757e8a;box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-form-control-box-shadow)}.bb-form-control-container:has(input:not(:disabled):read-only,textarea:not(:disabled):read-only){cursor:default;border-style:dotted;border-color:#bdc4c9}.bb-form-control-container:has(input:disabled,textarea:disabled,select:disabled){cursor:default;pointer-events:none;color:gray;background-color:#e6e6e6}.bb-form-control.error>.bb-form-control-label{color:#c23934}.bb-form-control.error>.bb-form-control-hint{display:none}.bb-form-control.error>.bb-form-control-container>*.bb-prefix,.bb-form-control.error>.bb-form-control-container>.bb-suffix{color:#b51c1c}.bb-form-control.error>.bb-form-control-container>input::placeholder,.bb-form-control.error>.bb-form-control-container>textarea::placeholder{color:#ea7b7b}.bb-form-control.error>.bb-form-control-container,.bb-form-control.error>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,textarea:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){border:1px solid hsl(0,73%,30%);background-color:#f8d3d3;box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-form-control-container:has(select):after{top:0;right:0;bottom:0;content:\"\";width:1.5rem;display:flex;height:2.5rem;min-width:1.5rem;position:absolute;pointer-events:none;background-repeat:no-repeat;background-size:.75rem .375rem;background-position:calc(100% - .5rem) center;background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 6\"%3E%3Cpath fill=\"%23D8D8D8\" fill-rule=\"evenodd\" d=\"m6 6 6-6H0z\"/%3E%3C/svg%3E')}.bb-form-control-container{width:100%;display:flex;color:#111;overflow:hidden;position:relative;align-items:center;border-radius:.5rem;background-color:#fff;transition-duration:.25s;border:1px solid hsl(213,8%,74%);transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-form-control-container>input::placeholder,.bb-form-control-container>textarea::placeholder{color:#d1d1d1;transition:color .3s cubic-bezier(0,0,.2,1)}.bb-form-control-container>input,.bb-form-control-container>textarea,.bb-form-control-container>select{margin:0;width:100%;border:none;color:inherit;font-size:1rem;appearance:none;background-color:transparent}.bb-form-control-container>input,.bb-form-control-container>select{height:2.5rem;padding:0 .5rem}.bb-form-control-container>select{padding-right:2rem}.bb-form-control-container>select>::-ms-expand{display:none}.bb-form-control-container>input::-ms-clear,.bb-form-control-container>input::-ms-reveal{width:0;height:0;display:none}.bb-form-control-container>input::-webkit-search-decoration,.bb-form-control-container>input::-webkit-search-cancel-button,.bb-form-control-container>input::-webkit-search-results-button,.bb-form-control-container>input::-webkit-search-results-decoration{display:none}.bb-form-control-container>textarea{resize:none;padding:.5rem}.bb-form-control-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-form-control-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"] }]
|
|
508
242
|
}], propDecorators: { ngControl: [{
|
|
509
243
|
type: ContentChild,
|
|
510
244
|
args: [NgControl]
|
|
@@ -512,8 +246,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImpor
|
|
|
512
246
|
type: Input
|
|
513
247
|
}], hint: [{
|
|
514
248
|
type: Input
|
|
249
|
+
}], grouped: [{
|
|
250
|
+
type: Input,
|
|
251
|
+
args: [{ transform: booleanAttribute }]
|
|
252
|
+
}], hideErrors: [{
|
|
253
|
+
type: Input,
|
|
254
|
+
args: [{ transform: booleanAttribute }]
|
|
255
|
+
}] } });
|
|
256
|
+
|
|
257
|
+
class BbInput {
|
|
258
|
+
constructor(_elementRef, _formControl) {
|
|
259
|
+
this._elementRef = _elementRef;
|
|
260
|
+
this._formControl = _formControl;
|
|
261
|
+
this._required = false;
|
|
262
|
+
}
|
|
263
|
+
focus() {
|
|
264
|
+
return this._elementRef?.nativeElement?.focus();
|
|
265
|
+
}
|
|
266
|
+
get id() {
|
|
267
|
+
return this._formControl?.labelId ?? null;
|
|
268
|
+
}
|
|
269
|
+
get required() {
|
|
270
|
+
const hasValidator = this._formControl?.ngControl?.control?.hasValidator(Validators.required);
|
|
271
|
+
return hasValidator || this._required === true ? true : null;
|
|
272
|
+
}
|
|
273
|
+
set required(value) {
|
|
274
|
+
this._required = value;
|
|
275
|
+
}
|
|
276
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbInput, deps: [{ token: i0.ElementRef }, { token: BbFormControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
277
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.5", type: BbInput, isStandalone: true, selector: "input[bbInput],textarea[bbInput],select[bbInput]", inputs: { required: ["required", "required", booleanAttribute] }, host: { properties: { "attr.id": "this.id", "attr.required": "this.required" } }, ngImport: i0 }); }
|
|
278
|
+
}
|
|
279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbInput, decorators: [{
|
|
280
|
+
type: Directive,
|
|
281
|
+
args: [{
|
|
282
|
+
selector: 'input[bbInput],textarea[bbInput],select[bbInput]',
|
|
283
|
+
standalone: true
|
|
284
|
+
}]
|
|
285
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: BbFormControl, decorators: [{
|
|
286
|
+
type: Optional
|
|
287
|
+
}, {
|
|
288
|
+
type: Host
|
|
289
|
+
}] }], propDecorators: { id: [{
|
|
290
|
+
type: HostBinding,
|
|
291
|
+
args: ['attr.id']
|
|
292
|
+
}], required: [{
|
|
293
|
+
type: Input,
|
|
294
|
+
args: [{ transform: booleanAttribute }]
|
|
295
|
+
}, {
|
|
296
|
+
type: HostBinding,
|
|
297
|
+
args: ['attr.required']
|
|
515
298
|
}] } });
|
|
516
299
|
|
|
300
|
+
class BbSuffix {
|
|
301
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbSuffix, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
302
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbSuffix, isStandalone: true, selector: "[bbSuffix]", host: { classAttribute: "bb-suffix" }, ngImport: i0 }); }
|
|
303
|
+
}
|
|
304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbSuffix, decorators: [{
|
|
305
|
+
type: Directive,
|
|
306
|
+
args: [{
|
|
307
|
+
selector: '[bbSuffix]',
|
|
308
|
+
host: { 'class': 'bb-suffix' },
|
|
309
|
+
standalone: true
|
|
310
|
+
}]
|
|
311
|
+
}] });
|
|
312
|
+
class BbPrefix {
|
|
313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbPrefix, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
314
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BbPrefix, isStandalone: true, selector: "[bbPrefix]", host: { classAttribute: "bb-prefix" }, ngImport: i0 }); }
|
|
315
|
+
}
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbPrefix, decorators: [{
|
|
317
|
+
type: Directive,
|
|
318
|
+
args: [{
|
|
319
|
+
selector: '[bbPrefix]',
|
|
320
|
+
host: { 'class': 'bb-prefix' },
|
|
321
|
+
standalone: true
|
|
322
|
+
}]
|
|
323
|
+
}] });
|
|
324
|
+
|
|
517
325
|
class BbImageUpload {
|
|
518
326
|
constructor(_files, _platform, _renderer) {
|
|
519
327
|
this._files = _files;
|
|
@@ -620,15 +428,16 @@ class BbImageUpload {
|
|
|
620
428
|
return 'image';
|
|
621
429
|
}
|
|
622
430
|
}
|
|
623
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
624
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.
|
|
431
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbImageUpload, deps: [{ token: i1$1.Files }, { token: i2.Platform }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
432
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.0.5", type: BbImageUpload, isStandalone: true, selector: "button[bbImageUpload]", inputs: { width: ["bbImageUploadWidth", "width", numberAttribute], height: ["bbImageUploadHeight", "height", numberAttribute], mode: ["bbImageUploadMode", "mode"], type: ["bbImageUploadType", "type"] }, outputs: { onDataUri: "onDataUri", onFile: "onFile" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
625
433
|
}
|
|
626
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
434
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbImageUpload, decorators: [{
|
|
627
435
|
type: Directive,
|
|
628
436
|
args: [{
|
|
629
|
-
selector: 'button[bbImageUpload]'
|
|
437
|
+
selector: 'button[bbImageUpload]',
|
|
438
|
+
standalone: true
|
|
630
439
|
}]
|
|
631
|
-
}], ctorParameters: () => [{ type: i1$1.Files }, { type: i2
|
|
440
|
+
}], ctorParameters: () => [{ type: i1$1.Files }, { type: i2.Platform }, { type: i0.Renderer2 }], propDecorators: { width: [{
|
|
632
441
|
type: Input,
|
|
633
442
|
args: [{ alias: 'bbImageUploadWidth', transform: numberAttribute }]
|
|
634
443
|
}], height: [{
|
|
@@ -665,13 +474,14 @@ class BbFileSize {
|
|
|
665
474
|
transform(value) {
|
|
666
475
|
return this.format(value);
|
|
667
476
|
}
|
|
668
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
669
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.
|
|
477
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFileSize, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
478
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: BbFileSize, isStandalone: true, name: "bbFileSize" }); }
|
|
670
479
|
}
|
|
671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
480
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFileSize, decorators: [{
|
|
672
481
|
type: Pipe,
|
|
673
482
|
args: [{
|
|
674
|
-
name: 'bbFileSize'
|
|
483
|
+
name: 'bbFileSize',
|
|
484
|
+
standalone: true
|
|
675
485
|
}]
|
|
676
486
|
}] });
|
|
677
487
|
|
|
@@ -704,467 +514,839 @@ class BbFileImage {
|
|
|
704
514
|
return null;
|
|
705
515
|
});
|
|
706
516
|
}
|
|
707
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
708
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.
|
|
517
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFileImage, deps: [{ token: i2.Platform }, { token: i1$1.ImageConverter }, { token: i3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
518
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: BbFileImage, isStandalone: true, name: "bbFileImage" }); }
|
|
709
519
|
}
|
|
710
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
520
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFileImage, decorators: [{
|
|
711
521
|
type: Pipe,
|
|
712
522
|
args: [{
|
|
713
|
-
name: 'bbFileImage'
|
|
523
|
+
name: 'bbFileImage',
|
|
524
|
+
standalone: true
|
|
714
525
|
}]
|
|
715
|
-
}], ctorParameters: () => [{ type: i2
|
|
526
|
+
}], ctorParameters: () => [{ type: i2.Platform }, { type: i1$1.ImageConverter }, { type: i3.DomSanitizer }] });
|
|
716
527
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.label = null;
|
|
726
|
-
this.hint = null;
|
|
727
|
-
this.accept = null;
|
|
728
|
-
this.showImages = true;
|
|
729
|
-
this.allowDragging = true;
|
|
730
|
-
// State.
|
|
731
|
-
this.labelId = `bb-file-picker-${nextUniqueId$1++}`;
|
|
732
|
-
this.hovered = false;
|
|
733
|
-
this.value$ = new BehaviorSubject({});
|
|
734
|
-
this.valueChange = new EventEmitter();
|
|
735
|
-
this.onTouchedCallback = () => {
|
|
736
|
-
};
|
|
737
|
-
this.onChangeCallback = () => {
|
|
528
|
+
class BbRelativeTime {
|
|
529
|
+
constructor(_localeId, _localize) {
|
|
530
|
+
this._localeId = _localeId;
|
|
531
|
+
this._localize = _localize;
|
|
532
|
+
this.isValidDate = (date) => {
|
|
533
|
+
return typeof date === 'object' &&
|
|
534
|
+
typeof date.getTime === 'function' &&
|
|
535
|
+
!isNaN(date.getTime());
|
|
738
536
|
};
|
|
739
|
-
this.
|
|
740
|
-
//
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
// Retrieve the first file.
|
|
745
|
-
const file = files[0];
|
|
746
|
-
// Validate the first file exists.
|
|
747
|
-
if (!file) {
|
|
748
|
-
return;
|
|
537
|
+
this.parseAsDate = (value) => {
|
|
538
|
+
// Add a Z after the date so
|
|
539
|
+
// it is treated as a UTC date.
|
|
540
|
+
if (typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(value)) {
|
|
541
|
+
return new Date(`${value}Z`);
|
|
749
542
|
}
|
|
750
|
-
//
|
|
751
|
-
|
|
543
|
+
// Return the regular parsed date.
|
|
544
|
+
return new Date(value);
|
|
752
545
|
};
|
|
753
|
-
this.
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return element.files;
|
|
546
|
+
this.isToday = (date) => {
|
|
547
|
+
const today = new Date();
|
|
548
|
+
return date?.getDate() === today?.getDate() &&
|
|
549
|
+
date?.getMonth() === today?.getMonth() &&
|
|
550
|
+
date?.getFullYear() === today?.getFullYear();
|
|
759
551
|
};
|
|
760
|
-
this.
|
|
761
|
-
|
|
762
|
-
|
|
552
|
+
this.isYesterday = (date) => {
|
|
553
|
+
const yesterday = new Date(new Date()?.setDate(new Date()?.getDate() - 1));
|
|
554
|
+
return date?.getDate() === yesterday?.getDate() &&
|
|
555
|
+
date?.getMonth() === yesterday?.getMonth() &&
|
|
556
|
+
date?.getFullYear() === yesterday?.getFullYear();
|
|
557
|
+
};
|
|
558
|
+
this.isTomorrow = (date) => {
|
|
559
|
+
const tomorrow = new Date(new Date()?.setDate(new Date()?.getDate() + 1));
|
|
560
|
+
return date?.getDate() === tomorrow?.getDate() &&
|
|
561
|
+
date?.getMonth() === tomorrow?.getMonth() &&
|
|
562
|
+
date?.getFullYear() === tomorrow?.getFullYear();
|
|
763
563
|
};
|
|
764
564
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this.valueChange.emit(value);
|
|
772
|
-
}
|
|
773
|
-
onDrag(event, isHovered) {
|
|
774
|
-
// Validate the input can support drag.
|
|
775
|
-
if (!this.allowDragging || this.disabled) {
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
// Prevent the default event action
|
|
779
|
-
// and start the hovering.
|
|
780
|
-
this.preventDefault(event);
|
|
781
|
-
this.hovered = isHovered;
|
|
782
|
-
}
|
|
783
|
-
onDrop(event) {
|
|
784
|
-
// Validate the input can support drag.
|
|
785
|
-
if (!this.allowDragging || this.disabled) {
|
|
786
|
-
return;
|
|
565
|
+
transform(value) {
|
|
566
|
+
// Parse the value to a date object.
|
|
567
|
+
const date = this.parseAsDate(value);
|
|
568
|
+
// Check if the date is valid.
|
|
569
|
+
if (!this.isValidDate(date)) {
|
|
570
|
+
return value;
|
|
787
571
|
}
|
|
788
|
-
//
|
|
789
|
-
|
|
790
|
-
this.preventDefault(event);
|
|
791
|
-
this.hovered = false;
|
|
792
|
-
// Save the file.
|
|
793
|
-
this.saveFile(event['dataTransfer'].files);
|
|
794
|
-
// Run the on change callback.
|
|
795
|
-
this.onChangeCallback(this.value);
|
|
572
|
+
// Return the formatted date.
|
|
573
|
+
return this.format(date);
|
|
796
574
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
this.
|
|
801
|
-
return;
|
|
575
|
+
format(date) {
|
|
576
|
+
// It happens tomorrow.
|
|
577
|
+
if (this.isTomorrow(date)) {
|
|
578
|
+
return this.formatString(date, 'times.tomorrow_at', 'shortTime');
|
|
802
579
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
return this.fileInput
|
|
807
|
-
&& this.fileInput.nativeElement
|
|
808
|
-
&& this.fileInput.nativeElement.click
|
|
809
|
-
&& this.fileInput.nativeElement.click();
|
|
810
|
-
}
|
|
811
|
-
onFileChange(event) {
|
|
812
|
-
// Validate the input is not disabled.
|
|
813
|
-
if (this.disabled) {
|
|
814
|
-
return;
|
|
580
|
+
// It happened today.
|
|
581
|
+
if (this.isToday(date)) {
|
|
582
|
+
return this.formatString(date, 'times.today_at', 'shortTime');
|
|
815
583
|
}
|
|
816
|
-
//
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
this.saveFile(fileList);
|
|
820
|
-
// Run the on change callback.
|
|
821
|
-
this.onChangeCallback(this.value);
|
|
822
|
-
// Clear the file input.
|
|
823
|
-
if (this.fileInput && this.fileInput.nativeElement) {
|
|
824
|
-
this.fileInput.nativeElement.value = '';
|
|
584
|
+
// It happened yesterday.
|
|
585
|
+
if (this.isYesterday(date)) {
|
|
586
|
+
return this.formatString(date, 'times.yesterday_at', 'shortTime');
|
|
825
587
|
}
|
|
588
|
+
// Just return the date.
|
|
589
|
+
return this.formatString(date);
|
|
826
590
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
591
|
+
formatString(date, token, format) {
|
|
592
|
+
// Just return the parsed date.
|
|
593
|
+
if (!this._localize || !token || !format) {
|
|
594
|
+
return formatDate(date, 'mediumDate', this.locale);
|
|
595
|
+
}
|
|
596
|
+
// Return the translated formatting.
|
|
597
|
+
return this._localize.translate({
|
|
598
|
+
token: token,
|
|
599
|
+
data: { date: formatDate(date, format, this.locale) }
|
|
600
|
+
});
|
|
835
601
|
}
|
|
836
|
-
|
|
837
|
-
this.
|
|
602
|
+
get locale() {
|
|
603
|
+
return this._localize?.current?.locale ?? this._localeId;
|
|
838
604
|
}
|
|
839
|
-
|
|
840
|
-
|
|
605
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRelativeTime, deps: [{ token: LOCALE_ID }, { token: i1$2.Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
606
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: BbRelativeTime, isStandalone: true, name: "bbRelativeTime" }); }
|
|
607
|
+
}
|
|
608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRelativeTime, decorators: [{
|
|
609
|
+
type: Pipe,
|
|
610
|
+
args: [{
|
|
611
|
+
name: 'bbRelativeTime',
|
|
612
|
+
standalone: true
|
|
613
|
+
}]
|
|
614
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
615
|
+
type: Inject,
|
|
616
|
+
args: [LOCALE_ID]
|
|
617
|
+
}] }, { type: i1$2.Localize, decorators: [{
|
|
618
|
+
type: Optional
|
|
619
|
+
}] }] });
|
|
620
|
+
|
|
621
|
+
class BbDate {
|
|
622
|
+
constructor() {
|
|
623
|
+
// Dependencies.
|
|
624
|
+
this._localize = inject(Localize, { optional: true });
|
|
625
|
+
this._localeId = inject(LOCALE_ID);
|
|
841
626
|
}
|
|
842
|
-
|
|
843
|
-
|
|
627
|
+
transform(value, format) {
|
|
628
|
+
const date = parseDate(value);
|
|
629
|
+
if (date === null) {
|
|
844
630
|
return null;
|
|
845
631
|
}
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
.replace(/,/g, '|');
|
|
849
|
-
const mimeTypeRegex = new RegExp(regexString);
|
|
850
|
-
const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value?.type);
|
|
851
|
-
return isNotValid && {
|
|
852
|
-
invalidFileType: true
|
|
853
|
-
};
|
|
632
|
+
const locale = this._localize?.current?.locale ?? this._localeId ?? 'en-US';
|
|
633
|
+
return formatDate(date, format ?? 'mediumDate', locale);
|
|
854
634
|
}
|
|
855
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
856
|
-
static { this.ɵ
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
])
|
|
876
|
-
])
|
|
877
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
635
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbDate, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
636
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: BbDate, isStandalone: true, name: "bbDate" }); }
|
|
637
|
+
}
|
|
638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbDate, decorators: [{
|
|
639
|
+
type: Pipe,
|
|
640
|
+
args: [{
|
|
641
|
+
name: 'bbDate',
|
|
642
|
+
standalone: true
|
|
643
|
+
}]
|
|
644
|
+
}] });
|
|
645
|
+
|
|
646
|
+
class BbSpinner {
|
|
647
|
+
constructor() {
|
|
648
|
+
// Inputs.
|
|
649
|
+
this.color = 'hsla(212, 80%, 42%, 1)';
|
|
650
|
+
this.alt = 'Loading...';
|
|
651
|
+
this.disabled = false;
|
|
652
|
+
}
|
|
653
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbSpinner, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
654
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.5", type: BbSpinner, isStandalone: true, selector: "bb-spinner", inputs: { color: "color", alt: "alt", disabled: ["disabled", "disabled", booleanAttribute] }, host: { classAttribute: "bb-spinner" }, ngImport: i0, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{padding:1.5rem 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center;color:#666}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#fff3}.bb-spinner.inverse .bb-spinner-content{color:#fff}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:1.5rem;height:1.5rem;min-width:1.5rem;min-height:1.5rem}.bb-spinner.small .bb-spinner-loader{border-width:.125rem}.bb-spinner.small .bb-spinner-content{font-size:.75rem}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:3rem;height:3rem;min-width:3rem;min-height:3rem}.bb-spinner.medium .bb-spinner-loader{border-width:.1875rem}.bb-spinner.medium .bb-spinner-content{font-size:.875rem}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:4.5rem;height:4.5rem;min-width:4.5rem;min-height:4.5rem}.bb-spinner.large .bb-spinner-loader{border-width:.25rem}.bb-spinner.large .bb-spinner-content{font-size:1rem}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-top:0;margin-left:.75rem}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:.75rem}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:.1875rem solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:3rem;height:3rem;min-width:3rem;min-height:3rem;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-weight:400;font-size:.875rem;margin-top:.75rem}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
878
655
|
}
|
|
879
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
656
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbSpinner, decorators: [{
|
|
880
657
|
type: Component,
|
|
881
|
-
args: [{ selector: 'bb-
|
|
882
|
-
|
|
883
|
-
provide: NG_VALUE_ACCESSOR,
|
|
884
|
-
useExisting: forwardRef(() => BbFilePicker),
|
|
885
|
-
multi: true
|
|
886
|
-
},
|
|
887
|
-
{
|
|
888
|
-
provide: NG_VALIDATORS,
|
|
889
|
-
useExisting: BbFilePicker,
|
|
890
|
-
multi: true
|
|
891
|
-
}
|
|
892
|
-
], host: {
|
|
893
|
-
'class': 'bb-file-picker',
|
|
894
|
-
'[class.required]': 'required',
|
|
895
|
-
'[class.disabled]': 'disabled',
|
|
896
|
-
'[class.grouped]': 'grouped',
|
|
897
|
-
'[class.hovered]': 'hovered',
|
|
898
|
-
'[class.error]': 'error'
|
|
899
|
-
}, animations: [
|
|
900
|
-
trigger('bbFilePickerImageAnimation', [
|
|
901
|
-
transition(':enter', [
|
|
902
|
-
style({ opacity: 0 }),
|
|
903
|
-
animate('200ms', style({ opacity: 1 }))
|
|
904
|
-
]),
|
|
905
|
-
transition(':leave', [
|
|
906
|
-
animate('200ms', style({ opacity: 0 }))
|
|
907
|
-
])
|
|
908
|
-
])
|
|
909
|
-
], inputs: ['disabled', 'hideErrors', 'grouped', 'required'], preserveWhitespaces: false, template: "<!-- The label of the input. -->\n<label *ngIf=\"label as labelContent\"\n [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">\n {{ labelContent }}\n </ng-template>\n</label>\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n<div *ngIf=\"value$ | async as data\"\n class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n <div *ngIf=\"allowDragging\"\n class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n </div>\n\n <ng-container *ngIf=\"!!extraTemplate\">\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"showImages\">\n <div *ngIf=\"data?.file | bbFileImage | async as image\"\n class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n </ng-container>\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n <span *ngIf=\"data?.file?.name as name\">{{ name }}</span>\n <span *ngIf=\"data?.file?.size as size\">{{ size | bbFileSize }}</span>\n </div>\n</div>\n\n<bb-form-error *ngIf=\"!hideErrors\"\n (errorChange)=\"onErrorChange($event)\">\n</bb-form-error>\n\n<!-- The file picker hint. -->\n<p *ngIf=\"hint as hintContent\"\n class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">\n {{ hintContent }}\n </ng-template>\n</p>\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"24\"\n height=\"24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;background-color:#cccccca3}.bb-file-picker.grouped{margin-bottom:20px}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #007bff33}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid #962b26;background-color:#c2393440!important;box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a,0 0 0 3px #c2393466!important}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;border-radius:3px;display:inline-flex;flex-direction:column;border:1px solid #b6bbc1;background-color:#fff8ff;transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:inset 0 3px #b7bcc233,0 6px 6px -6px #0000001a}.bb-file-picker-label{color:#000;display:block;position:relative;margin-bottom:4px}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:38px;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;color:#2196f3;line-height:1;cursor:pointer;padding:0 12px;appearance:none;font-weight:500;align-items:center;white-space:nowrap;display:inline-flex;border-top-left-radius:3px;border-bottom-left-radius:3px;border-right:1px solid #b6bbc1;background-color:#ffffff80;transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:0 0 0 3px #007bff33}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:3px;border-bottom-right-radius:3px}.bb-file-picker-icon{margin-right:4px}.bb-file-picker-zone{flex:1;color:#848f99;font-size:14px;padding:8px 12px;line-height:18px;align-items:center;display:inline-flex;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;padding:0 12px;overflow:hidden;line-height:36px;align-items:center;display:inline-flex;background-color:#fff8ff;border-top:0 solid #b6bbc1;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:38px;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;font-size:14px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:12px}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid #b6bbc1}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:20px auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;border-radius:4px;will-change:opacity;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;color:#738694;font-size:13px;margin-top:4px}\n"] }]
|
|
910
|
-
}], propDecorators: { fileInput: [{
|
|
911
|
-
type: ViewChild,
|
|
912
|
-
args: ['fileInput', { static: true }]
|
|
913
|
-
}], extraTemplate: [{
|
|
914
|
-
type: ContentChild,
|
|
915
|
-
args: ['extra']
|
|
916
|
-
}], label: [{
|
|
917
|
-
type: Input
|
|
918
|
-
}], hint: [{
|
|
919
|
-
type: Input
|
|
920
|
-
}], accept: [{
|
|
921
|
-
type: Input
|
|
922
|
-
}], showImages: [{
|
|
923
|
-
type: Input
|
|
924
|
-
}], allowDragging: [{
|
|
658
|
+
args: [{ selector: 'bb-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'bb-spinner' }, preserveWhitespaces: false, standalone: true, template: "<!--\n The spinner element.\n\n This element contains a circle with a 25% bar that spins\n indefinitely. The border color can be set via the \"color\"\n property.\n-->\n<div class=\"bb-spinner-container\">\n <div [style.border-left-color]=\"color\"\n [class.disabled]=\"disabled\"\n class=\"bb-spinner-loader\"\n aria-live=\"assertive\"\n role=\"alert\">\n {{ alt }}\n </div>\n <ng-content select=\"img\"></ng-content>\n</div>\n\n<!--\n The content of the spinner.\n\n This element contains the content of the spinner. The user\n can set the content inside the tag.\n-->\n<span class=\"bb-spinner-content\">\n <ng-content></ng-content>\n</span>\n", styles: [".bb-spinner{padding:1.5rem 0;text-align:center;align-items:center;display:inline-flex;flex-direction:column;justify-content:center;color:#666}.bb-spinner.block{display:flex}.bb-spinner.inverse .bb-spinner-loader{border-color:#fff3}.bb-spinner.inverse .bb-spinner-content{color:#fff}.bb-spinner.small .bb-spinner-loader,.bb-spinner.small .bb-spinner-loader:after{width:1.5rem;height:1.5rem;min-width:1.5rem;min-height:1.5rem}.bb-spinner.small .bb-spinner-loader{border-width:.125rem}.bb-spinner.small .bb-spinner-content{font-size:.75rem}.bb-spinner.medium .bb-spinner-loader,.bb-spinner.medium .bb-spinner-loader:after{width:3rem;height:3rem;min-width:3rem;min-height:3rem}.bb-spinner.medium .bb-spinner-loader{border-width:.1875rem}.bb-spinner.medium .bb-spinner-content{font-size:.875rem}.bb-spinner.large .bb-spinner-loader,.bb-spinner.large .bb-spinner-loader:after{width:4.5rem;height:4.5rem;min-width:4.5rem;min-height:4.5rem}.bb-spinner.large .bb-spinner-loader{border-width:.25rem}.bb-spinner.large .bb-spinner-content{font-size:1rem}.bb-spinner.horizontal{text-align:left;flex-direction:row}.bb-spinner.horizontal .bb-spinner-content:not(:empty){margin-top:0;margin-left:.75rem}.bb-spinner.vertical{text-align:center;flex-direction:column}.bb-spinner.vertical .bb-spinner-content:not(:empty){margin-left:0;margin-top:.75rem}.bb-spinner-container{display:flex;position:relative}.bb-spinner-container>img{top:20%;left:20%;width:60%;height:60%;position:absolute}.bb-spinner-loader{margin:0;padding:0;overflow:hidden;text-indent:100%;color:transparent;position:relative;display:inline-block;vertical-align:middle;border:.1875rem solid #f2f4f6;animation:1s linear infinite spin}.bb-spinner-loader,.bb-spinner-loader:after{width:3rem;height:3rem;min-width:3rem;min-height:3rem;border-radius:50%}.bb-spinner-loader.disabled{cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none;animation-play-state:paused}.bb-spinner-content:not(:empty){font-weight:400;font-size:.875rem;margin-top:.75rem}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
|
659
|
+
}], propDecorators: { color: [{
|
|
925
660
|
type: Input
|
|
926
|
-
}],
|
|
661
|
+
}], alt: [{
|
|
927
662
|
type: Input
|
|
928
|
-
}],
|
|
929
|
-
type:
|
|
930
|
-
|
|
931
|
-
type: HostListener,
|
|
932
|
-
args: ['dragover', ['$event', 'true']]
|
|
933
|
-
}, {
|
|
934
|
-
type: HostListener,
|
|
935
|
-
args: ['dragleave', ['$event', 'false']]
|
|
936
|
-
}], onDrop: [{
|
|
937
|
-
type: HostListener,
|
|
938
|
-
args: ['drop', ['$event']]
|
|
663
|
+
}], disabled: [{
|
|
664
|
+
type: Input,
|
|
665
|
+
args: [{ transform: booleanAttribute }]
|
|
939
666
|
}] } });
|
|
940
667
|
|
|
941
|
-
class
|
|
942
|
-
constructor(
|
|
943
|
-
this.
|
|
944
|
-
|
|
945
|
-
this.
|
|
946
|
-
this.
|
|
947
|
-
this._disabled = false;
|
|
948
|
-
this._required = false;
|
|
949
|
-
}
|
|
950
|
-
ngOnInit() {
|
|
951
|
-
// Set an arrow on the form control if
|
|
952
|
-
// it requires one.
|
|
953
|
-
this._formControl.arrow = this.hasArrow;
|
|
954
|
-
}
|
|
955
|
-
ngDoCheck() {
|
|
956
|
-
if (this._ngControl) {
|
|
957
|
-
this.disabled = this._ngControl.disabled;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
ngOnDestroy() {
|
|
961
|
-
this._subscription?.unsubscribe();
|
|
668
|
+
class BbButton {
|
|
669
|
+
constructor(elementRef) {
|
|
670
|
+
this.elementRef = elementRef;
|
|
671
|
+
// Inputs.
|
|
672
|
+
this.disabled = false;
|
|
673
|
+
this.loading = false;
|
|
962
674
|
}
|
|
963
675
|
focus() {
|
|
964
|
-
|
|
676
|
+
const element = this.elementRef?.nativeElement ?? null;
|
|
677
|
+
element?.focus?.();
|
|
678
|
+
}
|
|
679
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbButton, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
680
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbButton, isStandalone: true, selector: "button[bb-button]", inputs: { disabled: ["disabled", "disabled", booleanAttribute], loading: ["loading", "loading", booleanAttribute] }, host: { properties: { "class.loading": "loading", "attr.disabled": "disabled || loading || null" }, classAttribute: "bb-button" }, exportAs: ["bbButton"], ngImport: i0, template: "@if (loading) {\n <bb-spinner class=\"bb-button-spinner small\"></bb-spinner>\n}\n\n<ng-content select=\"[prefix]\"></ng-content>\n<span class=\"bb-button-content\"><ng-content></ng-content></span>\n<ng-content select=\"[suffix]\"></ng-content>\n", styles: [".bb-button{height:2.5rem;cursor:pointer;font-size:1rem;max-width:100%;overflow:hidden;font-weight:400;padding:0 .5rem;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;text-align:center;align-items:center;display:inline-flex;border-radius:.5rem;text-decoration:none;text-overflow:ellipsis;justify-content:center;transition-duration:.2s;border:1px solid transparent;background-color:transparent;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1)}.bb-button,.bb-button:visited{color:var(--bb-button-color)}.bb-button:hover{background-color:var(--bb-button-hover-background-color)}.bb-button:focus{border-color:var(--bb-button-focus-border-color);box-shadow:var(--bb-button-focus-box-shadow)}.bb-button:active{background-color:var(--bb-button-active-background-color)}.bb-button.small{height:2rem;font-size:.875rem}.bb-button.large{height:3rem;font-size:1.125rem}.bb-button.full{width:100%}.bb-button.square{padding:0;width:2.5rem;min-width:2.5rem}.bb-button.square.small{width:2rem;min-width:2rem}.bb-button.square.large{width:3rem;min-width:3rem}.bb-button>[prefix]{margin-right:.25rem}.bb-button>[suffix]{margin-left:.25rem}.bb-button.secondary{border-color:var(--bb-button-secondary-border-color)}.bb-button.secondary,.bb-button.secondary:visited{color:var(--bb-button-secondary-color)}.bb-button.secondary:hover{background-color:var(--bb-button-secondary-hover-background-color)}.bb-button.secondary:focus{box-shadow:var(--bb-button-secondary-focus-box-shadow)}.bb-button.secondary:active{background-color:var(--bb-button-secondary-active-background-color)}.bb-button.primary{border-color:var(--bb-button-primary-border-color);background-color:var(--bb-button-primary-background-color)}.bb-button.primary,.bb-button.primary:visited{color:var(--bb-button-primary-color)}.bb-button.primary:hover{background-color:var(--bb-button-primary-hover-background-color)}.bb-button.primary:focus{box-shadow:var(--bb-button-primary-focus-box-shadow)}.bb-button.primary:active{background-color:var(--bb-button-primary-active-background-color)}.bb-button.destructive{border-color:var(--bb-button-destructive-border-color);background-color:var(--bb-button-destructive-background-color)}.bb-button.destructive,.bb-button.destructive:visited{color:var(--bb-button-destructive-color)}.bb-button.destructive:hover{background-color:var(--bb-button-destructive-hover-background-color)}.bb-button.destructive:focus{box-shadow:var(--bb-button-destructive-focus-box-shadow)}.bb-button.destructive:active{background-color:var(--bb-button-destructive-active-background-color)}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{cursor:default;box-shadow:none;opacity:var(--bb-button-disabled-opacity)}.bb-button.loading>*:not(.bb-button-spinner){opacity:0}.bb-button>.bb-button-spinner{left:50%;padding:0;overflow:hidden;position:absolute;transform:translate(-50%)}.bb-button-content{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
681
|
+
}
|
|
682
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbButton, decorators: [{
|
|
683
|
+
type: Component,
|
|
684
|
+
args: [{ selector: 'button[bb-button]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'bbButton', host: {
|
|
685
|
+
'class': 'bb-button',
|
|
686
|
+
'[class.loading]': 'loading',
|
|
687
|
+
'[attr.disabled]': 'disabled || loading || null'
|
|
688
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbSpinner], template: "@if (loading) {\n <bb-spinner class=\"bb-button-spinner small\"></bb-spinner>\n}\n\n<ng-content select=\"[prefix]\"></ng-content>\n<span class=\"bb-button-content\"><ng-content></ng-content></span>\n<ng-content select=\"[suffix]\"></ng-content>\n", styles: [".bb-button{height:2.5rem;cursor:pointer;font-size:1rem;max-width:100%;overflow:hidden;font-weight:400;padding:0 .5rem;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;text-align:center;align-items:center;display:inline-flex;border-radius:.5rem;text-decoration:none;text-overflow:ellipsis;justify-content:center;transition-duration:.2s;border:1px solid transparent;background-color:transparent;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1)}.bb-button,.bb-button:visited{color:var(--bb-button-color)}.bb-button:hover{background-color:var(--bb-button-hover-background-color)}.bb-button:focus{border-color:var(--bb-button-focus-border-color);box-shadow:var(--bb-button-focus-box-shadow)}.bb-button:active{background-color:var(--bb-button-active-background-color)}.bb-button.small{height:2rem;font-size:.875rem}.bb-button.large{height:3rem;font-size:1.125rem}.bb-button.full{width:100%}.bb-button.square{padding:0;width:2.5rem;min-width:2.5rem}.bb-button.square.small{width:2rem;min-width:2rem}.bb-button.square.large{width:3rem;min-width:3rem}.bb-button>[prefix]{margin-right:.25rem}.bb-button>[suffix]{margin-left:.25rem}.bb-button.secondary{border-color:var(--bb-button-secondary-border-color)}.bb-button.secondary,.bb-button.secondary:visited{color:var(--bb-button-secondary-color)}.bb-button.secondary:hover{background-color:var(--bb-button-secondary-hover-background-color)}.bb-button.secondary:focus{box-shadow:var(--bb-button-secondary-focus-box-shadow)}.bb-button.secondary:active{background-color:var(--bb-button-secondary-active-background-color)}.bb-button.primary{border-color:var(--bb-button-primary-border-color);background-color:var(--bb-button-primary-background-color)}.bb-button.primary,.bb-button.primary:visited{color:var(--bb-button-primary-color)}.bb-button.primary:hover{background-color:var(--bb-button-primary-hover-background-color)}.bb-button.primary:focus{box-shadow:var(--bb-button-primary-focus-box-shadow)}.bb-button.primary:active{background-color:var(--bb-button-primary-active-background-color)}.bb-button.destructive{border-color:var(--bb-button-destructive-border-color);background-color:var(--bb-button-destructive-background-color)}.bb-button.destructive,.bb-button.destructive:visited{color:var(--bb-button-destructive-color)}.bb-button.destructive:hover{background-color:var(--bb-button-destructive-hover-background-color)}.bb-button.destructive:focus{box-shadow:var(--bb-button-destructive-focus-box-shadow)}.bb-button.destructive:active{background-color:var(--bb-button-destructive-active-background-color)}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{cursor:default;box-shadow:none;opacity:var(--bb-button-disabled-opacity)}.bb-button.loading>*:not(.bb-button-spinner){opacity:0}.bb-button>.bb-button-spinner{left:50%;padding:0;overflow:hidden;position:absolute;transform:translate(-50%)}.bb-button-content{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}\n"] }]
|
|
689
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { disabled: [{
|
|
690
|
+
type: Input,
|
|
691
|
+
args: [{ transform: booleanAttribute }]
|
|
692
|
+
}], loading: [{
|
|
693
|
+
type: Input,
|
|
694
|
+
args: [{ transform: booleanAttribute }]
|
|
695
|
+
}] } });
|
|
696
|
+
class BbAnchor extends BbButton {
|
|
697
|
+
constructor(elementRef) {
|
|
698
|
+
super(elementRef);
|
|
699
|
+
this.elementRef = elementRef;
|
|
700
|
+
// Inputs.
|
|
701
|
+
this.tabIndex = null;
|
|
965
702
|
}
|
|
966
|
-
|
|
967
|
-
|
|
703
|
+
stopDisabledEvents(event) {
|
|
704
|
+
// If the button is not disabled (and not loading) let all events pass.
|
|
705
|
+
if (!this.disabled && !this.loading) {
|
|
968
706
|
return;
|
|
969
707
|
}
|
|
970
|
-
|
|
708
|
+
// If the button is disabled and/or loading stop
|
|
709
|
+
// the event from bubbling up.
|
|
710
|
+
event.preventDefault();
|
|
711
|
+
event.stopImmediatePropagation();
|
|
971
712
|
}
|
|
972
|
-
|
|
973
|
-
|
|
713
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbAnchor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
714
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbAnchor, isStandalone: true, selector: "a[bb-button]", inputs: { tabIndex: "tabIndex" }, host: { listeners: { "click": "stopDisabledEvents($event)" }, properties: { "attr.tabindex": "(disabled || loading) ? -1 : (tabIndex || 0)", "attr.disabled": "disabled || loading || null", "attr.aria-disabled": "(disabled || loading).toString()" }, classAttribute: "bb-button" }, exportAs: ["bbButton", "bbAnchor"], usesInheritance: true, ngImport: i0, template: "@if (loading) {\n <bb-spinner class=\"bb-button-spinner small\"></bb-spinner>\n}\n\n<ng-content select=\"[prefix]\"></ng-content>\n<span class=\"bb-button-content\"><ng-content></ng-content></span>\n<ng-content select=\"[suffix]\"></ng-content>\n", styles: [".bb-button{height:2.5rem;cursor:pointer;font-size:1rem;max-width:100%;overflow:hidden;font-weight:400;padding:0 .5rem;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;text-align:center;align-items:center;display:inline-flex;border-radius:.5rem;text-decoration:none;text-overflow:ellipsis;justify-content:center;transition-duration:.2s;border:1px solid transparent;background-color:transparent;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1)}.bb-button,.bb-button:visited{color:var(--bb-button-color)}.bb-button:hover{background-color:var(--bb-button-hover-background-color)}.bb-button:focus{border-color:var(--bb-button-focus-border-color);box-shadow:var(--bb-button-focus-box-shadow)}.bb-button:active{background-color:var(--bb-button-active-background-color)}.bb-button.small{height:2rem;font-size:.875rem}.bb-button.large{height:3rem;font-size:1.125rem}.bb-button.full{width:100%}.bb-button.square{padding:0;width:2.5rem;min-width:2.5rem}.bb-button.square.small{width:2rem;min-width:2rem}.bb-button.square.large{width:3rem;min-width:3rem}.bb-button>[prefix]{margin-right:.25rem}.bb-button>[suffix]{margin-left:.25rem}.bb-button.secondary{border-color:var(--bb-button-secondary-border-color)}.bb-button.secondary,.bb-button.secondary:visited{color:var(--bb-button-secondary-color)}.bb-button.secondary:hover{background-color:var(--bb-button-secondary-hover-background-color)}.bb-button.secondary:focus{box-shadow:var(--bb-button-secondary-focus-box-shadow)}.bb-button.secondary:active{background-color:var(--bb-button-secondary-active-background-color)}.bb-button.primary{border-color:var(--bb-button-primary-border-color);background-color:var(--bb-button-primary-background-color)}.bb-button.primary,.bb-button.primary:visited{color:var(--bb-button-primary-color)}.bb-button.primary:hover{background-color:var(--bb-button-primary-hover-background-color)}.bb-button.primary:focus{box-shadow:var(--bb-button-primary-focus-box-shadow)}.bb-button.primary:active{background-color:var(--bb-button-primary-active-background-color)}.bb-button.destructive{border-color:var(--bb-button-destructive-border-color);background-color:var(--bb-button-destructive-background-color)}.bb-button.destructive,.bb-button.destructive:visited{color:var(--bb-button-destructive-color)}.bb-button.destructive:hover{background-color:var(--bb-button-destructive-hover-background-color)}.bb-button.destructive:focus{box-shadow:var(--bb-button-destructive-focus-box-shadow)}.bb-button.destructive:active{background-color:var(--bb-button-destructive-active-background-color)}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{cursor:default;box-shadow:none;opacity:var(--bb-button-disabled-opacity)}.bb-button.loading>*:not(.bb-button-spinner){opacity:0}.bb-button>.bb-button-spinner{left:50%;padding:0;overflow:hidden;position:absolute;transform:translate(-50%)}.bb-button-content{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}\n"], dependencies: [{ kind: "component", type: BbSpinner, selector: "bb-spinner", inputs: ["color", "alt", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
715
|
+
}
|
|
716
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbAnchor, decorators: [{
|
|
717
|
+
type: Component,
|
|
718
|
+
args: [{ selector: 'a[bb-button]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'bbButton, bbAnchor', host: {
|
|
719
|
+
'class': 'bb-button',
|
|
720
|
+
'[attr.tabindex]': '(disabled || loading) ? -1 : (tabIndex || 0)',
|
|
721
|
+
'[attr.disabled]': 'disabled || loading || null',
|
|
722
|
+
'[attr.aria-disabled]': '(disabled || loading).toString()'
|
|
723
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbSpinner], template: "@if (loading) {\n <bb-spinner class=\"bb-button-spinner small\"></bb-spinner>\n}\n\n<ng-content select=\"[prefix]\"></ng-content>\n<span class=\"bb-button-content\"><ng-content></ng-content></span>\n<ng-content select=\"[suffix]\"></ng-content>\n", styles: [".bb-button{height:2.5rem;cursor:pointer;font-size:1rem;max-width:100%;overflow:hidden;font-weight:400;padding:0 .5rem;-webkit-user-select:none;user-select:none;position:relative;font-style:normal;text-align:center;align-items:center;display:inline-flex;border-radius:.5rem;text-decoration:none;text-overflow:ellipsis;justify-content:center;transition-duration:.2s;border:1px solid transparent;background-color:transparent;transition-property:background-color,box-shadow;transition-timing-function:cubic-bezier(0,0,.2,1)}.bb-button,.bb-button:visited{color:var(--bb-button-color)}.bb-button:hover{background-color:var(--bb-button-hover-background-color)}.bb-button:focus{border-color:var(--bb-button-focus-border-color);box-shadow:var(--bb-button-focus-box-shadow)}.bb-button:active{background-color:var(--bb-button-active-background-color)}.bb-button.small{height:2rem;font-size:.875rem}.bb-button.large{height:3rem;font-size:1.125rem}.bb-button.full{width:100%}.bb-button.square{padding:0;width:2.5rem;min-width:2.5rem}.bb-button.square.small{width:2rem;min-width:2rem}.bb-button.square.large{width:3rem;min-width:3rem}.bb-button>[prefix]{margin-right:.25rem}.bb-button>[suffix]{margin-left:.25rem}.bb-button.secondary{border-color:var(--bb-button-secondary-border-color)}.bb-button.secondary,.bb-button.secondary:visited{color:var(--bb-button-secondary-color)}.bb-button.secondary:hover{background-color:var(--bb-button-secondary-hover-background-color)}.bb-button.secondary:focus{box-shadow:var(--bb-button-secondary-focus-box-shadow)}.bb-button.secondary:active{background-color:var(--bb-button-secondary-active-background-color)}.bb-button.primary{border-color:var(--bb-button-primary-border-color);background-color:var(--bb-button-primary-background-color)}.bb-button.primary,.bb-button.primary:visited{color:var(--bb-button-primary-color)}.bb-button.primary:hover{background-color:var(--bb-button-primary-hover-background-color)}.bb-button.primary:focus{box-shadow:var(--bb-button-primary-focus-box-shadow)}.bb-button.primary:active{background-color:var(--bb-button-primary-active-background-color)}.bb-button.destructive{border-color:var(--bb-button-destructive-border-color);background-color:var(--bb-button-destructive-background-color)}.bb-button.destructive,.bb-button.destructive:visited{color:var(--bb-button-destructive-color)}.bb-button.destructive:hover{background-color:var(--bb-button-destructive-hover-background-color)}.bb-button.destructive:focus{box-shadow:var(--bb-button-destructive-focus-box-shadow)}.bb-button.destructive:active{background-color:var(--bb-button-destructive-active-background-color)}.bb-button:disabled,.bb-button:disabled:focus,.bb-button:disabled:hover,.bb-button:disabled:active,.bb-button[disabled],.bb-button[disabled]:focus,.bb-button[disabled]:hover,.bb-button[disabled]:active,.bb-button.loading,.bb-button.loading:focus,.bb-button.loading:hover,.bb-button.loading:active{cursor:default;box-shadow:none;opacity:var(--bb-button-disabled-opacity)}.bb-button.loading>*:not(.bb-button-spinner){opacity:0}.bb-button>.bb-button-spinner{left:50%;padding:0;overflow:hidden;position:absolute;transform:translate(-50%)}.bb-button-content{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}\n"] }]
|
|
724
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { tabIndex: [{
|
|
725
|
+
type: Input
|
|
726
|
+
}], stopDisabledEvents: [{
|
|
727
|
+
type: HostListener,
|
|
728
|
+
args: ['click', ['$event']]
|
|
729
|
+
}] } });
|
|
730
|
+
|
|
731
|
+
class BbIcon {
|
|
732
|
+
set src(newValue) {
|
|
733
|
+
this.state$.next(this.convert(newValue));
|
|
734
|
+
this._src = newValue;
|
|
974
735
|
}
|
|
975
|
-
get
|
|
976
|
-
|
|
977
|
-
return this._ngControl.disabled;
|
|
978
|
-
}
|
|
979
|
-
return this._disabled;
|
|
736
|
+
get src() {
|
|
737
|
+
return this._src;
|
|
980
738
|
}
|
|
981
|
-
|
|
982
|
-
this.
|
|
983
|
-
|
|
984
|
-
|
|
739
|
+
constructor(_registry) {
|
|
740
|
+
this._registry = _registry;
|
|
741
|
+
// Data.
|
|
742
|
+
this._src = null;
|
|
743
|
+
// State.
|
|
744
|
+
this.state$ = new BehaviorSubject(null);
|
|
745
|
+
this.alt = null;
|
|
746
|
+
this.size = 1.5;
|
|
747
|
+
this.ariaHidden = true;
|
|
748
|
+
this.warn = (content) => {
|
|
749
|
+
return console && console.warn && console.warn(content);
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
convert(src) {
|
|
753
|
+
const [namespace, value] = (src || '').split(':');
|
|
754
|
+
const onError = () => {
|
|
755
|
+
this.warn(`ElementsModule: The icon with src "${src}" could not be rendered correctly; Did you put a correct src attribute?`);
|
|
756
|
+
return { type: 'unknown' };
|
|
757
|
+
};
|
|
758
|
+
if (!namespace || !value || !this._registry) {
|
|
759
|
+
return onError();
|
|
760
|
+
}
|
|
761
|
+
// Try to find a image icon.
|
|
762
|
+
const imageIcon = this.findImageIcon(namespace, value);
|
|
763
|
+
if (imageIcon) {
|
|
764
|
+
return imageIcon;
|
|
765
|
+
}
|
|
766
|
+
// Try to find a font icon.
|
|
767
|
+
const fontIcon = this.findFontIcon(namespace, value);
|
|
768
|
+
if (fontIcon) {
|
|
769
|
+
return fontIcon;
|
|
985
770
|
}
|
|
986
|
-
|
|
771
|
+
// Return the on error function.
|
|
772
|
+
return onError();
|
|
987
773
|
}
|
|
988
|
-
|
|
989
|
-
|
|
774
|
+
findImageIcon(namespace, value) {
|
|
775
|
+
const data = this._registry.find(item => item['namespace'] === namespace && item['name'] === value);
|
|
776
|
+
if (!data) {
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
return { type: data['type'], src: data['src'] };
|
|
990
780
|
}
|
|
991
|
-
|
|
992
|
-
this.
|
|
993
|
-
if (!
|
|
994
|
-
return;
|
|
781
|
+
findFontIcon(namespace, content) {
|
|
782
|
+
const data = this._registry.find(item => item['namespace'] === namespace);
|
|
783
|
+
if (!data) {
|
|
784
|
+
return null;
|
|
785
|
+
}
|
|
786
|
+
const uses = data['uses'];
|
|
787
|
+
if (uses === 'data-attribute') {
|
|
788
|
+
return { type: data['type'], className: data['className'], attribute: content };
|
|
995
789
|
}
|
|
996
|
-
|
|
790
|
+
return { type: data['type'], className: data['className'], content };
|
|
997
791
|
}
|
|
998
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
999
|
-
static { this.ɵ
|
|
792
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbIcon, deps: [{ token: ELEMENTS_ICONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
793
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbIcon, isStandalone: true, selector: "bb-icon", inputs: { alt: "alt", size: ["size", "size", numberAttribute], ariaHidden: ["ariaHidden", "ariaHidden", booleanAttribute], src: "src" }, host: { properties: { "attr.aria-hidden": "ariaHidden", "style.width.rem": "size", "style.height.rem": "size", "style.min-width.rem": "size", "style.min-height.rem": "size", "style.font-size.rem": "size" }, classAttribute: "bb-icon" }, ngImport: i0, template: "@if (state$ | async; as data) {\n @switch (data?.type) {\n @case ('font') {\n <i [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n }\n @case ('image') {\n <img [src]=\"data?.src\"\n [alt]=\"alt\">\n }\n @default {\n <svg viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n }\n }\n}\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1000
794
|
}
|
|
1001
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
1002
|
-
type:
|
|
1003
|
-
args: [{
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
'[
|
|
1007
|
-
'
|
|
1008
|
-
'
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
}, {
|
|
1014
|
-
type: Self
|
|
1015
|
-
}] }, { type: BbFormControl, decorators: [{
|
|
795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbIcon, decorators: [{
|
|
796
|
+
type: Component,
|
|
797
|
+
args: [{ selector: 'bb-icon', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
798
|
+
'class': 'bb-icon',
|
|
799
|
+
'[attr.aria-hidden]': 'ariaHidden',
|
|
800
|
+
'[style.width.rem]': 'size',
|
|
801
|
+
'[style.height.rem]': 'size',
|
|
802
|
+
'[style.min-width.rem]': 'size',
|
|
803
|
+
'[style.min-height.rem]': 'size',
|
|
804
|
+
'[style.font-size.rem]': 'size'
|
|
805
|
+
}, preserveWhitespaces: false, standalone: true, imports: [AsyncPipe], template: "@if (state$ | async; as data) {\n @switch (data?.type) {\n @case ('font') {\n <i [attr.data-icon]=\"data?.attribute\"\n [class]=\"data?.className\">\n {{ data?.content }}\n </i>\n }\n @case ('image') {\n <img [src]=\"data?.src\"\n [alt]=\"alt\">\n }\n @default {\n <svg viewBox=\"0 0 1 1\">\n <rect x=\"0\" y=\"0\" width=\"1\" height=\"1\" fill=\"#c5c5c5\"></rect>\n </svg>\n }\n }\n}\n", styles: [".bb-icon{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.bb-icon>i{font-size:inherit}.bb-icon>img,.bb-icon>svg{width:100%;height:100%;display:flex}\n"] }]
|
|
806
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1016
807
|
type: Optional
|
|
1017
808
|
}, {
|
|
1018
|
-
type:
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
args: ['attr.id']
|
|
1022
|
-
}], disabled: [{
|
|
809
|
+
type: Inject,
|
|
810
|
+
args: [ELEMENTS_ICONS]
|
|
811
|
+
}] }], propDecorators: { alt: [{
|
|
1023
812
|
type: Input
|
|
1024
|
-
}],
|
|
813
|
+
}], size: [{
|
|
814
|
+
type: Input,
|
|
815
|
+
args: [{ transform: numberAttribute }]
|
|
816
|
+
}], ariaHidden: [{
|
|
817
|
+
type: Input,
|
|
818
|
+
args: [{ transform: booleanAttribute }]
|
|
819
|
+
}], src: [{
|
|
1025
820
|
type: Input
|
|
1026
821
|
}] } });
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
this.
|
|
1032
|
-
this._formControl = _formControl;
|
|
1033
|
-
this.hasArrow = false;
|
|
1034
|
-
this._readonly = false;
|
|
1035
|
-
}
|
|
1036
|
-
get readonly() {
|
|
1037
|
-
return this._readonly;
|
|
1038
|
-
}
|
|
1039
|
-
set readonly(newValue) {
|
|
1040
|
-
this._readonly = coerceBooleanProperty(newValue);
|
|
1041
|
-
if (!this._formControl) {
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1044
|
-
this._formControl.readonly = this._readonly;
|
|
822
|
+
|
|
823
|
+
class BbFormGroup {
|
|
824
|
+
constructor() {
|
|
825
|
+
// Inputs.
|
|
826
|
+
this.grouped = false;
|
|
1045
827
|
}
|
|
1046
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
1047
|
-
static { this.ɵ
|
|
828
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
829
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.5", type: BbFormGroup, isStandalone: true, selector: "bb-form-group", inputs: { grouped: ["grouped", "grouped", booleanAttribute] }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-.75rem}.bb-form-group>*{margin-top:.75rem}.bb-form-group>*:not(:first-child){margin-left:.75rem}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:1.5rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1048
830
|
}
|
|
1049
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
1050
|
-
type:
|
|
1051
|
-
args: [{
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
}]
|
|
1060
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i2.NgControl, decorators: [{
|
|
1061
|
-
type: Optional
|
|
1062
|
-
}, {
|
|
1063
|
-
type: Self
|
|
1064
|
-
}] }, { type: BbFormControl, decorators: [{
|
|
1065
|
-
type: Optional
|
|
1066
|
-
}, {
|
|
1067
|
-
type: Host
|
|
1068
|
-
}] }], propDecorators: { readonly: [{
|
|
1069
|
-
type: Input
|
|
831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFormGroup, decorators: [{
|
|
832
|
+
type: Component,
|
|
833
|
+
args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
834
|
+
'class': 'bb-form-group',
|
|
835
|
+
'[class.grouped]': 'grouped'
|
|
836
|
+
}, preserveWhitespaces: false, standalone: true, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-.75rem}.bb-form-group>*{margin-top:.75rem}.bb-form-group>*:not(:first-child){margin-left:.75rem}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:1.5rem}\n"] }]
|
|
837
|
+
}], propDecorators: { grouped: [{
|
|
838
|
+
type: Input,
|
|
839
|
+
args: [{ transform: booleanAttribute }]
|
|
1070
840
|
}] } });
|
|
1071
841
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
842
|
+
let nextUniqueId$2 = 0;
|
|
843
|
+
class BbCheckbox {
|
|
844
|
+
constructor(_renderer, _changeDetectorRef) {
|
|
845
|
+
this._renderer = _renderer;
|
|
846
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
847
|
+
// Data.
|
|
848
|
+
this.labelId = `bb-checkbox-${nextUniqueId$2++}`;
|
|
849
|
+
// Inputs.
|
|
850
|
+
this.checked = false;
|
|
851
|
+
this.indeterminate = false;
|
|
852
|
+
this.disabled = false;
|
|
853
|
+
this.grouped = false;
|
|
854
|
+
// Outputs.
|
|
855
|
+
this.checkedChange = new EventEmitter();
|
|
856
|
+
this.indeterminateChange = new EventEmitter();
|
|
857
|
+
// Callbacks.
|
|
858
|
+
this.onTouchedCallback = () => ({});
|
|
859
|
+
this.onChangeCallback = () => ({});
|
|
1078
860
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
861
|
+
ngAfterViewInit() {
|
|
862
|
+
this.syncField('indeterminate', this.indeterminate);
|
|
1081
863
|
}
|
|
1082
|
-
|
|
1083
|
-
this.
|
|
1084
|
-
this.valueChange.emit(this.value);
|
|
864
|
+
toggle() {
|
|
865
|
+
this.checked = !this.checked;
|
|
1085
866
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this.
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
this.
|
|
1097
|
-
this.
|
|
1098
|
-
|
|
1099
|
-
|
|
867
|
+
writeValue(newValue) {
|
|
868
|
+
this.checked = newValue;
|
|
869
|
+
}
|
|
870
|
+
registerOnChange(method) {
|
|
871
|
+
this.onChangeCallback = method;
|
|
872
|
+
}
|
|
873
|
+
registerOnTouched(method) {
|
|
874
|
+
this.onTouchedCallback = method;
|
|
875
|
+
}
|
|
876
|
+
setDisabledState(isDisabled) {
|
|
877
|
+
this.disabled = isDisabled;
|
|
878
|
+
this._changeDetectorRef.markForCheck();
|
|
879
|
+
}
|
|
880
|
+
onClickEvent(event) {
|
|
881
|
+
event.stopPropagation();
|
|
882
|
+
if (this.disabled) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
// When user manually click on the checkbox, `indeterminate` is set to false.
|
|
886
|
+
if (this.indeterminate) {
|
|
887
|
+
Promise.resolve().then(() => {
|
|
888
|
+
this.indeterminate = false;
|
|
889
|
+
this.indeterminateChange.emit(this.indeterminate);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
// Toggle the value.
|
|
893
|
+
this.toggle();
|
|
894
|
+
// Emit the change event.
|
|
895
|
+
this.emitChangeEvent();
|
|
896
|
+
}
|
|
897
|
+
onChangeEvent(event) {
|
|
898
|
+
// We always have to stop propagation on the change event.
|
|
899
|
+
// Otherwise, the change event, from the input element, will bubble up and
|
|
900
|
+
// emit its event object to the `change` output.
|
|
901
|
+
event.stopPropagation();
|
|
902
|
+
}
|
|
903
|
+
emitChangeEvent() {
|
|
904
|
+
this.onChangeCallback?.(this.checked);
|
|
905
|
+
this.checkedChange.emit(this.checked);
|
|
906
|
+
this.syncField('checked', this.checked);
|
|
907
|
+
}
|
|
908
|
+
syncField(field, value) {
|
|
909
|
+
const element = this.inputElementRef?.nativeElement;
|
|
910
|
+
if (!element) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
this._renderer.setProperty(element, field, value);
|
|
914
|
+
}
|
|
915
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbCheckbox, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
916
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.5", type: BbCheckbox, isStandalone: true, selector: "bb-checkbox", inputs: { checked: ["checked", "checked", booleanAttribute], indeterminate: ["indeterminate", "indeterminate", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], grouped: ["grouped", "grouped", booleanAttribute] }, outputs: { checkedChange: "checkedChange", indeterminateChange: "indeterminateChange" }, host: { properties: { "class.indeterminate": "indeterminate", "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-checkbox" }, providers: [
|
|
917
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
|
|
918
|
+
], viewQueries: [{ propertyName: "inputElementRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<input #input\n [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onChangeEvent($event)\"\n (click)=\"onClickEvent($event)\"\n (blur)=\"onTouchedCallback()\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n (keyup.space)=\"onClickEvent($event)\"\n class=\"bb-checkbox-label\">\n <span class=\"bb-checkbox-area\">\n <svg width=\"68%\"\n height=\"68%\"\n viewBox=\"0 0 12 12\">\n <polyline [attr.points]=\"indeterminate ? '1 6 11 6' : '1.5 7 4.5 10 10.5 2'\"></polyline>\n </svg>\n </span>\n <span class=\"bb-checkbox-content\">\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox.grouped{margin-bottom:1.5rem}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translateZ(0)}.bb-checkbox-area{width:1.25rem;height:1.25rem;position:relative;min-width:1.25rem;min-height:1.25rem;border-radius:.25rem;vertical-align:middle;transition-duration:.2s;border:1px solid hsl(213,8%,74%);transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a;transition-property:stroke-dashoffset,box-shadow,border-color,background-color}.bb-checkbox-area>svg{top:16%;left:16%;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:1rem;stroke-dashoffset:1rem;transition:all .3s ease;transform:translateZ(0)}.bb-checkbox-content{font-size:1rem;font-weight:400;padding-left:.5rem;color:#121212}.bb-checkbox-content>small{display:block;line-height:1.5;font-size:.8125rem;margin-top:.125rem;color:#758795}.bb-checkbox-input:not(:disabled)+.bb-checkbox-label:focus>.bb-checkbox-area{box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem var(--bb-checkbox-outline-color)}.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area,.bb-checkbox.indeterminate>.bb-checkbox-label>.bb-checkbox-area{border-color:var(--bb-checkbox-border-color);background-color:var(--bb-checkbox-background-color)}.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area>svg,.bb-checkbox.indeterminate>.bb-checkbox-label>.bb-checkbox-area>svg{stroke-dashoffset:0}.bb-checkbox.disabled>.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox.disabled>.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area,.bb-checkbox.indeterminate.disabled>.bb-checkbox-input+.bb-checkbox-label>.bb-checkbox-area{border-color:#b7bcc2;background-color:#e6e6e6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
919
|
+
}
|
|
920
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbCheckbox, decorators: [{
|
|
921
|
+
type: Component,
|
|
922
|
+
args: [{ selector: 'bb-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
923
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbCheckbox), multi: true }
|
|
924
|
+
], host: {
|
|
925
|
+
'class': 'bb-checkbox',
|
|
926
|
+
'[class.indeterminate]': 'indeterminate',
|
|
927
|
+
'[class.disabled]': 'disabled',
|
|
928
|
+
'[class.grouped]': 'grouped'
|
|
929
|
+
}, preserveWhitespaces: false, standalone: true, template: "<input #input\n [id]=\"labelId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onChangeEvent($event)\"\n (click)=\"onClickEvent($event)\"\n (blur)=\"onTouchedCallback()\"\n class=\"bb-checkbox-input\"\n tabindex=\"-1\"\n type=\"checkbox\">\n\n<label [for]=\"labelId\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n (keyup.space)=\"onClickEvent($event)\"\n class=\"bb-checkbox-label\">\n <span class=\"bb-checkbox-area\">\n <svg width=\"68%\"\n height=\"68%\"\n viewBox=\"0 0 12 12\">\n <polyline [attr.points]=\"indeterminate ? '1 6 11 6' : '1.5 7 4.5 10 10.5 2'\"></polyline>\n </svg>\n </span>\n <span class=\"bb-checkbox-content\">\n <ng-content></ng-content>\n </span>\n</label>\n", styles: [".bb-checkbox{display:block}.bb-checkbox.grouped{margin-bottom:1.5rem}.bb-checkbox-input{display:none}.bb-checkbox-label{margin:0;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center}.bb-checkbox-label>span{display:inline-block;vertical-align:middle;transform:translateZ(0)}.bb-checkbox-area{width:1.25rem;height:1.25rem;position:relative;min-width:1.25rem;min-height:1.25rem;border-radius:.25rem;vertical-align:middle;transition-duration:.2s;border:1px solid hsl(213,8%,74%);transition-timing-function:cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a;transition-property:stroke-dashoffset,box-shadow,border-color,background-color}.bb-checkbox-area>svg{top:16%;left:16%;fill:none;stroke:#fff;stroke-width:2;position:absolute;stroke-linecap:round;transition-delay:.1s;stroke-linejoin:round;stroke-dasharray:1rem;stroke-dashoffset:1rem;transition:all .3s ease;transform:translateZ(0)}.bb-checkbox-content{font-size:1rem;font-weight:400;padding-left:.5rem;color:#121212}.bb-checkbox-content>small{display:block;line-height:1.5;font-size:.8125rem;margin-top:.125rem;color:#758795}.bb-checkbox-input:not(:disabled)+.bb-checkbox-label:focus>.bb-checkbox-area{box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem var(--bb-checkbox-outline-color)}.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area,.bb-checkbox.indeterminate>.bb-checkbox-label>.bb-checkbox-area{border-color:var(--bb-checkbox-border-color);background-color:var(--bb-checkbox-background-color)}.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area>svg,.bb-checkbox.indeterminate>.bb-checkbox-label>.bb-checkbox-area>svg{stroke-dashoffset:0}.bb-checkbox.disabled>.bb-checkbox-label{cursor:default;pointer-events:none}.bb-checkbox.disabled>.bb-checkbox-input:checked+.bb-checkbox-label>.bb-checkbox-area,.bb-checkbox.indeterminate.disabled>.bb-checkbox-input+.bb-checkbox-label>.bb-checkbox-area{border-color:#b7bcc2;background-color:#e6e6e6}\n"] }]
|
|
930
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { inputElementRef: [{
|
|
931
|
+
type: ViewChild,
|
|
932
|
+
args: ['input', { static: true }]
|
|
933
|
+
}], checked: [{
|
|
934
|
+
type: Input,
|
|
935
|
+
args: [{ transform: booleanAttribute }]
|
|
936
|
+
}], indeterminate: [{
|
|
937
|
+
type: Input,
|
|
938
|
+
args: [{ transform: booleanAttribute }]
|
|
939
|
+
}], disabled: [{
|
|
940
|
+
type: Input,
|
|
941
|
+
args: [{ transform: booleanAttribute }]
|
|
942
|
+
}], grouped: [{
|
|
943
|
+
type: Input,
|
|
944
|
+
args: [{ transform: booleanAttribute }]
|
|
945
|
+
}], checkedChange: [{
|
|
946
|
+
type: Output
|
|
947
|
+
}], indeterminateChange: [{
|
|
948
|
+
type: Output
|
|
949
|
+
}] } });
|
|
950
|
+
|
|
951
|
+
class BbCheckboxGroup {
|
|
952
|
+
constructor() {
|
|
953
|
+
// Inputs.
|
|
954
|
+
this.label = null;
|
|
955
|
+
this.required = false;
|
|
956
|
+
this.grouped = false;
|
|
957
|
+
this.inline = false;
|
|
958
|
+
}
|
|
959
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbCheckboxGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
960
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbCheckboxGroup, isStandalone: true, selector: "bb-checkbox-group", inputs: { label: "label", required: ["required", "required", booleanAttribute], grouped: ["grouped", "grouped", booleanAttribute], inline: ["inline", "inline", booleanAttribute] }, host: { properties: { "class.grouped": "grouped", "class.required": "required", "class.inline": "inline" }, classAttribute: "bb-checkbox-group" }, ngImport: i0, template: "@if (label; as labelContent) {\n <label class=\"bb-checkbox-group-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<div class=\"bb-checkbox-group-items\">\n <ng-content select=\"bb-checkbox\"></ng-content>\n</div>\n", styles: [".bb-checkbox-group{display:block}.bb-checkbox-group.grouped{margin-bottom:1.5rem}.bb-checkbox-group.required>.bb-checkbox-group-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-checkbox-group-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-checkbox-group-items{display:flex;flex-direction:column}.bb-checkbox-group-items:not(:empty){margin-bottom:.25rem}.bb-checkbox-group-items>*{margin-bottom:.25rem}@media only screen and (min-width: 768px){.bb-checkbox-group.inline>.bb-checkbox-group-items{flex-wrap:wrap;flex-direction:row}.bb-checkbox-group.inline>.bb-checkbox-group-items>*:not(:last-child){margin-right:.75rem}}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
961
|
+
}
|
|
962
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbCheckboxGroup, decorators: [{
|
|
963
|
+
type: Component,
|
|
964
|
+
args: [{ selector: 'bb-checkbox-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
965
|
+
'class': 'bb-checkbox-group',
|
|
966
|
+
'[class.grouped]': 'grouped',
|
|
967
|
+
'[class.required]': 'required',
|
|
968
|
+
'[class.inline]': 'inline'
|
|
969
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbTemplate, AsyncPipe], template: "@if (label; as labelContent) {\n <label class=\"bb-checkbox-group-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<div class=\"bb-checkbox-group-items\">\n <ng-content select=\"bb-checkbox\"></ng-content>\n</div>\n", styles: [".bb-checkbox-group{display:block}.bb-checkbox-group.grouped{margin-bottom:1.5rem}.bb-checkbox-group.required>.bb-checkbox-group-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-checkbox-group-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-checkbox-group-items{display:flex;flex-direction:column}.bb-checkbox-group-items:not(:empty){margin-bottom:.25rem}.bb-checkbox-group-items>*{margin-bottom:.25rem}@media only screen and (min-width: 768px){.bb-checkbox-group.inline>.bb-checkbox-group-items{flex-wrap:wrap;flex-direction:row}.bb-checkbox-group.inline>.bb-checkbox-group-items>*:not(:last-child){margin-right:.75rem}}\n"] }]
|
|
970
|
+
}], propDecorators: { label: [{
|
|
971
|
+
type: Input
|
|
972
|
+
}], required: [{
|
|
973
|
+
type: Input,
|
|
974
|
+
args: [{ transform: booleanAttribute }]
|
|
975
|
+
}], grouped: [{
|
|
976
|
+
type: Input,
|
|
977
|
+
args: [{ transform: booleanAttribute }]
|
|
978
|
+
}], inline: [{
|
|
979
|
+
type: Input,
|
|
980
|
+
args: [{ transform: booleanAttribute }]
|
|
981
|
+
}] } });
|
|
982
|
+
|
|
983
|
+
class BbRadioGroup {
|
|
984
|
+
// Value.
|
|
985
|
+
get value() {
|
|
986
|
+
return this._value;
|
|
987
|
+
}
|
|
988
|
+
set value(value) {
|
|
989
|
+
this._value = value;
|
|
990
|
+
this._changeDetectorRef.markForCheck();
|
|
991
|
+
}
|
|
992
|
+
constructor(_changeDetectorRef) {
|
|
993
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
994
|
+
// Inputs.
|
|
995
|
+
this.label = null;
|
|
996
|
+
this.disabled = false;
|
|
997
|
+
this.readonly = false;
|
|
998
|
+
this.required = false;
|
|
999
|
+
this.grouped = false;
|
|
1000
|
+
this.inline = false;
|
|
1001
|
+
this.hideErrors = false;
|
|
1002
|
+
// Outputs.
|
|
1100
1003
|
this.valueChange = new EventEmitter();
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
this.onTouchedCallback = () => {
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1004
|
+
this._value = null;
|
|
1005
|
+
// Callbacks.
|
|
1006
|
+
this.onTouchedCallback = () => ({});
|
|
1007
|
+
this.onChangeCallback = () => ({});
|
|
1008
|
+
// State.
|
|
1009
|
+
this.error = false;
|
|
1010
|
+
}
|
|
1011
|
+
select(value) {
|
|
1012
|
+
if (this.value === value || this.disabled || this.readonly) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
this.value = value;
|
|
1016
|
+
this.onChangeCallback?.(this.value);
|
|
1017
|
+
this.valueChange.emit(this.value);
|
|
1018
|
+
this.onTouchedCallback?.();
|
|
1019
|
+
}
|
|
1020
|
+
registerOnChange(fn) {
|
|
1021
|
+
this.onChangeCallback = fn;
|
|
1022
|
+
}
|
|
1023
|
+
registerOnTouched(fn) {
|
|
1024
|
+
this.onTouchedCallback = fn;
|
|
1025
|
+
}
|
|
1026
|
+
setDisabledState(isDisabled) {
|
|
1027
|
+
this.disabled = isDisabled;
|
|
1028
|
+
}
|
|
1029
|
+
writeValue(newValue) {
|
|
1030
|
+
this.value = newValue;
|
|
1031
|
+
}
|
|
1032
|
+
onErrorChange(error) {
|
|
1033
|
+
this.error = !!error;
|
|
1034
|
+
}
|
|
1035
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRadioGroup, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1036
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbRadioGroup, isStandalone: true, selector: "bb-radio-group", inputs: { label: "label", disabled: ["disabled", "disabled", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], required: ["required", "required", booleanAttribute], grouped: ["grouped", "grouped", booleanAttribute], inline: ["inline", "inline", booleanAttribute], hideErrors: ["hideErrors", "hideErrors", booleanAttribute], value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.readonly": "readonly", "class.grouped": "grouped", "class.required": "required", "class.inline": "inline", "class.error": "error" }, classAttribute: "bb-radio-group" }, providers: [
|
|
1037
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbRadioGroup), multi: true }
|
|
1038
|
+
], ngImport: i0, template: "@if (label; as labelContent) {\n <label class=\"bb-radio-group-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<div class=\"bb-radio-group-items\">\n <ng-content select=\"bb-radio-button\"></ng-content>\n</div>\n\n<!-- The error component. -->\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n", styles: [".bb-radio-group{display:block}.bb-radio-group.grouped{margin-bottom:1.5rem}.bb-radio-group.readonly{pointer-events:none}.bb-radio-group.error>.bb-radio-group-label{color:#c23934}.bb-radio-group.required>.bb-radio-group-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-radio-group-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-radio-group-items{display:flex;flex-direction:column}.bb-radio-group-items:not(:empty){margin-bottom:.25rem}.bb-radio-group-items>*{margin-bottom:.25rem}@media only screen and (min-width: 768px){.bb-radio-group.inline>.bb-radio-group-items{flex-wrap:wrap;flex-direction:row}.bb-radio-group.inline>.bb-radio-group-items>*:not(:last-child){margin-right:.75rem}}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1039
|
+
}
|
|
1040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRadioGroup, decorators: [{
|
|
1041
|
+
type: Component,
|
|
1042
|
+
args: [{ selector: 'bb-radio-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
1043
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbRadioGroup), multi: true }
|
|
1044
|
+
], host: {
|
|
1045
|
+
'class': 'bb-radio-group',
|
|
1046
|
+
'[class.disabled]': 'disabled',
|
|
1047
|
+
'[class.readonly]': 'readonly',
|
|
1048
|
+
'[class.grouped]': 'grouped',
|
|
1049
|
+
'[class.required]': 'required',
|
|
1050
|
+
'[class.inline]': 'inline',
|
|
1051
|
+
'[class.error]': 'error'
|
|
1052
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbTemplate, AsyncPipe, BbFormError], template: "@if (label; as labelContent) {\n <label class=\"bb-radio-group-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<div class=\"bb-radio-group-items\">\n <ng-content select=\"bb-radio-button\"></ng-content>\n</div>\n\n<!-- The error component. -->\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n", styles: [".bb-radio-group{display:block}.bb-radio-group.grouped{margin-bottom:1.5rem}.bb-radio-group.readonly{pointer-events:none}.bb-radio-group.error>.bb-radio-group-label{color:#c23934}.bb-radio-group.required>.bb-radio-group-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-radio-group-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-radio-group-items{display:flex;flex-direction:column}.bb-radio-group-items:not(:empty){margin-bottom:.25rem}.bb-radio-group-items>*{margin-bottom:.25rem}@media only screen and (min-width: 768px){.bb-radio-group.inline>.bb-radio-group-items{flex-wrap:wrap;flex-direction:row}.bb-radio-group.inline>.bb-radio-group-items>*:not(:last-child){margin-right:.75rem}}\n"] }]
|
|
1053
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { label: [{
|
|
1054
|
+
type: Input
|
|
1055
|
+
}], disabled: [{
|
|
1056
|
+
type: Input,
|
|
1057
|
+
args: [{ transform: booleanAttribute }]
|
|
1058
|
+
}], readonly: [{
|
|
1059
|
+
type: Input,
|
|
1060
|
+
args: [{ transform: booleanAttribute }]
|
|
1061
|
+
}], required: [{
|
|
1062
|
+
type: Input,
|
|
1063
|
+
args: [{ transform: booleanAttribute }]
|
|
1064
|
+
}], grouped: [{
|
|
1065
|
+
type: Input,
|
|
1066
|
+
args: [{ transform: booleanAttribute }]
|
|
1067
|
+
}], inline: [{
|
|
1068
|
+
type: Input,
|
|
1069
|
+
args: [{ transform: booleanAttribute }]
|
|
1070
|
+
}], hideErrors: [{
|
|
1071
|
+
type: Input,
|
|
1072
|
+
args: [{ transform: booleanAttribute }]
|
|
1073
|
+
}], valueChange: [{
|
|
1074
|
+
type: Output
|
|
1075
|
+
}], value: [{
|
|
1076
|
+
type: Input
|
|
1077
|
+
}] } });
|
|
1078
|
+
|
|
1079
|
+
class BbRadioButton {
|
|
1080
|
+
// Disabled.
|
|
1081
|
+
set disabled(value) {
|
|
1082
|
+
this._disabled = value;
|
|
1083
|
+
}
|
|
1084
|
+
get disabled() {
|
|
1085
|
+
return this._radioGroup?.disabled || this._disabled;
|
|
1086
|
+
}
|
|
1087
|
+
onClick() {
|
|
1088
|
+
if (this.disabled) {
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
this._radioGroup.select(this.value);
|
|
1092
|
+
}
|
|
1093
|
+
onSpacePressed() {
|
|
1094
|
+
return this.onClick();
|
|
1095
|
+
}
|
|
1096
|
+
get selected() {
|
|
1097
|
+
return this._radioGroup?.value === this.value;
|
|
1098
|
+
}
|
|
1099
|
+
constructor(_radioGroup) {
|
|
1100
|
+
this._radioGroup = _radioGroup;
|
|
1101
|
+
// Inputs.
|
|
1102
|
+
this.value = null;
|
|
1103
|
+
this.hideText = false;
|
|
1104
|
+
this._disabled = false;
|
|
1105
|
+
}
|
|
1106
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRadioButton, deps: [{ token: BbRadioGroup }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1107
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbRadioButton, isStandalone: true, selector: "bb-radio-button", inputs: { value: "value", hideText: ["hideText", "hideText", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, host: { listeners: { "click": "onClick()", "keydown.space": "onSpacePressed()" }, properties: { "class.disabled": "disabled", "tabindex": "disabled ? -1 : 0", "class.selected": "this.selected" }, classAttribute: "bb-radio-button" }, ngImport: i0, template: "<div class=\"bb-radio-button-indicator\"></div>\n@if (!hideText) {\n <span class=\"bb-radio-button-text\"><ng-content></ng-content></span>\n}\n\n", styles: [".bb-radio-button{display:flex;cursor:pointer;align-items:center}.bb-radio-button:not(.disabled):focus>.bb-radio-button-indicator{box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem var(--bb-radio-outline-color)}.bb-radio-button.selected>.bb-radio-button-indicator{border-color:var(--bb-radio-border-color)}.bb-radio-button.selected>.bb-radio-button-indicator:after{opacity:1;transform:none}.bb-radio-button.disabled{-webkit-user-select:none;user-select:none}.bb-radio-button.disabled>.bb-radio-button-indicator{border-color:gray}.bb-radio-button.disabled>.bb-radio-button-indicator:after{background-color:gray}.bb-radio-button.disabled>.bb-radio-button-text{color:gray}.bb-radio-button-indicator{display:flex;width:1.25rem;height:1.25rem;min-width:1.25rem;border-radius:50%;min-height:1.25rem;align-items:center;justify-content:center;border:1px solid hsl(213,8%,74%);transition:box-shadow .25s cubic-bezier(0,0,.2,1),border-color .25s cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-radio-button-indicator:after{opacity:0;content:\"\";display:block;border-radius:50%;transform:scale(0);width:.625rem;height:.625rem;background-color:var(--bb-radio-indicator-color);transition:transform .12s cubic-bezier(0,0,.2,1),opacity .12s cubic-bezier(0,0,.2,1)}.bb-radio-button-text{color:#111;font-size:1rem;font-weight:400;padding-left:.5rem}.bb-radio-button-text>small{display:block;line-height:1.5;font-size:.8125rem;margin-top:.125rem;color:#758795}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1108
|
+
}
|
|
1109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbRadioButton, decorators: [{
|
|
1110
|
+
type: Component,
|
|
1111
|
+
args: [{ selector: 'bb-radio-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1112
|
+
'class': 'bb-radio-button',
|
|
1113
|
+
'[class.disabled]': 'disabled',
|
|
1114
|
+
'[tabindex]': 'disabled ? -1 : 0'
|
|
1115
|
+
}, preserveWhitespaces: false, standalone: true, template: "<div class=\"bb-radio-button-indicator\"></div>\n@if (!hideText) {\n <span class=\"bb-radio-button-text\"><ng-content></ng-content></span>\n}\n\n", styles: [".bb-radio-button{display:flex;cursor:pointer;align-items:center}.bb-radio-button:not(.disabled):focus>.bb-radio-button-indicator{box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem var(--bb-radio-outline-color)}.bb-radio-button.selected>.bb-radio-button-indicator{border-color:var(--bb-radio-border-color)}.bb-radio-button.selected>.bb-radio-button-indicator:after{opacity:1;transform:none}.bb-radio-button.disabled{-webkit-user-select:none;user-select:none}.bb-radio-button.disabled>.bb-radio-button-indicator{border-color:gray}.bb-radio-button.disabled>.bb-radio-button-indicator:after{background-color:gray}.bb-radio-button.disabled>.bb-radio-button-text{color:gray}.bb-radio-button-indicator{display:flex;width:1.25rem;height:1.25rem;min-width:1.25rem;border-radius:50%;min-height:1.25rem;align-items:center;justify-content:center;border:1px solid hsl(213,8%,74%);transition:box-shadow .25s cubic-bezier(0,0,.2,1),border-color .25s cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-radio-button-indicator:after{opacity:0;content:\"\";display:block;border-radius:50%;transform:scale(0);width:.625rem;height:.625rem;background-color:var(--bb-radio-indicator-color);transition:transform .12s cubic-bezier(0,0,.2,1),opacity .12s cubic-bezier(0,0,.2,1)}.bb-radio-button-text{color:#111;font-size:1rem;font-weight:400;padding-left:.5rem}.bb-radio-button-text>small{display:block;line-height:1.5;font-size:.8125rem;margin-top:.125rem;color:#758795}\n"] }]
|
|
1116
|
+
}], ctorParameters: () => [{ type: BbRadioGroup }], propDecorators: { value: [{
|
|
1117
|
+
type: Input
|
|
1118
|
+
}], hideText: [{
|
|
1119
|
+
type: Input,
|
|
1120
|
+
args: [{ transform: booleanAttribute }]
|
|
1121
|
+
}], disabled: [{
|
|
1122
|
+
type: Input,
|
|
1123
|
+
args: [{ transform: booleanAttribute }]
|
|
1124
|
+
}], onClick: [{
|
|
1125
|
+
type: HostListener,
|
|
1126
|
+
args: ['click']
|
|
1127
|
+
}], onSpacePressed: [{
|
|
1128
|
+
type: HostListener,
|
|
1129
|
+
args: ['keydown.space']
|
|
1130
|
+
}], selected: [{
|
|
1131
|
+
type: HostBinding,
|
|
1132
|
+
args: ['class.selected']
|
|
1133
|
+
}] } });
|
|
1134
|
+
|
|
1135
|
+
class BbAvatar {
|
|
1136
|
+
constructor() {
|
|
1137
|
+
// Inputs.
|
|
1138
|
+
this.size = 2.5;
|
|
1139
|
+
// State.
|
|
1140
|
+
this.state$ = new BehaviorSubject('initials');
|
|
1141
|
+
// Data.
|
|
1142
|
+
this._src = null;
|
|
1143
|
+
this._title = null;
|
|
1144
|
+
this._initials = '!';
|
|
1145
|
+
this._color = 'rgb(255, 255, 255)';
|
|
1146
|
+
this._backgroundColor = 'rgb(66, 66, 66)';
|
|
1147
|
+
this.toRgb = (value) => {
|
|
1148
|
+
const baseRed = 128;
|
|
1149
|
+
const baseGreen = 128;
|
|
1150
|
+
const baseBlue = 128;
|
|
1151
|
+
let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
|
|
1152
|
+
const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1153
|
+
const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1154
|
+
const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1155
|
+
const r = Math.round((rand_1 + baseRed) / 2);
|
|
1156
|
+
const g = Math.round((rand_2 + baseGreen) / 2);
|
|
1157
|
+
const b = Math.round((rand_3 + baseBlue) / 2);
|
|
1158
|
+
return { r, g, b };
|
|
1106
1159
|
};
|
|
1107
|
-
this.
|
|
1108
|
-
|
|
1160
|
+
this.getInitials = (name) => {
|
|
1161
|
+
// Get all the initials.
|
|
1162
|
+
const names = (name ?? '').split(' ');
|
|
1163
|
+
const initials = names
|
|
1164
|
+
.map(name => name.charAt(0).toUpperCase())
|
|
1165
|
+
.filter(name => /^[a-zA-Z]+$/.test(name));
|
|
1166
|
+
// Check if there are any initials.
|
|
1167
|
+
if (initials?.length <= 0) {
|
|
1109
1168
|
return null;
|
|
1110
1169
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1170
|
+
// Get the first and last initials.
|
|
1171
|
+
if (initials?.length > 1) {
|
|
1172
|
+
return `${initials?.[0]}${initials?.[initials?.length - 1]}`;
|
|
1173
|
+
}
|
|
1174
|
+
// Get only the first initial.
|
|
1175
|
+
return initials?.[0];
|
|
1114
1176
|
};
|
|
1115
|
-
this.
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const currentFullYear = new Date().getFullYear();
|
|
1119
|
-
// Handle default "current" syntax.
|
|
1120
|
-
if (yearString === 'current') {
|
|
1121
|
-
return currentFullYear;
|
|
1177
|
+
this.parseColorFormat = (value) => {
|
|
1178
|
+
if (!value) {
|
|
1179
|
+
return null;
|
|
1122
1180
|
}
|
|
1123
|
-
//
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1181
|
+
// Hex 3 values.
|
|
1182
|
+
let match = value.match(/^#([0-9a-f]{3})$/i);
|
|
1183
|
+
if (match && match[1]) {
|
|
1184
|
+
const r = parseInt(match[1].charAt(0), 16) * 0x11;
|
|
1185
|
+
const g = parseInt(match[1].charAt(1), 16) * 0x11;
|
|
1186
|
+
const b = parseInt(match[1].charAt(2), 16) * 0x11;
|
|
1187
|
+
return { r, g, b };
|
|
1127
1188
|
}
|
|
1128
|
-
//
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1189
|
+
// Hex 6 values.
|
|
1190
|
+
match = value.match(/^#([0-9a-f]{6})$/i);
|
|
1191
|
+
if (match && match[1]) {
|
|
1192
|
+
const r = parseInt(match[1].substring(0, 2), 16);
|
|
1193
|
+
const g = parseInt(match[1].substring(2, 4), 16);
|
|
1194
|
+
const b = parseInt(match[1].substring(4, 6), 16);
|
|
1195
|
+
return { r, g, b };
|
|
1132
1196
|
}
|
|
1133
|
-
//
|
|
1134
|
-
|
|
1135
|
-
|
|
1197
|
+
// Rgb values.
|
|
1198
|
+
match = value.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
|
|
1199
|
+
if (match) {
|
|
1200
|
+
const r = parseInt(match[1], 10);
|
|
1201
|
+
const g = parseInt(match[2], 10);
|
|
1202
|
+
const b = parseInt(match[3], 10);
|
|
1203
|
+
return { r, g, b };
|
|
1136
1204
|
}
|
|
1137
|
-
//
|
|
1205
|
+
// Not a supported color format.
|
|
1206
|
+
console?.warn?.(`BbAvatar: Unsupported tintColor "${value}" was used.`);
|
|
1138
1207
|
return null;
|
|
1139
1208
|
};
|
|
1140
|
-
this.getDaysInMonth = (month = null, year = null) => {
|
|
1141
|
-
if (this.form?.invalid || month === null || year === null) {
|
|
1142
|
-
return 31;
|
|
1143
|
-
}
|
|
1144
|
-
const parsedYear = parseInt(year, 10);
|
|
1145
|
-
return new Date(parsedYear, month, 0).getDate();
|
|
1146
|
-
};
|
|
1147
|
-
this.isValidDateString = (value) => {
|
|
1148
|
-
return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
|
|
1149
|
-
};
|
|
1150
|
-
this.padString = (value, maxLength, fillString = '0') => {
|
|
1151
|
-
const count = maxLength - value.length;
|
|
1152
|
-
for (let index = 0; index < count; index++) {
|
|
1153
|
-
value = `${fillString}${value}`;
|
|
1154
|
-
}
|
|
1155
|
-
return value;
|
|
1156
|
-
};
|
|
1157
1209
|
}
|
|
1158
|
-
|
|
1159
|
-
this.
|
|
1160
|
-
this.
|
|
1161
|
-
|
|
1210
|
+
set src(value) {
|
|
1211
|
+
this._src = value;
|
|
1212
|
+
if (this._src) {
|
|
1213
|
+
this.state$.next('image');
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
set title(value) {
|
|
1217
|
+
// Set the title and the initials.
|
|
1218
|
+
this._title = value ?? '!';
|
|
1219
|
+
this._initials = this.getInitials(this._title);
|
|
1220
|
+
// Generate the colors based on the name.
|
|
1221
|
+
const { r, g, b } = this.toRgb(this._title);
|
|
1222
|
+
this.setColors(r, g, b);
|
|
1223
|
+
}
|
|
1224
|
+
set tintColor(value) {
|
|
1225
|
+
const result = this.parseColorFormat(value);
|
|
1226
|
+
if (!result) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
const { r, g, b } = result;
|
|
1230
|
+
this.setColors(r, g, b);
|
|
1231
|
+
}
|
|
1232
|
+
get src() {
|
|
1233
|
+
return this._src;
|
|
1234
|
+
}
|
|
1235
|
+
get color() {
|
|
1236
|
+
return this._color;
|
|
1237
|
+
}
|
|
1238
|
+
get backgroundColor() {
|
|
1239
|
+
return this._backgroundColor;
|
|
1240
|
+
}
|
|
1241
|
+
get title() {
|
|
1242
|
+
return this._title;
|
|
1243
|
+
}
|
|
1244
|
+
get initials() {
|
|
1245
|
+
return this._initials;
|
|
1246
|
+
}
|
|
1247
|
+
setColors(red, green, blue) {
|
|
1248
|
+
this._color = `rgb(${red},${green},${blue})`;
|
|
1249
|
+
this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
|
|
1250
|
+
}
|
|
1251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbAvatar, isStandalone: true, selector: "bb-avatar", inputs: { size: ["size", "size", numberAttribute], src: "src", title: "title", tintColor: "tintColor" }, host: { attributes: { "role": "img" }, properties: { "style.width.rem": "size", "style.min-width.rem": "size", "style.height.rem": "size", "style.min-height.rem": "size", "style.font-size.rem": "size * 0.42", "style.color": "color", "style.background-color": "backgroundColor", "attr.title": "this.title" }, classAttribute: "bb-avatar" }, ngImport: i0, template: "@switch (state$ | async) {\n @case ('image') {\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n }\n @default {\n {{ initials }}\n }\n}\n", styles: [".bb-avatar{line-height:1;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1253
|
+
}
|
|
1254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbAvatar, decorators: [{
|
|
1255
|
+
type: Component,
|
|
1256
|
+
args: [{ selector: 'bb-avatar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
|
|
1257
|
+
'class': 'bb-avatar',
|
|
1258
|
+
'role': 'img',
|
|
1259
|
+
'[style.width.rem]': 'size',
|
|
1260
|
+
'[style.min-width.rem]': 'size',
|
|
1261
|
+
'[style.height.rem]': 'size',
|
|
1262
|
+
'[style.min-height.rem]': 'size',
|
|
1263
|
+
'[style.font-size.rem]': 'size * 0.42',
|
|
1264
|
+
'[style.color]': 'color',
|
|
1265
|
+
'[style.background-color]': 'backgroundColor'
|
|
1266
|
+
}, standalone: true, imports: [AsyncPipe], template: "@switch (state$ | async) {\n @case ('image') {\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n }\n @default {\n {{ initials }}\n }\n}\n", styles: [".bb-avatar{line-height:1;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
|
|
1267
|
+
}], propDecorators: { size: [{
|
|
1268
|
+
type: Input,
|
|
1269
|
+
args: [{ transform: numberAttribute }]
|
|
1270
|
+
}], src: [{
|
|
1271
|
+
type: Input
|
|
1272
|
+
}], title: [{
|
|
1273
|
+
type: Input
|
|
1274
|
+
}, {
|
|
1275
|
+
type: HostBinding,
|
|
1276
|
+
args: ['attr.title']
|
|
1277
|
+
}], tintColor: [{
|
|
1278
|
+
type: Input
|
|
1279
|
+
}] } });
|
|
1280
|
+
|
|
1281
|
+
let nextUniqueId$1 = 0;
|
|
1282
|
+
class BbMultiFileControl {
|
|
1283
|
+
constructor(_files, _changeDetectorRef) {
|
|
1284
|
+
this._files = _files;
|
|
1285
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
1286
|
+
// Readonly data.
|
|
1287
|
+
this.labelId = `bb-multi-file-control-${nextUniqueId$1++}`;
|
|
1288
|
+
// Inputs.
|
|
1289
|
+
this.label = null;
|
|
1290
|
+
this.hint = null;
|
|
1291
|
+
this.accept = null;
|
|
1292
|
+
this.grouped = false;
|
|
1293
|
+
this.required = false;
|
|
1294
|
+
this.disabled = false;
|
|
1295
|
+
this.hideErrors = false;
|
|
1296
|
+
this.items = [];
|
|
1297
|
+
// Outputs.
|
|
1298
|
+
this.delete = new EventEmitter();
|
|
1299
|
+
// State.
|
|
1300
|
+
this.value = [];
|
|
1301
|
+
this.dragging = false;
|
|
1302
|
+
this.error = false;
|
|
1303
|
+
// Callbacks.
|
|
1304
|
+
this.onTouchedCallback = () => ({});
|
|
1305
|
+
this.onChangeCallback = () => ({});
|
|
1306
|
+
}
|
|
1307
|
+
get showList() {
|
|
1308
|
+
return this.value?.length > 0 || this.items?.length > 0;
|
|
1162
1309
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1310
|
+
onDrag(event, isHovered) {
|
|
1311
|
+
event.preventDefault();
|
|
1312
|
+
event.stopPropagation();
|
|
1313
|
+
if (this.disabled) {
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
this.dragging = isHovered;
|
|
1317
|
+
}
|
|
1318
|
+
onDrop(event) {
|
|
1319
|
+
event.preventDefault();
|
|
1320
|
+
event.stopPropagation();
|
|
1321
|
+
if (this.disabled) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
this.dragging = false;
|
|
1325
|
+
const files = event?.['dataTransfer'].files;
|
|
1326
|
+
return this.addFiles(files);
|
|
1327
|
+
}
|
|
1328
|
+
downloadFile(file) {
|
|
1329
|
+
return this._files.download(file, file?.name);
|
|
1330
|
+
}
|
|
1331
|
+
openFileDialog() {
|
|
1332
|
+
const element = this.fileInput?.nativeElement;
|
|
1333
|
+
element?.click();
|
|
1334
|
+
}
|
|
1335
|
+
onFileChange(event) {
|
|
1336
|
+
if (this.disabled) {
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
const files = event.target?.['files'];
|
|
1340
|
+
this.addFiles(files);
|
|
1341
|
+
this.fileInput.nativeElement.value = null;
|
|
1342
|
+
this.onChangeCallback?.(this.value);
|
|
1343
|
+
}
|
|
1344
|
+
deleteFile(index) {
|
|
1345
|
+
this.value = this.value?.filter((_, i) => i !== index) ?? [];
|
|
1346
|
+
this.onChangeCallback?.(this.value);
|
|
1165
1347
|
}
|
|
1166
1348
|
writeValue(value) {
|
|
1167
|
-
this.
|
|
1349
|
+
this.value = value ?? [];
|
|
1168
1350
|
}
|
|
1169
1351
|
registerOnChange(method) {
|
|
1170
1352
|
this.onChangeCallback = method;
|
|
@@ -1174,661 +1356,793 @@ class BbDatePicker extends BbFilePickerMixinBase {
|
|
|
1174
1356
|
}
|
|
1175
1357
|
setDisabledState(isDisabled) {
|
|
1176
1358
|
this.disabled = isDisabled;
|
|
1177
|
-
this.disabled ? this.form?.disable() : this.form?.enable();
|
|
1178
1359
|
this._changeDetectorRef.markForCheck();
|
|
1179
1360
|
}
|
|
1180
1361
|
onErrorChange(error) {
|
|
1181
1362
|
this.error = !!error;
|
|
1182
1363
|
}
|
|
1183
1364
|
validate({ value }) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1365
|
+
// TODO(@Stan): file size validation + file type validation
|
|
1366
|
+
return null;
|
|
1367
|
+
}
|
|
1368
|
+
addFiles(files) {
|
|
1369
|
+
for (let index = 0; index < files?.length; index++) {
|
|
1370
|
+
const file = files?.[index] ?? null;
|
|
1371
|
+
if (!(this.isFile(file) || this.isBlob(file))) {
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1374
|
+
this.value.push(file);
|
|
1186
1375
|
}
|
|
1187
|
-
const data = this.parseDateString(value);
|
|
1188
|
-
const date = new Date(data?.year, data?.month - 1, data?.day);
|
|
1189
|
-
const maxDays = this.getDaysInMonth(data?.month, `${data?.year}`);
|
|
1190
|
-
const isInvalidDate = date.toString() === 'Invalid Date';
|
|
1191
|
-
const exceededMaxDays = data?.day > maxDays;
|
|
1192
|
-
return (isInvalidDate || exceededMaxDays) && {
|
|
1193
|
-
invalidDate: true
|
|
1194
|
-
};
|
|
1195
1376
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
const subscription = dateOrNull$.subscribe(() => {
|
|
1199
|
-
this.valueChange.emit(this.value);
|
|
1200
|
-
this.onChangeCallback(this.value);
|
|
1201
|
-
});
|
|
1202
|
-
this._subscription.add(subscription);
|
|
1377
|
+
isFile(input) {
|
|
1378
|
+
return 'File' in window && input instanceof File;
|
|
1203
1379
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
const months$ = this.getMonthData();
|
|
1207
|
-
const days$ = this.getDayData();
|
|
1208
|
-
this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => this.verifyListData(data?.days?.length, data?.years)));
|
|
1380
|
+
isBlob(input) {
|
|
1381
|
+
return 'Blob' in window && input instanceof Blob;
|
|
1209
1382
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbMultiFileControl, deps: [{ token: i1$1.Files }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1384
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbMultiFileControl, isStandalone: true, selector: "bb-multi-file-control", inputs: { label: "label", hint: "hint", accept: "accept", grouped: ["grouped", "grouped", booleanAttribute], required: ["required", "required", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], hideErrors: ["hideErrors", "hideErrors", booleanAttribute], items: "items" }, outputs: { delete: "delete" }, host: { listeners: { "dragover": "onDrag($event,true)", "dragleave": "onDrag($event,false)", "drop": "onDrop($event)" }, properties: { "class.required": "required", "class.disabled": "disabled", "class.grouped": "grouped", "class.dragging": "dragging", "class.error": "error" }, classAttribute: "bb-multi-file-control" }, providers: [
|
|
1385
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbMultiFileControl), multi: true },
|
|
1386
|
+
{ provide: NG_VALIDATORS, useExisting: BbMultiFileControl, multi: true }
|
|
1387
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<!-- The label of the input. -->\n@if (label; as labelContent) {\n <label [for]=\"labelId\"\n class=\"bb-multi-file-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<input #fileInput\n [id]=\"labelId\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-multi-file-control-input\"\n type=\"file\"\n tabindex=\"-1\"\n multiple>\n\n<div class=\"bb-multi-file-control-container\">\n @if (showList) {\n <ul class=\"bb-multi-file-control-list\">\n @for (item of items; track item?.id) {\n <li class=\"bb-multi-file-control-item\">\n <i class=\"bb-multi-file-control-icon attach-horizontal\"></i>\n <a [href]=\"item?.url\"\n target=\"_blank\"\n rel=\"noopener\"\n class=\"bb-multi-file-control-item-content\">{{ item?.label }}</a>\n @if (!disabled && delete?.observed) {\n <button (click)=\"delete?.emit(item)\"\n type=\"button\"\n class=\"bb-multi-file-control-item-button\">\n <i class=\"bb-multi-file-control-icon clear\"></i>\n </button>\n }\n </li>\n }\n @for (file of value; track $index) {\n <li class=\"bb-multi-file-control-item\">\n <i class=\"bb-multi-file-control-icon attach-horizontal\"></i>\n <button (click)=\"downloadFile(file)\"\n class=\"bb-multi-file-control-item-content\"\n type=\"button\">\n {{ file?.name }}\n </button>\n @if (!disabled) {\n <button (click)=\"deleteFile($index)\"\n type=\"button\"\n class=\"bb-multi-file-control-item-button\">\n <i class=\"bb-multi-file-control-icon clear\"></i>\n </button>\n }\n </li>\n }\n </ul>\n } @else if (!disabled) {\n <i class=\"bb-multi-file-control-icon attach-vertical\"></i>\n <p [bb-localize-string]=\"'multi-file-control.choose_file_text' | bbLocalize\"\n class=\"bb-multi-file-control-empty\">\n <label *bbLocalizeTemplate=\"'label'\"\n [for]=\"labelId\">{{ 'multi-file-control.choose_file' | bbLocalize }}</label>\n </p>\n }\n @if (!disabled) {\n <button (click)=\"openFileDialog()\"\n type=\"button\"\n class=\"primary small bb-multi-file-control-button\"\n bb-button>\n <i class=\"bb-multi-file-control-icon add\" suffix></i>\n {{ 'multi-file-control.choose_file' | bbLocalize }}\n </button>\n }\n</div>\n\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n\n<!-- The file picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-multi-file-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-multi-file-control{display:block}.bb-multi-file-control.grouped{margin-bottom:1.5rem}.bb-multi-file-control.required>.bb-multi-file-control-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-multi-file-control.dragging>.bb-multi-file-control-container{border-color:#757e8a;box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-multi-file-control-box-shadow)}.bb-multi-file-control.disabled>.bb-multi-file-control-container{cursor:default;color:gray;background-color:#e6e6e6}.bb-multi-file-control-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-multi-file-control-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-multi-file-control-container{width:100%;display:flex;color:#111;padding:.5rem;overflow:hidden;min-height:7.5rem;align-items:center;border-radius:.5rem;flex-direction:column;justify-content:center;background-color:#fff;border:1px solid hsl(213,8%,74%);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-multi-file-control-button{margin-top:.5rem}.bb-multi-file-control-list{flex:1;width:100%;overflow:hidden}.bb-multi-file-control-empty{flex:1;width:100%;color:#758795;display:block;font-weight:400;line-height:1.5;text-align:center;font-size:.875rem}.bb-multi-file-control-empty>label{cursor:pointer;display:inline;font-size:inherit;font-weight:inherit;text-decoration:underline;color:var(--bb-multi-file-control-color)}.bb-multi-file-control-item{height:2rem;display:flex;max-width:100%;overflow:hidden;align-items:center;white-space:nowrap;border-radius:.5rem;text-overflow:ellipsis;padding:0 .25rem 0 .5rem;border:1px solid hsl(213,8%,74%);background-color:#edf4fd}.bb-multi-file-control-item:not(:last-child){margin-bottom:.25rem}.bb-multi-file-control-item-content{flex:1;padding:0;border:none;max-width:100%;margin:0 .5rem;overflow:hidden;appearance:none;text-align:left;font-weight:400;font-size:.875rem;white-space:nowrap;text-decoration:none;text-overflow:ellipsis;background-color:transparent}.bb-multi-file-control-item-content,.bb-multi-file-control-item-content:visited{color:#0a305c}.bb-multi-file-control-item-content:hover,.bb-multi-file-control-item-content:focus{text-decoration:underline}.bb-multi-file-control-item-button{padding:0;width:1.5rem;display:flex;height:1.5rem;align-items:center;border-radius:.25rem;justify-content:center;border:1px solid hsl(0,73%,25%);background-color:#b51c1c}.bb-multi-file-control-item-button:hover,.bb-multi-file-control-item-button:focus{background-color:#a81a1a}.bb-multi-file-control-item-button:active{background-color:#9a1818}.bb-multi-file-control-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}.bb-multi-file-control-icon{width:1.25rem;height:1.25rem;display:inline-flex;background-size:contain;background-repeat:no-repeat;background-position:center center}.bb-multi-file-control-icon.add{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23fff\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.attach-vertical{width:1.5rem;height:1.5rem;margin-bottom:.5rem;background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23758795\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.attach-horizontal{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.clear{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23fff\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"/%3E%3C/svg%3E')}\n"], dependencies: [{ kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "component", type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }, { kind: "pipe", type: BbLocalize, name: "bbLocalize" }, { kind: "directive", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: ["bbLocalizeTemplate"] }, { kind: "component", type: BbLocalizeString, selector: "[bb-localize-string]", inputs: ["substitutions", "bb-localize-string"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1388
|
+
}
|
|
1389
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbMultiFileControl, decorators: [{
|
|
1390
|
+
type: Component,
|
|
1391
|
+
args: [{ selector: 'bb-multi-file-control', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
1392
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbMultiFileControl), multi: true },
|
|
1393
|
+
{ provide: NG_VALIDATORS, useExisting: BbMultiFileControl, multi: true }
|
|
1394
|
+
], host: {
|
|
1395
|
+
'class': 'bb-multi-file-control',
|
|
1396
|
+
'[class.required]': 'required',
|
|
1397
|
+
'[class.disabled]': 'disabled',
|
|
1398
|
+
'[class.grouped]': 'grouped',
|
|
1399
|
+
'[class.dragging]': 'dragging',
|
|
1400
|
+
'[class.error]': 'error'
|
|
1401
|
+
}, preserveWhitespaces: false, standalone: true, imports: [BbFormError, BbTemplate, BbButton, BbLocalize, BbLocalizeTemplate, BbLocalizeString], template: "<!-- The label of the input. -->\n@if (label; as labelContent) {\n <label [for]=\"labelId\"\n class=\"bb-multi-file-control-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<input #fileInput\n [id]=\"labelId\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-multi-file-control-input\"\n type=\"file\"\n tabindex=\"-1\"\n multiple>\n\n<div class=\"bb-multi-file-control-container\">\n @if (showList) {\n <ul class=\"bb-multi-file-control-list\">\n @for (item of items; track item?.id) {\n <li class=\"bb-multi-file-control-item\">\n <i class=\"bb-multi-file-control-icon attach-horizontal\"></i>\n <a [href]=\"item?.url\"\n target=\"_blank\"\n rel=\"noopener\"\n class=\"bb-multi-file-control-item-content\">{{ item?.label }}</a>\n @if (!disabled && delete?.observed) {\n <button (click)=\"delete?.emit(item)\"\n type=\"button\"\n class=\"bb-multi-file-control-item-button\">\n <i class=\"bb-multi-file-control-icon clear\"></i>\n </button>\n }\n </li>\n }\n @for (file of value; track $index) {\n <li class=\"bb-multi-file-control-item\">\n <i class=\"bb-multi-file-control-icon attach-horizontal\"></i>\n <button (click)=\"downloadFile(file)\"\n class=\"bb-multi-file-control-item-content\"\n type=\"button\">\n {{ file?.name }}\n </button>\n @if (!disabled) {\n <button (click)=\"deleteFile($index)\"\n type=\"button\"\n class=\"bb-multi-file-control-item-button\">\n <i class=\"bb-multi-file-control-icon clear\"></i>\n </button>\n }\n </li>\n }\n </ul>\n } @else if (!disabled) {\n <i class=\"bb-multi-file-control-icon attach-vertical\"></i>\n <p [bb-localize-string]=\"'multi-file-control.choose_file_text' | bbLocalize\"\n class=\"bb-multi-file-control-empty\">\n <label *bbLocalizeTemplate=\"'label'\"\n [for]=\"labelId\">{{ 'multi-file-control.choose_file' | bbLocalize }}</label>\n </p>\n }\n @if (!disabled) {\n <button (click)=\"openFileDialog()\"\n type=\"button\"\n class=\"primary small bb-multi-file-control-button\"\n bb-button>\n <i class=\"bb-multi-file-control-icon add\" suffix></i>\n {{ 'multi-file-control.choose_file' | bbLocalize }}\n </button>\n }\n</div>\n\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n\n<!-- The file picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-multi-file-control-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-multi-file-control{display:block}.bb-multi-file-control.grouped{margin-bottom:1.5rem}.bb-multi-file-control.required>.bb-multi-file-control-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-multi-file-control.dragging>.bb-multi-file-control-container{border-color:#757e8a;box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-multi-file-control-box-shadow)}.bb-multi-file-control.disabled>.bb-multi-file-control-container{cursor:default;color:gray;background-color:#e6e6e6}.bb-multi-file-control-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-multi-file-control-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-multi-file-control-container{width:100%;display:flex;color:#111;padding:.5rem;overflow:hidden;min-height:7.5rem;align-items:center;border-radius:.5rem;flex-direction:column;justify-content:center;background-color:#fff;border:1px solid hsl(213,8%,74%);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-multi-file-control-button{margin-top:.5rem}.bb-multi-file-control-list{flex:1;width:100%;overflow:hidden}.bb-multi-file-control-empty{flex:1;width:100%;color:#758795;display:block;font-weight:400;line-height:1.5;text-align:center;font-size:.875rem}.bb-multi-file-control-empty>label{cursor:pointer;display:inline;font-size:inherit;font-weight:inherit;text-decoration:underline;color:var(--bb-multi-file-control-color)}.bb-multi-file-control-item{height:2rem;display:flex;max-width:100%;overflow:hidden;align-items:center;white-space:nowrap;border-radius:.5rem;text-overflow:ellipsis;padding:0 .25rem 0 .5rem;border:1px solid hsl(213,8%,74%);background-color:#edf4fd}.bb-multi-file-control-item:not(:last-child){margin-bottom:.25rem}.bb-multi-file-control-item-content{flex:1;padding:0;border:none;max-width:100%;margin:0 .5rem;overflow:hidden;appearance:none;text-align:left;font-weight:400;font-size:.875rem;white-space:nowrap;text-decoration:none;text-overflow:ellipsis;background-color:transparent}.bb-multi-file-control-item-content,.bb-multi-file-control-item-content:visited{color:#0a305c}.bb-multi-file-control-item-content:hover,.bb-multi-file-control-item-content:focus{text-decoration:underline}.bb-multi-file-control-item-button{padding:0;width:1.5rem;display:flex;height:1.5rem;align-items:center;border-radius:.25rem;justify-content:center;border:1px solid hsl(0,73%,25%);background-color:#b51c1c}.bb-multi-file-control-item-button:hover,.bb-multi-file-control-item-button:focus{background-color:#a81a1a}.bb-multi-file-control-item-button:active{background-color:#9a1818}.bb-multi-file-control-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}.bb-multi-file-control-icon{width:1.25rem;height:1.25rem;display:inline-flex;background-size:contain;background-repeat:no-repeat;background-position:center center}.bb-multi-file-control-icon.add{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23fff\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.attach-vertical{width:1.5rem;height:1.5rem;margin-bottom:.5rem;background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23758795\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.attach-horizontal{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"/%3E%3C/svg%3E')}.bb-multi-file-control-icon.clear{background-image:url('data:image/svg+xml,%3Csvg xmlns=\"http://www.w3.org/2000/svg\" fill=\"%23fff\" viewBox=\"0 0 24 24\"%3E%3Cpath d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"/%3E%3C/svg%3E')}\n"] }]
|
|
1402
|
+
}], ctorParameters: () => [{ type: i1$1.Files }, { type: i0.ChangeDetectorRef }], propDecorators: { fileInput: [{
|
|
1403
|
+
type: ViewChild,
|
|
1404
|
+
args: ['fileInput', { static: true }]
|
|
1405
|
+
}], label: [{
|
|
1406
|
+
type: Input
|
|
1407
|
+
}], hint: [{
|
|
1408
|
+
type: Input
|
|
1409
|
+
}], accept: [{
|
|
1410
|
+
type: Input
|
|
1411
|
+
}], grouped: [{
|
|
1412
|
+
type: Input,
|
|
1413
|
+
args: [{ transform: booleanAttribute }]
|
|
1414
|
+
}], required: [{
|
|
1415
|
+
type: Input,
|
|
1416
|
+
args: [{ transform: booleanAttribute }]
|
|
1417
|
+
}], disabled: [{
|
|
1418
|
+
type: Input,
|
|
1419
|
+
args: [{ transform: booleanAttribute }]
|
|
1420
|
+
}], hideErrors: [{
|
|
1421
|
+
type: Input,
|
|
1422
|
+
args: [{ transform: booleanAttribute }]
|
|
1423
|
+
}], items: [{
|
|
1424
|
+
type: Input
|
|
1425
|
+
}], delete: [{
|
|
1426
|
+
type: Output
|
|
1427
|
+
}], onDrag: [{
|
|
1428
|
+
type: HostListener,
|
|
1429
|
+
args: ['dragover', ['$event', 'true']]
|
|
1430
|
+
}, {
|
|
1431
|
+
type: HostListener,
|
|
1432
|
+
args: ['dragleave', ['$event', 'false']]
|
|
1433
|
+
}], onDrop: [{
|
|
1434
|
+
type: HostListener,
|
|
1435
|
+
args: ['drop', ['$event']]
|
|
1436
|
+
}] } });
|
|
1437
|
+
|
|
1438
|
+
let nextUniqueId = 0;
|
|
1439
|
+
class BbFilePicker {
|
|
1440
|
+
constructor() {
|
|
1441
|
+
// Readonly data.
|
|
1442
|
+
this.labelId = `bb-file-picker-${nextUniqueId++}`;
|
|
1443
|
+
// Inputs.
|
|
1444
|
+
this.label = null;
|
|
1445
|
+
this.hint = null;
|
|
1446
|
+
this.accept = null;
|
|
1447
|
+
this.showImages = true;
|
|
1448
|
+
this.allowDragging = true;
|
|
1449
|
+
this.grouped = false;
|
|
1450
|
+
this.required = false;
|
|
1451
|
+
this.disabled = false;
|
|
1452
|
+
this.hideErrors = false;
|
|
1453
|
+
// State.
|
|
1454
|
+
this.hovered = false;
|
|
1455
|
+
this.error = false;
|
|
1456
|
+
this.value$ = new BehaviorSubject({});
|
|
1457
|
+
// Callbacks.
|
|
1458
|
+
this.onTouchedCallback = () => ({});
|
|
1459
|
+
this.onChangeCallback = () => ({});
|
|
1460
|
+
this.valueChange = new EventEmitter();
|
|
1461
|
+
this.saveFile = (files) => {
|
|
1462
|
+
// Validate the files exist.
|
|
1463
|
+
if (!files) {
|
|
1464
|
+
return;
|
|
1222
1465
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1466
|
+
// Retrieve the first file.
|
|
1467
|
+
const file = files[0];
|
|
1468
|
+
// Validate the first file exists.
|
|
1469
|
+
if (!file) {
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
// Save the file.
|
|
1473
|
+
this.value = file;
|
|
1474
|
+
};
|
|
1475
|
+
this.getFileListFromEvent = (event) => {
|
|
1476
|
+
const element = event.target;
|
|
1477
|
+
if (!element) {
|
|
1478
|
+
return null;
|
|
1479
|
+
}
|
|
1480
|
+
return element.files;
|
|
1481
|
+
};
|
|
1482
|
+
this.preventDefault = (event) => {
|
|
1483
|
+
event.preventDefault();
|
|
1484
|
+
event.stopPropagation();
|
|
1485
|
+
};
|
|
1231
1486
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
const date = new Date(2000, month, 1);
|
|
1236
|
-
const label = formatDate(date, 'LLLL', locale);
|
|
1237
|
-
return { label, value: month + 1 };
|
|
1238
|
-
});
|
|
1239
|
-
}));
|
|
1487
|
+
get value() {
|
|
1488
|
+
const { file } = this.value$.getValue();
|
|
1489
|
+
return file;
|
|
1240
1490
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
|
|
1245
|
-
this.form = new FormGroup({
|
|
1246
|
-
day: new FormControl(null, required),
|
|
1247
|
-
month: new FormControl(null, required),
|
|
1248
|
-
year: new FormControl(null, yearValidators)
|
|
1249
|
-
});
|
|
1491
|
+
set value(value) {
|
|
1492
|
+
this.value$.next({ file: value });
|
|
1493
|
+
this.valueChange.emit(value);
|
|
1250
1494
|
}
|
|
1251
|
-
|
|
1252
|
-
//
|
|
1253
|
-
if (!this.
|
|
1254
|
-
if (value !== null) {
|
|
1255
|
-
this.form?.reset({ year: null, month: null, day: null }, { emitEvent: false });
|
|
1256
|
-
}
|
|
1495
|
+
onDrag(event, isHovered) {
|
|
1496
|
+
// Validate the input can support drag.
|
|
1497
|
+
if (!this.allowDragging || this.disabled) {
|
|
1257
1498
|
return;
|
|
1258
1499
|
}
|
|
1259
|
-
//
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
: null;
|
|
1264
|
-
const formData = { ...(data ?? {}), year };
|
|
1265
|
-
this.form?.patchValue(formData, { emitEvent: false });
|
|
1500
|
+
// Prevent the default event action
|
|
1501
|
+
// and start the hovering.
|
|
1502
|
+
this.preventDefault(event);
|
|
1503
|
+
this.hovered = isHovered;
|
|
1266
1504
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1505
|
+
onDrop(event) {
|
|
1506
|
+
// Validate the input can support drag.
|
|
1507
|
+
if (!this.allowDragging || this.disabled) {
|
|
1508
|
+
return;
|
|
1270
1509
|
}
|
|
1271
|
-
//
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1510
|
+
// Prevent the default event action
|
|
1511
|
+
// and stop the hovering.
|
|
1512
|
+
this.preventDefault(event);
|
|
1513
|
+
this.hovered = false;
|
|
1514
|
+
// Save the file.
|
|
1515
|
+
this.saveFile(event['dataTransfer'].files);
|
|
1516
|
+
// Run the on change callback.
|
|
1517
|
+
this.onChangeCallback(this.value);
|
|
1278
1518
|
}
|
|
1279
|
-
|
|
1280
|
-
if (
|
|
1281
|
-
|
|
1519
|
+
onButtonPressed(file) {
|
|
1520
|
+
if (file) {
|
|
1521
|
+
this.value = null;
|
|
1522
|
+
this.onChangeCallback(this.value);
|
|
1523
|
+
return;
|
|
1282
1524
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1525
|
+
return this.openFilePicker();
|
|
1526
|
+
}
|
|
1527
|
+
openFilePicker() {
|
|
1528
|
+
return this.fileInput
|
|
1529
|
+
&& this.fileInput.nativeElement
|
|
1530
|
+
&& this.fileInput.nativeElement.click
|
|
1531
|
+
&& this.fileInput.nativeElement.click();
|
|
1532
|
+
}
|
|
1533
|
+
onFileChange(event) {
|
|
1534
|
+
// Validate the input is not disabled.
|
|
1535
|
+
if (this.disabled) {
|
|
1536
|
+
return;
|
|
1290
1537
|
}
|
|
1291
|
-
|
|
1292
|
-
const
|
|
1293
|
-
//
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
//
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1538
|
+
// Extract the file from the event.
|
|
1539
|
+
const fileList = this.getFileListFromEvent(event);
|
|
1540
|
+
// Save the file.
|
|
1541
|
+
this.saveFile(fileList);
|
|
1542
|
+
// Run the on change callback.
|
|
1543
|
+
this.onChangeCallback(this.value);
|
|
1544
|
+
// Clear the file input.
|
|
1545
|
+
if (this.fileInput && this.fileInput.nativeElement) {
|
|
1546
|
+
this.fileInput.nativeElement.value = '';
|
|
1300
1547
|
}
|
|
1301
|
-
// Push the years.
|
|
1302
|
-
return this.years$.next(years);
|
|
1303
1548
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1549
|
+
writeValue(value) {
|
|
1550
|
+
this.value = value;
|
|
1551
|
+
}
|
|
1552
|
+
registerOnChange(method) {
|
|
1553
|
+
this.onChangeCallback = method;
|
|
1554
|
+
}
|
|
1555
|
+
registerOnTouched(method) {
|
|
1556
|
+
this.onTouchedCallback = method;
|
|
1557
|
+
}
|
|
1558
|
+
setDisabledState(isDisabled) {
|
|
1559
|
+
this.disabled = isDisabled;
|
|
1560
|
+
}
|
|
1561
|
+
onErrorChange(error) {
|
|
1562
|
+
this.error = !!error;
|
|
1563
|
+
}
|
|
1564
|
+
validate({ value }) {
|
|
1565
|
+
if (value === null || value === undefined) {
|
|
1566
|
+
return null;
|
|
1567
|
+
}
|
|
1568
|
+
const regexString = (this.accept || '*')
|
|
1569
|
+
.replace(/\*/g, '.\*')
|
|
1570
|
+
.replace(/,/g, '|');
|
|
1571
|
+
const mimeTypeRegex = new RegExp(regexString);
|
|
1572
|
+
const isNotValid = (typeof File === 'undefined') || !(value instanceof File) || !mimeTypeRegex.test(value?.type);
|
|
1573
|
+
return isNotValid && {
|
|
1574
|
+
invalidFileType: true
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFilePicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1578
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbFilePicker, isStandalone: true, selector: "bb-file-picker", inputs: { label: "label", hint: "hint", accept: "accept", showImages: "showImages", allowDragging: "allowDragging", grouped: ["grouped", "grouped", booleanAttribute], required: ["required", "required", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], hideErrors: ["hideErrors", "hideErrors", booleanAttribute], value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "dragover": "onDrag($event,true)", "dragleave": "onDrag($event,false)", "drop": "onDrop($event)" }, properties: { "class.required": "required", "class.disabled": "disabled", "class.grouped": "grouped", "class.hovered": "hovered", "class.error": "error" }, classAttribute: "bb-file-picker" }, providers: [
|
|
1306
1579
|
{
|
|
1307
1580
|
provide: NG_VALUE_ACCESSOR,
|
|
1308
|
-
useExisting: forwardRef(() =>
|
|
1581
|
+
useExisting: forwardRef(() => BbFilePicker),
|
|
1309
1582
|
multi: true
|
|
1310
1583
|
},
|
|
1311
1584
|
{
|
|
1312
1585
|
provide: NG_VALIDATORS,
|
|
1313
|
-
useExisting:
|
|
1586
|
+
useExisting: BbFilePicker,
|
|
1314
1587
|
multi: true
|
|
1315
1588
|
}
|
|
1316
|
-
],
|
|
1589
|
+
], queries: [{ propertyName: "extraTemplate", first: true, predicate: ["extra"], descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<!-- The label of the input. -->\n@if (label; as labelContent) {\n <label [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n@if (value$ | async; as data) {\n <div class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n @if (allowDragging) {\n <div class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n }\n </div>\n\n @if (!!extraTemplate) {\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n }\n\n @if (showImages) {\n @if (data?.file | bbFileImage | async; as image) {\n <div class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n }\n }\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n @if (data?.file?.name; as name) {\n <span>{{ name }}</span>\n }\n @if (data?.file?.size; as size) {\n <span>{{ size | bbFileSize }}</span>\n }\n </div>\n </div>\n}\n\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n\n<!-- The file picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-file-picker-box-shadow)}.bb-file-picker.grouped{margin-bottom:1.5rem}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;pointer-events:none;color:gray;background-color:#e6e6e6}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid hsl(0,73%,30%);background-color:#f8d3d3;box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;display:inline-flex;border-radius:.5rem;flex-direction:column;background-color:#fff;border:1px solid hsl(213,8%,74%);transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-file-picker-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:2.5rem;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;line-height:1;cursor:pointer;font-size:1rem;appearance:none;font-weight:400;padding:0 .75rem;align-items:center;white-space:nowrap;display:inline-flex;background-color:transparent;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem;color:var(--bb-file-picker-color);border-right:1px solid hsl(213,8%,74%);transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:var(--bb-file-picker-box-shadow)}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.bb-file-picker-icon{margin-right:.25rem}.bb-file-picker-zone{flex:1;color:#758795;line-height:1.125;font-size:.875rem;align-items:center;display:inline-flex;padding:.5rem .75rem;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;overflow:hidden;padding:0 .75rem;align-items:center;line-height:2.5rem;display:inline-flex;border-top:0 solid #b6bbc1;background-color:transparent;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:2.5rem;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;overflow:hidden;font-size:.875rem;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:.75rem}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid hsl(213,8%,74%)}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:1.5rem auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;will-change:opacity;border-radius:.5rem;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: BbLocalize, name: "bbLocalize" }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }, { kind: "pipe", type: BbFileSize, name: "bbFileSize" }, { kind: "pipe", type: BbFileImage, name: "bbFileImage" }], animations: [
|
|
1590
|
+
trigger('bbFilePickerImageAnimation', [
|
|
1591
|
+
transition(':enter', [
|
|
1592
|
+
style({ opacity: 0 }),
|
|
1593
|
+
animate('200ms', style({ opacity: 1 }))
|
|
1594
|
+
]),
|
|
1595
|
+
transition(':leave', [
|
|
1596
|
+
animate('200ms', style({ opacity: 0 }))
|
|
1597
|
+
])
|
|
1598
|
+
])
|
|
1599
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1317
1600
|
}
|
|
1318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
1601
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbFilePicker, decorators: [{
|
|
1319
1602
|
type: Component,
|
|
1320
|
-
args: [{ selector: 'bb-
|
|
1603
|
+
args: [{ selector: 'bb-file-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
1321
1604
|
{
|
|
1322
1605
|
provide: NG_VALUE_ACCESSOR,
|
|
1323
|
-
useExisting: forwardRef(() =>
|
|
1606
|
+
useExisting: forwardRef(() => BbFilePicker),
|
|
1324
1607
|
multi: true
|
|
1325
1608
|
},
|
|
1326
1609
|
{
|
|
1327
1610
|
provide: NG_VALIDATORS,
|
|
1328
|
-
useExisting:
|
|
1611
|
+
useExisting: BbFilePicker,
|
|
1329
1612
|
multi: true
|
|
1330
1613
|
}
|
|
1331
1614
|
], host: {
|
|
1332
|
-
'class': 'bb-
|
|
1615
|
+
'class': 'bb-file-picker',
|
|
1333
1616
|
'[class.required]': 'required',
|
|
1334
|
-
'[class.readonly]': 'readonly',
|
|
1335
1617
|
'[class.disabled]': 'disabled',
|
|
1336
1618
|
'[class.grouped]': 'grouped',
|
|
1619
|
+
'[class.hovered]': 'hovered',
|
|
1337
1620
|
'[class.error]': 'error'
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1621
|
+
}, animations: [
|
|
1622
|
+
trigger('bbFilePickerImageAnimation', [
|
|
1623
|
+
transition(':enter', [
|
|
1624
|
+
style({ opacity: 0 }),
|
|
1625
|
+
animate('200ms', style({ opacity: 1 }))
|
|
1626
|
+
]),
|
|
1627
|
+
transition(':leave', [
|
|
1628
|
+
animate('200ms', style({ opacity: 0 }))
|
|
1629
|
+
])
|
|
1630
|
+
])
|
|
1631
|
+
], preserveWhitespaces: false, imports: [BbTemplate, AsyncPipe, NgTemplateOutlet, BbLocalize, BbFormError, BbFileSize, BbFileImage], standalone: true, template: "<!-- The label of the input. -->\n@if (label; as labelContent) {\n <label [for]=\"labelId\"\n class=\"bb-file-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n<!-- The input that can open the file picker. -->\n<input #fileInput\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n (change)=\"onFileChange($event)\"\n class=\"bb-file-picker-input\"\n type=\"file\"\n tabindex=\"-1\">\n\n@if (value$ | async; as data) {\n <div class=\"bb-file-picker-wrapper\">\n <!-- The button that accepts files. -->\n <div class=\"bb-file-picker-container\">\n <button [class.destructive]=\"!!data?.file\"\n [class.standalone]=\"!allowDragging\"\n [disabled]=\"disabled\"\n [id]=\"labelId\"\n (click)=\"onButtonPressed(data?.file)\"\n type=\"button\"\n class=\"bb-file-picker-button\">\n <ng-container *ngTemplateOutlet=\"data?.file ? closeIcon : uploadIcon\"></ng-container>\n {{ (data?.file ? 'file-picker.remove' : 'file-picker.choose') | bbLocalize }}\n </button>\n @if (allowDragging) {\n <div class=\"bb-file-picker-zone\">\n {{ 'file-picker.drop' | bbLocalize }}\n </div>\n }\n </div>\n\n @if (!!extraTemplate) {\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: {$implicit: data?.file}\"></ng-container>\n }\n\n @if (showImages) {\n @if (data?.file | bbFileImage | async; as image) {\n <div class=\"bb-file-picker-image-container\">\n <div class=\"bb-file-picker-image-wrapper\">\n <div [@bbFilePickerImageAnimation]=\"true\"\n [style.padding-top.%]=\"image?.aspectRatio * 100\"\n [style.background-image]=\"image?.background\"\n class=\"bb-file-picker-image\">\n </div>\n </div>\n </div>\n }\n }\n\n <!-- Extra information of the file. -->\n <div [class.visible]=\"!!data?.file\"\n class=\"bb-file-picker-info\">\n @if (data?.file?.name; as name) {\n <span>{{ name }}</span>\n }\n @if (data?.file?.size; as size) {\n <span>{{ size | bbFileSize }}</span>\n }\n </div>\n </div>\n}\n\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n\n<!-- The file picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-file-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n\n<!-- Upload icon. -->\n<ng-template #uploadIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\"\n d=\"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5a2.5 2.5 0 010-5H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5z\"></path>\n <path fill=\"none\" d=\"M0 0h24v24H0V0z\"></path>\n </svg>\n</ng-template>\n\n<!-- Close icon. -->\n<ng-template #closeIcon>\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n class=\"bb-file-picker-icon\"\n width=\"1.5rem\"\n height=\"1.5rem\"\n viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\"\n d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\n </svg>\n</ng-template>\n", styles: [".bb-file-picker{display:block}.bb-file-picker.full>.bb-file-picker-wrapper{width:100%}.bb-file-picker:not(.disabled) .bb-file-picker-button{background-color:#fff}.bb-file-picker:not(.disabled):focus>.bb-file-picker-wrapper,.bb-file-picker:not(.disabled).hovered>.bb-file-picker-wrapper{box-shadow:0 .375rem .375rem -.375rem #0000001a,var(--bb-file-picker-box-shadow)}.bb-file-picker.grouped{margin-bottom:1.5rem}.bb-file-picker.disabled>.bb-file-picker-wrapper{cursor:default;pointer-events:none;color:gray;background-color:#e6e6e6}.bb-file-picker.required>.bb-file-picker-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-file-picker.error>.bb-file-picker-label{color:#c23934}.bb-file-picker.error>.bb-file-picker-hint{display:none}.bb-file-picker.error>.bb-file-picker-wrapper{border:1px solid hsl(0,73%,30%);background-color:#f8d3d3;box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-file-picker.error .bb-file-picker-button{background-color:transparent}.bb-file-picker-wrapper{max-width:100%;-webkit-user-select:none;user-select:none;display:inline-flex;border-radius:.5rem;flex-direction:column;background-color:#fff;border:1px solid hsl(213,8%,74%);transition:box-shadow .2s cubic-bezier(0,0,.2,1);box-shadow:0 .375rem .375rem -.375rem #0000001a}.bb-file-picker-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color);font-size:var(--bb-form-label-font-size);font-weight:var(--bb-form-label-font-weight)}.bb-file-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-file-picker-container{min-height:2.5rem;display:inline-flex}.bb-file-picker-button{margin:0;z-index:1;border:none;line-height:1;cursor:pointer;font-size:1rem;appearance:none;font-weight:400;padding:0 .75rem;align-items:center;white-space:nowrap;display:inline-flex;background-color:transparent;border-top-left-radius:.5rem;border-bottom-left-radius:.5rem;color:var(--bb-file-picker-color);border-right:1px solid hsl(213,8%,74%);transition:box-shadow .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-button:focus{box-shadow:var(--bb-file-picker-box-shadow)}.bb-file-picker-button:disabled{cursor:default}.bb-file-picker-button.destructive{color:#f55656}.bb-file-picker-button.standalone{width:100%;border-right:none;border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.bb-file-picker-icon{margin-right:.25rem}.bb-file-picker-zone{flex:1;color:#758795;line-height:1.125;font-size:.875rem;align-items:center;display:inline-flex;padding:.5rem .75rem;justify-content:center}.bb-file-picker-info{height:0;color:#848f99;overflow:hidden;padding:0 .75rem;align-items:center;line-height:2.5rem;display:inline-flex;border-top:0 solid #b6bbc1;background-color:transparent;transition:height .2s cubic-bezier(0,0,.2,1)}.bb-file-picker-info.visible{height:2.5rem;border-top-width:1px}.bb-file-picker-info>span{opacity:.4;max-width:100%;overflow:hidden;font-size:.875rem;white-space:nowrap;text-overflow:ellipsis}.bb-file-picker-info>span:first-child{flex:1}.bb-file-picker-info>span:last-child{margin-left:.75rem}.bb-file-picker-image-container{overflow:hidden;border-top:1px solid hsl(213,8%,74%)}.bb-file-picker-image-wrapper{width:100%;max-width:40%;margin:1.5rem auto}.bb-file-picker-image{width:100%;display:flex;overflow:hidden;position:relative;will-change:opacity;border-radius:.5rem;background-size:cover;background-position:center;background-repeat:no-repeat}.bb-file-picker-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"] }]
|
|
1632
|
+
}], propDecorators: { fileInput: [{
|
|
1633
|
+
type: ViewChild,
|
|
1634
|
+
args: ['fileInput', { static: true }]
|
|
1635
|
+
}], extraTemplate: [{
|
|
1636
|
+
type: ContentChild,
|
|
1637
|
+
args: ['extra']
|
|
1638
|
+
}], label: [{
|
|
1343
1639
|
type: Input
|
|
1344
1640
|
}], hint: [{
|
|
1345
1641
|
type: Input
|
|
1346
|
-
}],
|
|
1347
|
-
type: Input
|
|
1348
|
-
}], monthPlaceholder: [{
|
|
1642
|
+
}], accept: [{
|
|
1349
1643
|
type: Input
|
|
1350
|
-
}],
|
|
1644
|
+
}], showImages: [{
|
|
1351
1645
|
type: Input
|
|
1352
|
-
}],
|
|
1646
|
+
}], allowDragging: [{
|
|
1353
1647
|
type: Input
|
|
1648
|
+
}], grouped: [{
|
|
1649
|
+
type: Input,
|
|
1650
|
+
args: [{ transform: booleanAttribute }]
|
|
1651
|
+
}], required: [{
|
|
1652
|
+
type: Input,
|
|
1653
|
+
args: [{ transform: booleanAttribute }]
|
|
1654
|
+
}], disabled: [{
|
|
1655
|
+
type: Input,
|
|
1656
|
+
args: [{ transform: booleanAttribute }]
|
|
1657
|
+
}], hideErrors: [{
|
|
1658
|
+
type: Input,
|
|
1659
|
+
args: [{ transform: booleanAttribute }]
|
|
1354
1660
|
}], value: [{
|
|
1355
1661
|
type: Input
|
|
1356
1662
|
}], valueChange: [{
|
|
1357
1663
|
type: Output
|
|
1664
|
+
}], onDrag: [{
|
|
1665
|
+
type: HostListener,
|
|
1666
|
+
args: ['dragover', ['$event', 'true']]
|
|
1667
|
+
}, {
|
|
1668
|
+
type: HostListener,
|
|
1669
|
+
args: ['dragleave', ['$event', 'false']]
|
|
1670
|
+
}], onDrop: [{
|
|
1671
|
+
type: HostListener,
|
|
1672
|
+
args: ['drop', ['$event']]
|
|
1358
1673
|
}] } });
|
|
1359
1674
|
|
|
1360
|
-
class
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbPrefix, decorators: [{
|
|
1378
|
-
type: Directive,
|
|
1379
|
-
args: [{
|
|
1380
|
-
selector: '[bbPrefix]',
|
|
1381
|
-
host: {
|
|
1382
|
-
'class': 'bb-prefix'
|
|
1383
|
-
}
|
|
1384
|
-
}]
|
|
1385
|
-
}] });
|
|
1386
|
-
|
|
1387
|
-
class BbFormGroupBase {
|
|
1388
|
-
}
|
|
1389
|
-
const BbFormGroupMixinBase = mixinGrouped(BbFormGroupBase);
|
|
1390
|
-
class BbFormGroup extends BbFormGroupMixinBase {
|
|
1391
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbFormGroup, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1392
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: BbFormGroup, selector: "bb-form-group", inputs: { grouped: "grouped" }, host: { properties: { "class.grouped": "grouped" }, classAttribute: "bb-form-group" }, usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1393
|
-
}
|
|
1394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbFormGroup, decorators: [{
|
|
1395
|
-
type: Component,
|
|
1396
|
-
args: [{ selector: 'bb-form-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1397
|
-
'class': 'bb-form-group',
|
|
1398
|
-
'[class.grouped]': 'grouped'
|
|
1399
|
-
}, inputs: ['grouped'], preserveWhitespaces: false, template: "<ng-content></ng-content>\n", styles: [".bb-form-group{width:100%;display:flex;flex-wrap:wrap;margin-top:-10px}.bb-form-group>*{margin-top:10px}.bb-form-group>*:not(:first-child){margin-left:10px}.bb-form-group.start{justify-content:flex-start}.bb-form-group.end{justify-content:flex-end}.bb-form-group.vertical{flex-direction:column;justify-content:normal}.bb-form-group.vertical>*{margin-left:0}.bb-form-group.vertical.start{align-items:flex-start}.bb-form-group.vertical.end{align-items:flex-end}.bb-form-group.grouped{margin-bottom:20px}\n"] }]
|
|
1400
|
-
}] });
|
|
1401
|
-
|
|
1402
|
-
class BbRelativeTime {
|
|
1403
|
-
constructor(_localeId, _localize) {
|
|
1404
|
-
this._localeId = _localeId;
|
|
1405
|
-
this._localize = _localize;
|
|
1406
|
-
this.isValidDate = (date) => {
|
|
1407
|
-
return typeof date === 'object' &&
|
|
1408
|
-
typeof date.getTime === 'function' &&
|
|
1409
|
-
!isNaN(date.getTime());
|
|
1410
|
-
};
|
|
1411
|
-
this.parseAsDate = (value) => {
|
|
1412
|
-
// Add a Z after the date so
|
|
1413
|
-
// it is treated as a UTC date.
|
|
1414
|
-
if (typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(value)) {
|
|
1415
|
-
return new Date(`${value}Z`);
|
|
1416
|
-
}
|
|
1417
|
-
// Return the regular parsed date.
|
|
1418
|
-
return new Date(value);
|
|
1419
|
-
};
|
|
1420
|
-
this.isToday = (date) => {
|
|
1421
|
-
const today = new Date();
|
|
1422
|
-
return date?.getDate() === today?.getDate() &&
|
|
1423
|
-
date?.getMonth() === today?.getMonth() &&
|
|
1424
|
-
date?.getFullYear() === today?.getFullYear();
|
|
1425
|
-
};
|
|
1426
|
-
this.isYesterday = (date) => {
|
|
1427
|
-
const yesterday = new Date(new Date()?.setDate(new Date()?.getDate() - 1));
|
|
1428
|
-
return date?.getDate() === yesterday?.getDate() &&
|
|
1429
|
-
date?.getMonth() === yesterday?.getMonth() &&
|
|
1430
|
-
date?.getFullYear() === yesterday?.getFullYear();
|
|
1431
|
-
};
|
|
1432
|
-
this.isTomorrow = (date) => {
|
|
1433
|
-
const tomorrow = new Date(new Date()?.setDate(new Date()?.getDate() + 1));
|
|
1434
|
-
return date?.getDate() === tomorrow?.getDate() &&
|
|
1435
|
-
date?.getMonth() === tomorrow?.getMonth() &&
|
|
1436
|
-
date?.getFullYear() === tomorrow?.getFullYear();
|
|
1437
|
-
};
|
|
1675
|
+
class BbImagePicker {
|
|
1676
|
+
constructor(_converter) {
|
|
1677
|
+
this._converter = _converter;
|
|
1678
|
+
// Inputs.
|
|
1679
|
+
this.label = null;
|
|
1680
|
+
this.placeholder = null;
|
|
1681
|
+
this.styleDimensions = null;
|
|
1682
|
+
this.cropDimensions = null;
|
|
1683
|
+
this.disabled = false;
|
|
1684
|
+
this.grouped = false;
|
|
1685
|
+
// Callbacks.
|
|
1686
|
+
this.onTouchedCallback = () => ({});
|
|
1687
|
+
this.onChangeCallback = () => ({});
|
|
1688
|
+
// Form.
|
|
1689
|
+
this._value$ = new BehaviorSubject(null);
|
|
1690
|
+
this.valueChange = new EventEmitter();
|
|
1438
1691
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
const date = this.parseAsDate(value);
|
|
1442
|
-
// Check if the date is valid.
|
|
1443
|
-
if (!this.isValidDate(date)) {
|
|
1444
|
-
return value;
|
|
1445
|
-
}
|
|
1446
|
-
// Return the formatted date.
|
|
1447
|
-
return this.format(date);
|
|
1692
|
+
get value() {
|
|
1693
|
+
return this._value$.getValue();
|
|
1448
1694
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1695
|
+
set value(value) {
|
|
1696
|
+
this._value$.next(value);
|
|
1697
|
+
this.valueChange.emit(value);
|
|
1698
|
+
}
|
|
1699
|
+
get image() {
|
|
1700
|
+
return this._value$.pipe(map(value => value || this.placeholder), map(value => value ? `url(${value})` : null));
|
|
1701
|
+
}
|
|
1702
|
+
async onFileChange(event) {
|
|
1703
|
+
// Grab the file from the event.
|
|
1704
|
+
const file = event.target.files[0];
|
|
1705
|
+
// Check if the file exists.
|
|
1706
|
+
if (!file || this.disabled) {
|
|
1707
|
+
return;
|
|
1453
1708
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
return this.formatString(date, 'times.today_at', 'shortTime');
|
|
1709
|
+
try {
|
|
1710
|
+
this.value = await this._converter.toDataUri(file, this.cropDimensions);
|
|
1457
1711
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
return this.formatString(date, 'times.yesterday_at', 'shortTime');
|
|
1712
|
+
catch {
|
|
1713
|
+
this.value = null;
|
|
1461
1714
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
formatString(date, token, format) {
|
|
1466
|
-
// Just return the parsed date.
|
|
1467
|
-
if (!this._localize || !token || !format) {
|
|
1468
|
-
return formatDate(date, 'mediumDate', this.locale);
|
|
1715
|
+
this.onChangeCallback(this.value);
|
|
1716
|
+
if (this.fileInput && this.fileInput.nativeElement) {
|
|
1717
|
+
this.fileInput.nativeElement.value = '';
|
|
1469
1718
|
}
|
|
1470
|
-
// Return the translated formatting.
|
|
1471
|
-
return this._localize.translate({
|
|
1472
|
-
token: token,
|
|
1473
|
-
data: { date: formatDate(date, format, this.locale) }
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
get locale() {
|
|
1477
|
-
return this._localize?.current?.locale ?? this._localeId;
|
|
1478
|
-
}
|
|
1479
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbRelativeTime, deps: [{ token: LOCALE_ID }, { token: i1$2.Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1480
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.0.1", ngImport: i0, type: BbRelativeTime, name: "bbRelativeTime" }); }
|
|
1481
|
-
}
|
|
1482
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbRelativeTime, decorators: [{
|
|
1483
|
-
type: Pipe,
|
|
1484
|
-
args: [{
|
|
1485
|
-
name: 'bbRelativeTime'
|
|
1486
|
-
}]
|
|
1487
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1488
|
-
type: Inject,
|
|
1489
|
-
args: [LOCALE_ID]
|
|
1490
|
-
}] }, { type: i1$2.Localize, decorators: [{
|
|
1491
|
-
type: Optional
|
|
1492
|
-
}] }] });
|
|
1493
|
-
|
|
1494
|
-
let nextUniqueId = 0;
|
|
1495
|
-
class BbCheckboxBase {
|
|
1496
|
-
}
|
|
1497
|
-
const BbCheckboxMixinBase = mixinDisabled(mixinGrouped(BbCheckboxBase));
|
|
1498
|
-
class BbCheckbox extends BbCheckboxMixinBase {
|
|
1499
|
-
get checked() {
|
|
1500
|
-
return this._checked;
|
|
1501
|
-
}
|
|
1502
|
-
set checked(value) {
|
|
1503
|
-
this._checked = coerceBooleanProperty(value);
|
|
1504
|
-
this._changeDetection.markForCheck();
|
|
1505
|
-
}
|
|
1506
|
-
constructor(_changeDetection) {
|
|
1507
|
-
super();
|
|
1508
|
-
this._changeDetection = _changeDetection;
|
|
1509
|
-
// Data.
|
|
1510
|
-
this.labelId = `bb-checkbox-${nextUniqueId++}`;
|
|
1511
|
-
this._checked = false;
|
|
1512
|
-
// Methods.
|
|
1513
|
-
this.onChange = () => {
|
|
1514
|
-
};
|
|
1515
|
-
this.onTouched = () => {
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
registerOnChange(fn) {
|
|
1519
|
-
this.onChange = fn;
|
|
1520
1719
|
}
|
|
1521
|
-
|
|
1522
|
-
this.
|
|
1720
|
+
openFilePicker() {
|
|
1721
|
+
if (this.disabled) {
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
// Execute a click on the file input.
|
|
1725
|
+
this.fileInput
|
|
1726
|
+
&& this.fileInput.nativeElement
|
|
1727
|
+
&& this.fileInput.nativeElement.click
|
|
1728
|
+
&& this.fileInput.nativeElement.click();
|
|
1523
1729
|
}
|
|
1524
|
-
|
|
1525
|
-
this.
|
|
1526
|
-
this._changeDetection.markForCheck();
|
|
1730
|
+
writeValue(value) {
|
|
1731
|
+
this.value = value;
|
|
1527
1732
|
}
|
|
1528
|
-
|
|
1529
|
-
this.
|
|
1733
|
+
registerOnChange(method) {
|
|
1734
|
+
this.onChangeCallback = method;
|
|
1530
1735
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
event.stopPropagation();
|
|
1736
|
+
registerOnTouched(method) {
|
|
1737
|
+
this.onTouchedCallback = method;
|
|
1534
1738
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
event.stopPropagation();
|
|
1538
|
-
// Toggle the value.
|
|
1539
|
-
this.checked = !this.checked;
|
|
1540
|
-
// Emit the change event.
|
|
1541
|
-
this.onChange && this.onChange(this.checked);
|
|
1739
|
+
setDisabledState(isDisabled) {
|
|
1740
|
+
this.disabled = isDisabled;
|
|
1542
1741
|
}
|
|
1543
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
1544
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1545
|
-
{
|
|
1546
|
-
|
|
1742
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbImagePicker, deps: [{ token: i1$1.ImageConverter }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1743
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbImagePicker, isStandalone: true, selector: "bb-image-picker", inputs: { label: "label", placeholder: "placeholder", styleDimensions: "styleDimensions", cropDimensions: "cropDimensions", disabled: ["disabled", "disabled", booleanAttribute], grouped: ["grouped", "grouped", booleanAttribute], value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled", "class.grouped": "grouped" }, classAttribute: "bb-image-picker" }, providers: [
|
|
1744
|
+
{
|
|
1745
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1746
|
+
useExisting: forwardRef(() => BbImagePicker),
|
|
1747
|
+
multi: true
|
|
1748
|
+
}
|
|
1749
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n@if (label; as labelText) {\n <button (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n </button>\n}\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:1.5rem}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;align-items:center;border-radius:.25rem;justify-content:center;background:#0003 url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:.75rem}\n"], dependencies: [{ kind: "component", type: BbButton, selector: "button[bb-button]", inputs: ["disabled", "loading"], exportAs: ["bbButton"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1547
1750
|
}
|
|
1548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
1751
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbImagePicker, decorators: [{
|
|
1549
1752
|
type: Component,
|
|
1550
|
-
args: [{ selector: 'bb-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
'class': 'bb-checkbox',
|
|
1753
|
+
args: [{ selector: 'bb-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1754
|
+
'class': 'bb-image-picker',
|
|
1755
|
+
'[class.disabled]': 'disabled',
|
|
1554
1756
|
'[class.grouped]': 'grouped'
|
|
1555
|
-
},
|
|
1556
|
-
|
|
1757
|
+
}, providers: [
|
|
1758
|
+
{
|
|
1759
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1760
|
+
useExisting: forwardRef(() => BbImagePicker),
|
|
1761
|
+
multi: true
|
|
1762
|
+
}
|
|
1763
|
+
], preserveWhitespaces: false, standalone: true, imports: [BbButton, AsyncPipe], template: "<!-- The input that can open the file picker. -->\n<input #fileInput\n (change)=\"onFileChange($event)\"\n class=\"bb-image-picker-input\"\n type=\"file\"\n tabindex=\"-1\"\n accept=\"image/*\">\n\n<span [style.width]=\"styleDimensions?.width || '100%'\"\n [style.height]=\"styleDimensions?.height || '215px'\"\n [style.background-image]=\"image | async\"\n class=\"bb-image-input-image\">\n </span>\n\n@if (label; as labelText) {\n <button (click)=\"openFilePicker()\"\n bb-button\n class=\"bb-image-input-button\"\n type=\"button\">\n {{ labelText }}\n </button>\n}\n", styles: [".bb-image-picker{display:flex;align-items:center;flex-direction:column}.bb-image-picker.circle>.bb-image-input-image{border-radius:50%}.bb-image-picker.grouped{margin-bottom:1.5rem}.bb-image-picker.disabled{opacity:.5;cursor:default;-webkit-user-select:none;user-select:none;pointer-events:none}.bb-image-picker-input{opacity:0;z-index:-1;width:.1px;height:.1px;overflow:hidden;position:absolute}.bb-image-input-image{display:flex;cursor:default;position:relative;align-items:center;border-radius:.25rem;justify-content:center;background:#0003 url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) center center/cover no-repeat}.bb-image-input-button{margin-top:.75rem}\n"] }]
|
|
1764
|
+
}], ctorParameters: () => [{ type: i1$1.ImageConverter }], propDecorators: { fileInput: [{
|
|
1765
|
+
type: ViewChild,
|
|
1766
|
+
args: ['fileInput', { static: true }]
|
|
1767
|
+
}], label: [{
|
|
1557
1768
|
type: Input
|
|
1558
|
-
}],
|
|
1769
|
+
}], placeholder: [{
|
|
1770
|
+
type: Input
|
|
1771
|
+
}], styleDimensions: [{
|
|
1772
|
+
type: Input
|
|
1773
|
+
}], cropDimensions: [{
|
|
1774
|
+
type: Input
|
|
1775
|
+
}], disabled: [{
|
|
1776
|
+
type: Input,
|
|
1777
|
+
args: [{ transform: booleanAttribute }]
|
|
1778
|
+
}], grouped: [{
|
|
1779
|
+
type: Input,
|
|
1780
|
+
args: [{ transform: booleanAttribute }]
|
|
1781
|
+
}], value: [{
|
|
1559
1782
|
type: Input
|
|
1783
|
+
}], valueChange: [{
|
|
1784
|
+
type: Output
|
|
1560
1785
|
}] } });
|
|
1561
1786
|
|
|
1562
|
-
class
|
|
1563
|
-
|
|
1787
|
+
class BbDatePicker {
|
|
1788
|
+
set disabled(value) {
|
|
1789
|
+
this._disabled = value;
|
|
1790
|
+
this._disabled ? this.form?.disable() : this.form?.enable();
|
|
1791
|
+
this._changeDetectorRef.markForCheck();
|
|
1792
|
+
}
|
|
1793
|
+
get disabled() {
|
|
1794
|
+
return this._disabled;
|
|
1795
|
+
}
|
|
1796
|
+
set years(value) {
|
|
1797
|
+
this.parseYears(value);
|
|
1798
|
+
}
|
|
1799
|
+
get value() {
|
|
1800
|
+
return this.formToDateString(this.form?.value);
|
|
1801
|
+
}
|
|
1802
|
+
set value(value) {
|
|
1803
|
+
this.parseDateStringInForm(value);
|
|
1804
|
+
this.valueChange.emit(this.value);
|
|
1805
|
+
}
|
|
1806
|
+
constructor(_changeDetectorRef, _localizeId) {
|
|
1807
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
1808
|
+
this._localizeId = _localizeId;
|
|
1809
|
+
// Readonly data.
|
|
1810
|
+
this._yearRegex = /^(10|[1-9][0-9])\d{2}$/; // Note: 1000 - 9999
|
|
1564
1811
|
// Inputs.
|
|
1565
|
-
this.
|
|
1812
|
+
this.label = null;
|
|
1813
|
+
this.hint = null;
|
|
1814
|
+
this.dayPlaceholder = 'dd';
|
|
1815
|
+
this.monthPlaceholder = 'mm';
|
|
1816
|
+
this.yearPlaceholder = 'yyyy';
|
|
1817
|
+
this.required = false;
|
|
1818
|
+
this.grouped = false;
|
|
1819
|
+
this.readonly = false;
|
|
1820
|
+
this.hideErrors = false;
|
|
1821
|
+
this.years$ = new BehaviorSubject(null);
|
|
1822
|
+
this.valueChange = new EventEmitter();
|
|
1566
1823
|
// State.
|
|
1567
|
-
this.
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
this.
|
|
1571
|
-
this.
|
|
1572
|
-
|
|
1573
|
-
this.
|
|
1574
|
-
this.
|
|
1575
|
-
|
|
1576
|
-
const baseGreen = 128;
|
|
1577
|
-
const baseBlue = 128;
|
|
1578
|
-
let seed = value.charCodeAt(0) ^ value.charCodeAt(1);
|
|
1579
|
-
const rand_1 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1580
|
-
const rand_2 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1581
|
-
const rand_3 = Math.abs((Math.sin(seed++) * 10000)) % 256;
|
|
1582
|
-
const r = Math.round((rand_1 + baseRed) / 2);
|
|
1583
|
-
const g = Math.round((rand_2 + baseGreen) / 2);
|
|
1584
|
-
const b = Math.round((rand_3 + baseBlue) / 2);
|
|
1585
|
-
return { r, g, b };
|
|
1586
|
-
};
|
|
1587
|
-
this.getInitials = (name) => {
|
|
1588
|
-
// Get all the initials.
|
|
1589
|
-
const names = (name ?? '').split(' ');
|
|
1590
|
-
const initials = names
|
|
1591
|
-
.map(name => name.charAt(0).toUpperCase())
|
|
1592
|
-
.filter(name => /^[a-zA-Z]+$/.test(name));
|
|
1593
|
-
// Check if there are any initials.
|
|
1594
|
-
if (initials?.length <= 0) {
|
|
1824
|
+
this.error = false;
|
|
1825
|
+
this._disabled = false;
|
|
1826
|
+
// Callbacks.
|
|
1827
|
+
this.onTouchedCallback = () => ({});
|
|
1828
|
+
this.onChangeCallback = () => ({});
|
|
1829
|
+
// Subscriptions.
|
|
1830
|
+
this._subscription = new Subscription();
|
|
1831
|
+
this.formToDateString = ({ year, month, day }) => {
|
|
1832
|
+
if (this.form?.invalid) {
|
|
1595
1833
|
return null;
|
|
1596
1834
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
}
|
|
1601
|
-
// Get only the first initial.
|
|
1602
|
-
return initials?.[0];
|
|
1835
|
+
const prefixedMonth = this.padString(`${month}`, 2, '0');
|
|
1836
|
+
const prefixedDay = this.padString(`${day}`, 2, '0');
|
|
1837
|
+
return [year, prefixedMonth, prefixedDay].join('-');
|
|
1603
1838
|
};
|
|
1604
|
-
this.
|
|
1605
|
-
|
|
1606
|
-
|
|
1839
|
+
this.parseYearFormat = (value) => {
|
|
1840
|
+
// Transform the value to a definitive string.
|
|
1841
|
+
const yearString = `${value}`;
|
|
1842
|
+
const currentFullYear = new Date().getFullYear();
|
|
1843
|
+
// Handle default "current" syntax.
|
|
1844
|
+
if (yearString === 'current') {
|
|
1845
|
+
return currentFullYear;
|
|
1607
1846
|
}
|
|
1608
|
-
//
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
const g = parseInt(match[1].charAt(1), 16) * 0x11;
|
|
1613
|
-
const b = parseInt(match[1].charAt(2), 16) * 0x11;
|
|
1614
|
-
return { r, g, b };
|
|
1847
|
+
// Handle "current + {amount}" syntax.
|
|
1848
|
+
if (/^current\s?\+\s?\d+$/.test(yearString)) {
|
|
1849
|
+
const amount = Number(yearString?.split('+')?.[1]?.trim()) ?? 0;
|
|
1850
|
+
return currentFullYear + amount;
|
|
1615
1851
|
}
|
|
1616
|
-
//
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
const g = parseInt(match[1].substring(2, 4), 16);
|
|
1621
|
-
const b = parseInt(match[1].substring(4, 6), 16);
|
|
1622
|
-
return { r, g, b };
|
|
1852
|
+
// Handle "current - {amount}" syntax.
|
|
1853
|
+
if (/^current\s?-\s?\d+$/.test(yearString)) {
|
|
1854
|
+
const amount = Number(yearString?.split('-')?.[1]?.trim()) ?? 0;
|
|
1855
|
+
return currentFullYear - amount;
|
|
1623
1856
|
}
|
|
1624
|
-
//
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
const r = parseInt(match[1], 10);
|
|
1628
|
-
const g = parseInt(match[2], 10);
|
|
1629
|
-
const b = parseInt(match[3], 10);
|
|
1630
|
-
return { r, g, b };
|
|
1857
|
+
// Handling the default number case.
|
|
1858
|
+
if (/^[0-9]{4}$/.test(yearString)) {
|
|
1859
|
+
return Number(yearString);
|
|
1631
1860
|
}
|
|
1632
|
-
//
|
|
1633
|
-
console?.warn?.(`BbAvatar: Unsupported tintColor "${value}" was used.`);
|
|
1861
|
+
// We could not parse it.
|
|
1634
1862
|
return null;
|
|
1635
1863
|
};
|
|
1864
|
+
this.getDaysInMonth = (month = null, year = null) => {
|
|
1865
|
+
if (this.form?.invalid || month === null || year === null) {
|
|
1866
|
+
return 31;
|
|
1867
|
+
}
|
|
1868
|
+
const parsedYear = parseInt(year, 10);
|
|
1869
|
+
return new Date(parsedYear, month, 0).getDate();
|
|
1870
|
+
};
|
|
1871
|
+
this.isValidDateString = (value) => {
|
|
1872
|
+
return typeof value === 'string' && /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value);
|
|
1873
|
+
};
|
|
1874
|
+
this.padString = (value, maxLength, fillString = '0') => {
|
|
1875
|
+
const count = maxLength - value.length;
|
|
1876
|
+
for (let index = 0; index < count; index++) {
|
|
1877
|
+
value = `${fillString}${value}`;
|
|
1878
|
+
}
|
|
1879
|
+
return value;
|
|
1880
|
+
};
|
|
1636
1881
|
}
|
|
1637
|
-
|
|
1638
|
-
this.
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
set title(value) {
|
|
1644
|
-
// Set the title and the initials.
|
|
1645
|
-
this._title = value ?? '!';
|
|
1646
|
-
this._initials = this.getInitials(this._title);
|
|
1647
|
-
// Generate the colors based on the name.
|
|
1648
|
-
const { r, g, b } = this.toRgb(this._title);
|
|
1649
|
-
this.setColors(r, g, b);
|
|
1650
|
-
}
|
|
1651
|
-
set tintColor(value) {
|
|
1652
|
-
const result = this.parseColorFormat(value);
|
|
1653
|
-
if (!result) {
|
|
1654
|
-
return;
|
|
1655
|
-
}
|
|
1656
|
-
const { r, g, b } = result;
|
|
1657
|
-
this.setColors(r, g, b);
|
|
1882
|
+
ngOnInit() {
|
|
1883
|
+
this.composeForm();
|
|
1884
|
+
this.getData();
|
|
1885
|
+
this.handleChanges();
|
|
1658
1886
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1887
|
+
ngOnDestroy() {
|
|
1888
|
+
this._subscription?.unsubscribe();
|
|
1661
1889
|
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1890
|
+
writeValue(value) {
|
|
1891
|
+
this.parseDateStringInForm(value);
|
|
1664
1892
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1893
|
+
registerOnChange(method) {
|
|
1894
|
+
this.onChangeCallback = method;
|
|
1667
1895
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1896
|
+
registerOnTouched(method) {
|
|
1897
|
+
this.onTouchedCallback = method;
|
|
1670
1898
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1899
|
+
setDisabledState(isDisabled) {
|
|
1900
|
+
this.disabled = isDisabled;
|
|
1673
1901
|
}
|
|
1674
|
-
|
|
1675
|
-
this.
|
|
1676
|
-
this._backgroundColor = `rgba(${red},${green},${blue}, 0.25)`;
|
|
1902
|
+
onErrorChange(error) {
|
|
1903
|
+
this.error = !!error;
|
|
1677
1904
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
'[style.font-size.px]': 'size * 0.42',
|
|
1691
|
-
'[style.color]': 'color',
|
|
1692
|
-
'[style.background-color]': 'backgroundColor'
|
|
1693
|
-
}, template: "<ng-container [ngSwitch]=\"state$ | async\">\n <!-- Image. -->\n <ng-container *ngSwitchCase=\"'image'\">\n <img [src]=\"src\"\n [alt]=\"initials\"\n (error)=\"state$?.next('initials')\"\n class=\"bb-avatar-image\">\n </ng-container>\n\n <!-- Default initials fallback. -->\n <ng-container *ngSwitchDefault>\n {{ initials }}\n </ng-container>\n</ng-container>\n", styles: [".bb-avatar{line-height:1;overflow:hidden;font-weight:500;-webkit-user-select:none;user-select:none;position:relative;border-radius:50%;align-items:center;display:inline-flex;justify-content:center}.bb-avatar.rounded{border-radius:4px}.bb-avatar.square{border-radius:0}.bb-avatar-image{width:100%;height:100%;object-fit:cover;position:absolute}\n"] }]
|
|
1694
|
-
}], propDecorators: { size: [{
|
|
1695
|
-
type: Input
|
|
1696
|
-
}], src: [{
|
|
1697
|
-
type: Input
|
|
1698
|
-
}], title: [{
|
|
1699
|
-
type: Input
|
|
1700
|
-
}, {
|
|
1701
|
-
type: HostBinding,
|
|
1702
|
-
args: ['attr.title']
|
|
1703
|
-
}], tintColor: [{
|
|
1704
|
-
type: Input
|
|
1705
|
-
}] } });
|
|
1706
|
-
|
|
1707
|
-
class BbIcon {
|
|
1708
|
-
set src(newValue) {
|
|
1709
|
-
this.state$.next(this.convert(newValue));
|
|
1710
|
-
this._src = newValue;
|
|
1905
|
+
validate({ value }) {
|
|
1906
|
+
if (value === null || value === undefined) {
|
|
1907
|
+
return null;
|
|
1908
|
+
}
|
|
1909
|
+
const data = this.parseDateString(value);
|
|
1910
|
+
const date = new Date(data?.year, data?.month - 1, data?.day);
|
|
1911
|
+
const maxDays = this.getDaysInMonth(data?.month, `${data?.year}`);
|
|
1912
|
+
const isInvalidDate = date.toString() === 'Invalid Date';
|
|
1913
|
+
const exceededMaxDays = data?.day > maxDays;
|
|
1914
|
+
return (isInvalidDate || exceededMaxDays) && {
|
|
1915
|
+
invalidDate: true
|
|
1916
|
+
};
|
|
1711
1917
|
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1918
|
+
handleChanges() {
|
|
1919
|
+
const dateOrNull$ = this.form.valueChanges.pipe(map(value => this.formToDateString(value)), distinctUntilChanged());
|
|
1920
|
+
const subscription = dateOrNull$.subscribe(() => {
|
|
1921
|
+
this.valueChange.emit(this.value);
|
|
1922
|
+
this.onChangeCallback(this.value);
|
|
1923
|
+
});
|
|
1924
|
+
this._subscription.add(subscription);
|
|
1714
1925
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1926
|
+
getData() {
|
|
1927
|
+
const years$ = this.years$.asObservable();
|
|
1928
|
+
const months$ = this.getMonthData();
|
|
1929
|
+
const days$ = this.getDayData();
|
|
1930
|
+
this.data$ = combineLatest([years$, months$, days$]).pipe(map(([years, months, days]) => ({ years, months, days })), tap(data => this.verifyListData(data?.days?.length, data?.years)));
|
|
1717
1931
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1932
|
+
verifyListData(maxDays, years) {
|
|
1933
|
+
const dayControl = this.form.get('day');
|
|
1934
|
+
if (dayControl?.value !== null && dayControl?.value > maxDays) {
|
|
1935
|
+
dayControl.patchValue(maxDays);
|
|
1936
|
+
}
|
|
1937
|
+
const yearControl = this.form.get('year');
|
|
1938
|
+
if (years !== null && yearControl?.value !== null && this._yearRegex.test(yearControl?.value)) {
|
|
1939
|
+
const selectedYear = Number(yearControl?.value);
|
|
1940
|
+
const firstYear = Math.min(...years);
|
|
1941
|
+
const lastYear = Math.max(...years);
|
|
1942
|
+
if (selectedYear < firstYear || selectedYear > lastYear) {
|
|
1943
|
+
Promise.resolve().then(() => yearControl.patchValue(null));
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1720
1946
|
}
|
|
1721
|
-
|
|
1722
|
-
this.
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
this.alt = null;
|
|
1728
|
-
this.size = 24;
|
|
1729
|
-
this._ariaHidden = true;
|
|
1730
|
-
this.warn = (content) => {
|
|
1731
|
-
return console && console.warn && console.warn(content);
|
|
1732
|
-
};
|
|
1947
|
+
getDayData() {
|
|
1948
|
+
const count$ = this.form.valueChanges.pipe(startWith(this.form?.value), map(({ month, year }) => this.getDaysInMonth(month, year)), distinctUntilChanged());
|
|
1949
|
+
return count$.pipe(map(count => Array(count).fill(0).map((_, index) => ({
|
|
1950
|
+
label: `${index + 1}`,
|
|
1951
|
+
value: index + 1
|
|
1952
|
+
}))));
|
|
1733
1953
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1954
|
+
getMonthData() {
|
|
1955
|
+
return this._localizeId.pipe(map(locale => {
|
|
1956
|
+
return Array(12).fill(0).map((_, month) => {
|
|
1957
|
+
const date = new Date(2000, month, 1);
|
|
1958
|
+
const label = formatDate(date, 'LLLL', locale);
|
|
1959
|
+
return { label, value: month + 1 };
|
|
1960
|
+
});
|
|
1961
|
+
}));
|
|
1962
|
+
}
|
|
1963
|
+
composeForm() {
|
|
1964
|
+
const { required, pattern, minLength, maxLength } = Validators;
|
|
1965
|
+
const yearPattern = pattern(this._yearRegex);
|
|
1966
|
+
const yearValidators = [required, yearPattern, minLength(4), maxLength(4)];
|
|
1967
|
+
this.form = new FormGroup({
|
|
1968
|
+
day: new FormControl(null, required),
|
|
1969
|
+
month: new FormControl(null, required),
|
|
1970
|
+
year: new FormControl(null, yearValidators)
|
|
1971
|
+
});
|
|
1972
|
+
if (this.disabled) {
|
|
1973
|
+
this.form?.disable();
|
|
1747
1974
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1975
|
+
}
|
|
1976
|
+
parseDateStringInForm(value) {
|
|
1977
|
+
// If the date string was not a valid format, reset the form.
|
|
1978
|
+
if (!this.isValidDateString(value)) {
|
|
1979
|
+
if (value !== null) {
|
|
1980
|
+
this.form?.reset({ year: null, month: null, day: null }, { emitEvent: false });
|
|
1981
|
+
}
|
|
1982
|
+
return;
|
|
1752
1983
|
}
|
|
1753
|
-
//
|
|
1754
|
-
|
|
1984
|
+
// Parse the date string and save in the form.
|
|
1985
|
+
const data = this.parseDateString(value);
|
|
1986
|
+
const year = data?.year !== null && data?.year !== undefined
|
|
1987
|
+
? this.padString(`${data?.year}`, 4, '0')
|
|
1988
|
+
: null;
|
|
1989
|
+
const formData = { ...(data ?? {}), year };
|
|
1990
|
+
this.form?.patchValue(formData, { emitEvent: false });
|
|
1755
1991
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
if (!data) {
|
|
1992
|
+
parseDateString(value) {
|
|
1993
|
+
if (!this.isValidDateString(value)) {
|
|
1759
1994
|
return null;
|
|
1760
1995
|
}
|
|
1761
|
-
|
|
1996
|
+
// Parse the date string.
|
|
1997
|
+
const [year, month, day] = value?.split('-');
|
|
1998
|
+
return {
|
|
1999
|
+
day: day ? parseInt(day, 10) : null,
|
|
2000
|
+
month: month ? parseInt(month, 10) : null,
|
|
2001
|
+
year: year ? parseInt(year, 10) : null
|
|
2002
|
+
};
|
|
1762
2003
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
return null;
|
|
2004
|
+
parseYears(values) {
|
|
2005
|
+
if (!values) {
|
|
2006
|
+
return this.years$.next(null);
|
|
1767
2007
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
2008
|
+
// Parse the values to years (in numbers).
|
|
2009
|
+
const [first, last] = values;
|
|
2010
|
+
const firstYear = this.parseYearFormat(first);
|
|
2011
|
+
const lastYear = this.parseYearFormat(last);
|
|
2012
|
+
// Check cases in where we cannot parse.
|
|
2013
|
+
if (firstYear === null || lastYear === null) {
|
|
2014
|
+
return this.years$.next(null);
|
|
1771
2015
|
}
|
|
1772
|
-
|
|
2016
|
+
const difference = firstYear - lastYear;
|
|
2017
|
+
const absoluteDifference = Math.abs(difference) + 1;
|
|
2018
|
+
// Create an array with years.
|
|
2019
|
+
const years = Array(absoluteDifference)
|
|
2020
|
+
.fill(0)
|
|
2021
|
+
.map((_, index) => difference < 0 ? (firstYear + index) : (firstYear - index));
|
|
2022
|
+
// Validate we have one or more years.
|
|
2023
|
+
if (years?.length <= 0) {
|
|
2024
|
+
return this.years$.next(null);
|
|
2025
|
+
}
|
|
2026
|
+
// Push the years.
|
|
2027
|
+
return this.years$.next(years);
|
|
1773
2028
|
}
|
|
1774
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
1775
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2029
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbDatePicker, deps: [{ token: i0.ChangeDetectorRef }, { token: LOCALIZE_ID }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2030
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.5", type: BbDatePicker, isStandalone: true, selector: "bb-date-picker", inputs: { label: "label", hint: "hint", dayPlaceholder: "dayPlaceholder", monthPlaceholder: "monthPlaceholder", yearPlaceholder: "yearPlaceholder", required: ["required", "required", booleanAttribute], grouped: ["grouped", "grouped", booleanAttribute], readonly: ["readonly", "readonly", booleanAttribute], hideErrors: ["hideErrors", "hideErrors", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], years: "years", value: "value" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.required": "required", "class.readonly": "readonly", "class.disabled": "disabled", "class.grouped": "grouped", "class.error": "error" }, classAttribute: "bb-date-picker" }, providers: [
|
|
2031
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbDatePicker), multi: true },
|
|
2032
|
+
{ provide: NG_VALIDATORS, useExisting: BbDatePicker, multi: true }
|
|
2033
|
+
], ngImport: i0, template: "<!-- Label of the date picker. -->\n@if (label; as labelContent) {\n <label class=\"bb-date-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n@if (data$ | async; as data) {\n <!-- The form containing the year/month/day fields. -->\n <div [formGroup]=\"form\"\n class=\"bb-date-picker-container\">\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('day')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"day\">\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\n @for (day of data?.days; track day?.value) {\n <option [ngValue]=\"day?.value\">{{ day?.label }}</option>\n }\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('month')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"month\">\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\n @for (month of data?.months; track month?.value) {\n <option [ngValue]=\"month?.value\">{{ month?.label }}</option>\n }\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n @if (data?.years?.length > 0) {\n <select [class.has-value]=\"!!form?.get('year')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"year\">\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\n @for (year of data?.years; track year) {\n <option [ngValue]=\"year\">{{ year }}</option>\n }\n </select>\n } @else {\n <input [placeholder]=\"yearPlaceholder\"\n bbInput\n type=\"text\"\n inputmode=\"numeric\"\n minlength=\"4\"\n maxlength=\"4\"\n pattern=\"^[0-9]{4}$\"\n formControlName=\"year\"\n autocomplete=\"off\">\n }\n </bb-form-control>\n </div>\n </div>\n}\n\n<!-- The date picker error. -->\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n<!-- The date picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-date-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container{cursor:default;border-style:dotted;border-color:#bdc4c9}.bb-date-picker.readonly>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:1.5rem}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container{border-color:#841515;background-color:#f8d3d3}.bb-date-picker.error>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-date-picker-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>.bb-form-control>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#111}.bb-date-picker-item:not(:first-child):not(:last-child){margin:0 -1px}.bb-date-picker-item:not(:first-child):not(:last-child)>.bb-form-control>.bb-form-control-container{border-radius:0}.bb-date-picker-item:first-child>.bb-form-control>.bb-form-control-container{border-top-right-radius:0;border-bottom-right-radius:0}.bb-date-picker-item:last-child>.bb-form-control>.bb-form-control-container{border-top-left-radius:0;border-bottom-left-radius:0}.bb-date-picker-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"], dependencies: [{ kind: "directive", type: BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: BbFormControl, selector: "bb-form-control", inputs: ["label", "hint", "grouped", "hideErrors"] }, { kind: "directive", type: BbInput, selector: "input[bbInput],textarea[bbInput],select[bbInput]", inputs: ["required"] }, { kind: "component", type: BbFormError, selector: "bb-form-error", inputs: ["control"], outputs: ["errorChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1776
2034
|
}
|
|
1777
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
2035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BbDatePicker, decorators: [{
|
|
1778
2036
|
type: Component,
|
|
1779
|
-
args: [{ selector: 'bb-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
'
|
|
1784
|
-
'[
|
|
1785
|
-
'[
|
|
1786
|
-
'[
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
2037
|
+
args: [{ selector: 'bb-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
2038
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbDatePicker), multi: true },
|
|
2039
|
+
{ provide: NG_VALIDATORS, useExisting: BbDatePicker, multi: true }
|
|
2040
|
+
], host: {
|
|
2041
|
+
'class': 'bb-date-picker',
|
|
2042
|
+
'[class.required]': 'required',
|
|
2043
|
+
'[class.readonly]': 'readonly',
|
|
2044
|
+
'[class.disabled]': 'disabled',
|
|
2045
|
+
'[class.grouped]': 'grouped',
|
|
2046
|
+
'[class.error]': 'error'
|
|
2047
|
+
}, preserveWhitespaces: false, imports: [
|
|
2048
|
+
BbTemplate,
|
|
2049
|
+
AsyncPipe,
|
|
2050
|
+
ReactiveFormsModule,
|
|
2051
|
+
BbFormControl,
|
|
2052
|
+
BbInput,
|
|
2053
|
+
BbFormError
|
|
2054
|
+
], standalone: true, template: "<!-- Label of the date picker. -->\n@if (label; as labelContent) {\n <label class=\"bb-date-picker-label\">\n <ng-template [bbTemplate]=\"labelContent\">{{ labelContent }}</ng-template>\n </label>\n}\n\n@if (data$ | async; as data) {\n <!-- The form containing the year/month/day fields. -->\n <div [formGroup]=\"form\"\n class=\"bb-date-picker-container\">\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('day')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"day\">\n <option [ngValue]=\"null\">{{ dayPlaceholder }}</option>\n @for (day of data?.days; track day?.value) {\n <option [ngValue]=\"day?.value\">{{ day?.label }}</option>\n }\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n <select [class.has-value]=\"!!form?.get('month')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"month\">\n <option [ngValue]=\"null\">{{ monthPlaceholder }}</option>\n @for (month of data?.months; track month?.value) {\n <option [ngValue]=\"month?.value\">{{ month?.label }}</option>\n }\n </select>\n </bb-form-control>\n </div>\n <div class=\"bb-date-picker-item\">\n <bb-form-control hideErrors>\n @if (data?.years?.length > 0) {\n <select [class.has-value]=\"!!form?.get('year')?.value\"\n bbInput\n autocomplete=\"off\"\n formControlName=\"year\">\n <option [ngValue]=\"null\">{{ yearPlaceholder }}</option>\n @for (year of data?.years; track year) {\n <option [ngValue]=\"year\">{{ year }}</option>\n }\n </select>\n } @else {\n <input [placeholder]=\"yearPlaceholder\"\n bbInput\n type=\"text\"\n inputmode=\"numeric\"\n minlength=\"4\"\n maxlength=\"4\"\n pattern=\"^[0-9]{4}$\"\n formControlName=\"year\"\n autocomplete=\"off\">\n }\n </bb-form-control>\n </div>\n </div>\n}\n\n<!-- The date picker error. -->\n@if (!hideErrors) {\n <bb-form-error (errorChange)=\"onErrorChange($event)\"></bb-form-error>\n}\n<!-- The date picker hint. -->\n@if (hint; as hintContent) {\n <p class=\"bb-date-picker-hint\">\n <ng-template [bbTemplate]=\"hintContent\">{{ hintContent }}</ng-template>\n </p>\n}\n", styles: [".bb-date-picker{display:block}.bb-date-picker.required>.bb-date-picker-label:after{content:\"*\";font-size:.75rem;vertical-align:top;color:var(--bb-form-label-required-color)}.bb-date-picker.readonly{pointer-events:none}.bb-date-picker.readonly>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container{cursor:default;border-style:dotted;border-color:#bdc4c9}.bb-date-picker.readonly>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:disabled{opacity:1}.bb-date-picker.grouped{margin-bottom:1.5rem}.bb-date-picker.error>.bb-date-picker-label{color:#c23934}.bb-date-picker.error>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container{border-color:#841515;background-color:#f8d3d3}.bb-date-picker.error>.bb-date-picker-container>.bb-date-picker-item>.bb-form-control>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){box-shadow:0 .375rem .375rem -.375rem #0000001a,0 0 0 .1875rem #f8d3d3}.bb-date-picker-label{display:block;margin-bottom:.25rem;color:var(--bb-form-label-color, #525252);font-weight:var(--bb-form-label-font-weight, 400);font-size:var(--bb-form-label-font-size, .875rem)}.bb-date-picker-container{display:flex}.bb-date-picker-item{flex:1}.bb-date-picker-item>.bb-form-control>.bb-form-control-container:has(input:not(:disabled):not(:read-only):focus,select:not(:disabled):focus){z-index:1;position:relative}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select>option:first-child{color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value){color:#d2d2d2}.bb-date-picker-item>.bb-form-control>.bb-form-control-container>select:not(.has-value)>option:not(:first-child){color:#111}.bb-date-picker-item:not(:first-child):not(:last-child){margin:0 -1px}.bb-date-picker-item:not(:first-child):not(:last-child)>.bb-form-control>.bb-form-control-container{border-radius:0}.bb-date-picker-item:first-child>.bb-form-control>.bb-form-control-container{border-top-right-radius:0;border-bottom-right-radius:0}.bb-date-picker-item:last-child>.bb-form-control>.bb-form-control-container{border-top-left-radius:0;border-bottom-left-radius:0}.bb-date-picker-hint{display:block;line-height:1.5;margin-top:.25rem;font-size:.8125rem;color:#758795}\n"] }]
|
|
2055
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i2$1.Observable, decorators: [{
|
|
1791
2056
|
type: Inject,
|
|
1792
|
-
args: [
|
|
1793
|
-
}] }], propDecorators: {
|
|
2057
|
+
args: [LOCALIZE_ID]
|
|
2058
|
+
}] }], propDecorators: { label: [{
|
|
1794
2059
|
type: Input
|
|
1795
|
-
}],
|
|
2060
|
+
}], hint: [{
|
|
1796
2061
|
type: Input
|
|
1797
|
-
}],
|
|
2062
|
+
}], dayPlaceholder: [{
|
|
1798
2063
|
type: Input
|
|
1799
|
-
}],
|
|
2064
|
+
}], monthPlaceholder: [{
|
|
2065
|
+
type: Input
|
|
2066
|
+
}], yearPlaceholder: [{
|
|
2067
|
+
type: Input
|
|
2068
|
+
}], required: [{
|
|
2069
|
+
type: Input,
|
|
2070
|
+
args: [{ transform: booleanAttribute }]
|
|
2071
|
+
}], grouped: [{
|
|
2072
|
+
type: Input,
|
|
2073
|
+
args: [{ transform: booleanAttribute }]
|
|
2074
|
+
}], readonly: [{
|
|
2075
|
+
type: Input,
|
|
2076
|
+
args: [{ transform: booleanAttribute }]
|
|
2077
|
+
}], hideErrors: [{
|
|
2078
|
+
type: Input,
|
|
2079
|
+
args: [{ transform: booleanAttribute }]
|
|
2080
|
+
}], disabled: [{
|
|
2081
|
+
type: Input,
|
|
2082
|
+
args: [{ transform: booleanAttribute }]
|
|
2083
|
+
}], years: [{
|
|
2084
|
+
type: Input
|
|
2085
|
+
}], value: [{
|
|
1800
2086
|
type: Input
|
|
2087
|
+
}], valueChange: [{
|
|
2088
|
+
type: Output
|
|
1801
2089
|
}] } });
|
|
1802
2090
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
2091
|
+
function provideElementsConfig() {
|
|
2092
|
+
return makeEnvironmentProviders([
|
|
2093
|
+
{ provide: ELEMENTS_ERRORS, useFactory: getErrors, multi: true },
|
|
2094
|
+
ELEMENTS_MATERIAL_ICON
|
|
2095
|
+
]);
|
|
2096
|
+
}
|
|
2097
|
+
const ELEMENTS_MATERIAL_ICON = {
|
|
2098
|
+
provide: ELEMENTS_ICONS,
|
|
2099
|
+
useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
|
|
2100
|
+
multi: true
|
|
2101
|
+
};
|
|
2102
|
+
function getErrors() {
|
|
2103
|
+
const data = {
|
|
2104
|
+
unknown: () => 'form-control-errors.unknown',
|
|
2105
|
+
required: () => 'form-control-errors.required',
|
|
2106
|
+
pattern: () => 'form-control-errors.pattern',
|
|
2107
|
+
email: () => 'form-control-errors.email',
|
|
2108
|
+
emailTaken: () => 'form-control-errors.emailTaken',
|
|
2109
|
+
passwordMatch: () => 'form-control-errors.passwordMatch',
|
|
2110
|
+
confirm: () => 'form-control-errors.confirm',
|
|
2111
|
+
fullNumber: () => 'form-control-errors.fullNumber',
|
|
2112
|
+
min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
|
|
2113
|
+
max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
|
|
2114
|
+
maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
|
|
2115
|
+
minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
|
|
2116
|
+
maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
|
|
2117
|
+
invalidDate: () => 'form-control-errors.invalidDate',
|
|
2118
|
+
invalidFileType: () => 'form-control-errors.invalidFileType',
|
|
2119
|
+
minlength: ({ requiredLength, actualLength }) => ({
|
|
2120
|
+
token: 'form-control-errors.minlength',
|
|
2121
|
+
data: { requiredLength, actualLength }
|
|
2122
|
+
}),
|
|
2123
|
+
maxlength: ({ requiredLength, actualLength }) => ({
|
|
2124
|
+
token: 'form-control-errors.maxlength',
|
|
2125
|
+
data: { requiredLength, actualLength }
|
|
2126
|
+
})
|
|
2127
|
+
};
|
|
2128
|
+
return data;
|
|
1810
2129
|
}
|
|
1811
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: BbTag, decorators: [{
|
|
1812
|
-
type: Component,
|
|
1813
|
-
args: [{ selector: 'bb-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: { 'class': 'bb-tag' }, template: "<ng-content></ng-content>\n\n<button *ngIf=\"onClose?.observed\"\n (click)=\"onClose.emit()\"\n type=\"button\">\n Close\n</button>", styles: [".bb-tag{cursor:default;padding:0 7px;font-size:12px;list-style:none;line-height:20px;border-radius:4px;white-space:nowrap;display:inline-block;color:#000000a6;border:1px solid #d9d9d9;background-color:#fafafa;font-variant:tabular-nums;font-feature-settings:\"tnum\"}.bb-tag:not(:last-child){margin-right:8px}\n"] }]
|
|
1814
|
-
}], propDecorators: { onClose: [{
|
|
1815
|
-
type: Output
|
|
1816
|
-
}] } });
|
|
1817
2130
|
|
|
1818
|
-
const
|
|
2131
|
+
const IMPORTS_EXPORTS = [
|
|
1819
2132
|
// Directives.
|
|
1820
2133
|
BbFormError,
|
|
1821
2134
|
BbFormSubmit,
|
|
1822
2135
|
BbFormSubmitter,
|
|
1823
2136
|
BbInput,
|
|
1824
|
-
BbSelect,
|
|
1825
2137
|
BbPrefix,
|
|
1826
2138
|
BbSuffix,
|
|
1827
2139
|
BbImageUpload,
|
|
2140
|
+
BbExtraErrorControls,
|
|
1828
2141
|
// Pipes.
|
|
1829
2142
|
BbFileSize,
|
|
1830
2143
|
BbFileImage,
|
|
1831
2144
|
BbRelativeTime,
|
|
2145
|
+
BbDate,
|
|
1832
2146
|
// Components.
|
|
1833
2147
|
BbButton,
|
|
1834
2148
|
BbAnchor,
|
|
@@ -1837,10 +2151,11 @@ const DECLARATIONS_EXPORTS = [
|
|
|
1837
2151
|
BbFormControl,
|
|
1838
2152
|
BbFormGroup,
|
|
1839
2153
|
BbCheckbox,
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
2154
|
+
BbCheckboxGroup,
|
|
2155
|
+
BbRadioGroup,
|
|
2156
|
+
BbRadioButton,
|
|
1843
2157
|
BbAvatar,
|
|
2158
|
+
BbMultiFileControl,
|
|
1844
2159
|
BbFilePicker,
|
|
1845
2160
|
BbImagePicker,
|
|
1846
2161
|
BbDatePicker
|
|
@@ -1850,26 +2165,26 @@ class ElementsModule {
|
|
|
1850
2165
|
return {
|
|
1851
2166
|
ngModule: ElementsModule,
|
|
1852
2167
|
providers: [
|
|
1853
|
-
|
|
1854
|
-
ELEMENTS_MATERIAL_ICON
|
|
2168
|
+
provideElementsConfig()
|
|
1855
2169
|
]
|
|
1856
2170
|
};
|
|
1857
2171
|
}
|
|
1858
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.
|
|
1859
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.
|
|
2172
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2173
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: ElementsModule, imports: [
|
|
1860
2174
|
// Directives.
|
|
1861
2175
|
BbFormError,
|
|
1862
2176
|
BbFormSubmit,
|
|
1863
2177
|
BbFormSubmitter,
|
|
1864
2178
|
BbInput,
|
|
1865
|
-
BbSelect,
|
|
1866
2179
|
BbPrefix,
|
|
1867
2180
|
BbSuffix,
|
|
1868
2181
|
BbImageUpload,
|
|
2182
|
+
BbExtraErrorControls,
|
|
1869
2183
|
// Pipes.
|
|
1870
2184
|
BbFileSize,
|
|
1871
2185
|
BbFileImage,
|
|
1872
2186
|
BbRelativeTime,
|
|
2187
|
+
BbDate,
|
|
1873
2188
|
// Components.
|
|
1874
2189
|
BbButton,
|
|
1875
2190
|
BbAnchor,
|
|
@@ -1878,29 +2193,28 @@ class ElementsModule {
|
|
|
1878
2193
|
BbFormControl,
|
|
1879
2194
|
BbFormGroup,
|
|
1880
2195
|
BbCheckbox,
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2196
|
+
BbCheckboxGroup,
|
|
2197
|
+
BbRadioGroup,
|
|
2198
|
+
BbRadioButton,
|
|
1884
2199
|
BbAvatar,
|
|
2200
|
+
BbMultiFileControl,
|
|
1885
2201
|
BbFilePicker,
|
|
1886
2202
|
BbImagePicker,
|
|
1887
|
-
BbDatePicker],
|
|
1888
|
-
ReactiveFormsModule,
|
|
1889
|
-
LocalizeModule,
|
|
1890
|
-
UtilsModule], exports: [
|
|
2203
|
+
BbDatePicker], exports: [
|
|
1891
2204
|
// Directives.
|
|
1892
2205
|
BbFormError,
|
|
1893
2206
|
BbFormSubmit,
|
|
1894
2207
|
BbFormSubmitter,
|
|
1895
2208
|
BbInput,
|
|
1896
|
-
BbSelect,
|
|
1897
2209
|
BbPrefix,
|
|
1898
2210
|
BbSuffix,
|
|
1899
2211
|
BbImageUpload,
|
|
2212
|
+
BbExtraErrorControls,
|
|
1900
2213
|
// Pipes.
|
|
1901
2214
|
BbFileSize,
|
|
1902
2215
|
BbFileImage,
|
|
1903
2216
|
BbRelativeTime,
|
|
2217
|
+
BbDate,
|
|
1904
2218
|
// Components.
|
|
1905
2219
|
BbButton,
|
|
1906
2220
|
BbAnchor,
|
|
@@ -1909,68 +2223,28 @@ class ElementsModule {
|
|
|
1909
2223
|
BbFormControl,
|
|
1910
2224
|
BbFormGroup,
|
|
1911
2225
|
BbCheckbox,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2226
|
+
BbCheckboxGroup,
|
|
2227
|
+
BbRadioGroup,
|
|
2228
|
+
BbRadioButton,
|
|
1915
2229
|
BbAvatar,
|
|
2230
|
+
BbMultiFileControl,
|
|
1916
2231
|
BbFilePicker,
|
|
1917
2232
|
BbImagePicker,
|
|
1918
|
-
BbDatePicker
|
|
1919
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.
|
|
1920
|
-
|
|
1921
|
-
LocalizeModule,
|
|
1922
|
-
UtilsModule, UtilsModule] }); }
|
|
2233
|
+
BbDatePicker] }); }
|
|
2234
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ElementsModule, imports: [BbMultiFileControl,
|
|
2235
|
+
BbDatePicker] }); }
|
|
1923
2236
|
}
|
|
1924
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.
|
|
2237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ElementsModule, decorators: [{
|
|
1925
2238
|
type: NgModule,
|
|
1926
2239
|
args: [{
|
|
1927
|
-
imports: [
|
|
1928
|
-
|
|
1929
|
-
ReactiveFormsModule,
|
|
1930
|
-
LocalizeModule,
|
|
1931
|
-
UtilsModule
|
|
1932
|
-
],
|
|
1933
|
-
declarations: [...DECLARATIONS_EXPORTS],
|
|
1934
|
-
exports: [...DECLARATIONS_EXPORTS, UtilsModule]
|
|
2240
|
+
imports: [...IMPORTS_EXPORTS],
|
|
2241
|
+
exports: [...IMPORTS_EXPORTS]
|
|
1935
2242
|
}]
|
|
1936
2243
|
}] });
|
|
1937
|
-
const ELEMENTS_MATERIAL_ICON = {
|
|
1938
|
-
provide: ELEMENTS_ICONS,
|
|
1939
|
-
useValue: { namespace: 'material', className: 'material-icons', uses: 'content', type: 'font' },
|
|
1940
|
-
multi: true
|
|
1941
|
-
};
|
|
1942
|
-
function getErrors() {
|
|
1943
|
-
const data = {
|
|
1944
|
-
unknown: () => 'form-control-errors.unknown',
|
|
1945
|
-
required: () => 'form-control-errors.required',
|
|
1946
|
-
pattern: () => 'form-control-errors.pattern',
|
|
1947
|
-
email: () => 'form-control-errors.email',
|
|
1948
|
-
emailTaken: () => 'form-control-errors.emailTaken',
|
|
1949
|
-
passwordMatch: () => 'form-control-errors.passwordMatch',
|
|
1950
|
-
confirm: () => 'form-control-errors.confirm',
|
|
1951
|
-
fullNumber: () => 'form-control-errors.fullNumber',
|
|
1952
|
-
min: ({ min }) => ({ token: 'form-control-errors.min', data: { min } }),
|
|
1953
|
-
max: ({ max }) => ({ token: 'form-control-errors.max', data: { max } }),
|
|
1954
|
-
maxFileSize: ({ maxSize }) => ({ token: 'form-control-errors.maxFileSize', data: { maxSize } }),
|
|
1955
|
-
minDate: ({ date }) => ({ token: 'form-control-errors.minDate', data: { date } }),
|
|
1956
|
-
maxDate: ({ date }) => ({ token: 'form-control-errors.maxDate', data: { date } }),
|
|
1957
|
-
invalidDate: () => 'form-control-errors.invalidDate',
|
|
1958
|
-
invalidFileType: () => 'form-control-errors.invalidFileType',
|
|
1959
|
-
minlength: ({ requiredLength, actualLength }) => ({
|
|
1960
|
-
token: 'form-control-errors.minlength',
|
|
1961
|
-
data: { requiredLength, actualLength }
|
|
1962
|
-
}),
|
|
1963
|
-
maxlength: ({ requiredLength, actualLength }) => ({
|
|
1964
|
-
token: 'form-control-errors.maxlength',
|
|
1965
|
-
data: { requiredLength, actualLength }
|
|
1966
|
-
})
|
|
1967
|
-
};
|
|
1968
|
-
return data;
|
|
1969
|
-
}
|
|
1970
2244
|
|
|
1971
2245
|
/**
|
|
1972
2246
|
* Generated bundle index. Do not edit.
|
|
1973
2247
|
*/
|
|
1974
2248
|
|
|
1975
|
-
export { BbAnchor, BbAvatar, BbButton, BbCheckbox,
|
|
2249
|
+
export { BbAnchor, BbAvatar, BbButton, BbCheckbox, BbCheckboxGroup, BbDate, BbDatePicker, BbExtraErrorControls, BbFileImage, BbFilePicker, BbFileSize, BbFormControl, BbFormError, BbFormGroup, BbFormSubmit, BbFormSubmitter, BbIcon, BbImagePicker, BbImageUpload, BbInput, BbMultiFileControl, BbPrefix, BbRadioButton, BbRadioGroup, BbRelativeTime, BbSpinner, BbSuffix, ELEMENTS_ERRORS, ELEMENTS_ICONS, ELEMENTS_MATERIAL_ICON, ElementsModule, getErrors, provideElementsConfig };
|
|
1976
2250
|
//# sourceMappingURL=bravobit-bb-foundation-elements.mjs.map
|