@sixbell-telco/sdk 0.71.0 → 1.0.2
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/CHANGELOG.md +317 -30
- package/README.md +357 -241
- package/_index.css +452 -0
- package/components/accordion/accordion-item/accordion-item.component.d.ts +1 -1
- package/components/audio-player/audio-timeline/audio-timeline.component.d.ts +2 -2
- package/components/audio-player/button-play/button-play.component.d.ts +6 -6
- package/components/audio-player/services/audio.service.d.ts +1 -0
- package/components/audio-player/src/audio-player.component.d.ts +14 -8
- package/components/audio-player/volume-control/volume-control.component.d.ts +2 -2
- package/components/avatar/src/avatar.component.d.ts +116 -8
- package/components/badge/src/badge.component.d.ts +69 -7
- package/components/button/src/button.component.d.ts +120 -8
- package/components/card/card-actions/card-actions.component.d.ts +29 -1
- package/components/card/card-content/card-content.component.d.ts +25 -0
- package/components/card/card-title/card-title.component.d.ts +22 -0
- package/components/card/src/card.component.d.ts +90 -5
- package/components/countdown/src/countdown.component.d.ts +2 -6
- package/components/dropdown/dropdown-item/dropdown-item.component.d.ts +35 -2
- package/components/dropdown/src/dropdown.component.d.ts +151 -9
- package/components/dual-list/src/dual-list.component.d.ts +7 -8
- package/components/file-upload/file-dropzone/file-dropzone.component.d.ts +254 -0
- package/components/file-upload/file-uploader/file-uploader.component.d.ts +209 -0
- package/components/file-upload/index.d.ts +5 -0
- package/components/file-upload/public-api.d.ts +4 -0
- package/components/file-upload/shared/types/file-upload.d.ts +8 -0
- package/components/forms/checkbox/src/checkbox.component.d.ts +68 -5
- package/components/forms/combobox/src/combobox.component.d.ts +476 -39
- package/components/forms/datepicker/src/datepicker.component.d.ts +2 -2
- package/components/forms/form-error/src/form-error.component.d.ts +2 -2
- package/components/forms/input/input-content/input-content.component.d.ts +8 -0
- package/components/forms/input/public-api.d.ts +1 -0
- package/components/forms/input/src/input.component.d.ts +148 -25
- package/components/forms/radio/src/radio.component.d.ts +83 -7
- package/components/forms/range/src/range.component.d.ts +101 -6
- package/components/forms/select/src/select.component.d.ts +316 -24
- package/components/forms/switch/src/switch.component.d.ts +74 -7
- package/components/forms/textarea/src/textarea.component.d.ts +172 -16
- package/components/forms/toggle/src/toggle.component.d.ts +3 -3
- package/components/icon/src/icon.component.d.ts +5 -5
- package/components/link/src/link.component.d.ts +1 -1
- package/components/modal/modal-actions/modal-actions.component.d.ts +1 -1
- package/components/modal/src/modal.component.d.ts +10 -10
- package/components/notification/src/notification.component.d.ts +2 -3
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +64 -15
- package/components/paginator/src/paginator.component.d.ts +93 -2
- package/components/product-card/src/product-card.component.d.ts +7 -8
- package/components/progress/src/progress.component.d.ts +59 -4
- package/components/tab/directives/tab-content/tab-content.directive.d.ts +1 -1
- package/components/tab/directives/tab-header/tab-header.directive.d.ts +1 -1
- package/components/tab/src/tab.component.d.ts +3 -3
- package/components/table/public-api.d.ts +2 -0
- package/components/table/src/table.component.d.ts +160 -14
- package/components/table/table-action/table-action.component.d.ts +49 -0
- package/components/table/table-actions/table-actions.component.d.ts +25 -0
- package/components/table/table-header-checkbox/table-header-checkbox.component.d.ts +42 -0
- package/components/table/table-row-checkbox/table-row-checkbox.component.d.ts +46 -0
- package/components/toast/toast-message/toast-message.component.d.ts +3 -3
- package/components/tooltip/public-api.d.ts +1 -0
- package/components/tooltip/src/tooltip.component.d.ts +66 -5
- package/components/tooltip/tooltip-content/tooltip-content.component.d.ts +38 -0
- package/components/wizard/public-api.d.ts +2 -3
- package/components/wizard/services/wizard.service.d.ts +221 -0
- package/components/wizard/wizard-actions/wizard-actions.component.d.ts +8 -0
- package/components/wizard/wizard-content/wizard-content.component.d.ts +67 -13
- package/components/wizard/wizard-marker/wizard-marker.component.d.ts +81 -6
- package/components/wizard/wizard-step/wizard-step.component.d.ts +76 -9
- package/components/wizard/wizard-sub-step/wizard-sub-step.component.d.ts +91 -9
- package/components/wizard/wizard-wrapper/wizard-wrapper.component.d.ts +152 -16
- package/directives/auto-focus/index.d.ts +5 -0
- package/directives/auto-focus/public-api.d.ts +1 -0
- package/directives/auto-focus/src/autofocus.directive.d.ts +93 -0
- package/directives/click-outside/src/click-outside.directive.d.ts +48 -3
- package/directives/only-numbers/index.d.ts +5 -0
- package/directives/only-numbers/public-api.d.ts +1 -0
- package/directives/only-numbers/src/just-numbers.directive.d.ts +9 -0
- package/directives/typography/src/typography.directive.d.ts +47 -1
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +10 -12
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs +119 -69
- package/fesm2022/sixbell-telco-sdk-components-audio-player.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs +109 -19
- package/fesm2022/sixbell-telco-sdk-components-avatar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs +92 -46
- package/fesm2022/sixbell-telco-sdk-components-badge.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-button.mjs +153 -34
- package/fesm2022/sixbell-telco-sdk-components-button.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-card.mjs +195 -33
- package/fesm2022/sixbell-telco-sdk-components-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-countdown.mjs +8 -11
- package/fesm2022/sixbell-telco-sdk-components-countdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +197 -26
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +30 -18
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +706 -0
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs +85 -25
- package/fesm2022/sixbell-telco-sdk-components-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +996 -113
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +11 -11
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +13 -12
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +221 -121
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs +98 -26
- package/fesm2022/sixbell-telco-sdk-components-forms-radio.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs +117 -25
- package/fesm2022/sixbell-telco-sdk-components-forms-range.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +671 -74
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +95 -45
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +236 -75
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs +74 -258
- package/fesm2022/sixbell-telco-sdk-components-forms-toggle.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs +23 -14
- package/fesm2022/sixbell-telco-sdk-components-icon.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-link.mjs +16 -16
- package/fesm2022/sixbell-telco-sdk-components-link.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs +39 -36
- package/fesm2022/sixbell-telco-sdk-components-modal.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs +16 -9
- package/fesm2022/sixbell-telco-sdk-components-notification.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +189 -59
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs +35 -43
- package/fesm2022/sixbell-telco-sdk-components-product-card.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs +60 -12
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs +33 -35
- package/fesm2022/sixbell-telco-sdk-components-tab.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +403 -58
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs +28 -44
- package/fesm2022/sixbell-telco-sdk-components-toast.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs +112 -10
- package/fesm2022/sixbell-telco-sdk-components-tooltip.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs +897 -161
- package/fesm2022/sixbell-telco-sdk-components-wizard.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs +206 -0
- package/fesm2022/sixbell-telco-sdk-directives-auto-focus.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs +54 -11
- package/fesm2022/sixbell-telco-sdk-directives-click-outside.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +52 -0
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs +66 -15
- package/fesm2022/sixbell-telco-sdk-directives-typography.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-cn.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-generators-uuid.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-extract-extension.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-time.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs.map +1 -1
- package/package.json +55 -148
- package/sixbell-telco-sdk-1.0.2.tgz +0 -0
- package/_index.scss +0 -146
- package/assets/styles/combobox.scss +0 -454
- package/components/file-upload/file-dropzone/index.d.ts +0 -5
- package/components/file-upload/file-dropzone/public-api.d.ts +0 -1
- package/components/file-upload/file-dropzone/src/file-dropzone.component.d.ts +0 -68
- package/components/file-upload/file-uploader/index.d.ts +0 -5
- package/components/file-upload/file-uploader/public-api.d.ts +0 -1
- package/components/file-upload/file-uploader/src/file-uploader.component.d.ts +0 -46
- package/esm2022/components/accordion/accordion-item/accordion-item.component.mjs +0 -43
- package/esm2022/components/accordion/public-api.mjs +0 -3
- package/esm2022/components/accordion/sixbell-telco-sdk-components-accordion.mjs +0 -5
- package/esm2022/components/accordion/src/accordion.component.mjs +0 -13
- package/esm2022/components/audio-player/audio-timeline/audio-timeline.component.mjs +0 -76
- package/esm2022/components/audio-player/button-play/button-play.component.mjs +0 -71
- package/esm2022/components/audio-player/public-api.mjs +0 -4
- package/esm2022/components/audio-player/services/audio.service.mjs +0 -189
- package/esm2022/components/audio-player/sixbell-telco-sdk-components-audio-player.mjs +0 -5
- package/esm2022/components/audio-player/src/audio-player.component.mjs +0 -84
- package/esm2022/components/audio-player/track-info/track-info.component.mjs +0 -17
- package/esm2022/components/audio-player/volume-control/volume-control.component.mjs +0 -83
- package/esm2022/components/avatar/public-api.mjs +0 -2
- package/esm2022/components/avatar/sixbell-telco-sdk-components-avatar.mjs +0 -5
- package/esm2022/components/avatar/src/avatar.component.mjs +0 -59
- package/esm2022/components/badge/public-api.mjs +0 -2
- package/esm2022/components/badge/sixbell-telco-sdk-components-badge.mjs +0 -5
- package/esm2022/components/badge/src/badge.component.mjs +0 -76
- package/esm2022/components/button/public-api.mjs +0 -2
- package/esm2022/components/button/sixbell-telco-sdk-components-button.mjs +0 -5
- package/esm2022/components/button/src/button.component.mjs +0 -84
- package/esm2022/components/card/card-actions/card-actions.component.mjs +0 -22
- package/esm2022/components/card/card-content/card-content.component.mjs +0 -12
- package/esm2022/components/card/card-title/card-title.component.mjs +0 -12
- package/esm2022/components/card/public-api.mjs +0 -5
- package/esm2022/components/card/sixbell-telco-sdk-components-card.mjs +0 -5
- package/esm2022/components/card/src/card.component.mjs +0 -32
- package/esm2022/components/countdown/public-api.mjs +0 -2
- package/esm2022/components/countdown/sixbell-telco-sdk-components-countdown.mjs +0 -5
- package/esm2022/components/countdown/src/countdown.component.mjs +0 -60
- package/esm2022/components/dropdown/dropdown-item/dropdown-item.component.mjs +0 -24
- package/esm2022/components/dropdown/public-api.mjs +0 -3
- package/esm2022/components/dropdown/sixbell-telco-sdk-components-dropdown.mjs +0 -5
- package/esm2022/components/dropdown/src/dropdown.component.mjs +0 -127
- package/esm2022/components/dual-list/public-api.mjs +0 -2
- package/esm2022/components/dual-list/sixbell-telco-sdk-components-dual-list.mjs +0 -5
- package/esm2022/components/dual-list/src/dual-list.component.mjs +0 -174
- package/esm2022/components/file-upload/file-dropzone/public-api.mjs +0 -2
- package/esm2022/components/file-upload/file-dropzone/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +0 -5
- package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.component.mjs +0 -232
- package/esm2022/components/file-upload/file-dropzone/src/file-dropzone.constants.mjs +0 -7
- package/esm2022/components/file-upload/file-uploader/public-api.mjs +0 -2
- package/esm2022/components/file-upload/file-uploader/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +0 -5
- package/esm2022/components/file-upload/file-uploader/src/file-uploader.component.mjs +0 -114
- package/esm2022/components/forms/checkbox/public-api.mjs +0 -2
- package/esm2022/components/forms/checkbox/sixbell-telco-sdk-components-forms-checkbox.mjs +0 -5
- package/esm2022/components/forms/checkbox/src/checkbox.component.mjs +0 -94
- package/esm2022/components/forms/combobox/public-api.mjs +0 -2
- package/esm2022/components/forms/combobox/sixbell-telco-sdk-components-forms-combobox.mjs +0 -5
- package/esm2022/components/forms/combobox/src/combobox.component.mjs +0 -165
- package/esm2022/components/forms/datepicker/public-api.mjs +0 -3
- package/esm2022/components/forms/datepicker/sixbell-telco-sdk-components-forms-datepicker.mjs +0 -5
- package/esm2022/components/forms/datepicker/src/datepicker-format-month.pipe.mjs +0 -20
- package/esm2022/components/forms/datepicker/src/datepicker.component.mjs +0 -190
- package/esm2022/components/forms/form-error/public-api.mjs +0 -2
- package/esm2022/components/forms/form-error/sixbell-telco-sdk-components-forms-form-error.mjs +0 -5
- package/esm2022/components/forms/form-error/src/form-error.component.mjs +0 -32
- package/esm2022/components/forms/input/public-api.mjs +0 -2
- package/esm2022/components/forms/input/sixbell-telco-sdk-components-forms-input.mjs +0 -5
- package/esm2022/components/forms/input/src/input.component.mjs +0 -201
- package/esm2022/components/forms/radio/public-api.mjs +0 -2
- package/esm2022/components/forms/radio/sixbell-telco-sdk-components-forms-radio.mjs +0 -5
- package/esm2022/components/forms/radio/src/radio.component.mjs +0 -96
- package/esm2022/components/forms/range/public-api.mjs +0 -2
- package/esm2022/components/forms/range/sixbell-telco-sdk-components-forms-range.mjs +0 -5
- package/esm2022/components/forms/range/src/range.component.mjs +0 -103
- package/esm2022/components/forms/select/public-api.mjs +0 -2
- package/esm2022/components/forms/select/sixbell-telco-sdk-components-forms-select.mjs +0 -5
- package/esm2022/components/forms/select/src/select.component.mjs +0 -138
- package/esm2022/components/forms/switch/public-api.mjs +0 -2
- package/esm2022/components/forms/switch/sixbell-telco-sdk-components-forms-switch.mjs +0 -5
- package/esm2022/components/forms/switch/src/switch.component.mjs +0 -108
- package/esm2022/components/forms/textarea/public-api.mjs +0 -2
- package/esm2022/components/forms/textarea/sixbell-telco-sdk-components-forms-textarea.mjs +0 -5
- package/esm2022/components/forms/textarea/src/textarea.component.mjs +0 -167
- package/esm2022/components/forms/toggle/public-api.mjs +0 -2
- package/esm2022/components/forms/toggle/sixbell-telco-sdk-components-forms-toggle.mjs +0 -5
- package/esm2022/components/forms/toggle/src/toggle.component.mjs +0 -404
- package/esm2022/components/icon/heroicons/mini/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/mini/sixbell-telco-sdk-components-icon-heroicons-mini.mjs +0 -5
- package/esm2022/components/icon/heroicons/outline/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/outline/sixbell-telco-sdk-components-icon-heroicons-outline.mjs +0 -5
- package/esm2022/components/icon/heroicons/solid/public-api.mjs +0 -2
- package/esm2022/components/icon/heroicons/solid/sixbell-telco-sdk-components-icon-heroicons-solid.mjs +0 -5
- package/esm2022/components/icon/ionicons/public-api.mjs +0 -2
- package/esm2022/components/icon/ionicons/sixbell-telco-sdk-components-icon-ionicons.mjs +0 -5
- package/esm2022/components/icon/material/baseline/public-api.mjs +0 -2
- package/esm2022/components/icon/material/baseline/sixbell-telco-sdk-components-icon-material-baseline.mjs +0 -5
- package/esm2022/components/icon/material/outline/public-api.mjs +0 -2
- package/esm2022/components/icon/material/outline/sixbell-telco-sdk-components-icon-material-outline.mjs +0 -5
- package/esm2022/components/icon/material/round/public-api.mjs +0 -2
- package/esm2022/components/icon/material/round/sixbell-telco-sdk-components-icon-material-round.mjs +0 -5
- package/esm2022/components/icon/material/sharp/public-api.mjs +0 -2
- package/esm2022/components/icon/material/sharp/sixbell-telco-sdk-components-icon-material-sharp.mjs +0 -5
- package/esm2022/components/icon/public-api.mjs +0 -2
- package/esm2022/components/icon/sixbell-telco-sdk-components-icon.mjs +0 -5
- package/esm2022/components/icon/src/icon.component.mjs +0 -41
- package/esm2022/components/link/public-api.mjs +0 -2
- package/esm2022/components/link/sixbell-telco-sdk-components-link.mjs +0 -5
- package/esm2022/components/link/src/link.component.mjs +0 -63
- package/esm2022/components/modal/modal-actions/modal-actions.component.mjs +0 -22
- package/esm2022/components/modal/modal-content/modal-content.component.mjs +0 -12
- package/esm2022/components/modal/modal-title/modal-title.component.mjs +0 -13
- package/esm2022/components/modal/public-api.mjs +0 -5
- package/esm2022/components/modal/sixbell-telco-sdk-components-modal.mjs +0 -5
- package/esm2022/components/modal/src/modal.component.mjs +0 -154
- package/esm2022/components/notification/public-api.mjs +0 -2
- package/esm2022/components/notification/sixbell-telco-sdk-components-notification.mjs +0 -5
- package/esm2022/components/notification/src/notification.component.mjs +0 -55
- package/esm2022/components/paginator/components/pagination-item/pagination-item.component.mjs +0 -113
- package/esm2022/components/paginator/public-api.mjs +0 -3
- package/esm2022/components/paginator/sixbell-telco-sdk-components-paginator.mjs +0 -5
- package/esm2022/components/paginator/src/paginator.component.mjs +0 -52
- package/esm2022/components/product-card/directives/product-card-actions.directive.mjs +0 -15
- package/esm2022/components/product-card/directives/product-card-content.directive.mjs +0 -15
- package/esm2022/components/product-card/directives/product-card-header.directive.mjs +0 -15
- package/esm2022/components/product-card/public-api.mjs +0 -5
- package/esm2022/components/product-card/sixbell-telco-sdk-components-product-card.mjs +0 -5
- package/esm2022/components/product-card/src/product-card.component.mjs +0 -140
- package/esm2022/components/progress/public-api.mjs +0 -2
- package/esm2022/components/progress/sixbell-telco-sdk-components-progress.mjs +0 -5
- package/esm2022/components/progress/src/progress.component.mjs +0 -43
- package/esm2022/components/tab/directives/tab-content/tab-content.directive.mjs +0 -51
- package/esm2022/components/tab/directives/tab-header/tab-header.directive.mjs +0 -56
- package/esm2022/components/tab/public-api.mjs +0 -4
- package/esm2022/components/tab/sixbell-telco-sdk-components-tab.mjs +0 -5
- package/esm2022/components/tab/src/tab.component.mjs +0 -42
- package/esm2022/components/table/public-api.mjs +0 -4
- package/esm2022/components/table/sixbell-telco-sdk-components-table.mjs +0 -5
- package/esm2022/components/table/src/table.component.mjs +0 -143
- package/esm2022/components/table/table-header-checkbox/table-header-checkbox.component.mjs +0 -25
- package/esm2022/components/table/table-row-checkbox/table-row-checkbox.component.mjs +0 -26
- package/esm2022/components/toast/public-api.mjs +0 -4
- package/esm2022/components/toast/services/toast.service.mjs +0 -67
- package/esm2022/components/toast/sixbell-telco-sdk-components-toast.mjs +0 -5
- package/esm2022/components/toast/toast-message/toast-message.component.mjs +0 -80
- package/esm2022/components/toast/toasts-container/toasts-container.component.mjs +0 -41
- package/esm2022/components/tooltip/public-api.mjs +0 -2
- package/esm2022/components/tooltip/sixbell-telco-sdk-components-tooltip.mjs +0 -5
- package/esm2022/components/tooltip/src/tooltip.component.mjs +0 -45
- package/esm2022/components/wizard/public-api.mjs +0 -6
- package/esm2022/components/wizard/sixbell-telco-sdk-components-wizard.mjs +0 -5
- package/esm2022/components/wizard/wizard-content/wizard-content.component.mjs +0 -30
- package/esm2022/components/wizard/wizard-marker/wizard-marker.component.mjs +0 -24
- package/esm2022/components/wizard/wizard-step/wizard-step.component.mjs +0 -44
- package/esm2022/components/wizard/wizard-sub-step/wizard-sub-step.component.mjs +0 -34
- package/esm2022/components/wizard/wizard-wrapper/wizard-wrapper.component.mjs +0 -88
- package/esm2022/directives/click-outside/public-api.mjs +0 -2
- package/esm2022/directives/click-outside/sixbell-telco-sdk-directives-click-outside.mjs +0 -5
- package/esm2022/directives/click-outside/src/click-outside.directive.mjs +0 -30
- package/esm2022/directives/typography/public-api.mjs +0 -2
- package/esm2022/directives/typography/sixbell-telco-sdk-directives-typography.mjs +0 -5
- package/esm2022/directives/typography/src/typography.directive.mjs +0 -68
- package/esm2022/public_api.mjs +0 -2
- package/esm2022/sixbell-telco-sdk.mjs +0 -5
- package/esm2022/utils/cn/public-api.mjs +0 -2
- package/esm2022/utils/cn/sixbell-telco-sdk-utils-cn.mjs +0 -5
- package/esm2022/utils/cn/src/cn.mjs +0 -6
- package/esm2022/utils/generators/uuid/public-api.mjs +0 -2
- package/esm2022/utils/generators/uuid/sixbell-telco-sdk-utils-generators-uuid.mjs +0 -5
- package/esm2022/utils/generators/uuid/src/uuid.mjs +0 -5
- package/esm2022/utils/pipes/extract-extension/public-api.mjs +0 -2
- package/esm2022/utils/pipes/extract-extension/sixbell-telco-sdk-utils-pipes-extract-extension.mjs +0 -5
- package/esm2022/utils/pipes/extract-extension/src/extract-extension.mjs +0 -30
- package/esm2022/utils/pipes/time/public-api.mjs +0 -2
- package/esm2022/utils/pipes/time/sixbell-telco-sdk-utils-pipes-time.mjs +0 -5
- package/esm2022/utils/pipes/time/src/time.pipe.mjs +0 -19
- package/esm2022/utils/pipes/to-bytes-extesion/public-api.mjs +0 -2
- package/esm2022/utils/pipes/to-bytes-extesion/sixbell-telco-sdk-utils-pipes-to-bytes-extesion.mjs +0 -5
- package/esm2022/utils/pipes/to-bytes-extesion/src/to-bytes.pipe.mjs +0 -29
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs +0 -245
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-dropzone.mjs.map +0 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs +0 -121
- package/fesm2022/sixbell-telco-sdk-components-file-upload-file-uploader.mjs.map +0 -1
- /package/assets/styles/{toast.scss → toast.css} +0 -0
- /package/components/file-upload/{file-dropzone/src/file-dropzone.constants.d.ts → shared/const/file-upload.constants.d.ts} +0 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, input, model, computed, signal, output, viewChild, forwardRef, Component, ChangeDetectionStrategy } from '@angular/core';
|
|
4
|
+
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
+
import { TranslateService, _, TranslatePipe } from '@ngx-translate/core';
|
|
7
|
+
import { AudioPlayerService, ButtonPlayComponent, AudioPlayerComponent } from '@sixbell-telco/sdk/components/audio-player';
|
|
8
|
+
import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
9
|
+
import { IconComponent } from '@sixbell-telco/sdk/components/icon';
|
|
10
|
+
import { matDelete, matDownload, matInsertDriveFile, matCloudUpload, matError, matVisibility, matVisibilityOff } from '@sixbell-telco/sdk/components/icon/material/baseline';
|
|
11
|
+
import { TooltipComponent } from '@sixbell-telco/sdk/components/tooltip';
|
|
12
|
+
import { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';
|
|
13
|
+
import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
14
|
+
import { ExtractExtensionPipe } from '@sixbell-telco/sdk/utils/pipes/extract-extension';
|
|
15
|
+
import { ToBytesPipe } from '@sixbell-telco/sdk/utils/pipes/to-bytes-extesion';
|
|
16
|
+
import { switchMap, startWith } from 'rxjs';
|
|
17
|
+
import { InputComponent } from '@sixbell-telco/sdk/components/forms/input';
|
|
18
|
+
|
|
19
|
+
const AUDIO_EXTENSIONS = ['.mp3', '.wav', '.ogg', '.m4a', '.aac', '.wma'];
|
|
20
|
+
const VIDEO_EXTENSIONS = ['.mp4', '.avi', '.mov', '.wmv', '.mkv', '.flv', '.webm'];
|
|
21
|
+
const IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.svg', '.webp'];
|
|
22
|
+
const DOCUMENT_EXTENSIONS = ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.txt', '.csv'];
|
|
23
|
+
const ARCHIVE_EXTENSIONS = ['.zip', '.rar', '.7z'];
|
|
24
|
+
const CODE_EXTENSIONS = ['.html', '.xml', '.json', '.js', '.ts', '.css'];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A customizable drag-and-drop file upload zone with audio playback capabilities
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Supports file validation, multi-file uploads, and audio file preview/playback.
|
|
31
|
+
* Implements ControlValueAccessor for Angular form integration.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <st-file-dropzone
|
|
36
|
+
* [extensions]="['.mp3', '.wav']"
|
|
37
|
+
* [maxFiles]="3"
|
|
38
|
+
* (fileDropped)="handleUpload($event)"
|
|
39
|
+
* ></st-file-dropzone>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```html
|
|
44
|
+
* <!-- Form integration -->
|
|
45
|
+
* <st-file-dropzone
|
|
46
|
+
* [parentForm]="mediaForm"
|
|
47
|
+
* formControlName="attachments"
|
|
48
|
+
* [multiple]="true"
|
|
49
|
+
* ></st-file-dropzone>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
class DropzoneComponent {
|
|
53
|
+
/** @internal Translation service instance */
|
|
54
|
+
translateService = inject(TranslateService);
|
|
55
|
+
/** @internal Audio player service instance */
|
|
56
|
+
audioService = inject(AudioPlayerService);
|
|
57
|
+
// Input properties
|
|
58
|
+
/**
|
|
59
|
+
* Maximum number of allowed files
|
|
60
|
+
* @defaultValue 1
|
|
61
|
+
*/
|
|
62
|
+
maxFiles = input(1);
|
|
63
|
+
/**
|
|
64
|
+
* Maximum file size in bytes (0 for unlimited)
|
|
65
|
+
* @defaultValue 0
|
|
66
|
+
*/
|
|
67
|
+
maxFileSize = input(0);
|
|
68
|
+
/**
|
|
69
|
+
* Whether to display uploaded files list
|
|
70
|
+
* @defaultValue true
|
|
71
|
+
*/
|
|
72
|
+
showFiles = input(true);
|
|
73
|
+
/**
|
|
74
|
+
* Allowed file extensions (e.g., ['.pdf', '.mp3'])
|
|
75
|
+
*/
|
|
76
|
+
extensions = input.required();
|
|
77
|
+
/**
|
|
78
|
+
* Whether upload is in progress
|
|
79
|
+
* @defaultValue false
|
|
80
|
+
*/
|
|
81
|
+
uploading = input(false);
|
|
82
|
+
/**
|
|
83
|
+
* Whether the component is disabled
|
|
84
|
+
* @defaultValue false
|
|
85
|
+
*/
|
|
86
|
+
disabled = model(false);
|
|
87
|
+
/**
|
|
88
|
+
* Whether multiple files can be uploaded
|
|
89
|
+
* @defaultValue false
|
|
90
|
+
*/
|
|
91
|
+
multiple = input(false);
|
|
92
|
+
/**
|
|
93
|
+
* HTML name attribute for the input
|
|
94
|
+
* @defaultValue 'file'
|
|
95
|
+
*/
|
|
96
|
+
name = input('file');
|
|
97
|
+
/**
|
|
98
|
+
* Computed accept attribute for file input
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
accept = computed(() => this.extensions().join(','));
|
|
102
|
+
/** @internal Tracks audio player open state */
|
|
103
|
+
opened = signal(false);
|
|
104
|
+
/** @internal Tracks blur events for validation */
|
|
105
|
+
blurTrigger = signal(0);
|
|
106
|
+
// Form integration
|
|
107
|
+
/**
|
|
108
|
+
* Parent form group for reactive forms
|
|
109
|
+
*/
|
|
110
|
+
parentForm = input(null);
|
|
111
|
+
/**
|
|
112
|
+
* Form control name for reactive forms
|
|
113
|
+
*/
|
|
114
|
+
formControlName = input('');
|
|
115
|
+
// Output events
|
|
116
|
+
/**
|
|
117
|
+
* Emitted when valid files are dropped/selected
|
|
118
|
+
*/
|
|
119
|
+
fileDropped = output();
|
|
120
|
+
/**
|
|
121
|
+
* Emitted when a file is removed
|
|
122
|
+
*/
|
|
123
|
+
fileRemoved = output();
|
|
124
|
+
// Internal state
|
|
125
|
+
/** @internal Current list of uploaded files */
|
|
126
|
+
files = signal([]);
|
|
127
|
+
/** @internal Drag state tracker */
|
|
128
|
+
isDragging = signal(false);
|
|
129
|
+
/** @internal Validation error message */
|
|
130
|
+
errorMessage = signal('');
|
|
131
|
+
// ControlValueAccessor implementation
|
|
132
|
+
/** @internal Change callback function */
|
|
133
|
+
onControlChange = () => { };
|
|
134
|
+
/** @internal Touch callback function */
|
|
135
|
+
onControlTouch = () => { };
|
|
136
|
+
/** @internal Reference to file input element */
|
|
137
|
+
fileInput = viewChild('fileInput');
|
|
138
|
+
// Icon references
|
|
139
|
+
/** @internal Material icon references */
|
|
140
|
+
iconDelete = matDelete;
|
|
141
|
+
iconDownload = matDownload;
|
|
142
|
+
iconInsertDriveFile = matInsertDriveFile;
|
|
143
|
+
iconCloudUpload = matCloudUpload;
|
|
144
|
+
iconError = matError;
|
|
145
|
+
iconVisibility = matVisibility;
|
|
146
|
+
iconVisibilityOff = matVisibilityOff;
|
|
147
|
+
/**
|
|
148
|
+
* Computed audio tracks from uploaded files
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
tracks = computed(() => {
|
|
152
|
+
return this.files()
|
|
153
|
+
.filter((audio) => this.checkIfIsAudioFile(audio))
|
|
154
|
+
.map((audio) => ({
|
|
155
|
+
title: audio.name,
|
|
156
|
+
description: new ToBytesPipe().transform(audio.size),
|
|
157
|
+
url: URL.createObjectURL(audio),
|
|
158
|
+
}));
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Whether to show audio player controls
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
addAudioPlayer = computed(() => this.extensions().some((ext) => AUDIO_EXTENSIONS.includes(ext)));
|
|
165
|
+
/**
|
|
166
|
+
* Gets track index for audio files
|
|
167
|
+
* @param file - File to check
|
|
168
|
+
* @returns Index in audio tracks array
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
getIndexForTracks(file) {
|
|
172
|
+
return this.files()
|
|
173
|
+
.filter((audio) => this.checkIfIsAudioFile(audio))
|
|
174
|
+
.indexOf(file);
|
|
175
|
+
}
|
|
176
|
+
// Drag and drop handlers
|
|
177
|
+
/**
|
|
178
|
+
* Handles drag over event
|
|
179
|
+
* @param event - Drag event
|
|
180
|
+
* @internal
|
|
181
|
+
*/
|
|
182
|
+
handleDragOver(event) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
if (this.disabled())
|
|
185
|
+
return;
|
|
186
|
+
this.isDragging.set(true);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Handles drag leave event
|
|
190
|
+
* @param event - Drag event
|
|
191
|
+
* @internal
|
|
192
|
+
*/
|
|
193
|
+
handleDragLeave(event) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
this.isDragging.set(false);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Handles file drop event
|
|
199
|
+
* @param event - Drag event
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
handleDrop(event) {
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
this.isDragging.set(false);
|
|
205
|
+
if (this.disabled())
|
|
206
|
+
return;
|
|
207
|
+
const files = Array.from(event.dataTransfer?.files || []);
|
|
208
|
+
this.processFiles(files);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Handles file input selection
|
|
212
|
+
* @param event - Input change event
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
215
|
+
handleFileSelect(event) {
|
|
216
|
+
const input = event.target;
|
|
217
|
+
const files = Array.from(input.files || []);
|
|
218
|
+
this.processFiles(files);
|
|
219
|
+
input.value = ''; // Reset input
|
|
220
|
+
}
|
|
221
|
+
/** @internal Processes and validates uploaded files */
|
|
222
|
+
processFiles(files) {
|
|
223
|
+
this.errorMessage.set('');
|
|
224
|
+
// Validate max files
|
|
225
|
+
const totalFiles = this.files().length + files.length;
|
|
226
|
+
if (this.maxFiles() > 0 && totalFiles > this.maxFiles()) {
|
|
227
|
+
this.translateService.get(_('sdk.fileUpload.dropzone.maxFilesExceeded'), { max: this.maxFiles() }).subscribe((res) => {
|
|
228
|
+
this.errorMessage.set(res);
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// File validation
|
|
233
|
+
const validFiles = files.filter((file) => {
|
|
234
|
+
const isValidSize = this.validateFileSize(file);
|
|
235
|
+
const isValidType = this.validateFileType(file);
|
|
236
|
+
if (!isValidSize) {
|
|
237
|
+
console.warn(`File ${file.name} exceeds size limit`);
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
if (!isValidType) {
|
|
241
|
+
console.warn(`File ${file.name} has invalid type`);
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
});
|
|
246
|
+
if (validFiles.length > 0) {
|
|
247
|
+
this.files.update((current) => [...current, ...validFiles]);
|
|
248
|
+
this.onControlChange(this.files());
|
|
249
|
+
this.onControlTouch();
|
|
250
|
+
this.fileDropped.emit(validFiles);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
this.translateService.get(_('sdk.fileUpload.dropzone.noValidFiles')).subscribe((res) => {
|
|
254
|
+
this.errorMessage.set(res);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Validates file size against maxFileSize
|
|
260
|
+
* @param file - File to validate
|
|
261
|
+
* @returns True if file size is valid
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
validateFileSize(file) {
|
|
265
|
+
return this.maxFileSize() === 0 || file.size <= this.maxFileSize();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Validates file type against allowed extensions
|
|
269
|
+
* @param file - File to validate
|
|
270
|
+
* @returns True if file type is valid
|
|
271
|
+
* @internal
|
|
272
|
+
*/
|
|
273
|
+
validateFileType(file) {
|
|
274
|
+
if (this.extensions().length === 0)
|
|
275
|
+
return true;
|
|
276
|
+
const extension = file.name.match(/\.([0-9a-z]+)$/i)?.[0]?.toLowerCase() || '';
|
|
277
|
+
return this.extensions().some((ext) => ext.toLowerCase() === extension);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Handles file download
|
|
281
|
+
* @param file - File to download
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
handlefileDownload(file) {
|
|
285
|
+
const url = URL.createObjectURL(file);
|
|
286
|
+
const a = document.createElement('a');
|
|
287
|
+
a.href = url;
|
|
288
|
+
a.download = file.name;
|
|
289
|
+
document.body.appendChild(a);
|
|
290
|
+
a.click();
|
|
291
|
+
URL.revokeObjectURL(url);
|
|
292
|
+
document.body.removeChild(a);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Removes a file from the list
|
|
296
|
+
* @param file - File to remove
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
handleRemove(file) {
|
|
300
|
+
this.files.update((current) => current.filter((f) => f !== file));
|
|
301
|
+
this.onControlChange(this.files());
|
|
302
|
+
this.onControlTouch();
|
|
303
|
+
this.fileRemoved.emit(file);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Checks if a file is an audio file
|
|
307
|
+
* @param file - File to check
|
|
308
|
+
* @returns True if audio file
|
|
309
|
+
* @internal
|
|
310
|
+
*/
|
|
311
|
+
checkIfIsAudioFile(file) {
|
|
312
|
+
return AUDIO_EXTENSIONS.some((ext) => file.name.endsWith(ext));
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Toggles audio player visibility
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
handleAudioPlayerOpen() {
|
|
319
|
+
this.opened.set(!this.opened());
|
|
320
|
+
}
|
|
321
|
+
/** @internal Cleans up object URLs */
|
|
322
|
+
ngDestroy() {
|
|
323
|
+
this.tracks().forEach((track) => URL.revokeObjectURL(track.url));
|
|
324
|
+
}
|
|
325
|
+
// ControlValueAccessor implementation
|
|
326
|
+
/**
|
|
327
|
+
* Writes form value to component
|
|
328
|
+
* @param files - Array of files from form control
|
|
329
|
+
*/
|
|
330
|
+
writeValue(files) {
|
|
331
|
+
this.files.set(files || []);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Registers change callback
|
|
335
|
+
* @param fn - Callback function for value changes
|
|
336
|
+
*/
|
|
337
|
+
registerOnChange(fn) {
|
|
338
|
+
this.onControlChange = fn;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Registers touch callback
|
|
342
|
+
* @param fn - Callback function for touch events
|
|
343
|
+
*/
|
|
344
|
+
registerOnTouched(fn) {
|
|
345
|
+
this.onControlTouch = fn;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Sets disabled state
|
|
349
|
+
* @param isDisabled - Whether component is disabled
|
|
350
|
+
*/
|
|
351
|
+
setDisabledState(isDisabled) {
|
|
352
|
+
this.disabled.set(isDisabled);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Triggers file input dialog
|
|
356
|
+
* @internal
|
|
357
|
+
*/
|
|
358
|
+
triggerFileInput() {
|
|
359
|
+
if (!this.disabled()) {
|
|
360
|
+
this.fileInput()?.nativeElement.click();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Form control integration
|
|
364
|
+
/** @internal Form control reference */
|
|
365
|
+
formControl = computed(() => this.parentForm()?.get(this.formControlName()));
|
|
366
|
+
/** @internal Form control observable */
|
|
367
|
+
formControl$ = toObservable(this.formControl);
|
|
368
|
+
/** @internal Status changes observable */
|
|
369
|
+
statusChanges$ = this.formControl$.pipe(switchMap((control) => control?.statusChanges.pipe(startWith(control.status)) || []));
|
|
370
|
+
/** @internal Value changes observable */
|
|
371
|
+
stateChanges$ = this.formControl$.pipe(switchMap((control) => control?.valueChanges.pipe(startWith(control.value)) || []));
|
|
372
|
+
/** @internal Status signal */
|
|
373
|
+
statusSignal = toSignal(this.statusChanges$);
|
|
374
|
+
/** @internal State signal */
|
|
375
|
+
stateSignal = toSignal(this.stateChanges$);
|
|
376
|
+
/**
|
|
377
|
+
* Handles blur events for validation
|
|
378
|
+
* @internal
|
|
379
|
+
*/
|
|
380
|
+
handleBlur() {
|
|
381
|
+
this.onControlTouch();
|
|
382
|
+
this.blurTrigger.update((v) => v + 1);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Computes CSS classes for dropzone based on state
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
dropzoneClass = computed(() => {
|
|
389
|
+
const control = this.formControl();
|
|
390
|
+
const trigger = this.blurTrigger();
|
|
391
|
+
const baseClasses = 'cursor-pointer rounded-lg border-2 border-dashed p-8 text-center transition-colors duration-300 border-secondary hover:bg-secondary/10';
|
|
392
|
+
if (!control)
|
|
393
|
+
return baseClasses;
|
|
394
|
+
const isTouched = control.touched || trigger > 0;
|
|
395
|
+
this.statusSignal();
|
|
396
|
+
this.stateSignal();
|
|
397
|
+
const isFormError = control.invalid && (control.touched || isTouched);
|
|
398
|
+
const isComponentError = !!this.errorMessage();
|
|
399
|
+
return cn(baseClasses, {
|
|
400
|
+
'border-secondary bg-secondary/30': this.isDragging() && !this.disabled(),
|
|
401
|
+
'cursor-not-allowed bg-base-100/40 text-base-content/40': this.disabled(),
|
|
402
|
+
'border-error bg-error/15 hover:border-error hover:bg-error/10': isComponentError || isFormError,
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DropzoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
406
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DropzoneComponent, isStandalone: true, selector: "st-file-dropzone", inputs: { maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, showFiles: { classPropertyName: "showFiles", publicName: "showFiles", isSignal: true, isRequired: false, transformFunction: null }, extensions: { classPropertyName: "extensions", publicName: "extensions", isSignal: true, isRequired: true, transformFunction: null }, uploading: { classPropertyName: "uploading", publicName: "uploading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", fileDropped: "fileDropped", fileRemoved: "fileRemoved" }, providers: [
|
|
407
|
+
{
|
|
408
|
+
provide: NG_VALUE_ACCESSOR,
|
|
409
|
+
useExisting: forwardRef(() => DropzoneComponent),
|
|
410
|
+
multi: true,
|
|
411
|
+
},
|
|
412
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<div class=\"w-full\">\n\t<div\n\t\t[class]=\"dropzoneClass()\"\n\t\t(dragover)=\"handleDragOver($event)\"\n\t\t(dragleave)=\"handleDragLeave($event)\"\n\t\t(drop)=\"handleDrop($event)\"\n\t\t(click)=\"triggerFileInput()\"\n\t\t(blur)=\"handleBlur()\"\n\t\ttabindex=\"0\"\n\t>\n\t\t@if (parentForm()) {\n\t\t\t<input\n\t\t\t\t#fileInput\n\t\t\t\ttype=\"file\"\n\t\t\t\t[multiple]=\"multiple()\"\n\t\t\t\t[accept]=\"accept()\"\n\t\t\t\t(change)=\"handleFileSelect($event)\"\n\t\t\t\t[name]=\"name()\"\n\t\t\t\t(blur)=\"handleBlur()\"\n\t\t\t\trequired\n\t\t\t\thidden\n\t\t\t/>\n\t\t} @else {\n\t\t\t<input #fileInput type=\"file\" [multiple]=\"multiple()\" [accept]=\"accept()\" (change)=\"handleFileSelect($event)\" [name]=\"name()\" required hidden />\n\t\t}\n\n\t\t<div class=\"grid h-48 place-content-center\">\n\t\t\t@let errorMessageVar = this.errorMessage();\n\t\t\t@if (errorMessageVar) {\n\t\t\t\t<div>\n\t\t\t\t\t<st-icon [icon]=\"iconError\" size=\"xl\" class=\"text-error\" />\n\t\t\t\t\t<div typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t{{ errorMessageVar }}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t} @else if (!uploading()) {\n\t\t\t\t<div>\n\t\t\t\t\t<st-icon [icon]=\"iconCloudUpload\" size=\"xl\" class=\"text-accent\" />\n\t\t\t\t\t<div typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.selectPrompt' | translate }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t@if (maxFileSize() > 0) {\n\t\t\t\t\t\t<div class=\"mt-1\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-sm'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.maxSizeLabel' | translate }} <span class=\"text-accent\">{{ maxFileSize() | toBytes }}</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\n\t\t\t\t\t@if (extensions().length > 0) {\n\t\t\t\t\t\t<div class=\"mt-1\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-sm'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.allowedTypesLabel' | translate }} <span class=\"text-accent\">{{ extensions().join(', ') }}</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t</div>\n\n\t@if (maxFiles() > 0) {\n\t\t<div class=\"mt-4 flex items-center justify-between\">\n\t\t\t<ng-content></ng-content>\n\t\t\t<span typography [tyVariant]=\"'body-sm'\" [ngClass]=\"{ 'text-error': files().length > maxFiles() }\">\n\t\t\t\t{{ 'sdk.fileUpload.dropzone.fileCounter' | translate: { current: files().length, max: maxFiles() } }}\n\t\t\t</span>\n\t\t</div>\n\t}\n\n\t@if (showFiles() && files().length > 0) {\n\t\t<div class=\"mt-4 space-y-2\">\n\t\t\t@for (file of files(); track $index) {\n\t\t\t\t<div class=\"bg-neutral/30 flex items-center justify-between rounded-md py-3 pr-5 pl-3\">\n\t\t\t\t\t<div class=\"flex items-center justify-start\">\n\t\t\t\t\t\t<div class=\"text-primary relative\">\n\t\t\t\t\t\t\t<st-icon [icon]=\"iconInsertDriveFile\" size=\"xl\" />\n\t\t\t\t\t\t\t<div class=\"text-primary-content absolute bottom-2 left-1/2 -translate-x-1/2\">\n\t\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-xxs'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t\t{{ file.name | extractExtension }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"flex flex-col items-start justify-between\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t\t\t{{ file.name }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<div class=\"text-tertiary\">\n\t\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-xs'\"> {{ file.size | toBytes }} </span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"inline-flex items-center justify-end gap-1 align-top\">\n\t\t\t\t\t\t@if (checkIfIsAudioFile(file)) {\n\t\t\t\t\t\t\t<st-tooltip\n\t\t\t\t\t\t\t\t[label]=\"\n\t\t\t\t\t\t\t\t\t!this.audioService.isPlayingATrack()\n\t\t\t\t\t\t\t\t\t\t? ('sdk.fileUpload.dropzone.fileActions.play' | translate)\n\t\t\t\t\t\t\t\t\t\t: ('sdk.fileUpload.dropzone.fileActions.pause' | translate)\n\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<st-button-play\n\t\t\t\t\t\t\t\t\t[outline]=\"true\"\n\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t[asButton]=\"true\"\n\t\t\t\t\t\t\t\t\t[trackIndex]=\"getIndexForTracks(file)\"\n\t\t\t\t\t\t\t\t\t(togglePlay)=\"handleAudioPlayerOpen()\"\n\t\t\t\t\t\t\t\t></st-button-play>\n\t\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<div></div>\n\t\t\t\t\t\t<st-tooltip [label]=\"'sdk.fileUpload.dropzone.fileActions.download' | translate\" variant=\"secondary\">\n\t\t\t\t\t\t\t<st-button variant=\"info\" [outline]=\"true\" [square]=\"true\" size=\"sm\" (click)=\"handlefileDownload(file)\">\n\t\t\t\t\t\t\t\t<st-icon class=\"text-lg\" [icon]=\"iconDownload\"></st-icon>\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t\t<st-tooltip [label]=\"'sdk.fileUpload.dropzone.fileActions.remove' | translate\" variant=\"secondary\">\n\t\t\t\t\t\t\t<st-button variant=\"error\" [outline]=\"true\" [square]=\"true\" size=\"sm\" (click)=\"handleRemove(file)\">\n\t\t\t\t\t\t\t\t<st-icon class=\"text-lg\" [icon]=\"iconDelete\"></st-icon>\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t}\n</div>\n@if (addAudioPlayer()) {\n\t<st-audio-player [tracks]=\"tracks()\" [showTrackList]=\"false\" variant=\"fixed\" [(opened)]=\"opened\"></st-audio-player>\n}\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }, { kind: "pipe", type: ToBytesPipe, name: "toBytes" }, { kind: "pipe", type: ExtractExtensionPipe, name: "extractExtension" }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonPlayComponent, selector: "st-button-play", inputs: ["variant", "ghost", "outline", "circle", "square", "glass", "size", "shadow", "asButton", "trackIndex"], outputs: ["togglePlay"] }, { kind: "component", type: AudioPlayerComponent, selector: "st-audio-player", inputs: ["variant", "shadow", "opened", "tracks", "showTrackList", "currentTrackIndex"], outputs: ["openedChange", "currentTrackIndexChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "component", type: TooltipComponent, selector: "st-tooltip", inputs: ["variant", "position", "label"] }] });
|
|
413
|
+
}
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DropzoneComponent, decorators: [{
|
|
415
|
+
type: Component,
|
|
416
|
+
args: [{ selector: 'st-file-dropzone', imports: [
|
|
417
|
+
NgClass,
|
|
418
|
+
ButtonComponent,
|
|
419
|
+
TypographyDirective,
|
|
420
|
+
ToBytesPipe,
|
|
421
|
+
ExtractExtensionPipe,
|
|
422
|
+
IconComponent,
|
|
423
|
+
ButtonPlayComponent,
|
|
424
|
+
AudioPlayerComponent,
|
|
425
|
+
FormsModule,
|
|
426
|
+
TranslatePipe,
|
|
427
|
+
TooltipComponent,
|
|
428
|
+
], providers: [
|
|
429
|
+
{
|
|
430
|
+
provide: NG_VALUE_ACCESSOR,
|
|
431
|
+
useExisting: forwardRef(() => DropzoneComponent),
|
|
432
|
+
multi: true,
|
|
433
|
+
},
|
|
434
|
+
], template: "<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<div class=\"w-full\">\n\t<div\n\t\t[class]=\"dropzoneClass()\"\n\t\t(dragover)=\"handleDragOver($event)\"\n\t\t(dragleave)=\"handleDragLeave($event)\"\n\t\t(drop)=\"handleDrop($event)\"\n\t\t(click)=\"triggerFileInput()\"\n\t\t(blur)=\"handleBlur()\"\n\t\ttabindex=\"0\"\n\t>\n\t\t@if (parentForm()) {\n\t\t\t<input\n\t\t\t\t#fileInput\n\t\t\t\ttype=\"file\"\n\t\t\t\t[multiple]=\"multiple()\"\n\t\t\t\t[accept]=\"accept()\"\n\t\t\t\t(change)=\"handleFileSelect($event)\"\n\t\t\t\t[name]=\"name()\"\n\t\t\t\t(blur)=\"handleBlur()\"\n\t\t\t\trequired\n\t\t\t\thidden\n\t\t\t/>\n\t\t} @else {\n\t\t\t<input #fileInput type=\"file\" [multiple]=\"multiple()\" [accept]=\"accept()\" (change)=\"handleFileSelect($event)\" [name]=\"name()\" required hidden />\n\t\t}\n\n\t\t<div class=\"grid h-48 place-content-center\">\n\t\t\t@let errorMessageVar = this.errorMessage();\n\t\t\t@if (errorMessageVar) {\n\t\t\t\t<div>\n\t\t\t\t\t<st-icon [icon]=\"iconError\" size=\"xl\" class=\"text-error\" />\n\t\t\t\t\t<div typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t{{ errorMessageVar }}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t} @else if (!uploading()) {\n\t\t\t\t<div>\n\t\t\t\t\t<st-icon [icon]=\"iconCloudUpload\" size=\"xl\" class=\"text-accent\" />\n\t\t\t\t\t<div typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.selectPrompt' | translate }}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t@if (maxFileSize() > 0) {\n\t\t\t\t\t\t<div class=\"mt-1\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-sm'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.maxSizeLabel' | translate }} <span class=\"text-accent\">{{ maxFileSize() | toBytes }}</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\n\t\t\t\t\t@if (extensions().length > 0) {\n\t\t\t\t\t\t<div class=\"mt-1\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-sm'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t{{ 'sdk.fileUpload.dropzone.allowedTypesLabel' | translate }} <span class=\"text-accent\">{{ extensions().join(', ') }}</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t</div>\n\n\t@if (maxFiles() > 0) {\n\t\t<div class=\"mt-4 flex items-center justify-between\">\n\t\t\t<ng-content></ng-content>\n\t\t\t<span typography [tyVariant]=\"'body-sm'\" [ngClass]=\"{ 'text-error': files().length > maxFiles() }\">\n\t\t\t\t{{ 'sdk.fileUpload.dropzone.fileCounter' | translate: { current: files().length, max: maxFiles() } }}\n\t\t\t</span>\n\t\t</div>\n\t}\n\n\t@if (showFiles() && files().length > 0) {\n\t\t<div class=\"mt-4 space-y-2\">\n\t\t\t@for (file of files(); track $index) {\n\t\t\t\t<div class=\"bg-neutral/30 flex items-center justify-between rounded-md py-3 pr-5 pl-3\">\n\t\t\t\t\t<div class=\"flex items-center justify-start\">\n\t\t\t\t\t\t<div class=\"text-primary relative\">\n\t\t\t\t\t\t\t<st-icon [icon]=\"iconInsertDriveFile\" size=\"xl\" />\n\t\t\t\t\t\t\t<div class=\"text-primary-content absolute bottom-2 left-1/2 -translate-x-1/2\">\n\t\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-xxs'\" tyFontWeight=\"medium\">\n\t\t\t\t\t\t\t\t\t{{ file.name | extractExtension }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"flex flex-col items-start justify-between\">\n\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body'\">\n\t\t\t\t\t\t\t\t{{ file.name }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<div class=\"text-tertiary\">\n\t\t\t\t\t\t\t\t<span typography [tyVariant]=\"'body-xs'\"> {{ file.size | toBytes }} </span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"inline-flex items-center justify-end gap-1 align-top\">\n\t\t\t\t\t\t@if (checkIfIsAudioFile(file)) {\n\t\t\t\t\t\t\t<st-tooltip\n\t\t\t\t\t\t\t\t[label]=\"\n\t\t\t\t\t\t\t\t\t!this.audioService.isPlayingATrack()\n\t\t\t\t\t\t\t\t\t\t? ('sdk.fileUpload.dropzone.fileActions.play' | translate)\n\t\t\t\t\t\t\t\t\t\t: ('sdk.fileUpload.dropzone.fileActions.pause' | translate)\n\t\t\t\t\t\t\t\t\"\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<st-button-play\n\t\t\t\t\t\t\t\t\t[outline]=\"true\"\n\t\t\t\t\t\t\t\t\t[square]=\"true\"\n\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t[asButton]=\"true\"\n\t\t\t\t\t\t\t\t\t[trackIndex]=\"getIndexForTracks(file)\"\n\t\t\t\t\t\t\t\t\t(togglePlay)=\"handleAudioPlayerOpen()\"\n\t\t\t\t\t\t\t\t></st-button-play>\n\t\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<div></div>\n\t\t\t\t\t\t<st-tooltip [label]=\"'sdk.fileUpload.dropzone.fileActions.download' | translate\" variant=\"secondary\">\n\t\t\t\t\t\t\t<st-button variant=\"info\" [outline]=\"true\" [square]=\"true\" size=\"sm\" (click)=\"handlefileDownload(file)\">\n\t\t\t\t\t\t\t\t<st-icon class=\"text-lg\" [icon]=\"iconDownload\"></st-icon>\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t\t<st-tooltip [label]=\"'sdk.fileUpload.dropzone.fileActions.remove' | translate\" variant=\"secondary\">\n\t\t\t\t\t\t\t<st-button variant=\"error\" [outline]=\"true\" [square]=\"true\" size=\"sm\" (click)=\"handleRemove(file)\">\n\t\t\t\t\t\t\t\t<st-icon class=\"text-lg\" [icon]=\"iconDelete\"></st-icon>\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</st-tooltip>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t}\n</div>\n@if (addAudioPlayer()) {\n\t<st-audio-player [tracks]=\"tracks()\" [showTrackList]=\"false\" variant=\"fixed\" [(opened)]=\"opened\"></st-audio-player>\n}\n" }]
|
|
435
|
+
}] });
|
|
436
|
+
|
|
437
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
438
|
+
/**
|
|
439
|
+
* A customizable file upload component with form integration and validation support
|
|
440
|
+
*
|
|
441
|
+
* @remarks
|
|
442
|
+
* Supports file type restrictions, form control integration, and visual validation states.
|
|
443
|
+
* Implements ControlValueAccessor for Angular form compatibility.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```html
|
|
447
|
+
* <!-- Basic file upload -->
|
|
448
|
+
* <st-file-uploader
|
|
449
|
+
* [extensions]="['.pdf', '.docx']"
|
|
450
|
+
* label="Upload Resume"
|
|
451
|
+
* ></st-file-uploader>
|
|
452
|
+
* ```
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```html
|
|
456
|
+
* <!-- Reactive form integration -->
|
|
457
|
+
* <st-file-uploader
|
|
458
|
+
* [parentForm]="documentForm"
|
|
459
|
+
* formControlName="attachment"
|
|
460
|
+
* variant="primary"
|
|
461
|
+
* ></st-file-uploader>
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
class FileUploaderComponent {
|
|
465
|
+
/**
|
|
466
|
+
* Visual style variant
|
|
467
|
+
* @defaultValue 'secondary'
|
|
468
|
+
*/
|
|
469
|
+
variant = input('secondary');
|
|
470
|
+
/**
|
|
471
|
+
* Component size variant
|
|
472
|
+
* @defaultValue 'md'
|
|
473
|
+
*/
|
|
474
|
+
size = input('md');
|
|
475
|
+
/**
|
|
476
|
+
* Label displayed above the uploader
|
|
477
|
+
*/
|
|
478
|
+
label = input('');
|
|
479
|
+
/**
|
|
480
|
+
* HTML name attribute for the input
|
|
481
|
+
*/
|
|
482
|
+
name = input(null);
|
|
483
|
+
/**
|
|
484
|
+
* Placeholder text when no file is selected
|
|
485
|
+
*/
|
|
486
|
+
placeholder = input('');
|
|
487
|
+
/**
|
|
488
|
+
* Whether to show allowed file extensions
|
|
489
|
+
* @defaultValue true
|
|
490
|
+
*/
|
|
491
|
+
showExtensions = input(true);
|
|
492
|
+
/**
|
|
493
|
+
* Allowed file extensions (e.g., ['.pdf', '.docx'])
|
|
494
|
+
*/
|
|
495
|
+
extensions = input.required();
|
|
496
|
+
/**
|
|
497
|
+
* Computed accept attribute for native file input
|
|
498
|
+
* @internal
|
|
499
|
+
*/
|
|
500
|
+
accept = computed(() => this.extensions().join(','));
|
|
501
|
+
/**
|
|
502
|
+
* Event emitted when a valid file is selected
|
|
503
|
+
*/
|
|
504
|
+
fileUpdated = output();
|
|
505
|
+
/**
|
|
506
|
+
* Current selected filename
|
|
507
|
+
* @internal
|
|
508
|
+
*/
|
|
509
|
+
filename = '';
|
|
510
|
+
/**
|
|
511
|
+
* Current file value
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
fileValue = null;
|
|
515
|
+
/**
|
|
516
|
+
* Formatted extensions string for display
|
|
517
|
+
* @internal
|
|
518
|
+
*/
|
|
519
|
+
formattedExtensions = computed(() => this.extensions().join(', '));
|
|
520
|
+
/**
|
|
521
|
+
* Reference to the hidden file input
|
|
522
|
+
* @internal
|
|
523
|
+
*/
|
|
524
|
+
fileInput = viewChild('uploader');
|
|
525
|
+
/**
|
|
526
|
+
* Event emitted on component blur
|
|
527
|
+
*/
|
|
528
|
+
blurred = output();
|
|
529
|
+
/**
|
|
530
|
+
* Whether the component is disabled
|
|
531
|
+
* @defaultValue false
|
|
532
|
+
*/
|
|
533
|
+
disabled = model(false);
|
|
534
|
+
/** @internal Track blur events for validation */
|
|
535
|
+
blurTrigger = signal(0);
|
|
536
|
+
/**
|
|
537
|
+
* Parent form group for reactive forms
|
|
538
|
+
*/
|
|
539
|
+
parentForm = input(null);
|
|
540
|
+
/**
|
|
541
|
+
* Form control name for reactive forms
|
|
542
|
+
*/
|
|
543
|
+
formControlName = input('');
|
|
544
|
+
/**
|
|
545
|
+
* Two-way bindable file value
|
|
546
|
+
*/
|
|
547
|
+
value = model(null);
|
|
548
|
+
// ControlValueAccessor implementation
|
|
549
|
+
/** @internal */
|
|
550
|
+
onControlChange = () => { };
|
|
551
|
+
/** @internal */
|
|
552
|
+
onControlTouch = () => { };
|
|
553
|
+
/**
|
|
554
|
+
* Writes form value to component
|
|
555
|
+
* @param obj - The incoming form value
|
|
556
|
+
*/
|
|
557
|
+
writeValue(obj) {
|
|
558
|
+
this.value.set(obj);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Registers change callback
|
|
562
|
+
* @param fn - Callback function for value changes
|
|
563
|
+
*/
|
|
564
|
+
registerOnChange(fn) {
|
|
565
|
+
this.onControlChange = fn;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Registers touch callback
|
|
569
|
+
* @param fn - Callback function for touch events
|
|
570
|
+
*/
|
|
571
|
+
registerOnTouched(fn) {
|
|
572
|
+
this.onControlTouch = fn;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Sets disabled state
|
|
576
|
+
* @param isDisabled - Whether the component should be disabled
|
|
577
|
+
*/
|
|
578
|
+
setDisabledState(isDisabled) {
|
|
579
|
+
this.disabled.set(isDisabled);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Handles click event on the upload area
|
|
583
|
+
* @internal
|
|
584
|
+
*/
|
|
585
|
+
handleClick() {
|
|
586
|
+
if (!this.fileInput())
|
|
587
|
+
return;
|
|
588
|
+
this.fileInput()?.nativeElement.click();
|
|
589
|
+
this.handleBlur();
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Notifies form control of value changes
|
|
593
|
+
* @internal
|
|
594
|
+
*/
|
|
595
|
+
handleChange() {
|
|
596
|
+
this.onControlChange(this.value());
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Handles file selection from input
|
|
600
|
+
* @param event - File input change event
|
|
601
|
+
* @internal
|
|
602
|
+
*/
|
|
603
|
+
handleFileChange(event) {
|
|
604
|
+
const file = event.target.files?.[0];
|
|
605
|
+
if (file instanceof File) {
|
|
606
|
+
this.filename = file.name;
|
|
607
|
+
this.value.set(file);
|
|
608
|
+
this.fileUpdated.emit(file);
|
|
609
|
+
this.handleChange();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Clears selected file
|
|
614
|
+
* @internal
|
|
615
|
+
*/
|
|
616
|
+
removeFile() {
|
|
617
|
+
this.filename = '';
|
|
618
|
+
this.value.set(null);
|
|
619
|
+
this.handleChange();
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* @internal
|
|
623
|
+
* Returns base component classes
|
|
624
|
+
*/
|
|
625
|
+
componentClass() {
|
|
626
|
+
return {
|
|
627
|
+
variant: this.variant(),
|
|
628
|
+
size: this.size(),
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* @internal
|
|
633
|
+
* Returns error state classes
|
|
634
|
+
*/
|
|
635
|
+
errorClass() {
|
|
636
|
+
return {
|
|
637
|
+
variant: 'error',
|
|
638
|
+
size: this.size(),
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* @internal
|
|
643
|
+
* Returns success state classes
|
|
644
|
+
*/
|
|
645
|
+
successClass() {
|
|
646
|
+
return {
|
|
647
|
+
variant: 'success',
|
|
648
|
+
size: this.size(),
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Handles blur events and validation
|
|
653
|
+
* @internal
|
|
654
|
+
*/
|
|
655
|
+
handleBlur() {
|
|
656
|
+
this.blurred.emit(this.value());
|
|
657
|
+
this.onControlTouch();
|
|
658
|
+
this.blurTrigger.update((v) => v + 1);
|
|
659
|
+
}
|
|
660
|
+
// Form control integration
|
|
661
|
+
/** @internal */
|
|
662
|
+
formControl = computed(() => this.parentForm()?.get(this.formControlName()));
|
|
663
|
+
/** @internal */
|
|
664
|
+
formControl$ = toObservable(this.formControl);
|
|
665
|
+
/** @internal */
|
|
666
|
+
statusChanges$ = this.formControl$.pipe(switchMap((control) => control?.statusChanges.pipe(startWith(control.status)) || []));
|
|
667
|
+
/** @internal */
|
|
668
|
+
stateChanges$ = this.formControl$.pipe(switchMap((control) => control?.valueChanges.pipe(startWith(control.value)) || []));
|
|
669
|
+
/** @internal */
|
|
670
|
+
statusSignal = toSignal(this.statusChanges$);
|
|
671
|
+
/** @internal */
|
|
672
|
+
stateSignal = toSignal(this.stateChanges$);
|
|
673
|
+
/**
|
|
674
|
+
* Computes validation classes based on form state
|
|
675
|
+
* @internal
|
|
676
|
+
*/
|
|
677
|
+
validationClass = computed(() => {
|
|
678
|
+
const control = this.formControl();
|
|
679
|
+
const trigger = this.blurTrigger();
|
|
680
|
+
if (!control)
|
|
681
|
+
return this.componentClass();
|
|
682
|
+
const isTouched = control.touched || trigger > 0;
|
|
683
|
+
this.statusSignal();
|
|
684
|
+
this.stateSignal();
|
|
685
|
+
if (control.dirty || isTouched) {
|
|
686
|
+
if (control.invalid)
|
|
687
|
+
return this.errorClass();
|
|
688
|
+
if (control.valid)
|
|
689
|
+
return this.successClass();
|
|
690
|
+
}
|
|
691
|
+
return this.componentClass();
|
|
692
|
+
});
|
|
693
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: FileUploaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
694
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: FileUploaderComponent, isStandalone: true, selector: "st-file-uploader", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, showExtensions: { classPropertyName: "showExtensions", publicName: "showExtensions", isSignal: true, isRequired: false, transformFunction: null }, extensions: { classPropertyName: "extensions", publicName: "extensions", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileUpdated: "fileUpdated", blurred: "blurred", disabled: "disabledChange", value: "valueChange" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FileUploaderComponent), multi: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["uploader"], descendants: true, isSignal: true }], ngImport: i0, template: "<st-input\n\t[label]=\"label()\"\n\t[placeholder]=\"placeholder()\"\n\t[readonly]=\"true\"\n\t(click)=\"handleClick()\"\n\t[(value)]=\"filename\"\n\t[name]=\"name()\"\n\t[variant]=\"validationClass().variant\"\n\t[size]=\"validationClass().size\"\n\t(blur)=\"handleBlur()\"\n\t[disabled]=\"disabled()\"\n\t(valueChange)=\"handleChange()\"\n>\n\t<div class=\"flex justify-between\">\n\t\t<div>\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t\t@if (extensions().length > 0 && showExtensions()) {\n\t\t\t<div class=\"mt-1\">\n\t\t\t\t<span typography [tyVariant]=\"'body-xs'\" tyFontWeight=\"normal\">\n\t\t\t\t\t{{ 'sdk.fileUpload.fileUploader.allowedTypesLabel' | translate }} <span class=\"text-accent\">{{ formattedExtensions() }}</span>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t}\n\t</div>\n</st-input>\n\n<input type=\"file\" #uploader hidden (change)=\"handleFileChange($event)\" (blur)=\"handleBlur()\" [accept]=\"accept()\" required />\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "component", type: InputComponent, selector: "st-input", inputs: ["variant", "size", "label", "type", "name", "placeholder", "readonly", "focus", "justNumbers", "ghost", "value", "parentForm", "formControlName", "disabled", "debounceTime"], outputs: ["valueChange", "disabledChange", "enterPressed", "blurred", "valueDebounced"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
695
|
+
}
|
|
696
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: FileUploaderComponent, decorators: [{
|
|
697
|
+
type: Component,
|
|
698
|
+
args: [{ selector: 'st-file-uploader', imports: [FormsModule, InputComponent, TypographyDirective, TranslatePipe], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FileUploaderComponent), multi: true }], changeDetection: ChangeDetectionStrategy.Default, template: "<st-input\n\t[label]=\"label()\"\n\t[placeholder]=\"placeholder()\"\n\t[readonly]=\"true\"\n\t(click)=\"handleClick()\"\n\t[(value)]=\"filename\"\n\t[name]=\"name()\"\n\t[variant]=\"validationClass().variant\"\n\t[size]=\"validationClass().size\"\n\t(blur)=\"handleBlur()\"\n\t[disabled]=\"disabled()\"\n\t(valueChange)=\"handleChange()\"\n>\n\t<div class=\"flex justify-between\">\n\t\t<div>\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t\t@if (extensions().length > 0 && showExtensions()) {\n\t\t\t<div class=\"mt-1\">\n\t\t\t\t<span typography [tyVariant]=\"'body-xs'\" tyFontWeight=\"normal\">\n\t\t\t\t\t{{ 'sdk.fileUpload.fileUploader.allowedTypesLabel' | translate }} <span class=\"text-accent\">{{ formattedExtensions() }}</span>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t}\n\t</div>\n</st-input>\n\n<input type=\"file\" #uploader hidden (change)=\"handleFileChange($event)\" (blur)=\"handleBlur()\" [accept]=\"accept()\" required />\n" }]
|
|
699
|
+
}] });
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Generated bundle index. Do not edit.
|
|
703
|
+
*/
|
|
704
|
+
|
|
705
|
+
export { ARCHIVE_EXTENSIONS, AUDIO_EXTENSIONS, CODE_EXTENSIONS, DOCUMENT_EXTENSIONS, DropzoneComponent, FileUploaderComponent, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS };
|
|
706
|
+
//# sourceMappingURL=sixbell-telco-sdk-components-file-upload.mjs.map
|