@forgeroute/ui 0.5.15 → 0.5.17
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/fesm2022/forgeroute-ui-action-bar.mjs +190 -0
- package/fesm2022/forgeroute-ui-action-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-address-input.mjs +1164 -0
- package/fesm2022/forgeroute-ui-address-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-alert.mjs +223 -0
- package/fesm2022/forgeroute-ui-alert.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-avatar.mjs +320 -0
- package/fesm2022/forgeroute-ui-avatar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-badge.mjs +158 -0
- package/fesm2022/forgeroute-ui-badge.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-bar-row.mjs +255 -0
- package/fesm2022/forgeroute-ui-bar-row.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-boards.mjs +2201 -0
- package/fesm2022/forgeroute-ui-boards.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-bulk-eligible.mjs +172 -0
- package/fesm2022/forgeroute-ui-bulk-eligible.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-business-hours.mjs +771 -0
- package/fesm2022/forgeroute-ui-business-hours.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-calendar.mjs +2006 -0
- package/fesm2022/forgeroute-ui-calendar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-card-list-item.mjs +556 -0
- package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-charts.mjs +1 -1
- package/fesm2022/forgeroute-ui-charts.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-checkbox.mjs +815 -0
- package/fesm2022/forgeroute-ui-checkbox.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-chip.mjs +379 -0
- package/fesm2022/forgeroute-ui-chip.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-color-input.mjs +492 -0
- package/fesm2022/forgeroute-ui-color-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-column-filter.mjs +645 -0
- package/fesm2022/forgeroute-ui-column-filter.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-columns.mjs +351 -0
- package/fesm2022/forgeroute-ui-columns.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-combobox.mjs +772 -0
- package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-confirm.mjs +48 -0
- package/fesm2022/forgeroute-ui-confirm.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-contact-picker.mjs +865 -0
- package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-conversations.mjs +3627 -0
- package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-copy-field.mjs +378 -0
- package/fesm2022/forgeroute-ui-copy-field.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-data-table-core.mjs +6150 -0
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-date-input.mjs +384 -0
- package/fesm2022/forgeroute-ui-date-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-date-range-picker.mjs +453 -0
- package/fesm2022/forgeroute-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-datetime-input.mjs +375 -0
- package/fesm2022/forgeroute-ui-datetime-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-detail-card.mjs +655 -0
- package/fesm2022/forgeroute-ui-detail-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-discount-selector.mjs +259 -0
- package/fesm2022/forgeroute-ui-discount-selector.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-divider.mjs +111 -0
- package/fesm2022/forgeroute-ui-divider.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-dropdown.mjs +550 -0
- package/fesm2022/forgeroute-ui-dropdown.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-editor.mjs +4545 -0
- package/fesm2022/forgeroute-ui-editor.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-empty-state.mjs +231 -0
- package/fesm2022/forgeroute-ui-empty-state.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-error-state.mjs +195 -0
- package/fesm2022/forgeroute-ui-error-state.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-error.mjs +93 -0
- package/fesm2022/forgeroute-ui-error.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-fade.mjs +117 -0
- package/fesm2022/forgeroute-ui-fade.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-file-input.mjs +999 -0
- package/fesm2022/forgeroute-ui-file-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-fixed-footer.mjs +115 -0
- package/fesm2022/forgeroute-ui-fixed-footer.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form-row.mjs +126 -0
- package/fesm2022/forgeroute-ui-form-row.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form-section.mjs +93 -0
- package/fesm2022/forgeroute-ui-form-section.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form.mjs +139 -0
- package/fesm2022/forgeroute-ui-form.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-hint.mjs +47 -0
- package/fesm2022/forgeroute-ui-hint.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-icon-picker.mjs +424 -0
- package/fesm2022/forgeroute-ui-icon-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-icon.mjs +311 -0
- package/fesm2022/forgeroute-ui-icon.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-image-preview.mjs +237 -0
- package/fesm2022/forgeroute-ui-image-preview.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-keypad.mjs +278 -0
- package/fesm2022/forgeroute-ui-keypad.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-kpi-card.mjs +490 -0
- package/fesm2022/forgeroute-ui-kpi-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-language-switcher.mjs +134 -0
- package/fesm2022/forgeroute-ui-language-switcher.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-layout.mjs +18 -0
- package/fesm2022/forgeroute-ui-layout.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-list-item.mjs +620 -0
- package/fesm2022/forgeroute-ui-list-item.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-list.mjs +866 -0
- package/fesm2022/forgeroute-ui-list.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-live-region.mjs +118 -0
- package/fesm2022/forgeroute-ui-live-region.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-map.mjs +5 -1
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-maps.mjs +2 -1
- package/fesm2022/forgeroute-ui-maps.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-media.mjs +4615 -0
- package/fesm2022/forgeroute-ui-media.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-messaging.mjs +20 -1
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-more-menu.mjs +418 -0
- package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-multi-select.mjs +532 -0
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-notes.mjs +768 -0
- package/fesm2022/forgeroute-ui-notes.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-notification-bell.mjs +587 -0
- package/fesm2022/forgeroute-ui-notification-bell.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-offline-banner.mjs +156 -0
- package/fesm2022/forgeroute-ui-offline-banner.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-option-card.mjs +379 -0
- package/fesm2022/forgeroute-ui-option-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-page.mjs +317 -0
- package/fesm2022/forgeroute-ui-page.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pagination.mjs +225 -0
- package/fesm2022/forgeroute-ui-pagination.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-panel-info-list.mjs +422 -0
- package/fesm2022/forgeroute-ui-panel-info-list.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-password-requirements.mjs +237 -0
- package/fesm2022/forgeroute-ui-password-requirements.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-payments.mjs +6243 -0
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pdf.mjs +9 -1
- package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-phone-number-picker.mjs +840 -0
- package/fesm2022/forgeroute-ui-phone-number-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pill-tabs.mjs +546 -0
- package/fesm2022/forgeroute-ui-pill-tabs.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-print.mjs +76 -0
- package/fesm2022/forgeroute-ui-print.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-progress-bar.mjs +252 -0
- package/fesm2022/forgeroute-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-progress-ring.mjs +277 -0
- package/fesm2022/forgeroute-ui-progress-ring.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs +301 -0
- package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-quickbooks.mjs +20 -3
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-radio-matrix.mjs +471 -0
- package/fesm2022/forgeroute-ui-radio-matrix.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-radio.mjs +911 -0
- package/fesm2022/forgeroute-ui-radio.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-read-only-mode.mjs +15 -0
- package/fesm2022/forgeroute-ui-read-only-mode.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-readonly-fieldset.mjs +146 -0
- package/fesm2022/forgeroute-ui-readonly-fieldset.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs +249 -0
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-search-input.mjs +373 -0
- package/fesm2022/forgeroute-ui-search-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-section-header.mjs +296 -0
- package/fesm2022/forgeroute-ui-section-header.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-select.mjs +498 -0
- package/fesm2022/forgeroute-ui-select.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-setup.mjs +4649 -0
- package/fesm2022/forgeroute-ui-setup.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-share-menu.mjs +461 -0
- package/fesm2022/forgeroute-ui-share-menu.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-shell.mjs +981 -0
- package/fesm2022/forgeroute-ui-shell.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-show.mjs +129 -0
- package/fesm2022/forgeroute-ui-show.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-sidebar-layout.mjs +355 -0
- package/fesm2022/forgeroute-ui-sidebar-layout.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-skeleton.mjs +152 -0
- package/fesm2022/forgeroute-ui-skeleton.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-skip-link.mjs +129 -0
- package/fesm2022/forgeroute-ui-skip-link.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-snackbar.mjs +200 -0
- package/fesm2022/forgeroute-ui-snackbar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-square.mjs +17 -3
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stack.mjs +233 -0
- package/fesm2022/forgeroute-ui-stack.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stacked-bar.mjs +200 -0
- package/fesm2022/forgeroute-ui-stacked-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stacking-plan.mjs +365 -0
- package/fesm2022/forgeroute-ui-stacking-plan.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-star-rating.mjs +498 -0
- package/fesm2022/forgeroute-ui-star-rating.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-star.mjs +184 -0
- package/fesm2022/forgeroute-ui-star.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stepper.mjs +615 -0
- package/fesm2022/forgeroute-ui-stepper.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stripe.mjs +16 -3
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-swatch-picker.mjs +416 -0
- package/fesm2022/forgeroute-ui-swatch-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-table-toolbar.mjs +770 -0
- package/fesm2022/forgeroute-ui-table-toolbar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-table-types.mjs +277 -0
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text-input.mjs +1003 -0
- package/fesm2022/forgeroute-ui-text-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text-template-picker.mjs +356 -0
- package/fesm2022/forgeroute-ui-text-template-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text.mjs +195 -0
- package/fesm2022/forgeroute-ui-text.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-textarea-input.mjs +542 -0
- package/fesm2022/forgeroute-ui-textarea-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-time-input.mjs +401 -0
- package/fesm2022/forgeroute-ui-time-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-timeline.mjs +549 -0
- package/fesm2022/forgeroute-ui-timeline.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toast.mjs +507 -0
- package/fesm2022/forgeroute-ui-toast.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toggle-badge.mjs +177 -0
- package/fesm2022/forgeroute-ui-toggle-badge.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toggle.mjs +275 -0
- package/fesm2022/forgeroute-ui-toggle.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-tooltip.mjs +155 -0
- package/fesm2022/forgeroute-ui-tooltip.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-utils.mjs +1071 -0
- package/fesm2022/forgeroute-ui-utils.mjs.map +1 -0
- package/fesm2022/forgeroute-ui.mjs +105 -70663
- package/package.json +417 -1
- package/types/forgeroute-ui-action-bar.d.ts +74 -0
- package/types/forgeroute-ui-address-input.d.ts +354 -0
- package/types/forgeroute-ui-alert.d.ts +89 -0
- package/types/forgeroute-ui-avatar.d.ts +85 -0
- package/types/forgeroute-ui-badge.d.ts +45 -0
- package/types/forgeroute-ui-bar-row.d.ts +90 -0
- package/types/forgeroute-ui-boards.d.ts +575 -0
- package/types/forgeroute-ui-bulk-eligible.d.ts +53 -0
- package/types/forgeroute-ui-business-hours.d.ts +191 -0
- package/types/forgeroute-ui-calendar.d.ts +544 -0
- package/types/forgeroute-ui-card-list-item.d.ts +186 -0
- package/types/forgeroute-ui-charts.d.ts +1 -1
- package/types/forgeroute-ui-checkbox.d.ts +270 -0
- package/types/forgeroute-ui-chip.d.ts +125 -0
- package/types/forgeroute-ui-color-input.d.ts +160 -0
- package/types/forgeroute-ui-column-filter.d.ts +130 -0
- package/types/forgeroute-ui-columns.d.ts +150 -0
- package/types/forgeroute-ui-combobox.d.ts +252 -0
- package/types/forgeroute-ui-confirm.d.ts +34 -0
- package/types/forgeroute-ui-contact-picker.d.ts +173 -0
- package/types/forgeroute-ui-conversations.d.ts +993 -0
- package/types/forgeroute-ui-copy-field.d.ts +122 -0
- package/types/forgeroute-ui-data-table-core.d.ts +1221 -0
- package/types/forgeroute-ui-date-input.d.ts +101 -0
- package/types/forgeroute-ui-date-range-picker.d.ts +109 -0
- package/types/forgeroute-ui-datetime-input.d.ts +97 -0
- package/types/forgeroute-ui-detail-card.d.ts +252 -0
- package/types/forgeroute-ui-discount-selector.d.ts +57 -0
- package/types/forgeroute-ui-divider.d.ts +40 -0
- package/types/forgeroute-ui-dropdown.d.ts +156 -0
- package/types/forgeroute-ui-editor.d.ts +873 -0
- package/types/forgeroute-ui-empty-state.d.ts +29 -0
- package/types/forgeroute-ui-error-state.d.ts +38 -0
- package/types/forgeroute-ui-error.d.ts +29 -0
- package/types/forgeroute-ui-fade.d.ts +39 -0
- package/types/forgeroute-ui-file-input.d.ts +337 -0
- package/types/forgeroute-ui-fixed-footer.d.ts +53 -0
- package/types/forgeroute-ui-form-row.d.ts +30 -0
- package/types/forgeroute-ui-form-section.d.ts +18 -0
- package/types/forgeroute-ui-form.d.ts +68 -0
- package/types/forgeroute-ui-hint.d.ts +10 -0
- package/types/forgeroute-ui-icon-picker.d.ts +122 -0
- package/types/forgeroute-ui-icon.d.ts +95 -0
- package/types/forgeroute-ui-image-preview.d.ts +88 -0
- package/types/forgeroute-ui-keypad.d.ts +73 -0
- package/types/forgeroute-ui-kpi-card.d.ts +161 -0
- package/types/forgeroute-ui-language-switcher.d.ts +41 -0
- package/types/forgeroute-ui-layout.d.ts +13 -0
- package/types/forgeroute-ui-list-item.d.ts +253 -0
- package/types/forgeroute-ui-list.d.ts +282 -0
- package/types/forgeroute-ui-live-region.d.ts +49 -0
- package/types/forgeroute-ui-map.d.ts +1 -1
- package/types/forgeroute-ui-maps.d.ts +1 -1
- package/types/forgeroute-ui-media.d.ts +1221 -0
- package/types/forgeroute-ui-messaging.d.ts +11 -6
- package/types/forgeroute-ui-more-menu.d.ts +91 -0
- package/types/forgeroute-ui-multi-select.d.ts +119 -0
- package/types/forgeroute-ui-notes.d.ts +172 -0
- package/types/forgeroute-ui-notification-bell.d.ts +135 -0
- package/types/forgeroute-ui-offline-banner.d.ts +44 -0
- package/types/forgeroute-ui-option-card.d.ts +106 -0
- package/types/forgeroute-ui-page.d.ts +115 -0
- package/types/forgeroute-ui-pagination.d.ts +55 -0
- package/types/forgeroute-ui-panel-info-list.d.ts +147 -0
- package/types/forgeroute-ui-password-requirements.d.ts +89 -0
- package/types/forgeroute-ui-payments.d.ts +1818 -0
- package/types/forgeroute-ui-pdf.d.ts +1 -1
- package/types/forgeroute-ui-phone-number-picker.d.ts +199 -0
- package/types/forgeroute-ui-pill-tabs.d.ts +208 -0
- package/types/forgeroute-ui-print.d.ts +40 -0
- package/types/forgeroute-ui-progress-bar.d.ts +88 -0
- package/types/forgeroute-ui-progress-ring.d.ts +102 -0
- package/types/forgeroute-ui-quick-filter-tabs.d.ts +51 -0
- package/types/forgeroute-ui-quickbooks.d.ts +6 -3
- package/types/forgeroute-ui-radio-matrix.d.ts +131 -0
- package/types/forgeroute-ui-radio.d.ts +311 -0
- package/types/forgeroute-ui-read-only-mode.d.ts +26 -0
- package/types/forgeroute-ui-readonly-fieldset.d.ts +62 -0
- package/types/forgeroute-ui-reminder-alerts.d.ts +71 -0
- package/types/forgeroute-ui-search-input.d.ts +93 -0
- package/types/forgeroute-ui-section-header.d.ts +149 -0
- package/types/forgeroute-ui-select.d.ts +183 -0
- package/types/forgeroute-ui-setup.d.ts +775 -0
- package/types/forgeroute-ui-share-menu.d.ts +99 -0
- package/types/forgeroute-ui-shell.d.ts +173 -0
- package/types/forgeroute-ui-show.d.ts +40 -0
- package/types/forgeroute-ui-sidebar-layout.d.ts +161 -0
- package/types/forgeroute-ui-skeleton.d.ts +51 -0
- package/types/forgeroute-ui-skip-link.d.ts +51 -0
- package/types/forgeroute-ui-snackbar.d.ts +50 -0
- package/types/forgeroute-ui-square.d.ts +5 -3
- package/types/forgeroute-ui-stack.d.ts +99 -0
- package/types/forgeroute-ui-stacked-bar.d.ts +84 -0
- package/types/forgeroute-ui-stacking-plan.d.ts +116 -0
- package/types/forgeroute-ui-star-rating.d.ts +151 -0
- package/types/forgeroute-ui-star.d.ts +46 -0
- package/types/forgeroute-ui-stepper.d.ts +273 -0
- package/types/forgeroute-ui-stripe.d.ts +4 -2
- package/types/forgeroute-ui-swatch-picker.d.ts +118 -0
- package/types/forgeroute-ui-table-toolbar.d.ts +116 -0
- package/types/forgeroute-ui-table-types.d.ts +624 -0
- package/types/forgeroute-ui-text-input.d.ts +359 -0
- package/types/forgeroute-ui-text-template-picker.d.ts +100 -0
- package/types/forgeroute-ui-text.d.ts +76 -0
- package/types/forgeroute-ui-textarea-input.d.ts +174 -0
- package/types/forgeroute-ui-time-input.d.ts +105 -0
- package/types/forgeroute-ui-timeline.d.ts +196 -0
- package/types/forgeroute-ui-toast.d.ts +131 -0
- package/types/forgeroute-ui-toggle-badge.d.ts +64 -0
- package/types/forgeroute-ui-toggle.d.ts +92 -0
- package/types/forgeroute-ui-tooltip.d.ts +36 -0
- package/types/forgeroute-ui-utils.d.ts +210 -0
- package/types/forgeroute-ui.d.ts +106 -19539
- package/fesm2022/forgeroute-ui.mjs.map +0 -1
|
@@ -0,0 +1,4615 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, HostListener, Injector, afterNextRender, computed, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { ButtonComponent, ModalComponent, UiLabelsService, createFieldReveal } from "@forgeroute/ui/core";
|
|
4
|
+
import { FileInputComponent } from "@forgeroute/ui/file-input";
|
|
5
|
+
import { ImagePreviewComponent } from "@forgeroute/ui/image-preview";
|
|
6
|
+
import { LiveRegionComponent } from "@forgeroute/ui/live-region";
|
|
7
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
8
|
+
var AudioPlayerComponent = class AudioPlayerComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.labels = inject(UiLabelsService);
|
|
11
|
+
this.src = input("", ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
12
|
+
this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.preload = input("metadata", ...ngDevMode ? [{ debugName: "preload" }] : /* istanbul ignore next */ []);
|
|
14
|
+
this.playbackError = output();
|
|
15
|
+
this.failed = signal(false, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
|
|
16
|
+
effect(() => {
|
|
17
|
+
this.src();
|
|
18
|
+
this.failed.set(false);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
onError() {
|
|
22
|
+
if (!this.src()) return;
|
|
23
|
+
this.failed.set(true);
|
|
24
|
+
this.playbackError.emit();
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
28
|
+
minVersion: "12.0.0",
|
|
29
|
+
version: "22.2.2",
|
|
30
|
+
ngImport: i0,
|
|
31
|
+
type: AudioPlayerComponent,
|
|
32
|
+
deps: [],
|
|
33
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static {
|
|
37
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
38
|
+
minVersion: "17.0.0",
|
|
39
|
+
version: "22.2.2",
|
|
40
|
+
type: AudioPlayerComponent,
|
|
41
|
+
isStandalone: true,
|
|
42
|
+
selector: "ui-audio-player",
|
|
43
|
+
inputs: {
|
|
44
|
+
src: {
|
|
45
|
+
classPropertyName: "src",
|
|
46
|
+
publicName: "src",
|
|
47
|
+
isSignal: true,
|
|
48
|
+
isRequired: false,
|
|
49
|
+
transformFunction: null
|
|
50
|
+
},
|
|
51
|
+
ariaLabel: {
|
|
52
|
+
classPropertyName: "ariaLabel",
|
|
53
|
+
publicName: "ariaLabel",
|
|
54
|
+
isSignal: true,
|
|
55
|
+
isRequired: false,
|
|
56
|
+
transformFunction: null
|
|
57
|
+
},
|
|
58
|
+
preload: {
|
|
59
|
+
classPropertyName: "preload",
|
|
60
|
+
publicName: "preload",
|
|
61
|
+
isSignal: true,
|
|
62
|
+
isRequired: false,
|
|
63
|
+
transformFunction: null
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
outputs: { playbackError: "playbackError" },
|
|
67
|
+
ngImport: i0,
|
|
68
|
+
template: `
|
|
69
|
+
@if (failed()) {
|
|
70
|
+
<p class="ap-error" role="alert">{{ labels.t('audioPlayer.audioCouldNotBePlayed') }}</p>
|
|
71
|
+
} @else {
|
|
72
|
+
<audio class="ap-audio" controls [attr.preload]="preload()" [attr.src]="src() || null" [attr.aria-label]="ariaLabel() || null"
|
|
73
|
+
(error)="onError()">{{ labels.t('audioPlayer.yourBrowserDoesNotSupport') }}</audio>
|
|
74
|
+
}
|
|
75
|
+
`,
|
|
76
|
+
isInline: true,
|
|
77
|
+
styles: [":host{display:block}.ap-audio{display:block;width:100%;height:40px;border-radius:8px;outline:none;accent-color:#3b82f6}.ap-audio:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ap-error{margin:0;font-size:.8125rem;line-height:1.4;color:#dc2626}\n"],
|
|
78
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
83
|
+
minVersion: "12.0.0",
|
|
84
|
+
version: "22.2.2",
|
|
85
|
+
ngImport: i0,
|
|
86
|
+
type: AudioPlayerComponent,
|
|
87
|
+
decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{
|
|
90
|
+
selector: "ui-audio-player",
|
|
91
|
+
standalone: true,
|
|
92
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
93
|
+
template: `
|
|
94
|
+
@if (failed()) {
|
|
95
|
+
<p class="ap-error" role="alert">{{ labels.t('audioPlayer.audioCouldNotBePlayed') }}</p>
|
|
96
|
+
} @else {
|
|
97
|
+
<audio class="ap-audio" controls [attr.preload]="preload()" [attr.src]="src() || null" [attr.aria-label]="ariaLabel() || null"
|
|
98
|
+
(error)="onError()">{{ labels.t('audioPlayer.yourBrowserDoesNotSupport') }}</audio>
|
|
99
|
+
}
|
|
100
|
+
`,
|
|
101
|
+
styles: [":host{display:block}.ap-audio{display:block;width:100%;height:40px;border-radius:8px;outline:none;accent-color:#3b82f6}.ap-audio:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ap-error{margin:0;font-size:.8125rem;line-height:1.4;color:#dc2626}\n"]
|
|
102
|
+
}]
|
|
103
|
+
}],
|
|
104
|
+
ctorParameters: () => [],
|
|
105
|
+
propDecorators: {
|
|
106
|
+
src: [{
|
|
107
|
+
type: i0.Input,
|
|
108
|
+
args: [{
|
|
109
|
+
isSignal: true,
|
|
110
|
+
alias: "src",
|
|
111
|
+
required: false
|
|
112
|
+
}]
|
|
113
|
+
}],
|
|
114
|
+
ariaLabel: [{
|
|
115
|
+
type: i0.Input,
|
|
116
|
+
args: [{
|
|
117
|
+
isSignal: true,
|
|
118
|
+
alias: "ariaLabel",
|
|
119
|
+
required: false
|
|
120
|
+
}]
|
|
121
|
+
}],
|
|
122
|
+
preload: [{
|
|
123
|
+
type: i0.Input,
|
|
124
|
+
args: [{
|
|
125
|
+
isSignal: true,
|
|
126
|
+
alias: "preload",
|
|
127
|
+
required: false
|
|
128
|
+
}]
|
|
129
|
+
}],
|
|
130
|
+
playbackError: [{
|
|
131
|
+
type: i0.Output,
|
|
132
|
+
args: ["playbackError"]
|
|
133
|
+
}]
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const CENTERED_FOCAL_POINT = 50;
|
|
137
|
+
function clampFocalPoint(value) {
|
|
138
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 50;
|
|
139
|
+
return Math.min(100, Math.max(0, Math.round(value)));
|
|
140
|
+
}
|
|
141
|
+
function imageObjectPosition(point) {
|
|
142
|
+
return [clampFocalPoint(point?.x), clampFocalPoint(point?.y)].map((n) => n + "%").join(" ");
|
|
143
|
+
}
|
|
144
|
+
function frameAspectRatio(value) {
|
|
145
|
+
const m = /^\s*(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)\s*$/.exec(value ?? "");
|
|
146
|
+
if (!m || Number(m[1]) <= 0 || Number(m[2]) <= 0) return "1 / 1";
|
|
147
|
+
return `${m[1]} / ${m[2]}`;
|
|
148
|
+
}
|
|
149
|
+
const MIN_FRAME_WIDTH = 64;
|
|
150
|
+
const MAX_FRAME_WIDTH = 1200;
|
|
151
|
+
const DEFAULT_FRAME_WIDTH = 160;
|
|
152
|
+
function frameWidth(value) {
|
|
153
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_FRAME_WIDTH;
|
|
154
|
+
return Math.min(MAX_FRAME_WIDTH, Math.max(MIN_FRAME_WIDTH, Math.round(value)));
|
|
155
|
+
}
|
|
156
|
+
const KEY_STEP = 2;
|
|
157
|
+
const KEY_STEP_BIG = 10;
|
|
158
|
+
const clamp = clampFocalPoint;
|
|
159
|
+
var ImageRepositionComponent = class ImageRepositionComponent {
|
|
160
|
+
constructor() {
|
|
161
|
+
this.labels = inject(UiLabelsService);
|
|
162
|
+
this.hintId = `ui-image-reposition-hint-${ImageRepositionComponent.nextId++}`;
|
|
163
|
+
this.host = inject(ElementRef).nativeElement;
|
|
164
|
+
this.src = input(null, ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
165
|
+
this.alt = input("", ...ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []);
|
|
166
|
+
this.shape = input("circle", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
167
|
+
this.aspectRatio = input("1 / 1", ...ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []);
|
|
168
|
+
this.width = input(160, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
169
|
+
this.labelInput = input(null, {
|
|
170
|
+
...ngDevMode ? { debugName: "labelInput" } : /* istanbul ignore next */ {},
|
|
171
|
+
alias: "label"
|
|
172
|
+
});
|
|
173
|
+
this.label = computed(() => this.labelInput() ?? this.labels.t("imageReposition.label"), ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
174
|
+
this.x = model(50, ...ngDevMode ? [{ debugName: "x" }] : /* istanbul ignore next */ []);
|
|
175
|
+
this.y = model(50, ...ngDevMode ? [{ debugName: "y" }] : /* istanbul ignore next */ []);
|
|
176
|
+
this.frameRatio = computed(() => this.shape() === "circle" ? "1 / 1" : frameAspectRatio(this.aspectRatio()), ...ngDevMode ? [{ debugName: "frameRatio" }] : /* istanbul ignore next */ []);
|
|
177
|
+
this.frameWidthPx = computed(() => frameWidth(this.width()), ...ngDevMode ? [{ debugName: "frameWidthPx" }] : /* istanbul ignore next */ []);
|
|
178
|
+
this.dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []);
|
|
179
|
+
this.natural = null;
|
|
180
|
+
this.start = null;
|
|
181
|
+
}
|
|
182
|
+
static {
|
|
183
|
+
this.nextId = 0;
|
|
184
|
+
}
|
|
185
|
+
onLoad(e) {
|
|
186
|
+
const img = e.target;
|
|
187
|
+
this.natural = {
|
|
188
|
+
w: img.naturalWidth,
|
|
189
|
+
h: img.naturalHeight
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
overflow(frame) {
|
|
193
|
+
if (!this.natural || !this.natural.w || !this.natural.h) return {
|
|
194
|
+
x: 0,
|
|
195
|
+
y: 0
|
|
196
|
+
};
|
|
197
|
+
const scale = Math.max(frame.width / this.natural.w, frame.height / this.natural.h);
|
|
198
|
+
return {
|
|
199
|
+
x: Math.max(0, this.natural.w * scale - frame.width),
|
|
200
|
+
y: Math.max(0, this.natural.h * scale - frame.height)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
onPointerDown(e) {
|
|
204
|
+
if (!this.src() || e.pointerType === "mouse" && e.button !== 0) return;
|
|
205
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
206
|
+
this.start = {
|
|
207
|
+
px: e.clientX,
|
|
208
|
+
py: e.clientY,
|
|
209
|
+
x: this.x(),
|
|
210
|
+
y: this.y()
|
|
211
|
+
};
|
|
212
|
+
this.dragging.set(true);
|
|
213
|
+
}
|
|
214
|
+
onPointerMove(e) {
|
|
215
|
+
if (!this.start) return;
|
|
216
|
+
const frame = e.currentTarget.getBoundingClientRect();
|
|
217
|
+
const o = this.overflow(frame);
|
|
218
|
+
if (o.x > 0) this.x.set(clamp(this.start.x - (e.clientX - this.start.px) / o.x * 100));
|
|
219
|
+
if (o.y > 0) this.y.set(clamp(this.start.y - (e.clientY - this.start.py) / o.y * 100));
|
|
220
|
+
}
|
|
221
|
+
endDrag(e) {
|
|
222
|
+
if (!this.start) return;
|
|
223
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
224
|
+
this.start = null;
|
|
225
|
+
this.dragging.set(false);
|
|
226
|
+
}
|
|
227
|
+
onKeydown(e) {
|
|
228
|
+
if (!this.src()) return;
|
|
229
|
+
const step = e.shiftKey ? KEY_STEP_BIG : KEY_STEP;
|
|
230
|
+
const frame = this.host.querySelector(".ir-frame").getBoundingClientRect();
|
|
231
|
+
const o = this.overflow(frame);
|
|
232
|
+
let handled = true;
|
|
233
|
+
if (e.key === "ArrowLeft" && o.x > 0) this.x.set(clamp(this.x() + step));
|
|
234
|
+
else if (e.key === "ArrowRight" && o.x > 0) this.x.set(clamp(this.x() - step));
|
|
235
|
+
else if (e.key === "ArrowUp" && o.y > 0) this.y.set(clamp(this.y() + step));
|
|
236
|
+
else if (e.key === "ArrowDown" && o.y > 0) this.y.set(clamp(this.y() - step));
|
|
237
|
+
else handled = e.key.startsWith("Arrow");
|
|
238
|
+
if (handled) e.preventDefault();
|
|
239
|
+
}
|
|
240
|
+
static {
|
|
241
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
242
|
+
minVersion: "12.0.0",
|
|
243
|
+
version: "22.2.2",
|
|
244
|
+
ngImport: i0,
|
|
245
|
+
type: ImageRepositionComponent,
|
|
246
|
+
deps: [],
|
|
247
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
static {
|
|
251
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
252
|
+
minVersion: "17.0.0",
|
|
253
|
+
version: "22.2.2",
|
|
254
|
+
type: ImageRepositionComponent,
|
|
255
|
+
isStandalone: true,
|
|
256
|
+
selector: "ui-image-reposition",
|
|
257
|
+
inputs: {
|
|
258
|
+
src: {
|
|
259
|
+
classPropertyName: "src",
|
|
260
|
+
publicName: "src",
|
|
261
|
+
isSignal: true,
|
|
262
|
+
isRequired: false,
|
|
263
|
+
transformFunction: null
|
|
264
|
+
},
|
|
265
|
+
alt: {
|
|
266
|
+
classPropertyName: "alt",
|
|
267
|
+
publicName: "alt",
|
|
268
|
+
isSignal: true,
|
|
269
|
+
isRequired: false,
|
|
270
|
+
transformFunction: null
|
|
271
|
+
},
|
|
272
|
+
shape: {
|
|
273
|
+
classPropertyName: "shape",
|
|
274
|
+
publicName: "shape",
|
|
275
|
+
isSignal: true,
|
|
276
|
+
isRequired: false,
|
|
277
|
+
transformFunction: null
|
|
278
|
+
},
|
|
279
|
+
aspectRatio: {
|
|
280
|
+
classPropertyName: "aspectRatio",
|
|
281
|
+
publicName: "aspectRatio",
|
|
282
|
+
isSignal: true,
|
|
283
|
+
isRequired: false,
|
|
284
|
+
transformFunction: null
|
|
285
|
+
},
|
|
286
|
+
width: {
|
|
287
|
+
classPropertyName: "width",
|
|
288
|
+
publicName: "width",
|
|
289
|
+
isSignal: true,
|
|
290
|
+
isRequired: false,
|
|
291
|
+
transformFunction: null
|
|
292
|
+
},
|
|
293
|
+
labelInput: {
|
|
294
|
+
classPropertyName: "labelInput",
|
|
295
|
+
publicName: "label",
|
|
296
|
+
isSignal: true,
|
|
297
|
+
isRequired: false,
|
|
298
|
+
transformFunction: null
|
|
299
|
+
},
|
|
300
|
+
x: {
|
|
301
|
+
classPropertyName: "x",
|
|
302
|
+
publicName: "x",
|
|
303
|
+
isSignal: true,
|
|
304
|
+
isRequired: false,
|
|
305
|
+
transformFunction: null
|
|
306
|
+
},
|
|
307
|
+
y: {
|
|
308
|
+
classPropertyName: "y",
|
|
309
|
+
publicName: "y",
|
|
310
|
+
isSignal: true,
|
|
311
|
+
isRequired: false,
|
|
312
|
+
transformFunction: null
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
outputs: {
|
|
316
|
+
x: "xChange",
|
|
317
|
+
y: "yChange"
|
|
318
|
+
},
|
|
319
|
+
ngImport: i0,
|
|
320
|
+
template: `
|
|
321
|
+
<div class="ir-frame" [class.ir-circle]="shape() === 'circle'" [class.ir-dragging]="dragging()"
|
|
322
|
+
[style.width.px]="frameWidthPx()" [style.aspect-ratio]="frameRatio()"
|
|
323
|
+
role="group" tabindex="0" data-testid="image-reposition-frame"
|
|
324
|
+
[attr.aria-label]="label()" [attr.aria-describedby]="hintId"
|
|
325
|
+
(pointerdown)="onPointerDown($event)" (pointermove)="onPointerMove($event)"
|
|
326
|
+
(pointerup)="endDrag($event)" (pointercancel)="endDrag($event)" (keydown)="onKeydown($event)">
|
|
327
|
+
@if (src()) {
|
|
328
|
+
<img class="ir-img" [src]="src()" [attr.alt]="alt()" draggable="false"
|
|
329
|
+
[style.object-position]="x() + '% ' + y() + '%'" (load)="onLoad($event)" />
|
|
330
|
+
}
|
|
331
|
+
</div>
|
|
332
|
+
<span class="ir-hint" [id]="hintId">{{ labels.t('imageReposition.dragThePhotoOrUse') }}</span>
|
|
333
|
+
`,
|
|
334
|
+
isInline: true,
|
|
335
|
+
styles: [":host{display:inline-flex;flex-direction:column;gap:6px;max-width:100%}.ir-frame{max-width:100%;border-radius:12px;overflow:hidden;border:1px solid #e2e8f0;background:#f1f5f9;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;box-sizing:border-box;flex-shrink:0}.ir-frame:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ir-circle{border-radius:50%}.ir-dragging{cursor:grabbing}.ir-img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}.ir-hint{font-size:.75rem;color:#64748b}\n"],
|
|
336
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
341
|
+
minVersion: "12.0.0",
|
|
342
|
+
version: "22.2.2",
|
|
343
|
+
ngImport: i0,
|
|
344
|
+
type: ImageRepositionComponent,
|
|
345
|
+
decorators: [{
|
|
346
|
+
type: Component,
|
|
347
|
+
args: [{
|
|
348
|
+
selector: "ui-image-reposition",
|
|
349
|
+
standalone: true,
|
|
350
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
351
|
+
template: `
|
|
352
|
+
<div class="ir-frame" [class.ir-circle]="shape() === 'circle'" [class.ir-dragging]="dragging()"
|
|
353
|
+
[style.width.px]="frameWidthPx()" [style.aspect-ratio]="frameRatio()"
|
|
354
|
+
role="group" tabindex="0" data-testid="image-reposition-frame"
|
|
355
|
+
[attr.aria-label]="label()" [attr.aria-describedby]="hintId"
|
|
356
|
+
(pointerdown)="onPointerDown($event)" (pointermove)="onPointerMove($event)"
|
|
357
|
+
(pointerup)="endDrag($event)" (pointercancel)="endDrag($event)" (keydown)="onKeydown($event)">
|
|
358
|
+
@if (src()) {
|
|
359
|
+
<img class="ir-img" [src]="src()" [attr.alt]="alt()" draggable="false"
|
|
360
|
+
[style.object-position]="x() + '% ' + y() + '%'" (load)="onLoad($event)" />
|
|
361
|
+
}
|
|
362
|
+
</div>
|
|
363
|
+
<span class="ir-hint" [id]="hintId">{{ labels.t('imageReposition.dragThePhotoOrUse') }}</span>
|
|
364
|
+
`,
|
|
365
|
+
styles: [":host{display:inline-flex;flex-direction:column;gap:6px;max-width:100%}.ir-frame{max-width:100%;border-radius:12px;overflow:hidden;border:1px solid #e2e8f0;background:#f1f5f9;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;box-sizing:border-box;flex-shrink:0}.ir-frame:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ir-circle{border-radius:50%}.ir-dragging{cursor:grabbing}.ir-img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}.ir-hint{font-size:.75rem;color:#64748b}\n"]
|
|
366
|
+
}]
|
|
367
|
+
}],
|
|
368
|
+
propDecorators: {
|
|
369
|
+
src: [{
|
|
370
|
+
type: i0.Input,
|
|
371
|
+
args: [{
|
|
372
|
+
isSignal: true,
|
|
373
|
+
alias: "src",
|
|
374
|
+
required: false
|
|
375
|
+
}]
|
|
376
|
+
}],
|
|
377
|
+
alt: [{
|
|
378
|
+
type: i0.Input,
|
|
379
|
+
args: [{
|
|
380
|
+
isSignal: true,
|
|
381
|
+
alias: "alt",
|
|
382
|
+
required: false
|
|
383
|
+
}]
|
|
384
|
+
}],
|
|
385
|
+
shape: [{
|
|
386
|
+
type: i0.Input,
|
|
387
|
+
args: [{
|
|
388
|
+
isSignal: true,
|
|
389
|
+
alias: "shape",
|
|
390
|
+
required: false
|
|
391
|
+
}]
|
|
392
|
+
}],
|
|
393
|
+
aspectRatio: [{
|
|
394
|
+
type: i0.Input,
|
|
395
|
+
args: [{
|
|
396
|
+
isSignal: true,
|
|
397
|
+
alias: "aspectRatio",
|
|
398
|
+
required: false
|
|
399
|
+
}]
|
|
400
|
+
}],
|
|
401
|
+
width: [{
|
|
402
|
+
type: i0.Input,
|
|
403
|
+
args: [{
|
|
404
|
+
isSignal: true,
|
|
405
|
+
alias: "width",
|
|
406
|
+
required: false
|
|
407
|
+
}]
|
|
408
|
+
}],
|
|
409
|
+
labelInput: [{
|
|
410
|
+
type: i0.Input,
|
|
411
|
+
args: [{
|
|
412
|
+
isSignal: true,
|
|
413
|
+
alias: "label",
|
|
414
|
+
required: false
|
|
415
|
+
}]
|
|
416
|
+
}],
|
|
417
|
+
x: [{
|
|
418
|
+
type: i0.Input,
|
|
419
|
+
args: [{
|
|
420
|
+
isSignal: true,
|
|
421
|
+
alias: "x",
|
|
422
|
+
required: false
|
|
423
|
+
}]
|
|
424
|
+
}, {
|
|
425
|
+
type: i0.Output,
|
|
426
|
+
args: ["xChange"]
|
|
427
|
+
}],
|
|
428
|
+
y: [{
|
|
429
|
+
type: i0.Input,
|
|
430
|
+
args: [{
|
|
431
|
+
isSignal: true,
|
|
432
|
+
alias: "y",
|
|
433
|
+
required: false
|
|
434
|
+
}]
|
|
435
|
+
}, {
|
|
436
|
+
type: i0.Output,
|
|
437
|
+
args: ["yChange"]
|
|
438
|
+
}]
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
const IMAGE_FIELD_ACCEPT = "image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp";
|
|
442
|
+
const IMAGE_FIELD_MAX_BYTES = 10485760;
|
|
443
|
+
var ImageFieldComponent = class ImageFieldComponent {
|
|
444
|
+
constructor() {
|
|
445
|
+
this.labels = inject(UiLabelsService);
|
|
446
|
+
this.pickerRef = viewChild.required("picker", ...ngDevMode ? [{ debugName: "pickerRef" }] : /* istanbul ignore next */ []);
|
|
447
|
+
this.src = input(null, ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
448
|
+
this.alt = input("", ...ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []);
|
|
449
|
+
this.label = input(null, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
450
|
+
this.positionLabel = input(null, ...ngDevMode ? [{ debugName: "positionLabel" }] : /* istanbul ignore next */ []);
|
|
451
|
+
this.shape = input("circle", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
452
|
+
this.aspectRatio = input("1 / 1", ...ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []);
|
|
453
|
+
this.width = input(160, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
454
|
+
this.placeholder = input("image", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
455
|
+
this.removing = input(false, ...ngDevMode ? [{ debugName: "removing" }] : /* istanbul ignore next */ []);
|
|
456
|
+
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
457
|
+
this.accept = input(IMAGE_FIELD_ACCEPT, ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
|
|
458
|
+
this.maxSize = input(IMAGE_FIELD_MAX_BYTES, ...ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []);
|
|
459
|
+
this.uploadLabel = input(null, ...ngDevMode ? [{ debugName: "uploadLabel" }] : /* istanbul ignore next */ []);
|
|
460
|
+
this.changeLabel = input(null, ...ngDevMode ? [{ debugName: "changeLabel" }] : /* istanbul ignore next */ []);
|
|
461
|
+
this.removeLabel = input(null, ...ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []);
|
|
462
|
+
this.typeMessage = input("", ...ngDevMode ? [{ debugName: "typeMessage" }] : /* istanbul ignore next */ []);
|
|
463
|
+
this.sizeMessage = input("", ...ngDevMode ? [{ debugName: "sizeMessage" }] : /* istanbul ignore next */ []);
|
|
464
|
+
this.emptyMessage = input("", ...ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []);
|
|
465
|
+
this.testId = input("image-field", ...ngDevMode ? [{ debugName: "testId" }] : /* istanbul ignore next */ []);
|
|
466
|
+
this.x = model(50, ...ngDevMode ? [{ debugName: "x" }] : /* istanbul ignore next */ []);
|
|
467
|
+
this.y = model(50, ...ngDevMode ? [{ debugName: "y" }] : /* istanbul ignore next */ []);
|
|
468
|
+
this.file = signal(null, ...ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []);
|
|
469
|
+
this.preview = signal(null, ...ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []);
|
|
470
|
+
this.shownSrc = computed(() => this.preview() || this.src() || null, ...ngDevMode ? [{ debugName: "shownSrc" }] : /* istanbul ignore next */ []);
|
|
471
|
+
this.labelText = computed(() => this.label() ?? this.labels.t("imageField.label"), ...ngDevMode ? [{ debugName: "labelText" }] : /* istanbul ignore next */ []);
|
|
472
|
+
this.positionLabelText = computed(() => this.positionLabel() ?? this.labels.t("imageReposition.label"), ...ngDevMode ? [{ debugName: "positionLabelText" }] : /* istanbul ignore next */ []);
|
|
473
|
+
this.uploadText = computed(() => this.uploadLabel() ?? this.labels.t("imageField.upload"), ...ngDevMode ? [{ debugName: "uploadText" }] : /* istanbul ignore next */ []);
|
|
474
|
+
this.changeText = computed(() => this.changeLabel() ?? this.labels.t("imageField.change"), ...ngDevMode ? [{ debugName: "changeText" }] : /* istanbul ignore next */ []);
|
|
475
|
+
this.removeText = computed(() => this.removeLabel() ?? this.labels.t("imageField.remove"), ...ngDevMode ? [{ debugName: "removeText" }] : /* istanbul ignore next */ []);
|
|
476
|
+
this.fileChange = output();
|
|
477
|
+
this.remove = output();
|
|
478
|
+
}
|
|
479
|
+
onFilesSelected(files) {
|
|
480
|
+
const file = files[0];
|
|
481
|
+
if (!file) return;
|
|
482
|
+
this.file.set(file);
|
|
483
|
+
this.x.set(50);
|
|
484
|
+
this.y.set(50);
|
|
485
|
+
const reader = new FileReader();
|
|
486
|
+
reader.onload = () => {
|
|
487
|
+
if (this.file() === file) this.preview.set(reader.result);
|
|
488
|
+
};
|
|
489
|
+
reader.readAsDataURL(file);
|
|
490
|
+
this.fileChange.emit(file);
|
|
491
|
+
}
|
|
492
|
+
reset() {
|
|
493
|
+
this.file.set(null);
|
|
494
|
+
this.preview.set(null);
|
|
495
|
+
this.x.set(50);
|
|
496
|
+
this.y.set(50);
|
|
497
|
+
this.pickerRef().clear();
|
|
498
|
+
}
|
|
499
|
+
static {
|
|
500
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
501
|
+
minVersion: "12.0.0",
|
|
502
|
+
version: "22.2.2",
|
|
503
|
+
ngImport: i0,
|
|
504
|
+
type: ImageFieldComponent,
|
|
505
|
+
deps: [],
|
|
506
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
static {
|
|
510
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
511
|
+
minVersion: "17.0.0",
|
|
512
|
+
version: "22.2.2",
|
|
513
|
+
type: ImageFieldComponent,
|
|
514
|
+
isStandalone: true,
|
|
515
|
+
selector: "ui-image-field",
|
|
516
|
+
inputs: {
|
|
517
|
+
src: {
|
|
518
|
+
classPropertyName: "src",
|
|
519
|
+
publicName: "src",
|
|
520
|
+
isSignal: true,
|
|
521
|
+
isRequired: false,
|
|
522
|
+
transformFunction: null
|
|
523
|
+
},
|
|
524
|
+
alt: {
|
|
525
|
+
classPropertyName: "alt",
|
|
526
|
+
publicName: "alt",
|
|
527
|
+
isSignal: true,
|
|
528
|
+
isRequired: false,
|
|
529
|
+
transformFunction: null
|
|
530
|
+
},
|
|
531
|
+
label: {
|
|
532
|
+
classPropertyName: "label",
|
|
533
|
+
publicName: "label",
|
|
534
|
+
isSignal: true,
|
|
535
|
+
isRequired: false,
|
|
536
|
+
transformFunction: null
|
|
537
|
+
},
|
|
538
|
+
positionLabel: {
|
|
539
|
+
classPropertyName: "positionLabel",
|
|
540
|
+
publicName: "positionLabel",
|
|
541
|
+
isSignal: true,
|
|
542
|
+
isRequired: false,
|
|
543
|
+
transformFunction: null
|
|
544
|
+
},
|
|
545
|
+
shape: {
|
|
546
|
+
classPropertyName: "shape",
|
|
547
|
+
publicName: "shape",
|
|
548
|
+
isSignal: true,
|
|
549
|
+
isRequired: false,
|
|
550
|
+
transformFunction: null
|
|
551
|
+
},
|
|
552
|
+
aspectRatio: {
|
|
553
|
+
classPropertyName: "aspectRatio",
|
|
554
|
+
publicName: "aspectRatio",
|
|
555
|
+
isSignal: true,
|
|
556
|
+
isRequired: false,
|
|
557
|
+
transformFunction: null
|
|
558
|
+
},
|
|
559
|
+
width: {
|
|
560
|
+
classPropertyName: "width",
|
|
561
|
+
publicName: "width",
|
|
562
|
+
isSignal: true,
|
|
563
|
+
isRequired: false,
|
|
564
|
+
transformFunction: null
|
|
565
|
+
},
|
|
566
|
+
placeholder: {
|
|
567
|
+
classPropertyName: "placeholder",
|
|
568
|
+
publicName: "placeholder",
|
|
569
|
+
isSignal: true,
|
|
570
|
+
isRequired: false,
|
|
571
|
+
transformFunction: null
|
|
572
|
+
},
|
|
573
|
+
removing: {
|
|
574
|
+
classPropertyName: "removing",
|
|
575
|
+
publicName: "removing",
|
|
576
|
+
isSignal: true,
|
|
577
|
+
isRequired: false,
|
|
578
|
+
transformFunction: null
|
|
579
|
+
},
|
|
580
|
+
disabled: {
|
|
581
|
+
classPropertyName: "disabled",
|
|
582
|
+
publicName: "disabled",
|
|
583
|
+
isSignal: true,
|
|
584
|
+
isRequired: false,
|
|
585
|
+
transformFunction: null
|
|
586
|
+
},
|
|
587
|
+
accept: {
|
|
588
|
+
classPropertyName: "accept",
|
|
589
|
+
publicName: "accept",
|
|
590
|
+
isSignal: true,
|
|
591
|
+
isRequired: false,
|
|
592
|
+
transformFunction: null
|
|
593
|
+
},
|
|
594
|
+
maxSize: {
|
|
595
|
+
classPropertyName: "maxSize",
|
|
596
|
+
publicName: "maxSize",
|
|
597
|
+
isSignal: true,
|
|
598
|
+
isRequired: false,
|
|
599
|
+
transformFunction: null
|
|
600
|
+
},
|
|
601
|
+
uploadLabel: {
|
|
602
|
+
classPropertyName: "uploadLabel",
|
|
603
|
+
publicName: "uploadLabel",
|
|
604
|
+
isSignal: true,
|
|
605
|
+
isRequired: false,
|
|
606
|
+
transformFunction: null
|
|
607
|
+
},
|
|
608
|
+
changeLabel: {
|
|
609
|
+
classPropertyName: "changeLabel",
|
|
610
|
+
publicName: "changeLabel",
|
|
611
|
+
isSignal: true,
|
|
612
|
+
isRequired: false,
|
|
613
|
+
transformFunction: null
|
|
614
|
+
},
|
|
615
|
+
removeLabel: {
|
|
616
|
+
classPropertyName: "removeLabel",
|
|
617
|
+
publicName: "removeLabel",
|
|
618
|
+
isSignal: true,
|
|
619
|
+
isRequired: false,
|
|
620
|
+
transformFunction: null
|
|
621
|
+
},
|
|
622
|
+
typeMessage: {
|
|
623
|
+
classPropertyName: "typeMessage",
|
|
624
|
+
publicName: "typeMessage",
|
|
625
|
+
isSignal: true,
|
|
626
|
+
isRequired: false,
|
|
627
|
+
transformFunction: null
|
|
628
|
+
},
|
|
629
|
+
sizeMessage: {
|
|
630
|
+
classPropertyName: "sizeMessage",
|
|
631
|
+
publicName: "sizeMessage",
|
|
632
|
+
isSignal: true,
|
|
633
|
+
isRequired: false,
|
|
634
|
+
transformFunction: null
|
|
635
|
+
},
|
|
636
|
+
emptyMessage: {
|
|
637
|
+
classPropertyName: "emptyMessage",
|
|
638
|
+
publicName: "emptyMessage",
|
|
639
|
+
isSignal: true,
|
|
640
|
+
isRequired: false,
|
|
641
|
+
transformFunction: null
|
|
642
|
+
},
|
|
643
|
+
testId: {
|
|
644
|
+
classPropertyName: "testId",
|
|
645
|
+
publicName: "testId",
|
|
646
|
+
isSignal: true,
|
|
647
|
+
isRequired: false,
|
|
648
|
+
transformFunction: null
|
|
649
|
+
},
|
|
650
|
+
x: {
|
|
651
|
+
classPropertyName: "x",
|
|
652
|
+
publicName: "x",
|
|
653
|
+
isSignal: true,
|
|
654
|
+
isRequired: false,
|
|
655
|
+
transformFunction: null
|
|
656
|
+
},
|
|
657
|
+
y: {
|
|
658
|
+
classPropertyName: "y",
|
|
659
|
+
publicName: "y",
|
|
660
|
+
isSignal: true,
|
|
661
|
+
isRequired: false,
|
|
662
|
+
transformFunction: null
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
outputs: {
|
|
666
|
+
x: "xChange",
|
|
667
|
+
y: "yChange",
|
|
668
|
+
fileChange: "fileChange",
|
|
669
|
+
remove: "remove"
|
|
670
|
+
},
|
|
671
|
+
viewQueries: [{
|
|
672
|
+
propertyName: "pickerRef",
|
|
673
|
+
first: true,
|
|
674
|
+
predicate: ["picker"],
|
|
675
|
+
descendants: true,
|
|
676
|
+
isSignal: true
|
|
677
|
+
}],
|
|
678
|
+
ngImport: i0,
|
|
679
|
+
template: `
|
|
680
|
+
<div class="if-row" [attr.data-testid]="testId() + '-row'">
|
|
681
|
+
@if (shownSrc()) {
|
|
682
|
+
<ui-image-reposition [src]="shownSrc()" [alt]="alt()" [shape]="shape()" [aspectRatio]="aspectRatio()" [width]="width()"
|
|
683
|
+
[label]="positionLabelText()" [(x)]="x" [(y)]="y" [attr.data-testid]="testId() + '-preview'" />
|
|
684
|
+
} @else {
|
|
685
|
+
<ui-image-preview [src]="null" [alt]="alt()" [shape]="shape()" size="lg" [placeholder]="placeholder()" [attr.data-testid]="testId() + '-preview'" />
|
|
686
|
+
}
|
|
687
|
+
<div class="if-actions" [attr.data-testid]="testId() + '-actions'">
|
|
688
|
+
<ui-button variant="secondary" size="sm" [disabled]="disabled() || removing()" [attr.data-testid]="testId() + '-upload'" (click)="picker.open()">
|
|
689
|
+
{{ src() || file() ? changeText() : uploadText() }}
|
|
690
|
+
</ui-button>
|
|
691
|
+
@if (src()) {
|
|
692
|
+
<ui-button variant="danger" size="sm" [disabled]="disabled()" [loading]="removing()" [attr.data-testid]="testId() + '-remove'" (click)="remove.emit()">
|
|
693
|
+
{{ removeText() }}
|
|
694
|
+
</ui-button>
|
|
695
|
+
}
|
|
696
|
+
</div>
|
|
697
|
+
</div>
|
|
698
|
+
<!-- Hidden picker: only its refusal message (type / empty / size) shows, under the row. -->
|
|
699
|
+
<ui-file-input #picker [showField]="false" [accept]="accept()" [maxSize]="maxSize()" [rejectEmpty]="true"
|
|
700
|
+
[typeMessage]="typeMessage() || labels.t('imageField.typeMessage')" [sizeMessage]="sizeMessage() || labels.t('imageField.sizeMessage')"
|
|
701
|
+
[emptyMessage]="emptyMessage() || labels.t('imageField.emptyMessage')" [ariaLabel]="labelText()" [disabled]="disabled()"
|
|
702
|
+
[attr.data-testid]="testId() + '-input'" (filesSelected)="onFilesSelected($event)" />
|
|
703
|
+
`,
|
|
704
|
+
isInline: true,
|
|
705
|
+
styles: [":host{display:block}.if-row{display:flex;flex-wrap:wrap;align-items:center;gap:16px}.if-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n"],
|
|
706
|
+
dependencies: [
|
|
707
|
+
{
|
|
708
|
+
kind: "component",
|
|
709
|
+
type: ButtonComponent,
|
|
710
|
+
selector: "ui-button",
|
|
711
|
+
inputs: [
|
|
712
|
+
"variant",
|
|
713
|
+
"routerLink",
|
|
714
|
+
"queryParams",
|
|
715
|
+
"fragment",
|
|
716
|
+
"state",
|
|
717
|
+
"href",
|
|
718
|
+
"target",
|
|
719
|
+
"rel",
|
|
720
|
+
"shortLabel",
|
|
721
|
+
"shortBelow",
|
|
722
|
+
"color",
|
|
723
|
+
"active",
|
|
724
|
+
"size",
|
|
725
|
+
"type",
|
|
726
|
+
"disabled",
|
|
727
|
+
"loading",
|
|
728
|
+
"fullWidth",
|
|
729
|
+
"ariaLabel",
|
|
730
|
+
"ariaExpanded",
|
|
731
|
+
"ariaPressed",
|
|
732
|
+
"ariaDescribedBy",
|
|
733
|
+
"modal-footer-left",
|
|
734
|
+
"modal-footer-right"
|
|
735
|
+
]
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
kind: "component",
|
|
739
|
+
type: FileInputComponent,
|
|
740
|
+
selector: "ui-file-input",
|
|
741
|
+
inputs: [
|
|
742
|
+
"label",
|
|
743
|
+
"ariaLabel",
|
|
744
|
+
"placeholder",
|
|
745
|
+
"buttonLabel",
|
|
746
|
+
"accept",
|
|
747
|
+
"multiple",
|
|
748
|
+
"required",
|
|
749
|
+
"hint",
|
|
750
|
+
"error",
|
|
751
|
+
"showField",
|
|
752
|
+
"showErrors",
|
|
753
|
+
"toastOnReject",
|
|
754
|
+
"listRejections",
|
|
755
|
+
"ariaDescribedBy",
|
|
756
|
+
"clearable",
|
|
757
|
+
"removeLabel",
|
|
758
|
+
"maxSize",
|
|
759
|
+
"enforceAccept",
|
|
760
|
+
"typeMessage",
|
|
761
|
+
"sizeMessage",
|
|
762
|
+
"rejectEmpty",
|
|
763
|
+
"emptyMessage",
|
|
764
|
+
"minSize",
|
|
765
|
+
"minSizeMessage",
|
|
766
|
+
"dropzone",
|
|
767
|
+
"showDetails",
|
|
768
|
+
"preview",
|
|
769
|
+
"loading",
|
|
770
|
+
"loadingText",
|
|
771
|
+
"disabled"
|
|
772
|
+
],
|
|
773
|
+
outputs: [
|
|
774
|
+
"filesSelected",
|
|
775
|
+
"fileRejected",
|
|
776
|
+
"filesRejected",
|
|
777
|
+
"fileRemoved",
|
|
778
|
+
"invalidChange"
|
|
779
|
+
]
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
kind: "component",
|
|
783
|
+
type: ImagePreviewComponent,
|
|
784
|
+
selector: "ui-image-preview",
|
|
785
|
+
inputs: [
|
|
786
|
+
"src",
|
|
787
|
+
"alt",
|
|
788
|
+
"shape",
|
|
789
|
+
"size",
|
|
790
|
+
"placeholder",
|
|
791
|
+
"loading",
|
|
792
|
+
"positionX",
|
|
793
|
+
"positionY",
|
|
794
|
+
"retryKey"
|
|
795
|
+
]
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
kind: "component",
|
|
799
|
+
type: ImageRepositionComponent,
|
|
800
|
+
selector: "ui-image-reposition",
|
|
801
|
+
inputs: [
|
|
802
|
+
"src",
|
|
803
|
+
"alt",
|
|
804
|
+
"shape",
|
|
805
|
+
"aspectRatio",
|
|
806
|
+
"width",
|
|
807
|
+
"label",
|
|
808
|
+
"x",
|
|
809
|
+
"y"
|
|
810
|
+
],
|
|
811
|
+
outputs: ["xChange", "yChange"]
|
|
812
|
+
}
|
|
813
|
+
],
|
|
814
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
819
|
+
minVersion: "12.0.0",
|
|
820
|
+
version: "22.2.2",
|
|
821
|
+
ngImport: i0,
|
|
822
|
+
type: ImageFieldComponent,
|
|
823
|
+
decorators: [{
|
|
824
|
+
type: Component,
|
|
825
|
+
args: [{
|
|
826
|
+
selector: "ui-image-field",
|
|
827
|
+
standalone: true,
|
|
828
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
829
|
+
imports: [
|
|
830
|
+
ButtonComponent,
|
|
831
|
+
FileInputComponent,
|
|
832
|
+
ImagePreviewComponent,
|
|
833
|
+
ImageRepositionComponent
|
|
834
|
+
],
|
|
835
|
+
template: `
|
|
836
|
+
<div class="if-row" [attr.data-testid]="testId() + '-row'">
|
|
837
|
+
@if (shownSrc()) {
|
|
838
|
+
<ui-image-reposition [src]="shownSrc()" [alt]="alt()" [shape]="shape()" [aspectRatio]="aspectRatio()" [width]="width()"
|
|
839
|
+
[label]="positionLabelText()" [(x)]="x" [(y)]="y" [attr.data-testid]="testId() + '-preview'" />
|
|
840
|
+
} @else {
|
|
841
|
+
<ui-image-preview [src]="null" [alt]="alt()" [shape]="shape()" size="lg" [placeholder]="placeholder()" [attr.data-testid]="testId() + '-preview'" />
|
|
842
|
+
}
|
|
843
|
+
<div class="if-actions" [attr.data-testid]="testId() + '-actions'">
|
|
844
|
+
<ui-button variant="secondary" size="sm" [disabled]="disabled() || removing()" [attr.data-testid]="testId() + '-upload'" (click)="picker.open()">
|
|
845
|
+
{{ src() || file() ? changeText() : uploadText() }}
|
|
846
|
+
</ui-button>
|
|
847
|
+
@if (src()) {
|
|
848
|
+
<ui-button variant="danger" size="sm" [disabled]="disabled()" [loading]="removing()" [attr.data-testid]="testId() + '-remove'" (click)="remove.emit()">
|
|
849
|
+
{{ removeText() }}
|
|
850
|
+
</ui-button>
|
|
851
|
+
}
|
|
852
|
+
</div>
|
|
853
|
+
</div>
|
|
854
|
+
<!-- Hidden picker: only its refusal message (type / empty / size) shows, under the row. -->
|
|
855
|
+
<ui-file-input #picker [showField]="false" [accept]="accept()" [maxSize]="maxSize()" [rejectEmpty]="true"
|
|
856
|
+
[typeMessage]="typeMessage() || labels.t('imageField.typeMessage')" [sizeMessage]="sizeMessage() || labels.t('imageField.sizeMessage')"
|
|
857
|
+
[emptyMessage]="emptyMessage() || labels.t('imageField.emptyMessage')" [ariaLabel]="labelText()" [disabled]="disabled()"
|
|
858
|
+
[attr.data-testid]="testId() + '-input'" (filesSelected)="onFilesSelected($event)" />
|
|
859
|
+
`,
|
|
860
|
+
styles: [":host{display:block}.if-row{display:flex;flex-wrap:wrap;align-items:center;gap:16px}.if-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n"]
|
|
861
|
+
}]
|
|
862
|
+
}],
|
|
863
|
+
propDecorators: {
|
|
864
|
+
pickerRef: [{
|
|
865
|
+
type: i0.ViewChild,
|
|
866
|
+
args: ["picker", { isSignal: true }]
|
|
867
|
+
}],
|
|
868
|
+
src: [{
|
|
869
|
+
type: i0.Input,
|
|
870
|
+
args: [{
|
|
871
|
+
isSignal: true,
|
|
872
|
+
alias: "src",
|
|
873
|
+
required: false
|
|
874
|
+
}]
|
|
875
|
+
}],
|
|
876
|
+
alt: [{
|
|
877
|
+
type: i0.Input,
|
|
878
|
+
args: [{
|
|
879
|
+
isSignal: true,
|
|
880
|
+
alias: "alt",
|
|
881
|
+
required: false
|
|
882
|
+
}]
|
|
883
|
+
}],
|
|
884
|
+
label: [{
|
|
885
|
+
type: i0.Input,
|
|
886
|
+
args: [{
|
|
887
|
+
isSignal: true,
|
|
888
|
+
alias: "label",
|
|
889
|
+
required: false
|
|
890
|
+
}]
|
|
891
|
+
}],
|
|
892
|
+
positionLabel: [{
|
|
893
|
+
type: i0.Input,
|
|
894
|
+
args: [{
|
|
895
|
+
isSignal: true,
|
|
896
|
+
alias: "positionLabel",
|
|
897
|
+
required: false
|
|
898
|
+
}]
|
|
899
|
+
}],
|
|
900
|
+
shape: [{
|
|
901
|
+
type: i0.Input,
|
|
902
|
+
args: [{
|
|
903
|
+
isSignal: true,
|
|
904
|
+
alias: "shape",
|
|
905
|
+
required: false
|
|
906
|
+
}]
|
|
907
|
+
}],
|
|
908
|
+
aspectRatio: [{
|
|
909
|
+
type: i0.Input,
|
|
910
|
+
args: [{
|
|
911
|
+
isSignal: true,
|
|
912
|
+
alias: "aspectRatio",
|
|
913
|
+
required: false
|
|
914
|
+
}]
|
|
915
|
+
}],
|
|
916
|
+
width: [{
|
|
917
|
+
type: i0.Input,
|
|
918
|
+
args: [{
|
|
919
|
+
isSignal: true,
|
|
920
|
+
alias: "width",
|
|
921
|
+
required: false
|
|
922
|
+
}]
|
|
923
|
+
}],
|
|
924
|
+
placeholder: [{
|
|
925
|
+
type: i0.Input,
|
|
926
|
+
args: [{
|
|
927
|
+
isSignal: true,
|
|
928
|
+
alias: "placeholder",
|
|
929
|
+
required: false
|
|
930
|
+
}]
|
|
931
|
+
}],
|
|
932
|
+
removing: [{
|
|
933
|
+
type: i0.Input,
|
|
934
|
+
args: [{
|
|
935
|
+
isSignal: true,
|
|
936
|
+
alias: "removing",
|
|
937
|
+
required: false
|
|
938
|
+
}]
|
|
939
|
+
}],
|
|
940
|
+
disabled: [{
|
|
941
|
+
type: i0.Input,
|
|
942
|
+
args: [{
|
|
943
|
+
isSignal: true,
|
|
944
|
+
alias: "disabled",
|
|
945
|
+
required: false
|
|
946
|
+
}]
|
|
947
|
+
}],
|
|
948
|
+
accept: [{
|
|
949
|
+
type: i0.Input,
|
|
950
|
+
args: [{
|
|
951
|
+
isSignal: true,
|
|
952
|
+
alias: "accept",
|
|
953
|
+
required: false
|
|
954
|
+
}]
|
|
955
|
+
}],
|
|
956
|
+
maxSize: [{
|
|
957
|
+
type: i0.Input,
|
|
958
|
+
args: [{
|
|
959
|
+
isSignal: true,
|
|
960
|
+
alias: "maxSize",
|
|
961
|
+
required: false
|
|
962
|
+
}]
|
|
963
|
+
}],
|
|
964
|
+
uploadLabel: [{
|
|
965
|
+
type: i0.Input,
|
|
966
|
+
args: [{
|
|
967
|
+
isSignal: true,
|
|
968
|
+
alias: "uploadLabel",
|
|
969
|
+
required: false
|
|
970
|
+
}]
|
|
971
|
+
}],
|
|
972
|
+
changeLabel: [{
|
|
973
|
+
type: i0.Input,
|
|
974
|
+
args: [{
|
|
975
|
+
isSignal: true,
|
|
976
|
+
alias: "changeLabel",
|
|
977
|
+
required: false
|
|
978
|
+
}]
|
|
979
|
+
}],
|
|
980
|
+
removeLabel: [{
|
|
981
|
+
type: i0.Input,
|
|
982
|
+
args: [{
|
|
983
|
+
isSignal: true,
|
|
984
|
+
alias: "removeLabel",
|
|
985
|
+
required: false
|
|
986
|
+
}]
|
|
987
|
+
}],
|
|
988
|
+
typeMessage: [{
|
|
989
|
+
type: i0.Input,
|
|
990
|
+
args: [{
|
|
991
|
+
isSignal: true,
|
|
992
|
+
alias: "typeMessage",
|
|
993
|
+
required: false
|
|
994
|
+
}]
|
|
995
|
+
}],
|
|
996
|
+
sizeMessage: [{
|
|
997
|
+
type: i0.Input,
|
|
998
|
+
args: [{
|
|
999
|
+
isSignal: true,
|
|
1000
|
+
alias: "sizeMessage",
|
|
1001
|
+
required: false
|
|
1002
|
+
}]
|
|
1003
|
+
}],
|
|
1004
|
+
emptyMessage: [{
|
|
1005
|
+
type: i0.Input,
|
|
1006
|
+
args: [{
|
|
1007
|
+
isSignal: true,
|
|
1008
|
+
alias: "emptyMessage",
|
|
1009
|
+
required: false
|
|
1010
|
+
}]
|
|
1011
|
+
}],
|
|
1012
|
+
testId: [{
|
|
1013
|
+
type: i0.Input,
|
|
1014
|
+
args: [{
|
|
1015
|
+
isSignal: true,
|
|
1016
|
+
alias: "testId",
|
|
1017
|
+
required: false
|
|
1018
|
+
}]
|
|
1019
|
+
}],
|
|
1020
|
+
x: [{
|
|
1021
|
+
type: i0.Input,
|
|
1022
|
+
args: [{
|
|
1023
|
+
isSignal: true,
|
|
1024
|
+
alias: "x",
|
|
1025
|
+
required: false
|
|
1026
|
+
}]
|
|
1027
|
+
}, {
|
|
1028
|
+
type: i0.Output,
|
|
1029
|
+
args: ["xChange"]
|
|
1030
|
+
}],
|
|
1031
|
+
y: [{
|
|
1032
|
+
type: i0.Input,
|
|
1033
|
+
args: [{
|
|
1034
|
+
isSignal: true,
|
|
1035
|
+
alias: "y",
|
|
1036
|
+
required: false
|
|
1037
|
+
}]
|
|
1038
|
+
}, {
|
|
1039
|
+
type: i0.Output,
|
|
1040
|
+
args: ["yChange"]
|
|
1041
|
+
}],
|
|
1042
|
+
fileChange: [{
|
|
1043
|
+
type: i0.Output,
|
|
1044
|
+
args: ["fileChange"]
|
|
1045
|
+
}],
|
|
1046
|
+
remove: [{
|
|
1047
|
+
type: i0.Output,
|
|
1048
|
+
args: ["remove"]
|
|
1049
|
+
}]
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
const ECL_ORDINAL = {
|
|
1053
|
+
L: 0,
|
|
1054
|
+
M: 1,
|
|
1055
|
+
Q: 2,
|
|
1056
|
+
H: 3
|
|
1057
|
+
};
|
|
1058
|
+
const ECL_FORMAT_BITS = {
|
|
1059
|
+
L: 1,
|
|
1060
|
+
M: 0,
|
|
1061
|
+
Q: 3,
|
|
1062
|
+
H: 2
|
|
1063
|
+
};
|
|
1064
|
+
const ECC_CODEWORDS_PER_BLOCK = [
|
|
1065
|
+
[
|
|
1066
|
+
-1,
|
|
1067
|
+
7,
|
|
1068
|
+
10,
|
|
1069
|
+
15,
|
|
1070
|
+
20,
|
|
1071
|
+
26,
|
|
1072
|
+
18,
|
|
1073
|
+
20,
|
|
1074
|
+
24,
|
|
1075
|
+
30,
|
|
1076
|
+
18,
|
|
1077
|
+
20,
|
|
1078
|
+
24,
|
|
1079
|
+
26,
|
|
1080
|
+
30,
|
|
1081
|
+
22,
|
|
1082
|
+
24,
|
|
1083
|
+
28,
|
|
1084
|
+
30,
|
|
1085
|
+
28,
|
|
1086
|
+
28,
|
|
1087
|
+
28,
|
|
1088
|
+
28,
|
|
1089
|
+
30,
|
|
1090
|
+
30,
|
|
1091
|
+
26,
|
|
1092
|
+
28,
|
|
1093
|
+
30,
|
|
1094
|
+
30,
|
|
1095
|
+
30,
|
|
1096
|
+
30,
|
|
1097
|
+
30,
|
|
1098
|
+
30,
|
|
1099
|
+
30,
|
|
1100
|
+
30,
|
|
1101
|
+
30,
|
|
1102
|
+
30,
|
|
1103
|
+
30,
|
|
1104
|
+
30,
|
|
1105
|
+
30,
|
|
1106
|
+
30
|
|
1107
|
+
],
|
|
1108
|
+
[
|
|
1109
|
+
-1,
|
|
1110
|
+
10,
|
|
1111
|
+
16,
|
|
1112
|
+
26,
|
|
1113
|
+
18,
|
|
1114
|
+
24,
|
|
1115
|
+
16,
|
|
1116
|
+
18,
|
|
1117
|
+
22,
|
|
1118
|
+
22,
|
|
1119
|
+
26,
|
|
1120
|
+
30,
|
|
1121
|
+
22,
|
|
1122
|
+
22,
|
|
1123
|
+
24,
|
|
1124
|
+
24,
|
|
1125
|
+
28,
|
|
1126
|
+
28,
|
|
1127
|
+
26,
|
|
1128
|
+
26,
|
|
1129
|
+
26,
|
|
1130
|
+
26,
|
|
1131
|
+
28,
|
|
1132
|
+
28,
|
|
1133
|
+
28,
|
|
1134
|
+
28,
|
|
1135
|
+
28,
|
|
1136
|
+
28,
|
|
1137
|
+
28,
|
|
1138
|
+
28,
|
|
1139
|
+
28,
|
|
1140
|
+
28,
|
|
1141
|
+
28,
|
|
1142
|
+
28,
|
|
1143
|
+
28,
|
|
1144
|
+
28,
|
|
1145
|
+
28,
|
|
1146
|
+
28,
|
|
1147
|
+
28,
|
|
1148
|
+
28,
|
|
1149
|
+
28
|
|
1150
|
+
],
|
|
1151
|
+
[
|
|
1152
|
+
-1,
|
|
1153
|
+
13,
|
|
1154
|
+
22,
|
|
1155
|
+
18,
|
|
1156
|
+
26,
|
|
1157
|
+
18,
|
|
1158
|
+
24,
|
|
1159
|
+
18,
|
|
1160
|
+
22,
|
|
1161
|
+
20,
|
|
1162
|
+
24,
|
|
1163
|
+
28,
|
|
1164
|
+
26,
|
|
1165
|
+
24,
|
|
1166
|
+
20,
|
|
1167
|
+
30,
|
|
1168
|
+
24,
|
|
1169
|
+
28,
|
|
1170
|
+
28,
|
|
1171
|
+
26,
|
|
1172
|
+
30,
|
|
1173
|
+
28,
|
|
1174
|
+
30,
|
|
1175
|
+
30,
|
|
1176
|
+
30,
|
|
1177
|
+
30,
|
|
1178
|
+
28,
|
|
1179
|
+
30,
|
|
1180
|
+
30,
|
|
1181
|
+
30,
|
|
1182
|
+
30,
|
|
1183
|
+
30,
|
|
1184
|
+
30,
|
|
1185
|
+
30,
|
|
1186
|
+
30,
|
|
1187
|
+
30,
|
|
1188
|
+
30,
|
|
1189
|
+
30,
|
|
1190
|
+
30,
|
|
1191
|
+
30,
|
|
1192
|
+
30
|
|
1193
|
+
],
|
|
1194
|
+
[
|
|
1195
|
+
-1,
|
|
1196
|
+
17,
|
|
1197
|
+
28,
|
|
1198
|
+
22,
|
|
1199
|
+
16,
|
|
1200
|
+
22,
|
|
1201
|
+
28,
|
|
1202
|
+
26,
|
|
1203
|
+
26,
|
|
1204
|
+
24,
|
|
1205
|
+
28,
|
|
1206
|
+
24,
|
|
1207
|
+
28,
|
|
1208
|
+
22,
|
|
1209
|
+
24,
|
|
1210
|
+
24,
|
|
1211
|
+
30,
|
|
1212
|
+
28,
|
|
1213
|
+
28,
|
|
1214
|
+
26,
|
|
1215
|
+
28,
|
|
1216
|
+
30,
|
|
1217
|
+
24,
|
|
1218
|
+
30,
|
|
1219
|
+
30,
|
|
1220
|
+
30,
|
|
1221
|
+
30,
|
|
1222
|
+
30,
|
|
1223
|
+
30,
|
|
1224
|
+
30,
|
|
1225
|
+
30,
|
|
1226
|
+
30,
|
|
1227
|
+
30,
|
|
1228
|
+
30,
|
|
1229
|
+
30,
|
|
1230
|
+
30,
|
|
1231
|
+
30,
|
|
1232
|
+
30,
|
|
1233
|
+
30,
|
|
1234
|
+
30,
|
|
1235
|
+
30
|
|
1236
|
+
]
|
|
1237
|
+
];
|
|
1238
|
+
const NUM_ERROR_CORRECTION_BLOCKS = [
|
|
1239
|
+
[
|
|
1240
|
+
-1,
|
|
1241
|
+
1,
|
|
1242
|
+
1,
|
|
1243
|
+
1,
|
|
1244
|
+
1,
|
|
1245
|
+
1,
|
|
1246
|
+
2,
|
|
1247
|
+
2,
|
|
1248
|
+
2,
|
|
1249
|
+
2,
|
|
1250
|
+
4,
|
|
1251
|
+
4,
|
|
1252
|
+
4,
|
|
1253
|
+
4,
|
|
1254
|
+
4,
|
|
1255
|
+
6,
|
|
1256
|
+
6,
|
|
1257
|
+
6,
|
|
1258
|
+
6,
|
|
1259
|
+
7,
|
|
1260
|
+
8,
|
|
1261
|
+
8,
|
|
1262
|
+
9,
|
|
1263
|
+
9,
|
|
1264
|
+
10,
|
|
1265
|
+
12,
|
|
1266
|
+
12,
|
|
1267
|
+
12,
|
|
1268
|
+
13,
|
|
1269
|
+
14,
|
|
1270
|
+
15,
|
|
1271
|
+
16,
|
|
1272
|
+
17,
|
|
1273
|
+
18,
|
|
1274
|
+
19,
|
|
1275
|
+
19,
|
|
1276
|
+
20,
|
|
1277
|
+
21,
|
|
1278
|
+
22,
|
|
1279
|
+
24,
|
|
1280
|
+
25
|
|
1281
|
+
],
|
|
1282
|
+
[
|
|
1283
|
+
-1,
|
|
1284
|
+
1,
|
|
1285
|
+
1,
|
|
1286
|
+
1,
|
|
1287
|
+
2,
|
|
1288
|
+
2,
|
|
1289
|
+
4,
|
|
1290
|
+
4,
|
|
1291
|
+
4,
|
|
1292
|
+
5,
|
|
1293
|
+
5,
|
|
1294
|
+
5,
|
|
1295
|
+
8,
|
|
1296
|
+
9,
|
|
1297
|
+
9,
|
|
1298
|
+
10,
|
|
1299
|
+
10,
|
|
1300
|
+
11,
|
|
1301
|
+
13,
|
|
1302
|
+
14,
|
|
1303
|
+
16,
|
|
1304
|
+
17,
|
|
1305
|
+
17,
|
|
1306
|
+
18,
|
|
1307
|
+
20,
|
|
1308
|
+
21,
|
|
1309
|
+
23,
|
|
1310
|
+
25,
|
|
1311
|
+
26,
|
|
1312
|
+
28,
|
|
1313
|
+
29,
|
|
1314
|
+
31,
|
|
1315
|
+
33,
|
|
1316
|
+
35,
|
|
1317
|
+
37,
|
|
1318
|
+
38,
|
|
1319
|
+
40,
|
|
1320
|
+
43,
|
|
1321
|
+
45,
|
|
1322
|
+
47,
|
|
1323
|
+
49
|
|
1324
|
+
],
|
|
1325
|
+
[
|
|
1326
|
+
-1,
|
|
1327
|
+
1,
|
|
1328
|
+
1,
|
|
1329
|
+
2,
|
|
1330
|
+
2,
|
|
1331
|
+
4,
|
|
1332
|
+
4,
|
|
1333
|
+
6,
|
|
1334
|
+
6,
|
|
1335
|
+
8,
|
|
1336
|
+
8,
|
|
1337
|
+
8,
|
|
1338
|
+
10,
|
|
1339
|
+
12,
|
|
1340
|
+
16,
|
|
1341
|
+
12,
|
|
1342
|
+
17,
|
|
1343
|
+
16,
|
|
1344
|
+
18,
|
|
1345
|
+
21,
|
|
1346
|
+
20,
|
|
1347
|
+
23,
|
|
1348
|
+
23,
|
|
1349
|
+
25,
|
|
1350
|
+
27,
|
|
1351
|
+
29,
|
|
1352
|
+
34,
|
|
1353
|
+
34,
|
|
1354
|
+
35,
|
|
1355
|
+
38,
|
|
1356
|
+
40,
|
|
1357
|
+
43,
|
|
1358
|
+
45,
|
|
1359
|
+
48,
|
|
1360
|
+
51,
|
|
1361
|
+
53,
|
|
1362
|
+
56,
|
|
1363
|
+
59,
|
|
1364
|
+
62,
|
|
1365
|
+
65,
|
|
1366
|
+
68
|
|
1367
|
+
],
|
|
1368
|
+
[
|
|
1369
|
+
-1,
|
|
1370
|
+
1,
|
|
1371
|
+
1,
|
|
1372
|
+
2,
|
|
1373
|
+
4,
|
|
1374
|
+
4,
|
|
1375
|
+
4,
|
|
1376
|
+
5,
|
|
1377
|
+
6,
|
|
1378
|
+
8,
|
|
1379
|
+
8,
|
|
1380
|
+
11,
|
|
1381
|
+
11,
|
|
1382
|
+
16,
|
|
1383
|
+
16,
|
|
1384
|
+
18,
|
|
1385
|
+
16,
|
|
1386
|
+
19,
|
|
1387
|
+
21,
|
|
1388
|
+
25,
|
|
1389
|
+
25,
|
|
1390
|
+
25,
|
|
1391
|
+
34,
|
|
1392
|
+
30,
|
|
1393
|
+
32,
|
|
1394
|
+
35,
|
|
1395
|
+
37,
|
|
1396
|
+
40,
|
|
1397
|
+
42,
|
|
1398
|
+
45,
|
|
1399
|
+
48,
|
|
1400
|
+
51,
|
|
1401
|
+
54,
|
|
1402
|
+
57,
|
|
1403
|
+
60,
|
|
1404
|
+
63,
|
|
1405
|
+
66,
|
|
1406
|
+
70,
|
|
1407
|
+
74,
|
|
1408
|
+
77,
|
|
1409
|
+
81
|
|
1410
|
+
]
|
|
1411
|
+
];
|
|
1412
|
+
const PENALTY_N1 = 3;
|
|
1413
|
+
const PENALTY_N2 = 3;
|
|
1414
|
+
const PENALTY_N3 = 40;
|
|
1415
|
+
const PENALTY_N4 = 10;
|
|
1416
|
+
function encodeQr(text, options = {}) {
|
|
1417
|
+
const ecl = options.ecl ?? "M";
|
|
1418
|
+
const forcedMask = options.mask;
|
|
1419
|
+
if (forcedMask !== void 0 && (!Number.isInteger(forcedMask) || forcedMask < 0 || forcedMask > 7)) throw new RangeError("Mask must be an integer from 0 to 7.");
|
|
1420
|
+
const bytes = new TextEncoder().encode(text);
|
|
1421
|
+
let version = 1;
|
|
1422
|
+
let dataBits = 0;
|
|
1423
|
+
for (;; version++) {
|
|
1424
|
+
if (version > 40) throw new RangeError("Data too long for a QR code.");
|
|
1425
|
+
dataBits = 4 + (version <= 9 ? 8 : 16) + bytes.length * 8;
|
|
1426
|
+
if (dataBits <= numDataCodewords(version, ecl) * 8) break;
|
|
1427
|
+
}
|
|
1428
|
+
const bits = [];
|
|
1429
|
+
appendBits(bits, 4, 4);
|
|
1430
|
+
appendBits(bits, bytes.length, version <= 9 ? 8 : 16);
|
|
1431
|
+
for (const b of bytes) appendBits(bits, b, 8);
|
|
1432
|
+
const capacityBits = numDataCodewords(version, ecl) * 8;
|
|
1433
|
+
appendBits(bits, 0, Math.min(4, capacityBits - bits.length));
|
|
1434
|
+
appendBits(bits, 0, (8 - bits.length % 8) % 8);
|
|
1435
|
+
for (let pad = 236; bits.length < capacityBits; pad ^= 253) appendBits(bits, pad, 8);
|
|
1436
|
+
const dataCodewords = [];
|
|
1437
|
+
for (let i = 0; i < bits.length; i += 8) {
|
|
1438
|
+
let byte = 0;
|
|
1439
|
+
for (let j = 0; j < 8; j++) byte = byte << 1 | bits[i + j];
|
|
1440
|
+
dataCodewords.push(byte);
|
|
1441
|
+
}
|
|
1442
|
+
const qr = new QrBuilder(version, ecl);
|
|
1443
|
+
qr.drawFunctionPatterns();
|
|
1444
|
+
qr.drawCodewords(addEccAndInterleave(dataCodewords, version, ecl));
|
|
1445
|
+
let mask = forcedMask ?? -1;
|
|
1446
|
+
if (mask === -1) {
|
|
1447
|
+
let minPenalty = Infinity;
|
|
1448
|
+
for (let m = 0; m < 8; m++) {
|
|
1449
|
+
qr.applyMask(m);
|
|
1450
|
+
qr.drawFormatBits(m);
|
|
1451
|
+
const penalty = qr.penaltyScore();
|
|
1452
|
+
if (penalty < minPenalty) {
|
|
1453
|
+
mask = m;
|
|
1454
|
+
minPenalty = penalty;
|
|
1455
|
+
}
|
|
1456
|
+
qr.applyMask(m);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
qr.applyMask(mask);
|
|
1460
|
+
qr.drawFormatBits(mask);
|
|
1461
|
+
return {
|
|
1462
|
+
size: qr.size,
|
|
1463
|
+
version,
|
|
1464
|
+
mask,
|
|
1465
|
+
modules: qr.modules
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
function appendBits(out, value, length) {
|
|
1469
|
+
for (let i = length - 1; i >= 0; i--) out.push(value >>> i & 1);
|
|
1470
|
+
}
|
|
1471
|
+
function getBit(x, i) {
|
|
1472
|
+
return (x >>> i & 1) !== 0;
|
|
1473
|
+
}
|
|
1474
|
+
function numRawDataModules(version) {
|
|
1475
|
+
let result = (16 * version + 128) * version + 64;
|
|
1476
|
+
if (version >= 2) {
|
|
1477
|
+
const numAlign = Math.floor(version / 7) + 2;
|
|
1478
|
+
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
1479
|
+
if (version >= 7) result -= 36;
|
|
1480
|
+
}
|
|
1481
|
+
return result;
|
|
1482
|
+
}
|
|
1483
|
+
function numDataCodewords(version, ecl) {
|
|
1484
|
+
const e = ECL_ORDINAL[ecl];
|
|
1485
|
+
return Math.floor(numRawDataModules(version) / 8) - ECC_CODEWORDS_PER_BLOCK[e][version] * NUM_ERROR_CORRECTION_BLOCKS[e][version];
|
|
1486
|
+
}
|
|
1487
|
+
function addEccAndInterleave(data, version, ecl) {
|
|
1488
|
+
const e = ECL_ORDINAL[ecl];
|
|
1489
|
+
const numBlocks = NUM_ERROR_CORRECTION_BLOCKS[e][version];
|
|
1490
|
+
const blockEccLen = ECC_CODEWORDS_PER_BLOCK[e][version];
|
|
1491
|
+
const rawCodewords = Math.floor(numRawDataModules(version) / 8);
|
|
1492
|
+
const numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
|
1493
|
+
const shortBlockLen = Math.floor(rawCodewords / numBlocks);
|
|
1494
|
+
const divisor = reedSolomonDivisor(blockEccLen);
|
|
1495
|
+
const blocks = [];
|
|
1496
|
+
for (let i = 0, k = 0; i < numBlocks; i++) {
|
|
1497
|
+
const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
|
|
1498
|
+
k += dat.length;
|
|
1499
|
+
const ecc = reedSolomonRemainder(dat, divisor);
|
|
1500
|
+
if (i < numShortBlocks) dat.push(0);
|
|
1501
|
+
blocks.push(dat.concat(ecc));
|
|
1502
|
+
}
|
|
1503
|
+
const result = [];
|
|
1504
|
+
for (let i = 0; i < blocks[0].length; i++) blocks.forEach((block, j) => {
|
|
1505
|
+
if (i !== shortBlockLen - blockEccLen || j >= numShortBlocks) result.push(block[i]);
|
|
1506
|
+
});
|
|
1507
|
+
return result;
|
|
1508
|
+
}
|
|
1509
|
+
function reedSolomonDivisor(degree) {
|
|
1510
|
+
const result = new Array(degree).fill(0);
|
|
1511
|
+
result[degree - 1] = 1;
|
|
1512
|
+
let root = 1;
|
|
1513
|
+
for (let i = 0; i < degree; i++) {
|
|
1514
|
+
for (let j = 0; j < result.length; j++) {
|
|
1515
|
+
result[j] = reedSolomonMultiply(result[j], root);
|
|
1516
|
+
if (j + 1 < result.length) result[j] ^= result[j + 1];
|
|
1517
|
+
}
|
|
1518
|
+
root = reedSolomonMultiply(root, 2);
|
|
1519
|
+
}
|
|
1520
|
+
return result;
|
|
1521
|
+
}
|
|
1522
|
+
function reedSolomonRemainder(data, divisor) {
|
|
1523
|
+
const result = divisor.map(() => 0);
|
|
1524
|
+
for (const b of data) {
|
|
1525
|
+
const factor = b ^ result.shift();
|
|
1526
|
+
result.push(0);
|
|
1527
|
+
divisor.forEach((coef, i) => result[i] ^= reedSolomonMultiply(coef, factor));
|
|
1528
|
+
}
|
|
1529
|
+
return result;
|
|
1530
|
+
}
|
|
1531
|
+
function reedSolomonMultiply(x, y) {
|
|
1532
|
+
let z = 0;
|
|
1533
|
+
for (let i = 7; i >= 0; i--) {
|
|
1534
|
+
z = z << 1 ^ (z >>> 7) * 285;
|
|
1535
|
+
z ^= (y >>> i & 1) * x;
|
|
1536
|
+
}
|
|
1537
|
+
return z;
|
|
1538
|
+
}
|
|
1539
|
+
var QrBuilder = class {
|
|
1540
|
+
constructor(version, ecl) {
|
|
1541
|
+
this.version = version;
|
|
1542
|
+
this.ecl = ecl;
|
|
1543
|
+
this.size = version * 4 + 17;
|
|
1544
|
+
this.modules = Array.from({ length: this.size }, () => new Array(this.size).fill(false));
|
|
1545
|
+
this.isFunction = Array.from({ length: this.size }, () => new Array(this.size).fill(false));
|
|
1546
|
+
}
|
|
1547
|
+
drawFunctionPatterns() {
|
|
1548
|
+
for (let i = 0; i < this.size; i++) {
|
|
1549
|
+
this.setFunction(6, i, i % 2 === 0);
|
|
1550
|
+
this.setFunction(i, 6, i % 2 === 0);
|
|
1551
|
+
}
|
|
1552
|
+
this.drawFinderPattern(3, 3);
|
|
1553
|
+
this.drawFinderPattern(this.size - 4, 3);
|
|
1554
|
+
this.drawFinderPattern(3, this.size - 4);
|
|
1555
|
+
const align = this.alignmentPatternPositions();
|
|
1556
|
+
const n = align.length;
|
|
1557
|
+
for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) if (!(i === 0 && j === 0 || i === 0 && j === n - 1 || i === n - 1 && j === 0)) this.drawAlignmentPattern(align[i], align[j]);
|
|
1558
|
+
this.drawFormatBits(0);
|
|
1559
|
+
this.drawVersion();
|
|
1560
|
+
}
|
|
1561
|
+
drawFormatBits(mask) {
|
|
1562
|
+
const data = ECL_FORMAT_BITS[this.ecl] << 3 | mask;
|
|
1563
|
+
let rem = data;
|
|
1564
|
+
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
1565
|
+
const bits = (data << 10 | rem) ^ 21522;
|
|
1566
|
+
for (let i = 0; i <= 5; i++) this.setFunction(8, i, getBit(bits, i));
|
|
1567
|
+
this.setFunction(8, 7, getBit(bits, 6));
|
|
1568
|
+
this.setFunction(8, 8, getBit(bits, 7));
|
|
1569
|
+
this.setFunction(7, 8, getBit(bits, 8));
|
|
1570
|
+
for (let i = 9; i < 15; i++) this.setFunction(14 - i, 8, getBit(bits, i));
|
|
1571
|
+
for (let i = 0; i < 8; i++) this.setFunction(this.size - 1 - i, 8, getBit(bits, i));
|
|
1572
|
+
for (let i = 8; i < 15; i++) this.setFunction(8, this.size - 15 + i, getBit(bits, i));
|
|
1573
|
+
this.setFunction(8, this.size - 8, true);
|
|
1574
|
+
}
|
|
1575
|
+
drawCodewords(data) {
|
|
1576
|
+
let i = 0;
|
|
1577
|
+
for (let right = this.size - 1; right >= 1; right -= 2) {
|
|
1578
|
+
if (right === 6) right = 5;
|
|
1579
|
+
for (let vert = 0; vert < this.size; vert++) for (let j = 0; j < 2; j++) {
|
|
1580
|
+
const x = right - j;
|
|
1581
|
+
const y = (right + 1 & 2) === 0 ? this.size - 1 - vert : vert;
|
|
1582
|
+
if (!this.isFunction[y][x] && i < data.length * 8) {
|
|
1583
|
+
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
|
|
1584
|
+
i++;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
applyMask(mask) {
|
|
1590
|
+
for (let y = 0; y < this.size; y++) for (let x = 0; x < this.size; x++) {
|
|
1591
|
+
let invert;
|
|
1592
|
+
switch (mask) {
|
|
1593
|
+
case 0:
|
|
1594
|
+
invert = (x + y) % 2 === 0;
|
|
1595
|
+
break;
|
|
1596
|
+
case 1:
|
|
1597
|
+
invert = y % 2 === 0;
|
|
1598
|
+
break;
|
|
1599
|
+
case 2:
|
|
1600
|
+
invert = x % 3 === 0;
|
|
1601
|
+
break;
|
|
1602
|
+
case 3:
|
|
1603
|
+
invert = (x + y) % 3 === 0;
|
|
1604
|
+
break;
|
|
1605
|
+
case 4:
|
|
1606
|
+
invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0;
|
|
1607
|
+
break;
|
|
1608
|
+
case 5:
|
|
1609
|
+
invert = x * y % 2 + x * y % 3 === 0;
|
|
1610
|
+
break;
|
|
1611
|
+
case 6:
|
|
1612
|
+
invert = (x * y % 2 + x * y % 3) % 2 === 0;
|
|
1613
|
+
break;
|
|
1614
|
+
default: invert = ((x + y) % 2 + x * y % 3) % 2 === 0;
|
|
1615
|
+
}
|
|
1616
|
+
if (!this.isFunction[y][x] && invert) this.modules[y][x] = !this.modules[y][x];
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
penaltyScore() {
|
|
1620
|
+
let result = 0;
|
|
1621
|
+
const size = this.size;
|
|
1622
|
+
const m = this.modules;
|
|
1623
|
+
for (const horizontal of [true, false]) for (let a = 0; a < size; a++) {
|
|
1624
|
+
let runColor = false;
|
|
1625
|
+
let runLen = 0;
|
|
1626
|
+
const history = [
|
|
1627
|
+
0,
|
|
1628
|
+
0,
|
|
1629
|
+
0,
|
|
1630
|
+
0,
|
|
1631
|
+
0,
|
|
1632
|
+
0,
|
|
1633
|
+
0
|
|
1634
|
+
];
|
|
1635
|
+
for (let b = 0; b < size; b++) {
|
|
1636
|
+
const color = horizontal ? m[a][b] : m[b][a];
|
|
1637
|
+
if (color === runColor) {
|
|
1638
|
+
runLen++;
|
|
1639
|
+
if (runLen === 5) result += PENALTY_N1;
|
|
1640
|
+
else if (runLen > 5) result++;
|
|
1641
|
+
} else {
|
|
1642
|
+
this.finderPenaltyAddHistory(runLen, history);
|
|
1643
|
+
if (!runColor) result += this.finderPenaltyCountPatterns(history) * PENALTY_N3;
|
|
1644
|
+
runColor = color;
|
|
1645
|
+
runLen = 1;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
result += this.finderPenaltyTerminateAndCount(runColor, runLen, history) * PENALTY_N3;
|
|
1649
|
+
}
|
|
1650
|
+
for (let y = 0; y < size - 1; y++) for (let x = 0; x < size - 1; x++) {
|
|
1651
|
+
const c = m[y][x];
|
|
1652
|
+
if (c === m[y][x + 1] && c === m[y + 1][x] && c === m[y + 1][x + 1]) result += PENALTY_N2;
|
|
1653
|
+
}
|
|
1654
|
+
let dark = 0;
|
|
1655
|
+
for (const row of m) for (const c of row) if (c) dark++;
|
|
1656
|
+
const total = size * size;
|
|
1657
|
+
const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
|
|
1658
|
+
result += k * PENALTY_N4;
|
|
1659
|
+
return result;
|
|
1660
|
+
}
|
|
1661
|
+
finderPenaltyCountPatterns(h) {
|
|
1662
|
+
const n = h[1];
|
|
1663
|
+
const core = n > 0 && h[2] === n && h[3] === n * 3 && h[4] === n && h[5] === n;
|
|
1664
|
+
return (core && h[0] >= n * 4 && h[6] >= n ? 1 : 0) + (core && h[6] >= n * 4 && h[0] >= n ? 1 : 0);
|
|
1665
|
+
}
|
|
1666
|
+
finderPenaltyTerminateAndCount(runColor, runLen, history) {
|
|
1667
|
+
if (runColor) {
|
|
1668
|
+
this.finderPenaltyAddHistory(runLen, history);
|
|
1669
|
+
runLen = 0;
|
|
1670
|
+
}
|
|
1671
|
+
runLen += this.size;
|
|
1672
|
+
this.finderPenaltyAddHistory(runLen, history);
|
|
1673
|
+
return this.finderPenaltyCountPatterns(history);
|
|
1674
|
+
}
|
|
1675
|
+
finderPenaltyAddHistory(runLen, history) {
|
|
1676
|
+
if (history[0] === 0) runLen += this.size;
|
|
1677
|
+
history.pop();
|
|
1678
|
+
history.unshift(runLen);
|
|
1679
|
+
}
|
|
1680
|
+
alignmentPatternPositions() {
|
|
1681
|
+
if (this.version === 1) return [];
|
|
1682
|
+
const numAlign = Math.floor(this.version / 7) + 2;
|
|
1683
|
+
const step = Math.floor((this.version * 8 + numAlign * 3 + 5) / (numAlign * 4 - 4)) * 2;
|
|
1684
|
+
const result = [6];
|
|
1685
|
+
for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
|
|
1686
|
+
return result;
|
|
1687
|
+
}
|
|
1688
|
+
drawFinderPattern(x, y) {
|
|
1689
|
+
for (let dy = -4; dy <= 4; dy++) for (let dx = -4; dx <= 4; dx++) {
|
|
1690
|
+
const dist = Math.max(Math.abs(dx), Math.abs(dy));
|
|
1691
|
+
const xx = x + dx;
|
|
1692
|
+
const yy = y + dy;
|
|
1693
|
+
if (xx >= 0 && xx < this.size && yy >= 0 && yy < this.size) this.setFunction(xx, yy, dist !== 2 && dist !== 4);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
drawAlignmentPattern(x, y) {
|
|
1697
|
+
for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) this.setFunction(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
|
|
1698
|
+
}
|
|
1699
|
+
drawVersion() {
|
|
1700
|
+
if (this.version < 7) return;
|
|
1701
|
+
let rem = this.version;
|
|
1702
|
+
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
1703
|
+
const bits = this.version << 12 | rem;
|
|
1704
|
+
for (let i = 0; i < 18; i++) {
|
|
1705
|
+
const bit = getBit(bits, i);
|
|
1706
|
+
const a = this.size - 11 + i % 3;
|
|
1707
|
+
const b = Math.floor(i / 3);
|
|
1708
|
+
this.setFunction(a, b, bit);
|
|
1709
|
+
this.setFunction(b, a, bit);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
setFunction(x, y, dark) {
|
|
1713
|
+
this.modules[y][x] = dark;
|
|
1714
|
+
this.isFunction[y][x] = true;
|
|
1715
|
+
}
|
|
1716
|
+
};
|
|
1717
|
+
const QUIET_ZONE = 4;
|
|
1718
|
+
const DARK = "#1e293b";
|
|
1719
|
+
const LIGHT = "#ffffff";
|
|
1720
|
+
var QrCodeComponent = class QrCodeComponent {
|
|
1721
|
+
constructor() {
|
|
1722
|
+
this.labels = inject(UiLabelsService);
|
|
1723
|
+
this.url = input("", ...ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []);
|
|
1724
|
+
this.size = input(240, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
1725
|
+
this.filename = input("qr-code", ...ngDevMode ? [{ debugName: "filename" }] : /* istanbul ignore next */ []);
|
|
1726
|
+
this.altInput = input(null, {
|
|
1727
|
+
...ngDevMode ? { debugName: "altInput" } : /* istanbul ignore next */ {},
|
|
1728
|
+
alias: "alt"
|
|
1729
|
+
});
|
|
1730
|
+
this.alt = computed(() => this.altInput() ?? this.labels.t("qrCode.alt"), ...ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []);
|
|
1731
|
+
this.isIOS = typeof navigator !== "undefined" && (/iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
1732
|
+
this.qr = computed(() => {
|
|
1733
|
+
const url = this.url();
|
|
1734
|
+
if (!url) return {
|
|
1735
|
+
dataUrl: "",
|
|
1736
|
+
error: false
|
|
1737
|
+
};
|
|
1738
|
+
try {
|
|
1739
|
+
return {
|
|
1740
|
+
dataUrl: renderPng(encodeQr(url), this.size() * 2),
|
|
1741
|
+
error: false
|
|
1742
|
+
};
|
|
1743
|
+
} catch {
|
|
1744
|
+
return {
|
|
1745
|
+
dataUrl: "",
|
|
1746
|
+
error: true
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
}, ...ngDevMode ? [{ debugName: "qr" }] : /* istanbul ignore next */ []);
|
|
1750
|
+
}
|
|
1751
|
+
download() {
|
|
1752
|
+
const dataUrl = this.qr().dataUrl;
|
|
1753
|
+
if (!dataUrl) return;
|
|
1754
|
+
try {
|
|
1755
|
+
const [header, b64] = dataUrl.split(",");
|
|
1756
|
+
const mime = header.match(/:(.*?);/)?.[1] ?? "image/png";
|
|
1757
|
+
const bytes = atob(b64);
|
|
1758
|
+
const arr = new Uint8Array(bytes.length);
|
|
1759
|
+
for (let i = 0; i < bytes.length; i++) arr[i] = bytes.charCodeAt(i);
|
|
1760
|
+
const blobUrl = URL.createObjectURL(new Blob([arr], { type: mime }));
|
|
1761
|
+
const a = document.createElement("a");
|
|
1762
|
+
a.href = blobUrl;
|
|
1763
|
+
a.download = `${this.filename()}.png`;
|
|
1764
|
+
document.body.appendChild(a);
|
|
1765
|
+
a.click();
|
|
1766
|
+
document.body.removeChild(a);
|
|
1767
|
+
setTimeout(() => URL.revokeObjectURL(blobUrl), 1e3);
|
|
1768
|
+
} catch {
|
|
1769
|
+
window.open(dataUrl, "_blank", "noopener");
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
static {
|
|
1773
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1774
|
+
minVersion: "12.0.0",
|
|
1775
|
+
version: "22.2.2",
|
|
1776
|
+
ngImport: i0,
|
|
1777
|
+
type: QrCodeComponent,
|
|
1778
|
+
deps: [],
|
|
1779
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
static {
|
|
1783
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1784
|
+
minVersion: "17.0.0",
|
|
1785
|
+
version: "22.2.2",
|
|
1786
|
+
type: QrCodeComponent,
|
|
1787
|
+
isStandalone: true,
|
|
1788
|
+
selector: "ui-qr-code",
|
|
1789
|
+
inputs: {
|
|
1790
|
+
url: {
|
|
1791
|
+
classPropertyName: "url",
|
|
1792
|
+
publicName: "url",
|
|
1793
|
+
isSignal: true,
|
|
1794
|
+
isRequired: false,
|
|
1795
|
+
transformFunction: null
|
|
1796
|
+
},
|
|
1797
|
+
size: {
|
|
1798
|
+
classPropertyName: "size",
|
|
1799
|
+
publicName: "size",
|
|
1800
|
+
isSignal: true,
|
|
1801
|
+
isRequired: false,
|
|
1802
|
+
transformFunction: null
|
|
1803
|
+
},
|
|
1804
|
+
filename: {
|
|
1805
|
+
classPropertyName: "filename",
|
|
1806
|
+
publicName: "filename",
|
|
1807
|
+
isSignal: true,
|
|
1808
|
+
isRequired: false,
|
|
1809
|
+
transformFunction: null
|
|
1810
|
+
},
|
|
1811
|
+
altInput: {
|
|
1812
|
+
classPropertyName: "altInput",
|
|
1813
|
+
publicName: "alt",
|
|
1814
|
+
isSignal: true,
|
|
1815
|
+
isRequired: false,
|
|
1816
|
+
transformFunction: null
|
|
1817
|
+
}
|
|
1818
|
+
},
|
|
1819
|
+
ngImport: i0,
|
|
1820
|
+
template: `
|
|
1821
|
+
<div class="qr-box">
|
|
1822
|
+
@if (qr().error) {
|
|
1823
|
+
<div class="qr-error" role="alert">
|
|
1824
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
1825
|
+
<span>{{ labels.t('qrCode.qrCodeUnavailableCopyThe') }}</span>
|
|
1826
|
+
</div>
|
|
1827
|
+
} @else if (qr().dataUrl) {
|
|
1828
|
+
<img
|
|
1829
|
+
[src]="qr().dataUrl"
|
|
1830
|
+
[width]="size()"
|
|
1831
|
+
[height]="size()"
|
|
1832
|
+
[alt]="alt()"
|
|
1833
|
+
class="qr-img"
|
|
1834
|
+
/>
|
|
1835
|
+
@if (isIOS) {
|
|
1836
|
+
<p class="qr-ios-hint">{{ labels.t('qrCode.longPressTheImageAbove') }}</p>
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
<div class="qr-actions">
|
|
1840
|
+
@if (!isIOS) {
|
|
1841
|
+
<ui-button variant="secondary" size="sm" [disabled]="!qr().dataUrl" (click)="download()">
|
|
1842
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1843
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
1844
|
+
<polyline points="7 10 12 15 17 10"/>
|
|
1845
|
+
<line x1="12" y1="15" x2="12" y2="3"/>
|
|
1846
|
+
</svg>{{ labels.t('qrCode.downloadQrCode') }}</ui-button>
|
|
1847
|
+
}
|
|
1848
|
+
<ng-content />
|
|
1849
|
+
</div>
|
|
1850
|
+
</div>
|
|
1851
|
+
`,
|
|
1852
|
+
isInline: true,
|
|
1853
|
+
styles: [".qr-box{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px}.qr-img{display:block;border-radius:8px;max-width:100%;height:auto;image-rendering:pixelated}.qr-error{display:flex;align-items:flex-start;gap:8px;padding:12px 14px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;width:100%;box-sizing:border-box}.qr-error span{font-size:.8125rem;color:#dc2626;line-height:1.5}.qr-error svg{flex-shrink:0;margin-top:1px}.qr-ios-hint{font-size:.75rem;color:#94a3b8;margin:0;text-align:center}.qr-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}\n"],
|
|
1854
|
+
dependencies: [{
|
|
1855
|
+
kind: "component",
|
|
1856
|
+
type: ButtonComponent,
|
|
1857
|
+
selector: "ui-button",
|
|
1858
|
+
inputs: [
|
|
1859
|
+
"variant",
|
|
1860
|
+
"routerLink",
|
|
1861
|
+
"queryParams",
|
|
1862
|
+
"fragment",
|
|
1863
|
+
"state",
|
|
1864
|
+
"href",
|
|
1865
|
+
"target",
|
|
1866
|
+
"rel",
|
|
1867
|
+
"shortLabel",
|
|
1868
|
+
"shortBelow",
|
|
1869
|
+
"color",
|
|
1870
|
+
"active",
|
|
1871
|
+
"size",
|
|
1872
|
+
"type",
|
|
1873
|
+
"disabled",
|
|
1874
|
+
"loading",
|
|
1875
|
+
"fullWidth",
|
|
1876
|
+
"ariaLabel",
|
|
1877
|
+
"ariaExpanded",
|
|
1878
|
+
"ariaPressed",
|
|
1879
|
+
"ariaDescribedBy",
|
|
1880
|
+
"modal-footer-left",
|
|
1881
|
+
"modal-footer-right"
|
|
1882
|
+
]
|
|
1883
|
+
}],
|
|
1884
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1889
|
+
minVersion: "12.0.0",
|
|
1890
|
+
version: "22.2.2",
|
|
1891
|
+
ngImport: i0,
|
|
1892
|
+
type: QrCodeComponent,
|
|
1893
|
+
decorators: [{
|
|
1894
|
+
type: Component,
|
|
1895
|
+
args: [{
|
|
1896
|
+
selector: "ui-qr-code",
|
|
1897
|
+
standalone: true,
|
|
1898
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1899
|
+
imports: [ButtonComponent],
|
|
1900
|
+
template: `
|
|
1901
|
+
<div class="qr-box">
|
|
1902
|
+
@if (qr().error) {
|
|
1903
|
+
<div class="qr-error" role="alert">
|
|
1904
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
|
|
1905
|
+
<span>{{ labels.t('qrCode.qrCodeUnavailableCopyThe') }}</span>
|
|
1906
|
+
</div>
|
|
1907
|
+
} @else if (qr().dataUrl) {
|
|
1908
|
+
<img
|
|
1909
|
+
[src]="qr().dataUrl"
|
|
1910
|
+
[width]="size()"
|
|
1911
|
+
[height]="size()"
|
|
1912
|
+
[alt]="alt()"
|
|
1913
|
+
class="qr-img"
|
|
1914
|
+
/>
|
|
1915
|
+
@if (isIOS) {
|
|
1916
|
+
<p class="qr-ios-hint">{{ labels.t('qrCode.longPressTheImageAbove') }}</p>
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
<div class="qr-actions">
|
|
1920
|
+
@if (!isIOS) {
|
|
1921
|
+
<ui-button variant="secondary" size="sm" [disabled]="!qr().dataUrl" (click)="download()">
|
|
1922
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1923
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
1924
|
+
<polyline points="7 10 12 15 17 10"/>
|
|
1925
|
+
<line x1="12" y1="15" x2="12" y2="3"/>
|
|
1926
|
+
</svg>{{ labels.t('qrCode.downloadQrCode') }}</ui-button>
|
|
1927
|
+
}
|
|
1928
|
+
<ng-content />
|
|
1929
|
+
</div>
|
|
1930
|
+
</div>
|
|
1931
|
+
`,
|
|
1932
|
+
styles: [".qr-box{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px}.qr-img{display:block;border-radius:8px;max-width:100%;height:auto;image-rendering:pixelated}.qr-error{display:flex;align-items:flex-start;gap:8px;padding:12px 14px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;width:100%;box-sizing:border-box}.qr-error span{font-size:.8125rem;color:#dc2626;line-height:1.5}.qr-error svg{flex-shrink:0;margin-top:1px}.qr-ios-hint{font-size:.75rem;color:#94a3b8;margin:0;text-align:center}.qr-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}\n"]
|
|
1933
|
+
}]
|
|
1934
|
+
}],
|
|
1935
|
+
propDecorators: {
|
|
1936
|
+
url: [{
|
|
1937
|
+
type: i0.Input,
|
|
1938
|
+
args: [{
|
|
1939
|
+
isSignal: true,
|
|
1940
|
+
alias: "url",
|
|
1941
|
+
required: false
|
|
1942
|
+
}]
|
|
1943
|
+
}],
|
|
1944
|
+
size: [{
|
|
1945
|
+
type: i0.Input,
|
|
1946
|
+
args: [{
|
|
1947
|
+
isSignal: true,
|
|
1948
|
+
alias: "size",
|
|
1949
|
+
required: false
|
|
1950
|
+
}]
|
|
1951
|
+
}],
|
|
1952
|
+
filename: [{
|
|
1953
|
+
type: i0.Input,
|
|
1954
|
+
args: [{
|
|
1955
|
+
isSignal: true,
|
|
1956
|
+
alias: "filename",
|
|
1957
|
+
required: false
|
|
1958
|
+
}]
|
|
1959
|
+
}],
|
|
1960
|
+
altInput: [{
|
|
1961
|
+
type: i0.Input,
|
|
1962
|
+
args: [{
|
|
1963
|
+
isSignal: true,
|
|
1964
|
+
alias: "alt",
|
|
1965
|
+
required: false
|
|
1966
|
+
}]
|
|
1967
|
+
}]
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1970
|
+
function renderPng(qr, targetPx) {
|
|
1971
|
+
const count = qr.size + 8;
|
|
1972
|
+
const scale = Math.max(1, Math.floor(targetPx / count));
|
|
1973
|
+
const canvas = document.createElement("canvas");
|
|
1974
|
+
canvas.width = canvas.height = count * scale;
|
|
1975
|
+
const ctx = canvas.getContext("2d");
|
|
1976
|
+
if (!ctx) throw new Error("Canvas 2D context unavailable.");
|
|
1977
|
+
ctx.fillStyle = LIGHT;
|
|
1978
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
1979
|
+
ctx.fillStyle = DARK;
|
|
1980
|
+
for (let y = 0; y < qr.size; y++) for (let x = 0; x < qr.size; x++) if (qr.modules[y][x]) ctx.fillRect((x + QUIET_ZONE) * scale, (y + QUIET_ZONE) * scale, scale, scale);
|
|
1981
|
+
return canvas.toDataURL("image/png");
|
|
1982
|
+
}
|
|
1983
|
+
var TourComponent = class TourComponent {
|
|
1984
|
+
constructor() {
|
|
1985
|
+
this.labels = inject(UiLabelsService);
|
|
1986
|
+
this.steps = input.required(...ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []);
|
|
1987
|
+
this.open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
1988
|
+
this.index = model(0, ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
|
|
1989
|
+
this.skipLabelInput = input(null, {
|
|
1990
|
+
...ngDevMode ? { debugName: "skipLabelInput" } : /* istanbul ignore next */ {},
|
|
1991
|
+
alias: "skipLabel"
|
|
1992
|
+
});
|
|
1993
|
+
this.skipLabel = computed(() => this.skipLabelInput() ?? this.labels.t("tour.skipLabel"), ...ngDevMode ? [{ debugName: "skipLabel" }] : /* istanbul ignore next */ []);
|
|
1994
|
+
this.previousLabelInput = input(null, {
|
|
1995
|
+
...ngDevMode ? { debugName: "previousLabelInput" } : /* istanbul ignore next */ {},
|
|
1996
|
+
alias: "previousLabel"
|
|
1997
|
+
});
|
|
1998
|
+
this.previousLabel = computed(() => this.previousLabelInput() ?? this.labels.t("tour.previousLabel"), ...ngDevMode ? [{ debugName: "previousLabel" }] : /* istanbul ignore next */ []);
|
|
1999
|
+
this.nextLabelInput = input(null, {
|
|
2000
|
+
...ngDevMode ? { debugName: "nextLabelInput" } : /* istanbul ignore next */ {},
|
|
2001
|
+
alias: "nextLabel"
|
|
2002
|
+
});
|
|
2003
|
+
this.nextLabel = computed(() => this.nextLabelInput() ?? this.labels.t("tour.nextLabel"), ...ngDevMode ? [{ debugName: "nextLabel" }] : /* istanbul ignore next */ []);
|
|
2004
|
+
this.finishLabelInput = input(null, {
|
|
2005
|
+
...ngDevMode ? { debugName: "finishLabelInput" } : /* istanbul ignore next */ {},
|
|
2006
|
+
alias: "finishLabel"
|
|
2007
|
+
});
|
|
2008
|
+
this.finishLabel = computed(() => this.finishLabelInput() ?? this.labels.t("tour.finishLabel"), ...ngDevMode ? [{ debugName: "finishLabel" }] : /* istanbul ignore next */ []);
|
|
2009
|
+
this.progressLabelInput = input(null, {
|
|
2010
|
+
...ngDevMode ? { debugName: "progressLabelInput" } : /* istanbul ignore next */ {},
|
|
2011
|
+
alias: "progressLabel"
|
|
2012
|
+
});
|
|
2013
|
+
this.progressLabel = computed(() => this.progressLabelInput() ?? this.labels.t("tour.progressLabel"), ...ngDevMode ? [{ debugName: "progressLabel" }] : /* istanbul ignore next */ []);
|
|
2014
|
+
this.finished = output();
|
|
2015
|
+
this.skipped = output();
|
|
2016
|
+
this.tooltip = viewChild("tooltip", ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
2017
|
+
this.spotlight = signal({
|
|
2018
|
+
top: -9999,
|
|
2019
|
+
left: -9999,
|
|
2020
|
+
width: 0,
|
|
2021
|
+
height: 0
|
|
2022
|
+
}, ...ngDevMode ? [{ debugName: "spotlight" }] : /* istanbul ignore next */ []);
|
|
2023
|
+
this.place = signal({
|
|
2024
|
+
top: "50%",
|
|
2025
|
+
left: "calc(50% - 160px)"
|
|
2026
|
+
}, ...ngDevMode ? [{ debugName: "place" }] : /* istanbul ignore next */ []);
|
|
2027
|
+
this.side = signal("bottom", ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
|
|
2028
|
+
this.step = computed(() => this.steps()[this.index()] ?? null, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
|
|
2029
|
+
this.isLast = computed(() => this.index() >= this.steps().length - 1, ...ngDevMode ? [{ debugName: "isLast" }] : /* istanbul ignore next */ []);
|
|
2030
|
+
this.progressText = computed(() => this.progressLabel().replace("{n}", String(this.index() + 1)).replace("{total}", String(this.steps().length)), ...ngDevMode ? [{ debugName: "progressText" }] : /* istanbul ignore next */ []);
|
|
2031
|
+
effect(() => {
|
|
2032
|
+
const s = this.open() ? this.step() : null;
|
|
2033
|
+
if (!s) return;
|
|
2034
|
+
this.position(s);
|
|
2035
|
+
});
|
|
2036
|
+
effect(() => {
|
|
2037
|
+
if (this.open() && this.tooltip()) queueMicrotask(() => this.tooltip()?.nativeElement.focus());
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
next() {
|
|
2041
|
+
if (!this.open()) return;
|
|
2042
|
+
if (this.isLast()) {
|
|
2043
|
+
this.close();
|
|
2044
|
+
this.finished.emit();
|
|
2045
|
+
} else this.index.update((i) => i + 1);
|
|
2046
|
+
}
|
|
2047
|
+
previous() {
|
|
2048
|
+
if (this.open() && this.index() > 0) this.index.update((i) => i - 1);
|
|
2049
|
+
}
|
|
2050
|
+
skip() {
|
|
2051
|
+
if (!this.open()) return;
|
|
2052
|
+
this.close();
|
|
2053
|
+
this.skipped.emit();
|
|
2054
|
+
}
|
|
2055
|
+
onKeydown(e) {
|
|
2056
|
+
if (!this.open()) return;
|
|
2057
|
+
if (e.key === "Escape") {
|
|
2058
|
+
this.skip();
|
|
2059
|
+
e.preventDefault();
|
|
2060
|
+
} else if (e.key === "ArrowRight") {
|
|
2061
|
+
this.next();
|
|
2062
|
+
e.preventDefault();
|
|
2063
|
+
} else if (e.key === "ArrowLeft") {
|
|
2064
|
+
this.previous();
|
|
2065
|
+
e.preventDefault();
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
onResize() {
|
|
2069
|
+
const s = this.open() ? this.step() : null;
|
|
2070
|
+
if (s) this.position(s);
|
|
2071
|
+
}
|
|
2072
|
+
close() {
|
|
2073
|
+
this.open.set(false);
|
|
2074
|
+
this.index.set(0);
|
|
2075
|
+
}
|
|
2076
|
+
findTarget(selector) {
|
|
2077
|
+
for (const part of selector.split(",").map((p) => p.trim())) try {
|
|
2078
|
+
const el = document.querySelector(part);
|
|
2079
|
+
if (el) return el;
|
|
2080
|
+
} catch {}
|
|
2081
|
+
return null;
|
|
2082
|
+
}
|
|
2083
|
+
position(step) {
|
|
2084
|
+
const el = this.findTarget(step.target);
|
|
2085
|
+
if (!el) {
|
|
2086
|
+
this.spotlight.set({
|
|
2087
|
+
top: -9999,
|
|
2088
|
+
left: -9999,
|
|
2089
|
+
width: 0,
|
|
2090
|
+
height: 0
|
|
2091
|
+
});
|
|
2092
|
+
this.place.set({
|
|
2093
|
+
top: "50%",
|
|
2094
|
+
left: "calc(50% - 160px)"
|
|
2095
|
+
});
|
|
2096
|
+
this.side.set("bottom");
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
el.scrollIntoView?.({ block: "nearest" });
|
|
2100
|
+
const r = el.getBoundingClientRect();
|
|
2101
|
+
const pad = 8;
|
|
2102
|
+
this.spotlight.set({
|
|
2103
|
+
top: r.top - pad,
|
|
2104
|
+
left: r.left - pad,
|
|
2105
|
+
width: r.width + 16,
|
|
2106
|
+
height: r.height + 16
|
|
2107
|
+
});
|
|
2108
|
+
const side = this.chooseSide(r, step.position);
|
|
2109
|
+
this.side.set(side);
|
|
2110
|
+
this.place.set(this.placement(r, side));
|
|
2111
|
+
}
|
|
2112
|
+
chooseSide(r, preferred) {
|
|
2113
|
+
const room = {
|
|
2114
|
+
top: r.top > 196,
|
|
2115
|
+
bottom: window.innerHeight - r.bottom > 196,
|
|
2116
|
+
left: r.left > 356,
|
|
2117
|
+
right: window.innerWidth - r.right > 356
|
|
2118
|
+
};
|
|
2119
|
+
if (preferred && room[preferred]) return preferred;
|
|
2120
|
+
return [
|
|
2121
|
+
"bottom",
|
|
2122
|
+
"top",
|
|
2123
|
+
"right",
|
|
2124
|
+
"left"
|
|
2125
|
+
].find((s) => room[s]) ?? "bottom";
|
|
2126
|
+
}
|
|
2127
|
+
placement(r, side) {
|
|
2128
|
+
const gap = 14, w = 320;
|
|
2129
|
+
const centred = Math.max(16, Math.min(r.left + r.width / 2 - w / 2, window.innerWidth - w - 16));
|
|
2130
|
+
switch (side) {
|
|
2131
|
+
case "bottom": return {
|
|
2132
|
+
top: `${r.bottom + gap}px`,
|
|
2133
|
+
left: `${centred}px`
|
|
2134
|
+
};
|
|
2135
|
+
case "top": return {
|
|
2136
|
+
top: `${r.top - gap}px`,
|
|
2137
|
+
left: `${centred}px`
|
|
2138
|
+
};
|
|
2139
|
+
case "right": return {
|
|
2140
|
+
top: `${r.top + r.height / 2 - 90}px`,
|
|
2141
|
+
left: `${r.right + gap}px`
|
|
2142
|
+
};
|
|
2143
|
+
case "left": return {
|
|
2144
|
+
top: `${r.top + r.height / 2 - 90}px`,
|
|
2145
|
+
left: `${r.left - w - gap}px`
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
static {
|
|
2150
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
2151
|
+
minVersion: "12.0.0",
|
|
2152
|
+
version: "22.2.2",
|
|
2153
|
+
ngImport: i0,
|
|
2154
|
+
type: TourComponent,
|
|
2155
|
+
deps: [],
|
|
2156
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
static {
|
|
2160
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2161
|
+
minVersion: "17.0.0",
|
|
2162
|
+
version: "22.2.2",
|
|
2163
|
+
type: TourComponent,
|
|
2164
|
+
isStandalone: true,
|
|
2165
|
+
selector: "ui-tour",
|
|
2166
|
+
inputs: {
|
|
2167
|
+
steps: {
|
|
2168
|
+
classPropertyName: "steps",
|
|
2169
|
+
publicName: "steps",
|
|
2170
|
+
isSignal: true,
|
|
2171
|
+
isRequired: true,
|
|
2172
|
+
transformFunction: null
|
|
2173
|
+
},
|
|
2174
|
+
open: {
|
|
2175
|
+
classPropertyName: "open",
|
|
2176
|
+
publicName: "open",
|
|
2177
|
+
isSignal: true,
|
|
2178
|
+
isRequired: false,
|
|
2179
|
+
transformFunction: null
|
|
2180
|
+
},
|
|
2181
|
+
index: {
|
|
2182
|
+
classPropertyName: "index",
|
|
2183
|
+
publicName: "index",
|
|
2184
|
+
isSignal: true,
|
|
2185
|
+
isRequired: false,
|
|
2186
|
+
transformFunction: null
|
|
2187
|
+
},
|
|
2188
|
+
skipLabelInput: {
|
|
2189
|
+
classPropertyName: "skipLabelInput",
|
|
2190
|
+
publicName: "skipLabel",
|
|
2191
|
+
isSignal: true,
|
|
2192
|
+
isRequired: false,
|
|
2193
|
+
transformFunction: null
|
|
2194
|
+
},
|
|
2195
|
+
previousLabelInput: {
|
|
2196
|
+
classPropertyName: "previousLabelInput",
|
|
2197
|
+
publicName: "previousLabel",
|
|
2198
|
+
isSignal: true,
|
|
2199
|
+
isRequired: false,
|
|
2200
|
+
transformFunction: null
|
|
2201
|
+
},
|
|
2202
|
+
nextLabelInput: {
|
|
2203
|
+
classPropertyName: "nextLabelInput",
|
|
2204
|
+
publicName: "nextLabel",
|
|
2205
|
+
isSignal: true,
|
|
2206
|
+
isRequired: false,
|
|
2207
|
+
transformFunction: null
|
|
2208
|
+
},
|
|
2209
|
+
finishLabelInput: {
|
|
2210
|
+
classPropertyName: "finishLabelInput",
|
|
2211
|
+
publicName: "finishLabel",
|
|
2212
|
+
isSignal: true,
|
|
2213
|
+
isRequired: false,
|
|
2214
|
+
transformFunction: null
|
|
2215
|
+
},
|
|
2216
|
+
progressLabelInput: {
|
|
2217
|
+
classPropertyName: "progressLabelInput",
|
|
2218
|
+
publicName: "progressLabel",
|
|
2219
|
+
isSignal: true,
|
|
2220
|
+
isRequired: false,
|
|
2221
|
+
transformFunction: null
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
outputs: {
|
|
2225
|
+
open: "openChange",
|
|
2226
|
+
index: "indexChange",
|
|
2227
|
+
finished: "finished",
|
|
2228
|
+
skipped: "skipped"
|
|
2229
|
+
},
|
|
2230
|
+
host: { listeners: {
|
|
2231
|
+
"window:keydown": "onKeydown($event)",
|
|
2232
|
+
"window:resize": "onResize()"
|
|
2233
|
+
} },
|
|
2234
|
+
viewQueries: [{
|
|
2235
|
+
propertyName: "tooltip",
|
|
2236
|
+
first: true,
|
|
2237
|
+
predicate: ["tooltip"],
|
|
2238
|
+
descendants: true,
|
|
2239
|
+
isSignal: true
|
|
2240
|
+
}],
|
|
2241
|
+
ngImport: i0,
|
|
2242
|
+
template: `
|
|
2243
|
+
@if (open() && step(); as s) {
|
|
2244
|
+
<div class="spotlight" data-testid="tour-spotlight" aria-hidden="true"
|
|
2245
|
+
[style.top.px]="spotlight().top" [style.left.px]="spotlight().left" [style.width.px]="spotlight().width" [style.height.px]="spotlight().height"
|
|
2246
|
+
(click)="skip()"></div>
|
|
2247
|
+
<div #tooltip class="tooltip" role="dialog" aria-modal="true" tabindex="-1" data-testid="tour-tooltip"
|
|
2248
|
+
[attr.aria-label]="s.title" [attr.data-side]="side()"
|
|
2249
|
+
[style.top]="place().top" [style.left]="place().left" [style.transform]="side() === 'top' ? 'translateY(-100%)' : 'none'"
|
|
2250
|
+
(click)="$event.stopPropagation()">
|
|
2251
|
+
<h4 class="title" data-testid="tour-title">{{ s.title }}</h4>
|
|
2252
|
+
<p class="description" data-testid="tour-description">{{ s.description }}</p>
|
|
2253
|
+
<div class="footer">
|
|
2254
|
+
<span class="progress" data-testid="tour-progress">{{ progressText() }}</span>
|
|
2255
|
+
<span class="actions">
|
|
2256
|
+
<ui-button variant="ghost" size="sm" data-testid="tour-skip" (click)="skip()">{{ skipLabel() }}</ui-button>
|
|
2257
|
+
<ui-button variant="secondary" size="sm" data-testid="tour-prev" [disabled]="index() === 0" (click)="previous()">{{ previousLabel() }}</ui-button>
|
|
2258
|
+
<ui-button variant="primary" size="sm" data-testid="tour-next" (click)="next()">{{ isLast() ? finishLabel() : nextLabel() }}</ui-button>
|
|
2259
|
+
</span>
|
|
2260
|
+
</div>
|
|
2261
|
+
</div>
|
|
2262
|
+
}
|
|
2263
|
+
`,
|
|
2264
|
+
isInline: true,
|
|
2265
|
+
styles: [".spotlight{position:fixed;z-index:9999;border-radius:6px;box-shadow:0 0 0 9999px #00000080;cursor:pointer;transition:top .3s ease,left .3s ease,width .3s ease,height .3s ease}.tooltip{position:fixed;z-index:10000;width:320px;max-width:calc(100vw - 32px);box-sizing:border-box;padding:16px;background:#fff;color:#0f172a;border-radius:10px;box-shadow:0 8px 30px #00000040;outline:none}.title{margin:0 0 6px;font-size:1rem}.description{margin:0 0 12px;font-size:.875rem;line-height:1.45;color:#334155}.footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.progress{font-size:.75rem;color:#475569}.actions{display:flex;gap:4px}@media(prefers-reduced-motion:reduce){.spotlight{transition:none}}\n"],
|
|
2266
|
+
dependencies: [{
|
|
2267
|
+
kind: "component",
|
|
2268
|
+
type: ButtonComponent,
|
|
2269
|
+
selector: "ui-button",
|
|
2270
|
+
inputs: [
|
|
2271
|
+
"variant",
|
|
2272
|
+
"routerLink",
|
|
2273
|
+
"queryParams",
|
|
2274
|
+
"fragment",
|
|
2275
|
+
"state",
|
|
2276
|
+
"href",
|
|
2277
|
+
"target",
|
|
2278
|
+
"rel",
|
|
2279
|
+
"shortLabel",
|
|
2280
|
+
"shortBelow",
|
|
2281
|
+
"color",
|
|
2282
|
+
"active",
|
|
2283
|
+
"size",
|
|
2284
|
+
"type",
|
|
2285
|
+
"disabled",
|
|
2286
|
+
"loading",
|
|
2287
|
+
"fullWidth",
|
|
2288
|
+
"ariaLabel",
|
|
2289
|
+
"ariaExpanded",
|
|
2290
|
+
"ariaPressed",
|
|
2291
|
+
"ariaDescribedBy",
|
|
2292
|
+
"modal-footer-left",
|
|
2293
|
+
"modal-footer-right"
|
|
2294
|
+
]
|
|
2295
|
+
}],
|
|
2296
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2301
|
+
minVersion: "12.0.0",
|
|
2302
|
+
version: "22.2.2",
|
|
2303
|
+
ngImport: i0,
|
|
2304
|
+
type: TourComponent,
|
|
2305
|
+
decorators: [{
|
|
2306
|
+
type: Component,
|
|
2307
|
+
args: [{
|
|
2308
|
+
selector: "ui-tour",
|
|
2309
|
+
standalone: true,
|
|
2310
|
+
imports: [ButtonComponent],
|
|
2311
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2312
|
+
template: `
|
|
2313
|
+
@if (open() && step(); as s) {
|
|
2314
|
+
<div class="spotlight" data-testid="tour-spotlight" aria-hidden="true"
|
|
2315
|
+
[style.top.px]="spotlight().top" [style.left.px]="spotlight().left" [style.width.px]="spotlight().width" [style.height.px]="spotlight().height"
|
|
2316
|
+
(click)="skip()"></div>
|
|
2317
|
+
<div #tooltip class="tooltip" role="dialog" aria-modal="true" tabindex="-1" data-testid="tour-tooltip"
|
|
2318
|
+
[attr.aria-label]="s.title" [attr.data-side]="side()"
|
|
2319
|
+
[style.top]="place().top" [style.left]="place().left" [style.transform]="side() === 'top' ? 'translateY(-100%)' : 'none'"
|
|
2320
|
+
(click)="$event.stopPropagation()">
|
|
2321
|
+
<h4 class="title" data-testid="tour-title">{{ s.title }}</h4>
|
|
2322
|
+
<p class="description" data-testid="tour-description">{{ s.description }}</p>
|
|
2323
|
+
<div class="footer">
|
|
2324
|
+
<span class="progress" data-testid="tour-progress">{{ progressText() }}</span>
|
|
2325
|
+
<span class="actions">
|
|
2326
|
+
<ui-button variant="ghost" size="sm" data-testid="tour-skip" (click)="skip()">{{ skipLabel() }}</ui-button>
|
|
2327
|
+
<ui-button variant="secondary" size="sm" data-testid="tour-prev" [disabled]="index() === 0" (click)="previous()">{{ previousLabel() }}</ui-button>
|
|
2328
|
+
<ui-button variant="primary" size="sm" data-testid="tour-next" (click)="next()">{{ isLast() ? finishLabel() : nextLabel() }}</ui-button>
|
|
2329
|
+
</span>
|
|
2330
|
+
</div>
|
|
2331
|
+
</div>
|
|
2332
|
+
}
|
|
2333
|
+
`,
|
|
2334
|
+
styles: [".spotlight{position:fixed;z-index:9999;border-radius:6px;box-shadow:0 0 0 9999px #00000080;cursor:pointer;transition:top .3s ease,left .3s ease,width .3s ease,height .3s ease}.tooltip{position:fixed;z-index:10000;width:320px;max-width:calc(100vw - 32px);box-sizing:border-box;padding:16px;background:#fff;color:#0f172a;border-radius:10px;box-shadow:0 8px 30px #00000040;outline:none}.title{margin:0 0 6px;font-size:1rem}.description{margin:0 0 12px;font-size:.875rem;line-height:1.45;color:#334155}.footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}.progress{font-size:.75rem;color:#475569}.actions{display:flex;gap:4px}@media(prefers-reduced-motion:reduce){.spotlight{transition:none}}\n"]
|
|
2335
|
+
}]
|
|
2336
|
+
}],
|
|
2337
|
+
ctorParameters: () => [],
|
|
2338
|
+
propDecorators: {
|
|
2339
|
+
steps: [{
|
|
2340
|
+
type: i0.Input,
|
|
2341
|
+
args: [{
|
|
2342
|
+
isSignal: true,
|
|
2343
|
+
alias: "steps",
|
|
2344
|
+
required: true
|
|
2345
|
+
}]
|
|
2346
|
+
}],
|
|
2347
|
+
open: [{
|
|
2348
|
+
type: i0.Input,
|
|
2349
|
+
args: [{
|
|
2350
|
+
isSignal: true,
|
|
2351
|
+
alias: "open",
|
|
2352
|
+
required: false
|
|
2353
|
+
}]
|
|
2354
|
+
}, {
|
|
2355
|
+
type: i0.Output,
|
|
2356
|
+
args: ["openChange"]
|
|
2357
|
+
}],
|
|
2358
|
+
index: [{
|
|
2359
|
+
type: i0.Input,
|
|
2360
|
+
args: [{
|
|
2361
|
+
isSignal: true,
|
|
2362
|
+
alias: "index",
|
|
2363
|
+
required: false
|
|
2364
|
+
}]
|
|
2365
|
+
}, {
|
|
2366
|
+
type: i0.Output,
|
|
2367
|
+
args: ["indexChange"]
|
|
2368
|
+
}],
|
|
2369
|
+
skipLabelInput: [{
|
|
2370
|
+
type: i0.Input,
|
|
2371
|
+
args: [{
|
|
2372
|
+
isSignal: true,
|
|
2373
|
+
alias: "skipLabel",
|
|
2374
|
+
required: false
|
|
2375
|
+
}]
|
|
2376
|
+
}],
|
|
2377
|
+
previousLabelInput: [{
|
|
2378
|
+
type: i0.Input,
|
|
2379
|
+
args: [{
|
|
2380
|
+
isSignal: true,
|
|
2381
|
+
alias: "previousLabel",
|
|
2382
|
+
required: false
|
|
2383
|
+
}]
|
|
2384
|
+
}],
|
|
2385
|
+
nextLabelInput: [{
|
|
2386
|
+
type: i0.Input,
|
|
2387
|
+
args: [{
|
|
2388
|
+
isSignal: true,
|
|
2389
|
+
alias: "nextLabel",
|
|
2390
|
+
required: false
|
|
2391
|
+
}]
|
|
2392
|
+
}],
|
|
2393
|
+
finishLabelInput: [{
|
|
2394
|
+
type: i0.Input,
|
|
2395
|
+
args: [{
|
|
2396
|
+
isSignal: true,
|
|
2397
|
+
alias: "finishLabel",
|
|
2398
|
+
required: false
|
|
2399
|
+
}]
|
|
2400
|
+
}],
|
|
2401
|
+
progressLabelInput: [{
|
|
2402
|
+
type: i0.Input,
|
|
2403
|
+
args: [{
|
|
2404
|
+
isSignal: true,
|
|
2405
|
+
alias: "progressLabel",
|
|
2406
|
+
required: false
|
|
2407
|
+
}]
|
|
2408
|
+
}],
|
|
2409
|
+
finished: [{
|
|
2410
|
+
type: i0.Output,
|
|
2411
|
+
args: ["finished"]
|
|
2412
|
+
}],
|
|
2413
|
+
skipped: [{
|
|
2414
|
+
type: i0.Output,
|
|
2415
|
+
args: ["skipped"]
|
|
2416
|
+
}],
|
|
2417
|
+
tooltip: [{
|
|
2418
|
+
type: i0.ViewChild,
|
|
2419
|
+
args: ["tooltip", { isSignal: true }]
|
|
2420
|
+
}],
|
|
2421
|
+
onKeydown: [{
|
|
2422
|
+
type: HostListener,
|
|
2423
|
+
args: ["window:keydown", ["$event"]]
|
|
2424
|
+
}],
|
|
2425
|
+
onResize: [{
|
|
2426
|
+
type: HostListener,
|
|
2427
|
+
args: ["window:resize"]
|
|
2428
|
+
}]
|
|
2429
|
+
}
|
|
2430
|
+
});
|
|
2431
|
+
const RADIUS_PX = {
|
|
2432
|
+
none: "0",
|
|
2433
|
+
sm: "4px",
|
|
2434
|
+
md: "8px",
|
|
2435
|
+
lg: "12px",
|
|
2436
|
+
full: "9999px"
|
|
2437
|
+
};
|
|
2438
|
+
var ImageComponent = class ImageComponent {
|
|
2439
|
+
constructor() {
|
|
2440
|
+
this.src = input(null, ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
2441
|
+
this.alt = input("", ...ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []);
|
|
2442
|
+
this.fit = input("contain", ...ngDevMode ? [{ debugName: "fit" }] : /* istanbul ignore next */ []);
|
|
2443
|
+
this.positionX = input(50, ...ngDevMode ? [{ debugName: "positionX" }] : /* istanbul ignore next */ []);
|
|
2444
|
+
this.positionY = input(50, ...ngDevMode ? [{ debugName: "positionY" }] : /* istanbul ignore next */ []);
|
|
2445
|
+
this.objectPosition = computed(() => imageObjectPosition({
|
|
2446
|
+
x: this.positionX(),
|
|
2447
|
+
y: this.positionY()
|
|
2448
|
+
}), ...ngDevMode ? [{ debugName: "objectPosition" }] : /* istanbul ignore next */ []);
|
|
2449
|
+
this.width = input("", ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
2450
|
+
this.height = input("", ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
2451
|
+
this.maxWidth = input("100%", ...ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []);
|
|
2452
|
+
this.maxHeight = input("", ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
|
|
2453
|
+
this.minHeight = input("", ...ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []);
|
|
2454
|
+
this.aspectRatio = input("", ...ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []);
|
|
2455
|
+
this.radius = input("none", ...ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []);
|
|
2456
|
+
this.bordered = input(false, ...ngDevMode ? [{ debugName: "bordered" }] : /* istanbul ignore next */ []);
|
|
2457
|
+
this.align = input("start", ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
|
|
2458
|
+
this.placeholder = input(true, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
2459
|
+
this.priority = input(false, ...ngDevMode ? [{ debugName: "priority" }] : /* istanbul ignore next */ []);
|
|
2460
|
+
this.retryKey = input(null, ...ngDevMode ? [{ debugName: "retryKey" }] : /* istanbul ignore next */ []);
|
|
2461
|
+
this.interactive = input(false, ...ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []);
|
|
2462
|
+
this.loaded = output();
|
|
2463
|
+
this.failed = output();
|
|
2464
|
+
this.activate = output();
|
|
2465
|
+
this._failed = signal(false, ...ngDevMode ? [{ debugName: "_failed" }] : /* istanbul ignore next */ []);
|
|
2466
|
+
this._url = computed(() => this.src()?.trim() || null, ...ngDevMode ? [{ debugName: "_url" }] : /* istanbul ignore next */ []);
|
|
2467
|
+
this.radiusCss = computed(() => RADIUS_PX[this.radius()] ?? "0", ...ngDevMode ? [{ debugName: "radiusCss" }] : /* istanbul ignore next */ []);
|
|
2468
|
+
this.imgWidth = computed(() => this.width() || null, ...ngDevMode ? [{ debugName: "imgWidth" }] : /* istanbul ignore next */ []);
|
|
2469
|
+
this.imgHeight = computed(() => this.height() || null, ...ngDevMode ? [{ debugName: "imgHeight" }] : /* istanbul ignore next */ []);
|
|
2470
|
+
this.boxWidth = computed(() => this.width() || null, ...ngDevMode ? [{ debugName: "boxWidth" }] : /* istanbul ignore next */ []);
|
|
2471
|
+
this.boxHeight = computed(() => this.height() || null, ...ngDevMode ? [{ debugName: "boxHeight" }] : /* istanbul ignore next */ []);
|
|
2472
|
+
this.isBlock = computed(() => this.width() === "100%", ...ngDevMode ? [{ debugName: "isBlock" }] : /* istanbul ignore next */ []);
|
|
2473
|
+
effect(() => {
|
|
2474
|
+
this.src();
|
|
2475
|
+
this.retryKey();
|
|
2476
|
+
untracked(() => this._failed.set(false));
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
_onError() {
|
|
2480
|
+
this._failed.set(true);
|
|
2481
|
+
this.failed.emit();
|
|
2482
|
+
}
|
|
2483
|
+
onActivate() {
|
|
2484
|
+
if (this.interactive()) this.activate.emit();
|
|
2485
|
+
}
|
|
2486
|
+
onKey(event) {
|
|
2487
|
+
if (!this.interactive()) return;
|
|
2488
|
+
event.preventDefault();
|
|
2489
|
+
this.activate.emit();
|
|
2490
|
+
}
|
|
2491
|
+
static {
|
|
2492
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
2493
|
+
minVersion: "12.0.0",
|
|
2494
|
+
version: "22.2.2",
|
|
2495
|
+
ngImport: i0,
|
|
2496
|
+
type: ImageComponent,
|
|
2497
|
+
deps: [],
|
|
2498
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
static {
|
|
2502
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2503
|
+
minVersion: "17.0.0",
|
|
2504
|
+
version: "22.2.2",
|
|
2505
|
+
type: ImageComponent,
|
|
2506
|
+
isStandalone: true,
|
|
2507
|
+
selector: "ui-image",
|
|
2508
|
+
inputs: {
|
|
2509
|
+
src: {
|
|
2510
|
+
classPropertyName: "src",
|
|
2511
|
+
publicName: "src",
|
|
2512
|
+
isSignal: true,
|
|
2513
|
+
isRequired: false,
|
|
2514
|
+
transformFunction: null
|
|
2515
|
+
},
|
|
2516
|
+
alt: {
|
|
2517
|
+
classPropertyName: "alt",
|
|
2518
|
+
publicName: "alt",
|
|
2519
|
+
isSignal: true,
|
|
2520
|
+
isRequired: false,
|
|
2521
|
+
transformFunction: null
|
|
2522
|
+
},
|
|
2523
|
+
fit: {
|
|
2524
|
+
classPropertyName: "fit",
|
|
2525
|
+
publicName: "fit",
|
|
2526
|
+
isSignal: true,
|
|
2527
|
+
isRequired: false,
|
|
2528
|
+
transformFunction: null
|
|
2529
|
+
},
|
|
2530
|
+
positionX: {
|
|
2531
|
+
classPropertyName: "positionX",
|
|
2532
|
+
publicName: "positionX",
|
|
2533
|
+
isSignal: true,
|
|
2534
|
+
isRequired: false,
|
|
2535
|
+
transformFunction: null
|
|
2536
|
+
},
|
|
2537
|
+
positionY: {
|
|
2538
|
+
classPropertyName: "positionY",
|
|
2539
|
+
publicName: "positionY",
|
|
2540
|
+
isSignal: true,
|
|
2541
|
+
isRequired: false,
|
|
2542
|
+
transformFunction: null
|
|
2543
|
+
},
|
|
2544
|
+
width: {
|
|
2545
|
+
classPropertyName: "width",
|
|
2546
|
+
publicName: "width",
|
|
2547
|
+
isSignal: true,
|
|
2548
|
+
isRequired: false,
|
|
2549
|
+
transformFunction: null
|
|
2550
|
+
},
|
|
2551
|
+
height: {
|
|
2552
|
+
classPropertyName: "height",
|
|
2553
|
+
publicName: "height",
|
|
2554
|
+
isSignal: true,
|
|
2555
|
+
isRequired: false,
|
|
2556
|
+
transformFunction: null
|
|
2557
|
+
},
|
|
2558
|
+
maxWidth: {
|
|
2559
|
+
classPropertyName: "maxWidth",
|
|
2560
|
+
publicName: "maxWidth",
|
|
2561
|
+
isSignal: true,
|
|
2562
|
+
isRequired: false,
|
|
2563
|
+
transformFunction: null
|
|
2564
|
+
},
|
|
2565
|
+
maxHeight: {
|
|
2566
|
+
classPropertyName: "maxHeight",
|
|
2567
|
+
publicName: "maxHeight",
|
|
2568
|
+
isSignal: true,
|
|
2569
|
+
isRequired: false,
|
|
2570
|
+
transformFunction: null
|
|
2571
|
+
},
|
|
2572
|
+
minHeight: {
|
|
2573
|
+
classPropertyName: "minHeight",
|
|
2574
|
+
publicName: "minHeight",
|
|
2575
|
+
isSignal: true,
|
|
2576
|
+
isRequired: false,
|
|
2577
|
+
transformFunction: null
|
|
2578
|
+
},
|
|
2579
|
+
aspectRatio: {
|
|
2580
|
+
classPropertyName: "aspectRatio",
|
|
2581
|
+
publicName: "aspectRatio",
|
|
2582
|
+
isSignal: true,
|
|
2583
|
+
isRequired: false,
|
|
2584
|
+
transformFunction: null
|
|
2585
|
+
},
|
|
2586
|
+
radius: {
|
|
2587
|
+
classPropertyName: "radius",
|
|
2588
|
+
publicName: "radius",
|
|
2589
|
+
isSignal: true,
|
|
2590
|
+
isRequired: false,
|
|
2591
|
+
transformFunction: null
|
|
2592
|
+
},
|
|
2593
|
+
bordered: {
|
|
2594
|
+
classPropertyName: "bordered",
|
|
2595
|
+
publicName: "bordered",
|
|
2596
|
+
isSignal: true,
|
|
2597
|
+
isRequired: false,
|
|
2598
|
+
transformFunction: null
|
|
2599
|
+
},
|
|
2600
|
+
align: {
|
|
2601
|
+
classPropertyName: "align",
|
|
2602
|
+
publicName: "align",
|
|
2603
|
+
isSignal: true,
|
|
2604
|
+
isRequired: false,
|
|
2605
|
+
transformFunction: null
|
|
2606
|
+
},
|
|
2607
|
+
placeholder: {
|
|
2608
|
+
classPropertyName: "placeholder",
|
|
2609
|
+
publicName: "placeholder",
|
|
2610
|
+
isSignal: true,
|
|
2611
|
+
isRequired: false,
|
|
2612
|
+
transformFunction: null
|
|
2613
|
+
},
|
|
2614
|
+
priority: {
|
|
2615
|
+
classPropertyName: "priority",
|
|
2616
|
+
publicName: "priority",
|
|
2617
|
+
isSignal: true,
|
|
2618
|
+
isRequired: false,
|
|
2619
|
+
transformFunction: null
|
|
2620
|
+
},
|
|
2621
|
+
retryKey: {
|
|
2622
|
+
classPropertyName: "retryKey",
|
|
2623
|
+
publicName: "retryKey",
|
|
2624
|
+
isSignal: true,
|
|
2625
|
+
isRequired: false,
|
|
2626
|
+
transformFunction: null
|
|
2627
|
+
},
|
|
2628
|
+
interactive: {
|
|
2629
|
+
classPropertyName: "interactive",
|
|
2630
|
+
publicName: "interactive",
|
|
2631
|
+
isSignal: true,
|
|
2632
|
+
isRequired: false,
|
|
2633
|
+
transformFunction: null
|
|
2634
|
+
}
|
|
2635
|
+
},
|
|
2636
|
+
outputs: {
|
|
2637
|
+
loaded: "loaded",
|
|
2638
|
+
failed: "failed",
|
|
2639
|
+
activate: "activate"
|
|
2640
|
+
},
|
|
2641
|
+
host: {
|
|
2642
|
+
listeners: {
|
|
2643
|
+
"click": "onActivate()",
|
|
2644
|
+
"keydown.enter": "onKey($event)",
|
|
2645
|
+
"keydown.space": "onKey($event)"
|
|
2646
|
+
},
|
|
2647
|
+
properties: {
|
|
2648
|
+
"style.text-align": "align()",
|
|
2649
|
+
"class.im-block": "isBlock()",
|
|
2650
|
+
"class.im-interactive": "interactive()",
|
|
2651
|
+
"attr.role": "interactive() ? 'button' : null",
|
|
2652
|
+
"attr.tabindex": "interactive() ? 0 : null",
|
|
2653
|
+
"attr.aria-label": "interactive() ? (alt() || null) : null"
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
ngImport: i0,
|
|
2657
|
+
template: `
|
|
2658
|
+
@if (_url() && !_failed()) {
|
|
2659
|
+
<img class="im-img" [src]="_url()" [attr.alt]="alt()" [attr.loading]="priority() ? 'eager' : 'lazy'"
|
|
2660
|
+
[attr.fetchpriority]="priority() ? 'high' : null" decoding="async"
|
|
2661
|
+
[style.width]="imgWidth()" [style.height]="imgHeight()" [style.max-width]="maxWidth()" [style.max-height]="maxHeight() || null" [style.min-height]="minHeight() || null"
|
|
2662
|
+
[style.aspect-ratio]="aspectRatio() || null" [style.object-fit]="fit()" [style.object-position]="objectPosition()" [style.border-radius]="radiusCss()"
|
|
2663
|
+
[class.im-bordered]="bordered()" (load)="loaded.emit()" (error)="_onError()" />
|
|
2664
|
+
} @else if (placeholder()) {
|
|
2665
|
+
<span class="im-ph" [class.im-bordered]="bordered()" [attr.role]="alt() ? 'img' : null" [attr.aria-label]="alt() || null" [attr.aria-hidden]="alt() ? null : 'true'"
|
|
2666
|
+
[style.width]="boxWidth()" [style.height]="boxHeight()" [style.max-width]="maxWidth()" [style.max-height]="maxHeight() || null" [style.min-height]="minHeight() || null"
|
|
2667
|
+
[style.aspect-ratio]="aspectRatio() || null" [style.border-radius]="radiusCss()">
|
|
2668
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="1.8"/><path d="M21 16l-5-5-8 9"/></svg>
|
|
2669
|
+
</span>
|
|
2670
|
+
}
|
|
2671
|
+
`,
|
|
2672
|
+
isInline: true,
|
|
2673
|
+
styles: [":host{display:inline-block;max-width:100%;line-height:0}:host(.im-block){display:block}:host(.im-interactive){cursor:pointer}:host(.im-interactive:focus-visible){outline:2px solid var(--ui-focus, #3b82f6);outline-offset:2px}.im-img{display:inline-block;max-width:100%;height:auto;vertical-align:top}.im-bordered{border:1px solid #e2e8f0;box-sizing:border-box}.im-ph{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:48px;min-height:48px;background:#f1f5f9;color:#94a3b8;vertical-align:top}.im-ph svg{width:32px;height:32px;max-width:55%;max-height:55%}\n"],
|
|
2674
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2679
|
+
minVersion: "12.0.0",
|
|
2680
|
+
version: "22.2.2",
|
|
2681
|
+
ngImport: i0,
|
|
2682
|
+
type: ImageComponent,
|
|
2683
|
+
decorators: [{
|
|
2684
|
+
type: Component,
|
|
2685
|
+
args: [{
|
|
2686
|
+
selector: "ui-image",
|
|
2687
|
+
standalone: true,
|
|
2688
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2689
|
+
host: {
|
|
2690
|
+
"[style.text-align]": "align()",
|
|
2691
|
+
"[class.im-block]": "isBlock()",
|
|
2692
|
+
"[class.im-interactive]": "interactive()",
|
|
2693
|
+
"[attr.role]": "interactive() ? 'button' : null",
|
|
2694
|
+
"[attr.tabindex]": "interactive() ? 0 : null",
|
|
2695
|
+
"[attr.aria-label]": "interactive() ? (alt() || null) : null",
|
|
2696
|
+
"(click)": "onActivate()",
|
|
2697
|
+
"(keydown.enter)": "onKey($event)",
|
|
2698
|
+
"(keydown.space)": "onKey($event)"
|
|
2699
|
+
},
|
|
2700
|
+
template: `
|
|
2701
|
+
@if (_url() && !_failed()) {
|
|
2702
|
+
<img class="im-img" [src]="_url()" [attr.alt]="alt()" [attr.loading]="priority() ? 'eager' : 'lazy'"
|
|
2703
|
+
[attr.fetchpriority]="priority() ? 'high' : null" decoding="async"
|
|
2704
|
+
[style.width]="imgWidth()" [style.height]="imgHeight()" [style.max-width]="maxWidth()" [style.max-height]="maxHeight() || null" [style.min-height]="minHeight() || null"
|
|
2705
|
+
[style.aspect-ratio]="aspectRatio() || null" [style.object-fit]="fit()" [style.object-position]="objectPosition()" [style.border-radius]="radiusCss()"
|
|
2706
|
+
[class.im-bordered]="bordered()" (load)="loaded.emit()" (error)="_onError()" />
|
|
2707
|
+
} @else if (placeholder()) {
|
|
2708
|
+
<span class="im-ph" [class.im-bordered]="bordered()" [attr.role]="alt() ? 'img' : null" [attr.aria-label]="alt() || null" [attr.aria-hidden]="alt() ? null : 'true'"
|
|
2709
|
+
[style.width]="boxWidth()" [style.height]="boxHeight()" [style.max-width]="maxWidth()" [style.max-height]="maxHeight() || null" [style.min-height]="minHeight() || null"
|
|
2710
|
+
[style.aspect-ratio]="aspectRatio() || null" [style.border-radius]="radiusCss()">
|
|
2711
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="1.8"/><path d="M21 16l-5-5-8 9"/></svg>
|
|
2712
|
+
</span>
|
|
2713
|
+
}
|
|
2714
|
+
`,
|
|
2715
|
+
styles: [":host{display:inline-block;max-width:100%;line-height:0}:host(.im-block){display:block}:host(.im-interactive){cursor:pointer}:host(.im-interactive:focus-visible){outline:2px solid var(--ui-focus, #3b82f6);outline-offset:2px}.im-img{display:inline-block;max-width:100%;height:auto;vertical-align:top}.im-bordered{border:1px solid #e2e8f0;box-sizing:border-box}.im-ph{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:48px;min-height:48px;background:#f1f5f9;color:#94a3b8;vertical-align:top}.im-ph svg{width:32px;height:32px;max-width:55%;max-height:55%}\n"]
|
|
2716
|
+
}]
|
|
2717
|
+
}],
|
|
2718
|
+
ctorParameters: () => [],
|
|
2719
|
+
propDecorators: {
|
|
2720
|
+
src: [{
|
|
2721
|
+
type: i0.Input,
|
|
2722
|
+
args: [{
|
|
2723
|
+
isSignal: true,
|
|
2724
|
+
alias: "src",
|
|
2725
|
+
required: false
|
|
2726
|
+
}]
|
|
2727
|
+
}],
|
|
2728
|
+
alt: [{
|
|
2729
|
+
type: i0.Input,
|
|
2730
|
+
args: [{
|
|
2731
|
+
isSignal: true,
|
|
2732
|
+
alias: "alt",
|
|
2733
|
+
required: false
|
|
2734
|
+
}]
|
|
2735
|
+
}],
|
|
2736
|
+
fit: [{
|
|
2737
|
+
type: i0.Input,
|
|
2738
|
+
args: [{
|
|
2739
|
+
isSignal: true,
|
|
2740
|
+
alias: "fit",
|
|
2741
|
+
required: false
|
|
2742
|
+
}]
|
|
2743
|
+
}],
|
|
2744
|
+
positionX: [{
|
|
2745
|
+
type: i0.Input,
|
|
2746
|
+
args: [{
|
|
2747
|
+
isSignal: true,
|
|
2748
|
+
alias: "positionX",
|
|
2749
|
+
required: false
|
|
2750
|
+
}]
|
|
2751
|
+
}],
|
|
2752
|
+
positionY: [{
|
|
2753
|
+
type: i0.Input,
|
|
2754
|
+
args: [{
|
|
2755
|
+
isSignal: true,
|
|
2756
|
+
alias: "positionY",
|
|
2757
|
+
required: false
|
|
2758
|
+
}]
|
|
2759
|
+
}],
|
|
2760
|
+
width: [{
|
|
2761
|
+
type: i0.Input,
|
|
2762
|
+
args: [{
|
|
2763
|
+
isSignal: true,
|
|
2764
|
+
alias: "width",
|
|
2765
|
+
required: false
|
|
2766
|
+
}]
|
|
2767
|
+
}],
|
|
2768
|
+
height: [{
|
|
2769
|
+
type: i0.Input,
|
|
2770
|
+
args: [{
|
|
2771
|
+
isSignal: true,
|
|
2772
|
+
alias: "height",
|
|
2773
|
+
required: false
|
|
2774
|
+
}]
|
|
2775
|
+
}],
|
|
2776
|
+
maxWidth: [{
|
|
2777
|
+
type: i0.Input,
|
|
2778
|
+
args: [{
|
|
2779
|
+
isSignal: true,
|
|
2780
|
+
alias: "maxWidth",
|
|
2781
|
+
required: false
|
|
2782
|
+
}]
|
|
2783
|
+
}],
|
|
2784
|
+
maxHeight: [{
|
|
2785
|
+
type: i0.Input,
|
|
2786
|
+
args: [{
|
|
2787
|
+
isSignal: true,
|
|
2788
|
+
alias: "maxHeight",
|
|
2789
|
+
required: false
|
|
2790
|
+
}]
|
|
2791
|
+
}],
|
|
2792
|
+
minHeight: [{
|
|
2793
|
+
type: i0.Input,
|
|
2794
|
+
args: [{
|
|
2795
|
+
isSignal: true,
|
|
2796
|
+
alias: "minHeight",
|
|
2797
|
+
required: false
|
|
2798
|
+
}]
|
|
2799
|
+
}],
|
|
2800
|
+
aspectRatio: [{
|
|
2801
|
+
type: i0.Input,
|
|
2802
|
+
args: [{
|
|
2803
|
+
isSignal: true,
|
|
2804
|
+
alias: "aspectRatio",
|
|
2805
|
+
required: false
|
|
2806
|
+
}]
|
|
2807
|
+
}],
|
|
2808
|
+
radius: [{
|
|
2809
|
+
type: i0.Input,
|
|
2810
|
+
args: [{
|
|
2811
|
+
isSignal: true,
|
|
2812
|
+
alias: "radius",
|
|
2813
|
+
required: false
|
|
2814
|
+
}]
|
|
2815
|
+
}],
|
|
2816
|
+
bordered: [{
|
|
2817
|
+
type: i0.Input,
|
|
2818
|
+
args: [{
|
|
2819
|
+
isSignal: true,
|
|
2820
|
+
alias: "bordered",
|
|
2821
|
+
required: false
|
|
2822
|
+
}]
|
|
2823
|
+
}],
|
|
2824
|
+
align: [{
|
|
2825
|
+
type: i0.Input,
|
|
2826
|
+
args: [{
|
|
2827
|
+
isSignal: true,
|
|
2828
|
+
alias: "align",
|
|
2829
|
+
required: false
|
|
2830
|
+
}]
|
|
2831
|
+
}],
|
|
2832
|
+
placeholder: [{
|
|
2833
|
+
type: i0.Input,
|
|
2834
|
+
args: [{
|
|
2835
|
+
isSignal: true,
|
|
2836
|
+
alias: "placeholder",
|
|
2837
|
+
required: false
|
|
2838
|
+
}]
|
|
2839
|
+
}],
|
|
2840
|
+
priority: [{
|
|
2841
|
+
type: i0.Input,
|
|
2842
|
+
args: [{
|
|
2843
|
+
isSignal: true,
|
|
2844
|
+
alias: "priority",
|
|
2845
|
+
required: false
|
|
2846
|
+
}]
|
|
2847
|
+
}],
|
|
2848
|
+
retryKey: [{
|
|
2849
|
+
type: i0.Input,
|
|
2850
|
+
args: [{
|
|
2851
|
+
isSignal: true,
|
|
2852
|
+
alias: "retryKey",
|
|
2853
|
+
required: false
|
|
2854
|
+
}]
|
|
2855
|
+
}],
|
|
2856
|
+
interactive: [{
|
|
2857
|
+
type: i0.Input,
|
|
2858
|
+
args: [{
|
|
2859
|
+
isSignal: true,
|
|
2860
|
+
alias: "interactive",
|
|
2861
|
+
required: false
|
|
2862
|
+
}]
|
|
2863
|
+
}],
|
|
2864
|
+
loaded: [{
|
|
2865
|
+
type: i0.Output,
|
|
2866
|
+
args: ["loaded"]
|
|
2867
|
+
}],
|
|
2868
|
+
failed: [{
|
|
2869
|
+
type: i0.Output,
|
|
2870
|
+
args: ["failed"]
|
|
2871
|
+
}],
|
|
2872
|
+
activate: [{
|
|
2873
|
+
type: i0.Output,
|
|
2874
|
+
args: ["activate"]
|
|
2875
|
+
}]
|
|
2876
|
+
}
|
|
2877
|
+
});
|
|
2878
|
+
var ImageGalleryComponent = class ImageGalleryComponent {
|
|
2879
|
+
constructor() {
|
|
2880
|
+
this.labels = inject(UiLabelsService);
|
|
2881
|
+
this.images = input([], ...ngDevMode ? [{ debugName: "images" }] : /* istanbul ignore next */ []);
|
|
2882
|
+
this.index = model(0, ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
|
|
2883
|
+
this.loop = input(true, ...ngDevMode ? [{ debugName: "loop" }] : /* istanbul ignore next */ []);
|
|
2884
|
+
this.showDots = input(true, ...ngDevMode ? [{ debugName: "showDots" }] : /* istanbul ignore next */ []);
|
|
2885
|
+
this.showCounter = input(true, ...ngDevMode ? [{ debugName: "showCounter" }] : /* istanbul ignore next */ []);
|
|
2886
|
+
this.aspectRatio = input("4 / 3", ...ngDevMode ? [{ debugName: "aspectRatio" }] : /* istanbul ignore next */ []);
|
|
2887
|
+
this.maxHeight = input("70vh", ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
|
|
2888
|
+
this.fit = input("contain", ...ngDevMode ? [{ debugName: "fit" }] : /* istanbul ignore next */ []);
|
|
2889
|
+
this.ariaLabelInput = input(null, {
|
|
2890
|
+
...ngDevMode ? { debugName: "ariaLabelInput" } : /* istanbul ignore next */ {},
|
|
2891
|
+
alias: "ariaLabel"
|
|
2892
|
+
});
|
|
2893
|
+
this.ariaLabel = computed(() => this.ariaLabelInput() ?? this.labels.t("imageGallery.ariaLabel"), ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
2894
|
+
this.autofocus = input(false, ...ngDevMode ? [{ debugName: "autofocus" }] : /* istanbul ignore next */ []);
|
|
2895
|
+
this.count = computed(() => this.images().length, ...ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []);
|
|
2896
|
+
this.position = computed(() => {
|
|
2897
|
+
const n = this.count();
|
|
2898
|
+
const i = Math.trunc(Number(this.index()));
|
|
2899
|
+
return n === 0 || !Number.isFinite(i) ? 0 : Math.min(n - 1, Math.max(0, i));
|
|
2900
|
+
}, ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
|
|
2901
|
+
this.current = computed(() => this.images()[this.position()] ?? { src: "" }, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
2902
|
+
this.currentAlt = computed(() => this.current().alt ?? this.labels.t("imageGallery.imageN", {
|
|
2903
|
+
n: this.position() + 1,
|
|
2904
|
+
total: this.count()
|
|
2905
|
+
}), ...ngDevMode ? [{ debugName: "currentAlt" }] : /* istanbul ignore next */ []);
|
|
2906
|
+
this.currentCaption = computed(() => this.current().caption?.trim() || "", ...ngDevMode ? [{ debugName: "currentCaption" }] : /* istanbul ignore next */ []);
|
|
2907
|
+
this.autofocusNext = computed(() => this.autofocus() && this.canNext(), ...ngDevMode ? [{ debugName: "autofocusNext" }] : /* istanbul ignore next */ []);
|
|
2908
|
+
this.autofocusPrev = computed(() => this.autofocus() && !this.canNext() && this.canPrev(), ...ngDevMode ? [{ debugName: "autofocusPrev" }] : /* istanbul ignore next */ []);
|
|
2909
|
+
this.canPrev = computed(() => this.count() > 1 && (this.loop() || this.position() > 0), ...ngDevMode ? [{ debugName: "canPrev" }] : /* istanbul ignore next */ []);
|
|
2910
|
+
this.canNext = computed(() => this.count() > 1 && (this.loop() || this.position() < this.count() - 1), ...ngDevMode ? [{ debugName: "canNext" }] : /* istanbul ignore next */ []);
|
|
2911
|
+
this.announcement = computed(() => this.count() > 1 ? this.current().alt ? this.labels.t("imageGallery.imageNAlt", {
|
|
2912
|
+
n: this.position() + 1,
|
|
2913
|
+
total: this.count(),
|
|
2914
|
+
alt: this.current().alt
|
|
2915
|
+
}) : this.labels.t("imageGallery.imageN", {
|
|
2916
|
+
n: this.position() + 1,
|
|
2917
|
+
total: this.count()
|
|
2918
|
+
}) : "", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
2919
|
+
}
|
|
2920
|
+
prev() {
|
|
2921
|
+
if (this.canPrev()) this.index.set((this.position() - 1 + this.count()) % this.count());
|
|
2922
|
+
}
|
|
2923
|
+
next() {
|
|
2924
|
+
if (this.canNext()) this.index.set((this.position() + 1) % this.count());
|
|
2925
|
+
}
|
|
2926
|
+
go(i) {
|
|
2927
|
+
if (i >= 0 && i < this.count()) this.index.set(i);
|
|
2928
|
+
}
|
|
2929
|
+
onKey(e) {
|
|
2930
|
+
if (this.count() < 2 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2931
|
+
if (e.target?.closest("input, textarea, select, [contenteditable=\"true\"], [role=\"slider\"]")) return;
|
|
2932
|
+
if (e.key === "ArrowLeft") {
|
|
2933
|
+
this.prev();
|
|
2934
|
+
e.preventDefault();
|
|
2935
|
+
} else if (e.key === "ArrowRight") {
|
|
2936
|
+
this.next();
|
|
2937
|
+
e.preventDefault();
|
|
2938
|
+
} else if (e.key === "Home") {
|
|
2939
|
+
this.go(0);
|
|
2940
|
+
e.preventDefault();
|
|
2941
|
+
} else if (e.key === "End") {
|
|
2942
|
+
this.go(this.count() - 1);
|
|
2943
|
+
e.preventDefault();
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
static {
|
|
2947
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
2948
|
+
minVersion: "12.0.0",
|
|
2949
|
+
version: "22.2.2",
|
|
2950
|
+
ngImport: i0,
|
|
2951
|
+
type: ImageGalleryComponent,
|
|
2952
|
+
deps: [],
|
|
2953
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
static {
|
|
2957
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2958
|
+
minVersion: "17.0.0",
|
|
2959
|
+
version: "22.2.2",
|
|
2960
|
+
type: ImageGalleryComponent,
|
|
2961
|
+
isStandalone: true,
|
|
2962
|
+
selector: "ui-image-gallery",
|
|
2963
|
+
inputs: {
|
|
2964
|
+
images: {
|
|
2965
|
+
classPropertyName: "images",
|
|
2966
|
+
publicName: "images",
|
|
2967
|
+
isSignal: true,
|
|
2968
|
+
isRequired: false,
|
|
2969
|
+
transformFunction: null
|
|
2970
|
+
},
|
|
2971
|
+
index: {
|
|
2972
|
+
classPropertyName: "index",
|
|
2973
|
+
publicName: "index",
|
|
2974
|
+
isSignal: true,
|
|
2975
|
+
isRequired: false,
|
|
2976
|
+
transformFunction: null
|
|
2977
|
+
},
|
|
2978
|
+
loop: {
|
|
2979
|
+
classPropertyName: "loop",
|
|
2980
|
+
publicName: "loop",
|
|
2981
|
+
isSignal: true,
|
|
2982
|
+
isRequired: false,
|
|
2983
|
+
transformFunction: null
|
|
2984
|
+
},
|
|
2985
|
+
showDots: {
|
|
2986
|
+
classPropertyName: "showDots",
|
|
2987
|
+
publicName: "showDots",
|
|
2988
|
+
isSignal: true,
|
|
2989
|
+
isRequired: false,
|
|
2990
|
+
transformFunction: null
|
|
2991
|
+
},
|
|
2992
|
+
showCounter: {
|
|
2993
|
+
classPropertyName: "showCounter",
|
|
2994
|
+
publicName: "showCounter",
|
|
2995
|
+
isSignal: true,
|
|
2996
|
+
isRequired: false,
|
|
2997
|
+
transformFunction: null
|
|
2998
|
+
},
|
|
2999
|
+
aspectRatio: {
|
|
3000
|
+
classPropertyName: "aspectRatio",
|
|
3001
|
+
publicName: "aspectRatio",
|
|
3002
|
+
isSignal: true,
|
|
3003
|
+
isRequired: false,
|
|
3004
|
+
transformFunction: null
|
|
3005
|
+
},
|
|
3006
|
+
maxHeight: {
|
|
3007
|
+
classPropertyName: "maxHeight",
|
|
3008
|
+
publicName: "maxHeight",
|
|
3009
|
+
isSignal: true,
|
|
3010
|
+
isRequired: false,
|
|
3011
|
+
transformFunction: null
|
|
3012
|
+
},
|
|
3013
|
+
fit: {
|
|
3014
|
+
classPropertyName: "fit",
|
|
3015
|
+
publicName: "fit",
|
|
3016
|
+
isSignal: true,
|
|
3017
|
+
isRequired: false,
|
|
3018
|
+
transformFunction: null
|
|
3019
|
+
},
|
|
3020
|
+
ariaLabelInput: {
|
|
3021
|
+
classPropertyName: "ariaLabelInput",
|
|
3022
|
+
publicName: "ariaLabel",
|
|
3023
|
+
isSignal: true,
|
|
3024
|
+
isRequired: false,
|
|
3025
|
+
transformFunction: null
|
|
3026
|
+
},
|
|
3027
|
+
autofocus: {
|
|
3028
|
+
classPropertyName: "autofocus",
|
|
3029
|
+
publicName: "autofocus",
|
|
3030
|
+
isSignal: true,
|
|
3031
|
+
isRequired: false,
|
|
3032
|
+
transformFunction: null
|
|
3033
|
+
}
|
|
3034
|
+
},
|
|
3035
|
+
outputs: { index: "indexChange" },
|
|
3036
|
+
ngImport: i0,
|
|
3037
|
+
template: `
|
|
3038
|
+
@if (count() > 0) {
|
|
3039
|
+
<div class="ig" role="group" aria-roledescription="carousel" [attr.aria-label]="ariaLabel()" (keydown)="onKey($event)">
|
|
3040
|
+
<div class="ig-stage">
|
|
3041
|
+
@if (count() > 1) {
|
|
3042
|
+
<ui-button class="ig-nav ig-prev" variant="secondary" size="sm" [ariaLabel]="labels.t('imageGallery.previousImage')" [disabled]="!canPrev()" [attr.data-autofocus]="autofocusPrev() ? '' : null" (click)="prev()" data-testid="gallery-prev">
|
|
3043
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>
|
|
3044
|
+
</ui-button>
|
|
3045
|
+
}
|
|
3046
|
+
<ui-image class="ig-img" [src]="current().src" [alt]="currentAlt()" [fit]="fit()" [positionX]="current().positionX" [positionY]="current().positionY" width="100%" [maxHeight]="maxHeight()" [aspectRatio]="aspectRatio()" data-testid="gallery-image" />
|
|
3047
|
+
@if (count() > 1) {
|
|
3048
|
+
<ui-button class="ig-nav ig-next" variant="secondary" size="sm" [ariaLabel]="labels.t('imageGallery.nextImage')" [disabled]="!canNext()" [attr.data-autofocus]="autofocusNext() ? '' : null" (click)="next()" data-testid="gallery-next">
|
|
3049
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
|
|
3050
|
+
</ui-button>
|
|
3051
|
+
}
|
|
3052
|
+
</div>
|
|
3053
|
+
@if (currentCaption(); as cap) { <p class="ig-caption" data-testid="gallery-caption">{{ cap }}</p> }
|
|
3054
|
+
@if (count() > 1) {
|
|
3055
|
+
<div class="ig-meta">
|
|
3056
|
+
@if (showCounter()) { <span class="ig-counter" aria-hidden="true" data-testid="gallery-counter">{{ position() + 1 }} / {{ count() }}</span> }
|
|
3057
|
+
@if (showDots()) {
|
|
3058
|
+
<div class="ig-dots">
|
|
3059
|
+
@for (img of images(); track $index) {
|
|
3060
|
+
<button type="button" class="ig-dot" [class.ig-dot-on]="$index === position()" [attr.aria-label]="labels.t('imageGallery.showImage', { n: $index + 1, total: count() })"
|
|
3061
|
+
[attr.aria-current]="$index === position() ? 'true' : null" [attr.data-testid]="'gallery-dot-' + $index" (click)="go($index)"></button>
|
|
3062
|
+
}
|
|
3063
|
+
</div>
|
|
3064
|
+
}
|
|
3065
|
+
</div>
|
|
3066
|
+
}
|
|
3067
|
+
<ui-live-region [message]="announcement()" />
|
|
3068
|
+
</div>
|
|
3069
|
+
}
|
|
3070
|
+
`,
|
|
3071
|
+
isInline: true,
|
|
3072
|
+
styles: [":host{display:block}.ig{display:flex;flex-direction:column;gap:10px}.ig-stage{position:relative;display:flex;align-items:center;justify-content:center}.ig-img{flex:1 1 auto;min-width:0}.ig-nav{position:absolute;top:50%;transform:translateY(-50%);z-index:1}.ig-prev{left:8px}.ig-next{right:8px}.ig-caption{margin:0;text-align:center;font-size:.875rem;color:#334155;overflow-wrap:anywhere}.ig-meta{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}.ig-counter{font-size:.8125rem;color:#64748b}.ig-dots{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:center}.ig-dot{box-sizing:content-box;width:8px;height:8px;padding:18px;margin:-14px;border:0;border-radius:50%;background:#cbd5e1;background-clip:content-box;cursor:pointer;-webkit-appearance:none;appearance:none}.ig-dot-on{background:var(--ui-accent, #3b82f6);background-clip:content-box}.ig-dot:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-4px}\n"],
|
|
3073
|
+
dependencies: [
|
|
3074
|
+
{
|
|
3075
|
+
kind: "component",
|
|
3076
|
+
type: ButtonComponent,
|
|
3077
|
+
selector: "ui-button",
|
|
3078
|
+
inputs: [
|
|
3079
|
+
"variant",
|
|
3080
|
+
"routerLink",
|
|
3081
|
+
"queryParams",
|
|
3082
|
+
"fragment",
|
|
3083
|
+
"state",
|
|
3084
|
+
"href",
|
|
3085
|
+
"target",
|
|
3086
|
+
"rel",
|
|
3087
|
+
"shortLabel",
|
|
3088
|
+
"shortBelow",
|
|
3089
|
+
"color",
|
|
3090
|
+
"active",
|
|
3091
|
+
"size",
|
|
3092
|
+
"type",
|
|
3093
|
+
"disabled",
|
|
3094
|
+
"loading",
|
|
3095
|
+
"fullWidth",
|
|
3096
|
+
"ariaLabel",
|
|
3097
|
+
"ariaExpanded",
|
|
3098
|
+
"ariaPressed",
|
|
3099
|
+
"ariaDescribedBy",
|
|
3100
|
+
"modal-footer-left",
|
|
3101
|
+
"modal-footer-right"
|
|
3102
|
+
]
|
|
3103
|
+
},
|
|
3104
|
+
{
|
|
3105
|
+
kind: "component",
|
|
3106
|
+
type: ImageComponent,
|
|
3107
|
+
selector: "ui-image",
|
|
3108
|
+
inputs: [
|
|
3109
|
+
"src",
|
|
3110
|
+
"alt",
|
|
3111
|
+
"fit",
|
|
3112
|
+
"positionX",
|
|
3113
|
+
"positionY",
|
|
3114
|
+
"width",
|
|
3115
|
+
"height",
|
|
3116
|
+
"maxWidth",
|
|
3117
|
+
"maxHeight",
|
|
3118
|
+
"minHeight",
|
|
3119
|
+
"aspectRatio",
|
|
3120
|
+
"radius",
|
|
3121
|
+
"bordered",
|
|
3122
|
+
"align",
|
|
3123
|
+
"placeholder",
|
|
3124
|
+
"priority",
|
|
3125
|
+
"retryKey",
|
|
3126
|
+
"interactive"
|
|
3127
|
+
],
|
|
3128
|
+
outputs: [
|
|
3129
|
+
"loaded",
|
|
3130
|
+
"failed",
|
|
3131
|
+
"activate"
|
|
3132
|
+
]
|
|
3133
|
+
},
|
|
3134
|
+
{
|
|
3135
|
+
kind: "component",
|
|
3136
|
+
type: LiveRegionComponent,
|
|
3137
|
+
selector: "ui-live-region",
|
|
3138
|
+
inputs: [
|
|
3139
|
+
"message",
|
|
3140
|
+
"politeness",
|
|
3141
|
+
"atomic",
|
|
3142
|
+
"visible"
|
|
3143
|
+
]
|
|
3144
|
+
}
|
|
3145
|
+
],
|
|
3146
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
3151
|
+
minVersion: "12.0.0",
|
|
3152
|
+
version: "22.2.2",
|
|
3153
|
+
ngImport: i0,
|
|
3154
|
+
type: ImageGalleryComponent,
|
|
3155
|
+
decorators: [{
|
|
3156
|
+
type: Component,
|
|
3157
|
+
args: [{
|
|
3158
|
+
selector: "ui-image-gallery",
|
|
3159
|
+
standalone: true,
|
|
3160
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3161
|
+
imports: [
|
|
3162
|
+
ButtonComponent,
|
|
3163
|
+
ImageComponent,
|
|
3164
|
+
LiveRegionComponent
|
|
3165
|
+
],
|
|
3166
|
+
template: `
|
|
3167
|
+
@if (count() > 0) {
|
|
3168
|
+
<div class="ig" role="group" aria-roledescription="carousel" [attr.aria-label]="ariaLabel()" (keydown)="onKey($event)">
|
|
3169
|
+
<div class="ig-stage">
|
|
3170
|
+
@if (count() > 1) {
|
|
3171
|
+
<ui-button class="ig-nav ig-prev" variant="secondary" size="sm" [ariaLabel]="labels.t('imageGallery.previousImage')" [disabled]="!canPrev()" [attr.data-autofocus]="autofocusPrev() ? '' : null" (click)="prev()" data-testid="gallery-prev">
|
|
3172
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>
|
|
3173
|
+
</ui-button>
|
|
3174
|
+
}
|
|
3175
|
+
<ui-image class="ig-img" [src]="current().src" [alt]="currentAlt()" [fit]="fit()" [positionX]="current().positionX" [positionY]="current().positionY" width="100%" [maxHeight]="maxHeight()" [aspectRatio]="aspectRatio()" data-testid="gallery-image" />
|
|
3176
|
+
@if (count() > 1) {
|
|
3177
|
+
<ui-button class="ig-nav ig-next" variant="secondary" size="sm" [ariaLabel]="labels.t('imageGallery.nextImage')" [disabled]="!canNext()" [attr.data-autofocus]="autofocusNext() ? '' : null" (click)="next()" data-testid="gallery-next">
|
|
3178
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>
|
|
3179
|
+
</ui-button>
|
|
3180
|
+
}
|
|
3181
|
+
</div>
|
|
3182
|
+
@if (currentCaption(); as cap) { <p class="ig-caption" data-testid="gallery-caption">{{ cap }}</p> }
|
|
3183
|
+
@if (count() > 1) {
|
|
3184
|
+
<div class="ig-meta">
|
|
3185
|
+
@if (showCounter()) { <span class="ig-counter" aria-hidden="true" data-testid="gallery-counter">{{ position() + 1 }} / {{ count() }}</span> }
|
|
3186
|
+
@if (showDots()) {
|
|
3187
|
+
<div class="ig-dots">
|
|
3188
|
+
@for (img of images(); track $index) {
|
|
3189
|
+
<button type="button" class="ig-dot" [class.ig-dot-on]="$index === position()" [attr.aria-label]="labels.t('imageGallery.showImage', { n: $index + 1, total: count() })"
|
|
3190
|
+
[attr.aria-current]="$index === position() ? 'true' : null" [attr.data-testid]="'gallery-dot-' + $index" (click)="go($index)"></button>
|
|
3191
|
+
}
|
|
3192
|
+
</div>
|
|
3193
|
+
}
|
|
3194
|
+
</div>
|
|
3195
|
+
}
|
|
3196
|
+
<ui-live-region [message]="announcement()" />
|
|
3197
|
+
</div>
|
|
3198
|
+
}
|
|
3199
|
+
`,
|
|
3200
|
+
styles: [":host{display:block}.ig{display:flex;flex-direction:column;gap:10px}.ig-stage{position:relative;display:flex;align-items:center;justify-content:center}.ig-img{flex:1 1 auto;min-width:0}.ig-nav{position:absolute;top:50%;transform:translateY(-50%);z-index:1}.ig-prev{left:8px}.ig-next{right:8px}.ig-caption{margin:0;text-align:center;font-size:.875rem;color:#334155;overflow-wrap:anywhere}.ig-meta{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}.ig-counter{font-size:.8125rem;color:#64748b}.ig-dots{display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:center}.ig-dot{box-sizing:content-box;width:8px;height:8px;padding:18px;margin:-14px;border:0;border-radius:50%;background:#cbd5e1;background-clip:content-box;cursor:pointer;-webkit-appearance:none;appearance:none}.ig-dot-on{background:var(--ui-accent, #3b82f6);background-clip:content-box}.ig-dot:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-4px}\n"]
|
|
3201
|
+
}]
|
|
3202
|
+
}],
|
|
3203
|
+
propDecorators: {
|
|
3204
|
+
images: [{
|
|
3205
|
+
type: i0.Input,
|
|
3206
|
+
args: [{
|
|
3207
|
+
isSignal: true,
|
|
3208
|
+
alias: "images",
|
|
3209
|
+
required: false
|
|
3210
|
+
}]
|
|
3211
|
+
}],
|
|
3212
|
+
index: [{
|
|
3213
|
+
type: i0.Input,
|
|
3214
|
+
args: [{
|
|
3215
|
+
isSignal: true,
|
|
3216
|
+
alias: "index",
|
|
3217
|
+
required: false
|
|
3218
|
+
}]
|
|
3219
|
+
}, {
|
|
3220
|
+
type: i0.Output,
|
|
3221
|
+
args: ["indexChange"]
|
|
3222
|
+
}],
|
|
3223
|
+
loop: [{
|
|
3224
|
+
type: i0.Input,
|
|
3225
|
+
args: [{
|
|
3226
|
+
isSignal: true,
|
|
3227
|
+
alias: "loop",
|
|
3228
|
+
required: false
|
|
3229
|
+
}]
|
|
3230
|
+
}],
|
|
3231
|
+
showDots: [{
|
|
3232
|
+
type: i0.Input,
|
|
3233
|
+
args: [{
|
|
3234
|
+
isSignal: true,
|
|
3235
|
+
alias: "showDots",
|
|
3236
|
+
required: false
|
|
3237
|
+
}]
|
|
3238
|
+
}],
|
|
3239
|
+
showCounter: [{
|
|
3240
|
+
type: i0.Input,
|
|
3241
|
+
args: [{
|
|
3242
|
+
isSignal: true,
|
|
3243
|
+
alias: "showCounter",
|
|
3244
|
+
required: false
|
|
3245
|
+
}]
|
|
3246
|
+
}],
|
|
3247
|
+
aspectRatio: [{
|
|
3248
|
+
type: i0.Input,
|
|
3249
|
+
args: [{
|
|
3250
|
+
isSignal: true,
|
|
3251
|
+
alias: "aspectRatio",
|
|
3252
|
+
required: false
|
|
3253
|
+
}]
|
|
3254
|
+
}],
|
|
3255
|
+
maxHeight: [{
|
|
3256
|
+
type: i0.Input,
|
|
3257
|
+
args: [{
|
|
3258
|
+
isSignal: true,
|
|
3259
|
+
alias: "maxHeight",
|
|
3260
|
+
required: false
|
|
3261
|
+
}]
|
|
3262
|
+
}],
|
|
3263
|
+
fit: [{
|
|
3264
|
+
type: i0.Input,
|
|
3265
|
+
args: [{
|
|
3266
|
+
isSignal: true,
|
|
3267
|
+
alias: "fit",
|
|
3268
|
+
required: false
|
|
3269
|
+
}]
|
|
3270
|
+
}],
|
|
3271
|
+
ariaLabelInput: [{
|
|
3272
|
+
type: i0.Input,
|
|
3273
|
+
args: [{
|
|
3274
|
+
isSignal: true,
|
|
3275
|
+
alias: "ariaLabel",
|
|
3276
|
+
required: false
|
|
3277
|
+
}]
|
|
3278
|
+
}],
|
|
3279
|
+
autofocus: [{
|
|
3280
|
+
type: i0.Input,
|
|
3281
|
+
args: [{
|
|
3282
|
+
isSignal: true,
|
|
3283
|
+
alias: "autofocus",
|
|
3284
|
+
required: false
|
|
3285
|
+
}]
|
|
3286
|
+
}]
|
|
3287
|
+
}
|
|
3288
|
+
});
|
|
3289
|
+
let nextPadId = 0;
|
|
3290
|
+
var SignaturePadComponent = class SignaturePadComponent {
|
|
3291
|
+
resetTouched() {
|
|
3292
|
+
this._touched.set(false);
|
|
3293
|
+
}
|
|
3294
|
+
constructor() {
|
|
3295
|
+
this.labels = inject(UiLabelsService);
|
|
3296
|
+
this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
3297
|
+
this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
3298
|
+
this.hint = input("", ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
|
|
3299
|
+
this.error = input("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
3300
|
+
this.showErrors = input(false, ...ngDevMode ? [{ debugName: "showErrors" }] : /* istanbul ignore next */ []);
|
|
3301
|
+
this._reveal = createFieldReveal(this.showErrors);
|
|
3302
|
+
this._touched = this._reveal.touched;
|
|
3303
|
+
this._activeError = computed(() => this._reveal.revealed() ? this.error() : "", ...ngDevMode ? [{ debugName: "_activeError" }] : /* istanbul ignore next */ []);
|
|
3304
|
+
this.width = input(600, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
3305
|
+
this.height = input(120, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
3306
|
+
this.outputWidth = input(600, ...ngDevMode ? [{ debugName: "outputWidth" }] : /* istanbul ignore next */ []);
|
|
3307
|
+
this.outputHeight = input(60, ...ngDevMode ? [{ debugName: "outputHeight" }] : /* istanbul ignore next */ []);
|
|
3308
|
+
this.penColor = input("#000000", ...ngDevMode ? [{ debugName: "penColor" }] : /* istanbul ignore next */ []);
|
|
3309
|
+
this.penWidth = input(3, ...ngDevMode ? [{ debugName: "penWidth" }] : /* istanbul ignore next */ []);
|
|
3310
|
+
this.showClear = input(true, ...ngDevMode ? [{ debugName: "showClear" }] : /* istanbul ignore next */ []);
|
|
3311
|
+
this.clearLabelInput = input(null, {
|
|
3312
|
+
...ngDevMode ? { debugName: "clearLabelInput" } : /* istanbul ignore next */ {},
|
|
3313
|
+
alias: "clearLabel"
|
|
3314
|
+
});
|
|
3315
|
+
this.clearLabel = computed(() => this.clearLabelInput() ?? this.labels.t("signaturePad.clearLabel"), ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
3316
|
+
this._disabledInput = input(false, {
|
|
3317
|
+
...ngDevMode ? { debugName: "_disabledInput" } : /* istanbul ignore next */ {},
|
|
3318
|
+
alias: "disabled"
|
|
3319
|
+
});
|
|
3320
|
+
this.signatureChange = output();
|
|
3321
|
+
this._canvas = viewChild("canvas", ...ngDevMode ? [{ debugName: "_canvas" }] : /* istanbul ignore next */ []);
|
|
3322
|
+
this._cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "_cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
3323
|
+
this.disabled = computed(() => this._disabledInput() || this._cvaDisabled(), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
3324
|
+
this._empty = signal(true, ...ngDevMode ? [{ debugName: "_empty" }] : /* istanbul ignore next */ []);
|
|
3325
|
+
this._cursorVisible = signal(false, ...ngDevMode ? [{ debugName: "_cursorVisible" }] : /* istanbul ignore next */ []);
|
|
3326
|
+
this._cursorX = signal(0, ...ngDevMode ? [{ debugName: "_cursorX" }] : /* istanbul ignore next */ []);
|
|
3327
|
+
this._cursorY = signal(0, ...ngDevMode ? [{ debugName: "_cursorY" }] : /* istanbul ignore next */ []);
|
|
3328
|
+
this._keyboardDrawing = signal(false, ...ngDevMode ? [{ debugName: "_keyboardDrawing" }] : /* istanbul ignore next */ []);
|
|
3329
|
+
this._announcement = signal("", ...ngDevMode ? [{ debugName: "_announcement" }] : /* istanbul ignore next */ []);
|
|
3330
|
+
this._injector = inject(Injector);
|
|
3331
|
+
this._id = ++nextPadId;
|
|
3332
|
+
this._labelId = `sp-label-${this._id}`;
|
|
3333
|
+
this._descId = `sp-desc-${this._id}`;
|
|
3334
|
+
this._helpId = `sp-help-${this._id}`;
|
|
3335
|
+
this._accessibleName = computed(() => this.ariaLabel() || (this.label() ? null : this.labels.t("signaturePad.name")), ...ngDevMode ? [{ debugName: "_accessibleName" }] : /* istanbul ignore next */ []);
|
|
3336
|
+
this._describedBy = computed(() => (this._activeError() || this.hint() ? this._descId + " " : "") + this._helpId, ...ngDevMode ? [{ debugName: "_describedBy" }] : /* istanbul ignore next */ []);
|
|
3337
|
+
this._ctx = null;
|
|
3338
|
+
this._pointerId = null;
|
|
3339
|
+
this._dirty = false;
|
|
3340
|
+
this._pendingImage = false;
|
|
3341
|
+
this._value = null;
|
|
3342
|
+
this._loading = false;
|
|
3343
|
+
this._sizeKey = null;
|
|
3344
|
+
this._onChange = () => {};
|
|
3345
|
+
this._onTouched = () => {};
|
|
3346
|
+
effect(() => {
|
|
3347
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3348
|
+
const sizeKey = `${this.width()}x${this.height()}`;
|
|
3349
|
+
this.penColor();
|
|
3350
|
+
this.penWidth();
|
|
3351
|
+
if (canvas) untracked(() => {
|
|
3352
|
+
this._setUpContext(canvas);
|
|
3353
|
+
if (this._sizeKey !== null && this._sizeKey !== sizeKey) this._repaintAfterResize();
|
|
3354
|
+
this._sizeKey = sizeKey;
|
|
3355
|
+
if (this._pendingImage && this._value && this._ctx) {
|
|
3356
|
+
this._pendingImage = false;
|
|
3357
|
+
this._paint(this._value, canvas, this._ctx);
|
|
3358
|
+
}
|
|
3359
|
+
});
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
isEmpty() {
|
|
3363
|
+
return this._empty();
|
|
3364
|
+
}
|
|
3365
|
+
toDataUrl() {
|
|
3366
|
+
if (this._empty()) return null;
|
|
3367
|
+
return this._loading || this._pendingImage ? this._value : this._normalize();
|
|
3368
|
+
}
|
|
3369
|
+
clear() {
|
|
3370
|
+
this._clearBitmap();
|
|
3371
|
+
this._value = null;
|
|
3372
|
+
this._pendingImage = false;
|
|
3373
|
+
this._loading = false;
|
|
3374
|
+
const wasEmpty = this._empty();
|
|
3375
|
+
this._empty.set(true);
|
|
3376
|
+
this._dirty = false;
|
|
3377
|
+
this._keyboardDrawing.set(false);
|
|
3378
|
+
this._cursorVisible.set(false);
|
|
3379
|
+
if (!wasEmpty) this._announcement.set(this.labels.t("signaturePad.cleared"));
|
|
3380
|
+
this._onChange(null);
|
|
3381
|
+
this.signatureChange.emit(null);
|
|
3382
|
+
}
|
|
3383
|
+
writeValue(value) {
|
|
3384
|
+
this._value = value || null;
|
|
3385
|
+
this._pendingImage = false;
|
|
3386
|
+
this._loading = false;
|
|
3387
|
+
this._clearBitmap();
|
|
3388
|
+
this._announcement.set("");
|
|
3389
|
+
this._dirty = false;
|
|
3390
|
+
if (!value) {
|
|
3391
|
+
this._empty.set(true);
|
|
3392
|
+
return;
|
|
3393
|
+
}
|
|
3394
|
+
this._empty.set(false);
|
|
3395
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3396
|
+
const ctx = canvas ? this._contextOf(canvas) : null;
|
|
3397
|
+
if (!canvas || !ctx) {
|
|
3398
|
+
this._pendingImage = true;
|
|
3399
|
+
return;
|
|
3400
|
+
}
|
|
3401
|
+
this._paint(value, canvas, ctx);
|
|
3402
|
+
}
|
|
3403
|
+
_paint(value, canvas, ctx) {
|
|
3404
|
+
const image = new Image();
|
|
3405
|
+
this._loading = true;
|
|
3406
|
+
image.onerror = () => {
|
|
3407
|
+
if (this._value === value) this._loading = false;
|
|
3408
|
+
};
|
|
3409
|
+
image.onload = () => {
|
|
3410
|
+
if (this._value !== value) return;
|
|
3411
|
+
this._loading = false;
|
|
3412
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3413
|
+
const scale = Math.min(canvas.width / image.width, canvas.height / image.height);
|
|
3414
|
+
const drawWidth = image.width * scale;
|
|
3415
|
+
const drawHeight = image.height * scale;
|
|
3416
|
+
ctx.drawImage(image, 0, (canvas.height - drawHeight) / 2, drawWidth, drawHeight);
|
|
3417
|
+
};
|
|
3418
|
+
image.src = value;
|
|
3419
|
+
}
|
|
3420
|
+
_repaintAfterResize() {
|
|
3421
|
+
afterNextRender(() => {
|
|
3422
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3423
|
+
const ctx = canvas ? this._contextOf(canvas) : null;
|
|
3424
|
+
if (!canvas || !ctx || this._empty() || !this._value) return;
|
|
3425
|
+
this._paint(this._value, canvas, ctx);
|
|
3426
|
+
}, { injector: this._injector });
|
|
3427
|
+
}
|
|
3428
|
+
registerOnChange(fn) {
|
|
3429
|
+
this._onChange = fn;
|
|
3430
|
+
}
|
|
3431
|
+
registerOnTouched(fn) {
|
|
3432
|
+
this._onTouched = fn;
|
|
3433
|
+
}
|
|
3434
|
+
setDisabledState(disabled) {
|
|
3435
|
+
this._cvaDisabled.set(disabled);
|
|
3436
|
+
}
|
|
3437
|
+
onPointerDown(event) {
|
|
3438
|
+
if (this.disabled() || event.pointerType === "mouse" && event.button !== 0) return;
|
|
3439
|
+
if (!event.isPrimary) return;
|
|
3440
|
+
if (this._pointerId !== null) {
|
|
3441
|
+
if (event.pointerId !== this._pointerId) return;
|
|
3442
|
+
this._pointerId = null;
|
|
3443
|
+
this._commit();
|
|
3444
|
+
}
|
|
3445
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3446
|
+
const ctx = canvas ? this._contextOf(canvas) : null;
|
|
3447
|
+
if (!canvas || !ctx) return;
|
|
3448
|
+
event.preventDefault();
|
|
3449
|
+
this._applyPen(ctx);
|
|
3450
|
+
this._pointerId = event.pointerId;
|
|
3451
|
+
canvas.setPointerCapture?.(event.pointerId);
|
|
3452
|
+
this._cursorVisible.set(false);
|
|
3453
|
+
const point = this._pointOf(event.clientX, event.clientY, canvas);
|
|
3454
|
+
ctx.beginPath();
|
|
3455
|
+
ctx.moveTo(point.x, point.y);
|
|
3456
|
+
ctx.lineTo(point.x + .01, point.y);
|
|
3457
|
+
ctx.stroke();
|
|
3458
|
+
this._dirty = true;
|
|
3459
|
+
}
|
|
3460
|
+
onPointerMove(event) {
|
|
3461
|
+
if (this._pointerId === null || event.pointerId !== this._pointerId) return;
|
|
3462
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3463
|
+
const ctx = this._ctx;
|
|
3464
|
+
if (!canvas || !ctx) return;
|
|
3465
|
+
event.preventDefault();
|
|
3466
|
+
const point = this._pointOf(event.clientX, event.clientY, canvas);
|
|
3467
|
+
ctx.lineTo(point.x, point.y);
|
|
3468
|
+
ctx.stroke();
|
|
3469
|
+
}
|
|
3470
|
+
onPointerEnd(event) {
|
|
3471
|
+
if (this._pointerId === null || event.pointerId !== this._pointerId) return;
|
|
3472
|
+
this._pointerId = null;
|
|
3473
|
+
this._touched.set(true);
|
|
3474
|
+
this._commit();
|
|
3475
|
+
}
|
|
3476
|
+
onKeyDown(event) {
|
|
3477
|
+
if (this.disabled()) return;
|
|
3478
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3479
|
+
const ctx = canvas ? this._contextOf(canvas) : null;
|
|
3480
|
+
if (!ctx) return;
|
|
3481
|
+
if (event.key === "Escape") {
|
|
3482
|
+
if (this._cursorVisible()) {
|
|
3483
|
+
event.stopPropagation();
|
|
3484
|
+
this._stopKeyboardStroke();
|
|
3485
|
+
this._cursorVisible.set(false);
|
|
3486
|
+
}
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
const isArrow = [
|
|
3490
|
+
"ArrowUp",
|
|
3491
|
+
"ArrowDown",
|
|
3492
|
+
"ArrowLeft",
|
|
3493
|
+
"ArrowRight"
|
|
3494
|
+
].includes(event.key);
|
|
3495
|
+
if (!isArrow && event.key !== " ") return;
|
|
3496
|
+
event.preventDefault();
|
|
3497
|
+
if (!this._cursorVisible()) {
|
|
3498
|
+
this._cursorVisible.set(true);
|
|
3499
|
+
this._cursorX.set(this.width() / 2);
|
|
3500
|
+
this._cursorY.set(this.height() / 2);
|
|
3501
|
+
}
|
|
3502
|
+
if (isArrow) {
|
|
3503
|
+
const step = event.shiftKey ? 10 : 2;
|
|
3504
|
+
if (event.key === "ArrowUp") this._cursorY.set(Math.max(0, this._cursorY() - step));
|
|
3505
|
+
if (event.key === "ArrowDown") this._cursorY.set(Math.min(this.height(), this._cursorY() + step));
|
|
3506
|
+
if (event.key === "ArrowLeft") this._cursorX.set(Math.max(0, this._cursorX() - step));
|
|
3507
|
+
if (event.key === "ArrowRight") this._cursorX.set(Math.min(this.width(), this._cursorX() + step));
|
|
3508
|
+
if (this._keyboardDrawing()) {
|
|
3509
|
+
ctx.lineTo(this._cursorX(), this._cursorY());
|
|
3510
|
+
ctx.stroke();
|
|
3511
|
+
this._dirty = true;
|
|
3512
|
+
}
|
|
3513
|
+
return;
|
|
3514
|
+
}
|
|
3515
|
+
if (!this._keyboardDrawing()) {
|
|
3516
|
+
this._keyboardDrawing.set(true);
|
|
3517
|
+
this._applyPen(ctx);
|
|
3518
|
+
ctx.beginPath();
|
|
3519
|
+
ctx.moveTo(this._cursorX(), this._cursorY());
|
|
3520
|
+
ctx.lineTo(this._cursorX() + .01, this._cursorY());
|
|
3521
|
+
ctx.stroke();
|
|
3522
|
+
this._dirty = true;
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
onKeyUp(event) {
|
|
3526
|
+
if (event.key !== " " || this.disabled()) return;
|
|
3527
|
+
event.preventDefault();
|
|
3528
|
+
this._stopKeyboardStroke();
|
|
3529
|
+
}
|
|
3530
|
+
onBlur() {
|
|
3531
|
+
this._stopKeyboardStroke();
|
|
3532
|
+
this._cursorVisible.set(false);
|
|
3533
|
+
this._touched.set(true);
|
|
3534
|
+
this._onTouched();
|
|
3535
|
+
}
|
|
3536
|
+
_stopKeyboardStroke() {
|
|
3537
|
+
if (!this._keyboardDrawing()) return;
|
|
3538
|
+
this._keyboardDrawing.set(false);
|
|
3539
|
+
this._commit();
|
|
3540
|
+
}
|
|
3541
|
+
_commit() {
|
|
3542
|
+
if (!this._dirty) return;
|
|
3543
|
+
this._dirty = false;
|
|
3544
|
+
const wasEmpty = this._empty();
|
|
3545
|
+
this._empty.set(false);
|
|
3546
|
+
this._loading = false;
|
|
3547
|
+
this._value = this._normalize();
|
|
3548
|
+
if (wasEmpty) this._announcement.set(this.labels.t("signaturePad.captured"));
|
|
3549
|
+
this._onChange(this._value);
|
|
3550
|
+
this.signatureChange.emit(this._value);
|
|
3551
|
+
}
|
|
3552
|
+
_setUpContext(canvas) {
|
|
3553
|
+
this._ctx = canvas.getContext("2d");
|
|
3554
|
+
if (this._ctx) this._applyPen(this._ctx);
|
|
3555
|
+
}
|
|
3556
|
+
_contextOf(canvas) {
|
|
3557
|
+
if (!this._ctx) this._setUpContext(canvas);
|
|
3558
|
+
return this._ctx;
|
|
3559
|
+
}
|
|
3560
|
+
_applyPen(ctx) {
|
|
3561
|
+
ctx.strokeStyle = this.penColor();
|
|
3562
|
+
ctx.lineWidth = this.penWidth();
|
|
3563
|
+
ctx.lineCap = "round";
|
|
3564
|
+
ctx.lineJoin = "round";
|
|
3565
|
+
}
|
|
3566
|
+
_clearBitmap() {
|
|
3567
|
+
const canvas = this._canvas()?.nativeElement;
|
|
3568
|
+
this._ctx?.clearRect(0, 0, canvas?.width ?? this.width(), canvas?.height ?? this.height());
|
|
3569
|
+
}
|
|
3570
|
+
_pointOf(clientX, clientY, canvas) {
|
|
3571
|
+
const rect = canvas.getBoundingClientRect();
|
|
3572
|
+
const scaleX = rect.width ? canvas.width / rect.width : 1;
|
|
3573
|
+
const scaleY = rect.height ? canvas.height / rect.height : 1;
|
|
3574
|
+
return {
|
|
3575
|
+
x: (clientX - rect.left) * scaleX,
|
|
3576
|
+
y: (clientY - rect.top) * scaleY
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
_normalize() {
|
|
3580
|
+
const source = this._canvas()?.nativeElement;
|
|
3581
|
+
const sourceCtx = this._ctx;
|
|
3582
|
+
if (!source || !sourceCtx) return null;
|
|
3583
|
+
const { data, width, height } = sourceCtx.getImageData(0, 0, source.width, source.height);
|
|
3584
|
+
let minX = width, minY = height, maxX = -1, maxY = -1;
|
|
3585
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) if (data[(y * width + x) * 4 + 3] > 0) {
|
|
3586
|
+
if (x < minX) minX = x;
|
|
3587
|
+
if (x > maxX) maxX = x;
|
|
3588
|
+
if (y < minY) minY = y;
|
|
3589
|
+
if (y > maxY) maxY = y;
|
|
3590
|
+
}
|
|
3591
|
+
if (maxX < 0) return null;
|
|
3592
|
+
const padding = 4;
|
|
3593
|
+
minX = Math.max(0, minX - padding);
|
|
3594
|
+
minY = Math.max(0, minY - padding);
|
|
3595
|
+
maxX = Math.min(width - 1, maxX + padding);
|
|
3596
|
+
maxY = Math.min(height - 1, maxY + padding);
|
|
3597
|
+
const cropWidth = maxX - minX + 1;
|
|
3598
|
+
const cropHeight = maxY - minY + 1;
|
|
3599
|
+
const out = document.createElement("canvas");
|
|
3600
|
+
out.width = this.outputWidth();
|
|
3601
|
+
out.height = this.outputHeight();
|
|
3602
|
+
const scale = Math.min(out.width / cropWidth, out.height / cropHeight);
|
|
3603
|
+
const drawWidth = cropWidth * scale;
|
|
3604
|
+
const drawHeight = cropHeight * scale;
|
|
3605
|
+
out.getContext("2d").drawImage(source, minX, minY, cropWidth, cropHeight, 0, (out.height - drawHeight) / 2, drawWidth, drawHeight);
|
|
3606
|
+
return out.toDataURL("image/png");
|
|
3607
|
+
}
|
|
3608
|
+
static {
|
|
3609
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
3610
|
+
minVersion: "12.0.0",
|
|
3611
|
+
version: "22.2.2",
|
|
3612
|
+
ngImport: i0,
|
|
3613
|
+
type: SignaturePadComponent,
|
|
3614
|
+
deps: [],
|
|
3615
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
3616
|
+
});
|
|
3617
|
+
}
|
|
3618
|
+
static {
|
|
3619
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
3620
|
+
minVersion: "17.0.0",
|
|
3621
|
+
version: "22.2.2",
|
|
3622
|
+
type: SignaturePadComponent,
|
|
3623
|
+
isStandalone: true,
|
|
3624
|
+
selector: "ui-signature-pad",
|
|
3625
|
+
inputs: {
|
|
3626
|
+
label: {
|
|
3627
|
+
classPropertyName: "label",
|
|
3628
|
+
publicName: "label",
|
|
3629
|
+
isSignal: true,
|
|
3630
|
+
isRequired: false,
|
|
3631
|
+
transformFunction: null
|
|
3632
|
+
},
|
|
3633
|
+
ariaLabel: {
|
|
3634
|
+
classPropertyName: "ariaLabel",
|
|
3635
|
+
publicName: "ariaLabel",
|
|
3636
|
+
isSignal: true,
|
|
3637
|
+
isRequired: false,
|
|
3638
|
+
transformFunction: null
|
|
3639
|
+
},
|
|
3640
|
+
hint: {
|
|
3641
|
+
classPropertyName: "hint",
|
|
3642
|
+
publicName: "hint",
|
|
3643
|
+
isSignal: true,
|
|
3644
|
+
isRequired: false,
|
|
3645
|
+
transformFunction: null
|
|
3646
|
+
},
|
|
3647
|
+
error: {
|
|
3648
|
+
classPropertyName: "error",
|
|
3649
|
+
publicName: "error",
|
|
3650
|
+
isSignal: true,
|
|
3651
|
+
isRequired: false,
|
|
3652
|
+
transformFunction: null
|
|
3653
|
+
},
|
|
3654
|
+
showErrors: {
|
|
3655
|
+
classPropertyName: "showErrors",
|
|
3656
|
+
publicName: "showErrors",
|
|
3657
|
+
isSignal: true,
|
|
3658
|
+
isRequired: false,
|
|
3659
|
+
transformFunction: null
|
|
3660
|
+
},
|
|
3661
|
+
width: {
|
|
3662
|
+
classPropertyName: "width",
|
|
3663
|
+
publicName: "width",
|
|
3664
|
+
isSignal: true,
|
|
3665
|
+
isRequired: false,
|
|
3666
|
+
transformFunction: null
|
|
3667
|
+
},
|
|
3668
|
+
height: {
|
|
3669
|
+
classPropertyName: "height",
|
|
3670
|
+
publicName: "height",
|
|
3671
|
+
isSignal: true,
|
|
3672
|
+
isRequired: false,
|
|
3673
|
+
transformFunction: null
|
|
3674
|
+
},
|
|
3675
|
+
outputWidth: {
|
|
3676
|
+
classPropertyName: "outputWidth",
|
|
3677
|
+
publicName: "outputWidth",
|
|
3678
|
+
isSignal: true,
|
|
3679
|
+
isRequired: false,
|
|
3680
|
+
transformFunction: null
|
|
3681
|
+
},
|
|
3682
|
+
outputHeight: {
|
|
3683
|
+
classPropertyName: "outputHeight",
|
|
3684
|
+
publicName: "outputHeight",
|
|
3685
|
+
isSignal: true,
|
|
3686
|
+
isRequired: false,
|
|
3687
|
+
transformFunction: null
|
|
3688
|
+
},
|
|
3689
|
+
penColor: {
|
|
3690
|
+
classPropertyName: "penColor",
|
|
3691
|
+
publicName: "penColor",
|
|
3692
|
+
isSignal: true,
|
|
3693
|
+
isRequired: false,
|
|
3694
|
+
transformFunction: null
|
|
3695
|
+
},
|
|
3696
|
+
penWidth: {
|
|
3697
|
+
classPropertyName: "penWidth",
|
|
3698
|
+
publicName: "penWidth",
|
|
3699
|
+
isSignal: true,
|
|
3700
|
+
isRequired: false,
|
|
3701
|
+
transformFunction: null
|
|
3702
|
+
},
|
|
3703
|
+
showClear: {
|
|
3704
|
+
classPropertyName: "showClear",
|
|
3705
|
+
publicName: "showClear",
|
|
3706
|
+
isSignal: true,
|
|
3707
|
+
isRequired: false,
|
|
3708
|
+
transformFunction: null
|
|
3709
|
+
},
|
|
3710
|
+
clearLabelInput: {
|
|
3711
|
+
classPropertyName: "clearLabelInput",
|
|
3712
|
+
publicName: "clearLabel",
|
|
3713
|
+
isSignal: true,
|
|
3714
|
+
isRequired: false,
|
|
3715
|
+
transformFunction: null
|
|
3716
|
+
},
|
|
3717
|
+
_disabledInput: {
|
|
3718
|
+
classPropertyName: "_disabledInput",
|
|
3719
|
+
publicName: "disabled",
|
|
3720
|
+
isSignal: true,
|
|
3721
|
+
isRequired: false,
|
|
3722
|
+
transformFunction: null
|
|
3723
|
+
}
|
|
3724
|
+
},
|
|
3725
|
+
outputs: { signatureChange: "signatureChange" },
|
|
3726
|
+
providers: [{
|
|
3727
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3728
|
+
useExisting: forwardRef(() => SignaturePadComponent),
|
|
3729
|
+
multi: true
|
|
3730
|
+
}],
|
|
3731
|
+
viewQueries: [{
|
|
3732
|
+
propertyName: "_canvas",
|
|
3733
|
+
first: true,
|
|
3734
|
+
predicate: ["canvas"],
|
|
3735
|
+
descendants: true,
|
|
3736
|
+
isSignal: true
|
|
3737
|
+
}],
|
|
3738
|
+
ngImport: i0,
|
|
3739
|
+
template: `
|
|
3740
|
+
<div class="sp-field" [class.sp-disabled]="disabled()" [class.sp-error]="!!_activeError()">
|
|
3741
|
+
@if (label()) {
|
|
3742
|
+
<span class="sp-label" [id]="_labelId">{{ label() }}</span>
|
|
3743
|
+
}
|
|
3744
|
+
<div class="sp-pad">
|
|
3745
|
+
<canvas
|
|
3746
|
+
#canvas
|
|
3747
|
+
class="sp-canvas"
|
|
3748
|
+
role="application"
|
|
3749
|
+
[width]="width()"
|
|
3750
|
+
[height]="height()"
|
|
3751
|
+
[style.aspect-ratio]="width() + ' / ' + height()"
|
|
3752
|
+
[attr.tabindex]="disabled() ? null : 0"
|
|
3753
|
+
[attr.aria-label]="_accessibleName()"
|
|
3754
|
+
[attr.aria-labelledby]="!ariaLabel() && label() ? _labelId : null"
|
|
3755
|
+
[attr.aria-describedby]="_describedBy()"
|
|
3756
|
+
[attr.aria-disabled]="disabled() ? 'true' : null"
|
|
3757
|
+
[attr.aria-invalid]="_activeError() ? 'true' : null"
|
|
3758
|
+
(pointerdown)="onPointerDown($event)"
|
|
3759
|
+
(pointermove)="onPointerMove($event)"
|
|
3760
|
+
(pointerup)="onPointerEnd($event)"
|
|
3761
|
+
(pointercancel)="onPointerEnd($event)"
|
|
3762
|
+
(lostpointercapture)="onPointerEnd($event)"
|
|
3763
|
+
(keydown)="onKeyDown($event)"
|
|
3764
|
+
(keyup)="onKeyUp($event)"
|
|
3765
|
+
(blur)="onBlur()"></canvas>
|
|
3766
|
+
@if (_cursorVisible()) {
|
|
3767
|
+
<span class="sp-cursor" [class.is-drawing]="_keyboardDrawing()" [style.left.%]="_cursorX() / width() * 100" [style.top.%]="_cursorY() / height() * 100"></span>
|
|
3768
|
+
}
|
|
3769
|
+
</div>
|
|
3770
|
+
<span class="sp-sr" [id]="_helpId">{{ labels.t('signaturePad.keyboardHelp') }}</span>
|
|
3771
|
+
<span class="sp-sr" role="status" aria-live="polite">{{ _announcement() }}</span>
|
|
3772
|
+
@if (_activeError()) {
|
|
3773
|
+
<p class="sp-desc sp-desc-error" [id]="_descId" role="alert">{{ _activeError() }}</p>
|
|
3774
|
+
} @else if (hint()) {
|
|
3775
|
+
<p class="sp-desc" [id]="_descId">{{ hint() }}</p>
|
|
3776
|
+
}
|
|
3777
|
+
@if (showClear()) {
|
|
3778
|
+
<ui-button variant="secondary" size="sm" [disabled]="disabled() || _empty()" (click)="clear()">{{ clearLabel() }}</ui-button>
|
|
3779
|
+
}
|
|
3780
|
+
</div>
|
|
3781
|
+
`,
|
|
3782
|
+
isInline: true,
|
|
3783
|
+
styles: [":host{display:block}.sp-field{display:flex;flex-direction:column;gap:6px}.sp-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.sp-pad{position:relative;border:2px solid #d1d5db;border-radius:8px;background:#f9fafb}.sp-error .sp-pad{border-color:#ef4444}.sp-canvas{display:block;width:100%;height:auto;cursor:crosshair;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:none;-webkit-tap-highlight-color:transparent;border-radius:6px}.sp-canvas:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.sp-disabled .sp-pad{opacity:.5}.sp-disabled .sp-canvas{cursor:not-allowed}.sp-cursor{position:absolute;width:8px;height:8px;border-radius:9999px;pointer-events:none;background:#2563eb;border:2px solid #fff;box-shadow:0 1px 4px #00000059;transform:translate(-50%,-50%)}.sp-cursor.is-drawing{animation:sp-pulse 1s ease-in-out infinite}@keyframes sp-pulse{50%{opacity:.5}}@media(prefers-reduced-motion:reduce){.sp-cursor.is-drawing{animation:none}}.sp-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.sp-desc-error{color:#dc2626}.sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"],
|
|
3784
|
+
dependencies: [{
|
|
3785
|
+
kind: "component",
|
|
3786
|
+
type: ButtonComponent,
|
|
3787
|
+
selector: "ui-button",
|
|
3788
|
+
inputs: [
|
|
3789
|
+
"variant",
|
|
3790
|
+
"routerLink",
|
|
3791
|
+
"queryParams",
|
|
3792
|
+
"fragment",
|
|
3793
|
+
"state",
|
|
3794
|
+
"href",
|
|
3795
|
+
"target",
|
|
3796
|
+
"rel",
|
|
3797
|
+
"shortLabel",
|
|
3798
|
+
"shortBelow",
|
|
3799
|
+
"color",
|
|
3800
|
+
"active",
|
|
3801
|
+
"size",
|
|
3802
|
+
"type",
|
|
3803
|
+
"disabled",
|
|
3804
|
+
"loading",
|
|
3805
|
+
"fullWidth",
|
|
3806
|
+
"ariaLabel",
|
|
3807
|
+
"ariaExpanded",
|
|
3808
|
+
"ariaPressed",
|
|
3809
|
+
"ariaDescribedBy",
|
|
3810
|
+
"modal-footer-left",
|
|
3811
|
+
"modal-footer-right"
|
|
3812
|
+
]
|
|
3813
|
+
}],
|
|
3814
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
3815
|
+
});
|
|
3816
|
+
}
|
|
3817
|
+
};
|
|
3818
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
3819
|
+
minVersion: "12.0.0",
|
|
3820
|
+
version: "22.2.2",
|
|
3821
|
+
ngImport: i0,
|
|
3822
|
+
type: SignaturePadComponent,
|
|
3823
|
+
decorators: [{
|
|
3824
|
+
type: Component,
|
|
3825
|
+
args: [{
|
|
3826
|
+
selector: "ui-signature-pad",
|
|
3827
|
+
standalone: true,
|
|
3828
|
+
imports: [ButtonComponent],
|
|
3829
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3830
|
+
providers: [{
|
|
3831
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3832
|
+
useExisting: forwardRef(() => SignaturePadComponent),
|
|
3833
|
+
multi: true
|
|
3834
|
+
}],
|
|
3835
|
+
template: `
|
|
3836
|
+
<div class="sp-field" [class.sp-disabled]="disabled()" [class.sp-error]="!!_activeError()">
|
|
3837
|
+
@if (label()) {
|
|
3838
|
+
<span class="sp-label" [id]="_labelId">{{ label() }}</span>
|
|
3839
|
+
}
|
|
3840
|
+
<div class="sp-pad">
|
|
3841
|
+
<canvas
|
|
3842
|
+
#canvas
|
|
3843
|
+
class="sp-canvas"
|
|
3844
|
+
role="application"
|
|
3845
|
+
[width]="width()"
|
|
3846
|
+
[height]="height()"
|
|
3847
|
+
[style.aspect-ratio]="width() + ' / ' + height()"
|
|
3848
|
+
[attr.tabindex]="disabled() ? null : 0"
|
|
3849
|
+
[attr.aria-label]="_accessibleName()"
|
|
3850
|
+
[attr.aria-labelledby]="!ariaLabel() && label() ? _labelId : null"
|
|
3851
|
+
[attr.aria-describedby]="_describedBy()"
|
|
3852
|
+
[attr.aria-disabled]="disabled() ? 'true' : null"
|
|
3853
|
+
[attr.aria-invalid]="_activeError() ? 'true' : null"
|
|
3854
|
+
(pointerdown)="onPointerDown($event)"
|
|
3855
|
+
(pointermove)="onPointerMove($event)"
|
|
3856
|
+
(pointerup)="onPointerEnd($event)"
|
|
3857
|
+
(pointercancel)="onPointerEnd($event)"
|
|
3858
|
+
(lostpointercapture)="onPointerEnd($event)"
|
|
3859
|
+
(keydown)="onKeyDown($event)"
|
|
3860
|
+
(keyup)="onKeyUp($event)"
|
|
3861
|
+
(blur)="onBlur()"></canvas>
|
|
3862
|
+
@if (_cursorVisible()) {
|
|
3863
|
+
<span class="sp-cursor" [class.is-drawing]="_keyboardDrawing()" [style.left.%]="_cursorX() / width() * 100" [style.top.%]="_cursorY() / height() * 100"></span>
|
|
3864
|
+
}
|
|
3865
|
+
</div>
|
|
3866
|
+
<span class="sp-sr" [id]="_helpId">{{ labels.t('signaturePad.keyboardHelp') }}</span>
|
|
3867
|
+
<span class="sp-sr" role="status" aria-live="polite">{{ _announcement() }}</span>
|
|
3868
|
+
@if (_activeError()) {
|
|
3869
|
+
<p class="sp-desc sp-desc-error" [id]="_descId" role="alert">{{ _activeError() }}</p>
|
|
3870
|
+
} @else if (hint()) {
|
|
3871
|
+
<p class="sp-desc" [id]="_descId">{{ hint() }}</p>
|
|
3872
|
+
}
|
|
3873
|
+
@if (showClear()) {
|
|
3874
|
+
<ui-button variant="secondary" size="sm" [disabled]="disabled() || _empty()" (click)="clear()">{{ clearLabel() }}</ui-button>
|
|
3875
|
+
}
|
|
3876
|
+
</div>
|
|
3877
|
+
`,
|
|
3878
|
+
styles: [":host{display:block}.sp-field{display:flex;flex-direction:column;gap:6px}.sp-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.sp-pad{position:relative;border:2px solid #d1d5db;border-radius:8px;background:#f9fafb}.sp-error .sp-pad{border-color:#ef4444}.sp-canvas{display:block;width:100%;height:auto;cursor:crosshair;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:none;-webkit-tap-highlight-color:transparent;border-radius:6px}.sp-canvas:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.sp-disabled .sp-pad{opacity:.5}.sp-disabled .sp-canvas{cursor:not-allowed}.sp-cursor{position:absolute;width:8px;height:8px;border-radius:9999px;pointer-events:none;background:#2563eb;border:2px solid #fff;box-shadow:0 1px 4px #00000059;transform:translate(-50%,-50%)}.sp-cursor.is-drawing{animation:sp-pulse 1s ease-in-out infinite}@keyframes sp-pulse{50%{opacity:.5}}@media(prefers-reduced-motion:reduce){.sp-cursor.is-drawing{animation:none}}.sp-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.sp-desc-error{color:#dc2626}.sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"]
|
|
3879
|
+
}]
|
|
3880
|
+
}],
|
|
3881
|
+
ctorParameters: () => [],
|
|
3882
|
+
propDecorators: {
|
|
3883
|
+
label: [{
|
|
3884
|
+
type: i0.Input,
|
|
3885
|
+
args: [{
|
|
3886
|
+
isSignal: true,
|
|
3887
|
+
alias: "label",
|
|
3888
|
+
required: false
|
|
3889
|
+
}]
|
|
3890
|
+
}],
|
|
3891
|
+
ariaLabel: [{
|
|
3892
|
+
type: i0.Input,
|
|
3893
|
+
args: [{
|
|
3894
|
+
isSignal: true,
|
|
3895
|
+
alias: "ariaLabel",
|
|
3896
|
+
required: false
|
|
3897
|
+
}]
|
|
3898
|
+
}],
|
|
3899
|
+
hint: [{
|
|
3900
|
+
type: i0.Input,
|
|
3901
|
+
args: [{
|
|
3902
|
+
isSignal: true,
|
|
3903
|
+
alias: "hint",
|
|
3904
|
+
required: false
|
|
3905
|
+
}]
|
|
3906
|
+
}],
|
|
3907
|
+
error: [{
|
|
3908
|
+
type: i0.Input,
|
|
3909
|
+
args: [{
|
|
3910
|
+
isSignal: true,
|
|
3911
|
+
alias: "error",
|
|
3912
|
+
required: false
|
|
3913
|
+
}]
|
|
3914
|
+
}],
|
|
3915
|
+
showErrors: [{
|
|
3916
|
+
type: i0.Input,
|
|
3917
|
+
args: [{
|
|
3918
|
+
isSignal: true,
|
|
3919
|
+
alias: "showErrors",
|
|
3920
|
+
required: false
|
|
3921
|
+
}]
|
|
3922
|
+
}],
|
|
3923
|
+
width: [{
|
|
3924
|
+
type: i0.Input,
|
|
3925
|
+
args: [{
|
|
3926
|
+
isSignal: true,
|
|
3927
|
+
alias: "width",
|
|
3928
|
+
required: false
|
|
3929
|
+
}]
|
|
3930
|
+
}],
|
|
3931
|
+
height: [{
|
|
3932
|
+
type: i0.Input,
|
|
3933
|
+
args: [{
|
|
3934
|
+
isSignal: true,
|
|
3935
|
+
alias: "height",
|
|
3936
|
+
required: false
|
|
3937
|
+
}]
|
|
3938
|
+
}],
|
|
3939
|
+
outputWidth: [{
|
|
3940
|
+
type: i0.Input,
|
|
3941
|
+
args: [{
|
|
3942
|
+
isSignal: true,
|
|
3943
|
+
alias: "outputWidth",
|
|
3944
|
+
required: false
|
|
3945
|
+
}]
|
|
3946
|
+
}],
|
|
3947
|
+
outputHeight: [{
|
|
3948
|
+
type: i0.Input,
|
|
3949
|
+
args: [{
|
|
3950
|
+
isSignal: true,
|
|
3951
|
+
alias: "outputHeight",
|
|
3952
|
+
required: false
|
|
3953
|
+
}]
|
|
3954
|
+
}],
|
|
3955
|
+
penColor: [{
|
|
3956
|
+
type: i0.Input,
|
|
3957
|
+
args: [{
|
|
3958
|
+
isSignal: true,
|
|
3959
|
+
alias: "penColor",
|
|
3960
|
+
required: false
|
|
3961
|
+
}]
|
|
3962
|
+
}],
|
|
3963
|
+
penWidth: [{
|
|
3964
|
+
type: i0.Input,
|
|
3965
|
+
args: [{
|
|
3966
|
+
isSignal: true,
|
|
3967
|
+
alias: "penWidth",
|
|
3968
|
+
required: false
|
|
3969
|
+
}]
|
|
3970
|
+
}],
|
|
3971
|
+
showClear: [{
|
|
3972
|
+
type: i0.Input,
|
|
3973
|
+
args: [{
|
|
3974
|
+
isSignal: true,
|
|
3975
|
+
alias: "showClear",
|
|
3976
|
+
required: false
|
|
3977
|
+
}]
|
|
3978
|
+
}],
|
|
3979
|
+
clearLabelInput: [{
|
|
3980
|
+
type: i0.Input,
|
|
3981
|
+
args: [{
|
|
3982
|
+
isSignal: true,
|
|
3983
|
+
alias: "clearLabel",
|
|
3984
|
+
required: false
|
|
3985
|
+
}]
|
|
3986
|
+
}],
|
|
3987
|
+
_disabledInput: [{
|
|
3988
|
+
type: i0.Input,
|
|
3989
|
+
args: [{
|
|
3990
|
+
isSignal: true,
|
|
3991
|
+
alias: "disabled",
|
|
3992
|
+
required: false
|
|
3993
|
+
}]
|
|
3994
|
+
}],
|
|
3995
|
+
signatureChange: [{
|
|
3996
|
+
type: i0.Output,
|
|
3997
|
+
args: ["signatureChange"]
|
|
3998
|
+
}],
|
|
3999
|
+
_canvas: [{
|
|
4000
|
+
type: i0.ViewChild,
|
|
4001
|
+
args: ["canvas", { isSignal: true }]
|
|
4002
|
+
}]
|
|
4003
|
+
}
|
|
4004
|
+
});
|
|
4005
|
+
var PdfHotspotComponent = class PdfHotspotComponent {
|
|
4006
|
+
constructor() {
|
|
4007
|
+
this.labels = inject(UiLabelsService);
|
|
4008
|
+
this.x = input(0, ...ngDevMode ? [{ debugName: "x" }] : /* istanbul ignore next */ []);
|
|
4009
|
+
this.y = input(0, ...ngDevMode ? [{ debugName: "y" }] : /* istanbul ignore next */ []);
|
|
4010
|
+
this.width = input(0, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
4011
|
+
this.height = input(0, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
4012
|
+
this.state = input("ready", ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
4013
|
+
this.tone = input("primary", ...ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []);
|
|
4014
|
+
this.labelInput = input(null, {
|
|
4015
|
+
...ngDevMode ? { debugName: "labelInput" } : /* istanbul ignore next */ {},
|
|
4016
|
+
alias: "label"
|
|
4017
|
+
});
|
|
4018
|
+
this.label = computed(() => this.labelInput() ?? this.labels.t("pdfHotspot.label"), ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
4019
|
+
this.blockedLabel = input("", ...ngDevMode ? [{ debugName: "blockedLabel" }] : /* istanbul ignore next */ []);
|
|
4020
|
+
this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
4021
|
+
this.image = input(null, ...ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []);
|
|
4022
|
+
this.imageAltInput = input(null, {
|
|
4023
|
+
...ngDevMode ? { debugName: "imageAltInput" } : /* istanbul ignore next */ {},
|
|
4024
|
+
alias: "imageAlt"
|
|
4025
|
+
});
|
|
4026
|
+
this.imageAlt = computed(() => this.imageAltInput() ?? this.labels.t("pdfHotspot.imageAlt"), ...ngDevMode ? [{ debugName: "imageAlt" }] : /* istanbul ignore next */ []);
|
|
4027
|
+
this.scale = input(1, ...ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []);
|
|
4028
|
+
this.activate = output();
|
|
4029
|
+
this._scaleVar = computed(() => {
|
|
4030
|
+
const s = this.scale();
|
|
4031
|
+
return typeof s === "number" && Number.isFinite(s) && s > 0 && s !== 1 ? String(s) : null;
|
|
4032
|
+
}, ...ngDevMode ? [{ debugName: "_scaleVar" }] : /* istanbul ignore next */ []);
|
|
4033
|
+
this.fontSize = computed(() => Math.min(11, Math.max(7, this.height() * .25)), ...ngDevMode ? [{ debugName: "fontSize" }] : /* istanbul ignore next */ []);
|
|
4034
|
+
}
|
|
4035
|
+
static {
|
|
4036
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
4037
|
+
minVersion: "12.0.0",
|
|
4038
|
+
version: "22.2.2",
|
|
4039
|
+
ngImport: i0,
|
|
4040
|
+
type: PdfHotspotComponent,
|
|
4041
|
+
deps: [],
|
|
4042
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
static {
|
|
4046
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
4047
|
+
minVersion: "17.0.0",
|
|
4048
|
+
version: "22.2.2",
|
|
4049
|
+
type: PdfHotspotComponent,
|
|
4050
|
+
isStandalone: true,
|
|
4051
|
+
selector: "ui-pdf-hotspot",
|
|
4052
|
+
inputs: {
|
|
4053
|
+
x: {
|
|
4054
|
+
classPropertyName: "x",
|
|
4055
|
+
publicName: "x",
|
|
4056
|
+
isSignal: true,
|
|
4057
|
+
isRequired: false,
|
|
4058
|
+
transformFunction: null
|
|
4059
|
+
},
|
|
4060
|
+
y: {
|
|
4061
|
+
classPropertyName: "y",
|
|
4062
|
+
publicName: "y",
|
|
4063
|
+
isSignal: true,
|
|
4064
|
+
isRequired: false,
|
|
4065
|
+
transformFunction: null
|
|
4066
|
+
},
|
|
4067
|
+
width: {
|
|
4068
|
+
classPropertyName: "width",
|
|
4069
|
+
publicName: "width",
|
|
4070
|
+
isSignal: true,
|
|
4071
|
+
isRequired: false,
|
|
4072
|
+
transformFunction: null
|
|
4073
|
+
},
|
|
4074
|
+
height: {
|
|
4075
|
+
classPropertyName: "height",
|
|
4076
|
+
publicName: "height",
|
|
4077
|
+
isSignal: true,
|
|
4078
|
+
isRequired: false,
|
|
4079
|
+
transformFunction: null
|
|
4080
|
+
},
|
|
4081
|
+
state: {
|
|
4082
|
+
classPropertyName: "state",
|
|
4083
|
+
publicName: "state",
|
|
4084
|
+
isSignal: true,
|
|
4085
|
+
isRequired: false,
|
|
4086
|
+
transformFunction: null
|
|
4087
|
+
},
|
|
4088
|
+
tone: {
|
|
4089
|
+
classPropertyName: "tone",
|
|
4090
|
+
publicName: "tone",
|
|
4091
|
+
isSignal: true,
|
|
4092
|
+
isRequired: false,
|
|
4093
|
+
transformFunction: null
|
|
4094
|
+
},
|
|
4095
|
+
labelInput: {
|
|
4096
|
+
classPropertyName: "labelInput",
|
|
4097
|
+
publicName: "label",
|
|
4098
|
+
isSignal: true,
|
|
4099
|
+
isRequired: false,
|
|
4100
|
+
transformFunction: null
|
|
4101
|
+
},
|
|
4102
|
+
blockedLabel: {
|
|
4103
|
+
classPropertyName: "blockedLabel",
|
|
4104
|
+
publicName: "blockedLabel",
|
|
4105
|
+
isSignal: true,
|
|
4106
|
+
isRequired: false,
|
|
4107
|
+
transformFunction: null
|
|
4108
|
+
},
|
|
4109
|
+
ariaLabel: {
|
|
4110
|
+
classPropertyName: "ariaLabel",
|
|
4111
|
+
publicName: "ariaLabel",
|
|
4112
|
+
isSignal: true,
|
|
4113
|
+
isRequired: false,
|
|
4114
|
+
transformFunction: null
|
|
4115
|
+
},
|
|
4116
|
+
image: {
|
|
4117
|
+
classPropertyName: "image",
|
|
4118
|
+
publicName: "image",
|
|
4119
|
+
isSignal: true,
|
|
4120
|
+
isRequired: false,
|
|
4121
|
+
transformFunction: null
|
|
4122
|
+
},
|
|
4123
|
+
imageAltInput: {
|
|
4124
|
+
classPropertyName: "imageAltInput",
|
|
4125
|
+
publicName: "imageAlt",
|
|
4126
|
+
isSignal: true,
|
|
4127
|
+
isRequired: false,
|
|
4128
|
+
transformFunction: null
|
|
4129
|
+
},
|
|
4130
|
+
scale: {
|
|
4131
|
+
classPropertyName: "scale",
|
|
4132
|
+
publicName: "scale",
|
|
4133
|
+
isSignal: true,
|
|
4134
|
+
isRequired: false,
|
|
4135
|
+
transformFunction: null
|
|
4136
|
+
}
|
|
4137
|
+
},
|
|
4138
|
+
outputs: { activate: "activate" },
|
|
4139
|
+
host: { properties: {
|
|
4140
|
+
"style.left.px": "x()",
|
|
4141
|
+
"style.top.px": "y()",
|
|
4142
|
+
"style.width.px": "width()",
|
|
4143
|
+
"style.height.px": "height()",
|
|
4144
|
+
"attr.data-state": "state()",
|
|
4145
|
+
"style.--ph-scale": "_scaleVar()"
|
|
4146
|
+
} },
|
|
4147
|
+
ngImport: i0,
|
|
4148
|
+
template: `
|
|
4149
|
+
@if (state() === 'signed' && image()) {
|
|
4150
|
+
<img class="ph-image" [src]="image()" [alt]="imageAlt()" />
|
|
4151
|
+
} @else {
|
|
4152
|
+
<button
|
|
4153
|
+
type="button"
|
|
4154
|
+
class="ph-button"
|
|
4155
|
+
[class.ph-ready]="state() === 'ready'"
|
|
4156
|
+
[class.ph-warning]="tone() === 'warning'"
|
|
4157
|
+
[disabled]="state() !== 'ready'"
|
|
4158
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
4159
|
+
[style.font-size.px]="fontSize()"
|
|
4160
|
+
(click)="activate.emit()"><span class="ph-text">{{ state() === 'blocked' ? blockedLabel() : label() }}</span></button>
|
|
4161
|
+
}
|
|
4162
|
+
`,
|
|
4163
|
+
isInline: true,
|
|
4164
|
+
styles: [":host{position:absolute;display:block;box-sizing:border-box}.ph-image{display:block;width:100%;height:100%;object-fit:contain;object-position:left}.ph-button{position:relative;box-sizing:border-box;width:100%;height:100%;white-space:nowrap;font:inherit;font-weight:500;line-height:1;border:2px solid #d1d5db;background:#f3f4f6;color:#9ca3af;cursor:not-allowed;box-shadow:0 4px 10px #0000002e;transition:background-color .15s,border-color .15s}.ph-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.2}.ph-button.ph-ready{border-color:#2563eb;background:#dbeafe;color:#1d4ed8;cursor:pointer}.ph-button.ph-ready:hover{background:#bfdbfe}.ph-button.ph-ready.ph-warning{border-color:#f59e0b;background:#fffbeb;color:#b45309}.ph-button.ph-ready.ph-warning:hover{background:#fef3c7}.ph-button:focus-visible{outline:2px solid #2563eb;outline-offset:2px}@media(pointer:coarse){.ph-button:after{content:\"\";position:absolute;left:0;right:0;top:50%;height:100%;min-height:calc(44px / var(--ph-scale, 1));transform:translateY(-50%)}}\n"],
|
|
4165
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
4166
|
+
});
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
4170
|
+
minVersion: "12.0.0",
|
|
4171
|
+
version: "22.2.2",
|
|
4172
|
+
ngImport: i0,
|
|
4173
|
+
type: PdfHotspotComponent,
|
|
4174
|
+
decorators: [{
|
|
4175
|
+
type: Component,
|
|
4176
|
+
args: [{
|
|
4177
|
+
selector: "ui-pdf-hotspot",
|
|
4178
|
+
standalone: true,
|
|
4179
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4180
|
+
host: {
|
|
4181
|
+
"[style.left.px]": "x()",
|
|
4182
|
+
"[style.top.px]": "y()",
|
|
4183
|
+
"[style.width.px]": "width()",
|
|
4184
|
+
"[style.height.px]": "height()",
|
|
4185
|
+
"[attr.data-state]": "state()",
|
|
4186
|
+
"[style.--ph-scale]": "_scaleVar()"
|
|
4187
|
+
},
|
|
4188
|
+
template: `
|
|
4189
|
+
@if (state() === 'signed' && image()) {
|
|
4190
|
+
<img class="ph-image" [src]="image()" [alt]="imageAlt()" />
|
|
4191
|
+
} @else {
|
|
4192
|
+
<button
|
|
4193
|
+
type="button"
|
|
4194
|
+
class="ph-button"
|
|
4195
|
+
[class.ph-ready]="state() === 'ready'"
|
|
4196
|
+
[class.ph-warning]="tone() === 'warning'"
|
|
4197
|
+
[disabled]="state() !== 'ready'"
|
|
4198
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
4199
|
+
[style.font-size.px]="fontSize()"
|
|
4200
|
+
(click)="activate.emit()"><span class="ph-text">{{ state() === 'blocked' ? blockedLabel() : label() }}</span></button>
|
|
4201
|
+
}
|
|
4202
|
+
`,
|
|
4203
|
+
styles: [":host{position:absolute;display:block;box-sizing:border-box}.ph-image{display:block;width:100%;height:100%;object-fit:contain;object-position:left}.ph-button{position:relative;box-sizing:border-box;width:100%;height:100%;white-space:nowrap;font:inherit;font-weight:500;line-height:1;border:2px solid #d1d5db;background:#f3f4f6;color:#9ca3af;cursor:not-allowed;box-shadow:0 4px 10px #0000002e;transition:background-color .15s,border-color .15s}.ph-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.2}.ph-button.ph-ready{border-color:#2563eb;background:#dbeafe;color:#1d4ed8;cursor:pointer}.ph-button.ph-ready:hover{background:#bfdbfe}.ph-button.ph-ready.ph-warning{border-color:#f59e0b;background:#fffbeb;color:#b45309}.ph-button.ph-ready.ph-warning:hover{background:#fef3c7}.ph-button:focus-visible{outline:2px solid #2563eb;outline-offset:2px}@media(pointer:coarse){.ph-button:after{content:\"\";position:absolute;left:0;right:0;top:50%;height:100%;min-height:calc(44px / var(--ph-scale, 1));transform:translateY(-50%)}}\n"]
|
|
4204
|
+
}]
|
|
4205
|
+
}],
|
|
4206
|
+
propDecorators: {
|
|
4207
|
+
x: [{
|
|
4208
|
+
type: i0.Input,
|
|
4209
|
+
args: [{
|
|
4210
|
+
isSignal: true,
|
|
4211
|
+
alias: "x",
|
|
4212
|
+
required: false
|
|
4213
|
+
}]
|
|
4214
|
+
}],
|
|
4215
|
+
y: [{
|
|
4216
|
+
type: i0.Input,
|
|
4217
|
+
args: [{
|
|
4218
|
+
isSignal: true,
|
|
4219
|
+
alias: "y",
|
|
4220
|
+
required: false
|
|
4221
|
+
}]
|
|
4222
|
+
}],
|
|
4223
|
+
width: [{
|
|
4224
|
+
type: i0.Input,
|
|
4225
|
+
args: [{
|
|
4226
|
+
isSignal: true,
|
|
4227
|
+
alias: "width",
|
|
4228
|
+
required: false
|
|
4229
|
+
}]
|
|
4230
|
+
}],
|
|
4231
|
+
height: [{
|
|
4232
|
+
type: i0.Input,
|
|
4233
|
+
args: [{
|
|
4234
|
+
isSignal: true,
|
|
4235
|
+
alias: "height",
|
|
4236
|
+
required: false
|
|
4237
|
+
}]
|
|
4238
|
+
}],
|
|
4239
|
+
state: [{
|
|
4240
|
+
type: i0.Input,
|
|
4241
|
+
args: [{
|
|
4242
|
+
isSignal: true,
|
|
4243
|
+
alias: "state",
|
|
4244
|
+
required: false
|
|
4245
|
+
}]
|
|
4246
|
+
}],
|
|
4247
|
+
tone: [{
|
|
4248
|
+
type: i0.Input,
|
|
4249
|
+
args: [{
|
|
4250
|
+
isSignal: true,
|
|
4251
|
+
alias: "tone",
|
|
4252
|
+
required: false
|
|
4253
|
+
}]
|
|
4254
|
+
}],
|
|
4255
|
+
labelInput: [{
|
|
4256
|
+
type: i0.Input,
|
|
4257
|
+
args: [{
|
|
4258
|
+
isSignal: true,
|
|
4259
|
+
alias: "label",
|
|
4260
|
+
required: false
|
|
4261
|
+
}]
|
|
4262
|
+
}],
|
|
4263
|
+
blockedLabel: [{
|
|
4264
|
+
type: i0.Input,
|
|
4265
|
+
args: [{
|
|
4266
|
+
isSignal: true,
|
|
4267
|
+
alias: "blockedLabel",
|
|
4268
|
+
required: false
|
|
4269
|
+
}]
|
|
4270
|
+
}],
|
|
4271
|
+
ariaLabel: [{
|
|
4272
|
+
type: i0.Input,
|
|
4273
|
+
args: [{
|
|
4274
|
+
isSignal: true,
|
|
4275
|
+
alias: "ariaLabel",
|
|
4276
|
+
required: false
|
|
4277
|
+
}]
|
|
4278
|
+
}],
|
|
4279
|
+
image: [{
|
|
4280
|
+
type: i0.Input,
|
|
4281
|
+
args: [{
|
|
4282
|
+
isSignal: true,
|
|
4283
|
+
alias: "image",
|
|
4284
|
+
required: false
|
|
4285
|
+
}]
|
|
4286
|
+
}],
|
|
4287
|
+
imageAltInput: [{
|
|
4288
|
+
type: i0.Input,
|
|
4289
|
+
args: [{
|
|
4290
|
+
isSignal: true,
|
|
4291
|
+
alias: "imageAlt",
|
|
4292
|
+
required: false
|
|
4293
|
+
}]
|
|
4294
|
+
}],
|
|
4295
|
+
scale: [{
|
|
4296
|
+
type: i0.Input,
|
|
4297
|
+
args: [{
|
|
4298
|
+
isSignal: true,
|
|
4299
|
+
alias: "scale",
|
|
4300
|
+
required: false
|
|
4301
|
+
}]
|
|
4302
|
+
}],
|
|
4303
|
+
activate: [{
|
|
4304
|
+
type: i0.Output,
|
|
4305
|
+
args: ["activate"]
|
|
4306
|
+
}]
|
|
4307
|
+
}
|
|
4308
|
+
});
|
|
4309
|
+
var ImageGalleryDialogComponent = class ImageGalleryDialogComponent {
|
|
4310
|
+
constructor() {
|
|
4311
|
+
this.labels = inject(UiLabelsService);
|
|
4312
|
+
this.open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
4313
|
+
this.images = input([], ...ngDevMode ? [{ debugName: "images" }] : /* istanbul ignore next */ []);
|
|
4314
|
+
this.index = model(0, ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
|
|
4315
|
+
this.title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
4316
|
+
this.dialogTestId = input("", ...ngDevMode ? [{ debugName: "dialogTestId" }] : /* istanbul ignore next */ []);
|
|
4317
|
+
this.closeLabelInput = input(null, {
|
|
4318
|
+
...ngDevMode ? { debugName: "closeLabelInput" } : /* istanbul ignore next */ {},
|
|
4319
|
+
alias: "closeLabel"
|
|
4320
|
+
});
|
|
4321
|
+
this.closeLabel = computed(() => this.closeLabelInput() ?? this.labels.t("imageGalleryDialog.closeLabel"), ...ngDevMode ? [{ debugName: "closeLabel" }] : /* istanbul ignore next */ []);
|
|
4322
|
+
this.closeTestId = input("", ...ngDevMode ? [{ debugName: "closeTestId" }] : /* istanbul ignore next */ []);
|
|
4323
|
+
this.maxWidth = input("56rem", ...ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []);
|
|
4324
|
+
this.galleryLabelInput = input(null, {
|
|
4325
|
+
...ngDevMode ? { debugName: "galleryLabelInput" } : /* istanbul ignore next */ {},
|
|
4326
|
+
alias: "galleryLabel"
|
|
4327
|
+
});
|
|
4328
|
+
this.galleryLabel = computed(() => this.galleryLabelInput() ?? this.labels.t("imageGalleryDialog.galleryLabel"), ...ngDevMode ? [{ debugName: "galleryLabel" }] : /* istanbul ignore next */ []);
|
|
4329
|
+
effect(() => {
|
|
4330
|
+
if (this.open()) this.index.set(0);
|
|
4331
|
+
});
|
|
4332
|
+
}
|
|
4333
|
+
static {
|
|
4334
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
4335
|
+
minVersion: "12.0.0",
|
|
4336
|
+
version: "22.2.2",
|
|
4337
|
+
ngImport: i0,
|
|
4338
|
+
type: ImageGalleryDialogComponent,
|
|
4339
|
+
deps: [],
|
|
4340
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4343
|
+
static {
|
|
4344
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
4345
|
+
minVersion: "17.0.0",
|
|
4346
|
+
version: "22.2.2",
|
|
4347
|
+
type: ImageGalleryDialogComponent,
|
|
4348
|
+
isStandalone: true,
|
|
4349
|
+
selector: "ui-image-gallery-dialog",
|
|
4350
|
+
inputs: {
|
|
4351
|
+
open: {
|
|
4352
|
+
classPropertyName: "open",
|
|
4353
|
+
publicName: "open",
|
|
4354
|
+
isSignal: true,
|
|
4355
|
+
isRequired: false,
|
|
4356
|
+
transformFunction: null
|
|
4357
|
+
},
|
|
4358
|
+
images: {
|
|
4359
|
+
classPropertyName: "images",
|
|
4360
|
+
publicName: "images",
|
|
4361
|
+
isSignal: true,
|
|
4362
|
+
isRequired: false,
|
|
4363
|
+
transformFunction: null
|
|
4364
|
+
},
|
|
4365
|
+
index: {
|
|
4366
|
+
classPropertyName: "index",
|
|
4367
|
+
publicName: "index",
|
|
4368
|
+
isSignal: true,
|
|
4369
|
+
isRequired: false,
|
|
4370
|
+
transformFunction: null
|
|
4371
|
+
},
|
|
4372
|
+
title: {
|
|
4373
|
+
classPropertyName: "title",
|
|
4374
|
+
publicName: "title",
|
|
4375
|
+
isSignal: true,
|
|
4376
|
+
isRequired: false,
|
|
4377
|
+
transformFunction: null
|
|
4378
|
+
},
|
|
4379
|
+
dialogTestId: {
|
|
4380
|
+
classPropertyName: "dialogTestId",
|
|
4381
|
+
publicName: "dialogTestId",
|
|
4382
|
+
isSignal: true,
|
|
4383
|
+
isRequired: false,
|
|
4384
|
+
transformFunction: null
|
|
4385
|
+
},
|
|
4386
|
+
closeLabelInput: {
|
|
4387
|
+
classPropertyName: "closeLabelInput",
|
|
4388
|
+
publicName: "closeLabel",
|
|
4389
|
+
isSignal: true,
|
|
4390
|
+
isRequired: false,
|
|
4391
|
+
transformFunction: null
|
|
4392
|
+
},
|
|
4393
|
+
closeTestId: {
|
|
4394
|
+
classPropertyName: "closeTestId",
|
|
4395
|
+
publicName: "closeTestId",
|
|
4396
|
+
isSignal: true,
|
|
4397
|
+
isRequired: false,
|
|
4398
|
+
transformFunction: null
|
|
4399
|
+
},
|
|
4400
|
+
maxWidth: {
|
|
4401
|
+
classPropertyName: "maxWidth",
|
|
4402
|
+
publicName: "maxWidth",
|
|
4403
|
+
isSignal: true,
|
|
4404
|
+
isRequired: false,
|
|
4405
|
+
transformFunction: null
|
|
4406
|
+
},
|
|
4407
|
+
galleryLabelInput: {
|
|
4408
|
+
classPropertyName: "galleryLabelInput",
|
|
4409
|
+
publicName: "galleryLabel",
|
|
4410
|
+
isSignal: true,
|
|
4411
|
+
isRequired: false,
|
|
4412
|
+
transformFunction: null
|
|
4413
|
+
}
|
|
4414
|
+
},
|
|
4415
|
+
outputs: {
|
|
4416
|
+
open: "openChange",
|
|
4417
|
+
index: "indexChange"
|
|
4418
|
+
},
|
|
4419
|
+
ngImport: i0,
|
|
4420
|
+
template: `
|
|
4421
|
+
<ui-modal [open]="open()" [title]="title()" [maxWidth]="maxWidth()" [dialogTestId]="dialogTestId()" [hideClose]="true" (close)="open.set(false)">
|
|
4422
|
+
@if (open()) {
|
|
4423
|
+
<ui-image-gallery [images]="images()" [(index)]="index" [ariaLabel]="galleryLabel()" [autofocus]="true" />
|
|
4424
|
+
}
|
|
4425
|
+
<ui-button modal-footer-right variant="secondary" size="sm" [attr.data-testid]="closeTestId() || null" (click)="open.set(false)">{{ closeLabel() }}</ui-button>
|
|
4426
|
+
</ui-modal>
|
|
4427
|
+
`,
|
|
4428
|
+
isInline: true,
|
|
4429
|
+
dependencies: [
|
|
4430
|
+
{
|
|
4431
|
+
kind: "component",
|
|
4432
|
+
type: ModalComponent,
|
|
4433
|
+
selector: "ui-modal",
|
|
4434
|
+
inputs: [
|
|
4435
|
+
"open",
|
|
4436
|
+
"title",
|
|
4437
|
+
"description",
|
|
4438
|
+
"describedBy",
|
|
4439
|
+
"maxWidth",
|
|
4440
|
+
"bodyOverflow",
|
|
4441
|
+
"dialogTestId",
|
|
4442
|
+
"hideClose",
|
|
4443
|
+
"closable",
|
|
4444
|
+
"layout",
|
|
4445
|
+
"closeOnBackdrop",
|
|
4446
|
+
"closeOnEscape",
|
|
4447
|
+
"busy",
|
|
4448
|
+
"returnFocusTo"
|
|
4449
|
+
],
|
|
4450
|
+
outputs: ["close"]
|
|
4451
|
+
},
|
|
4452
|
+
{
|
|
4453
|
+
kind: "component",
|
|
4454
|
+
type: ImageGalleryComponent,
|
|
4455
|
+
selector: "ui-image-gallery",
|
|
4456
|
+
inputs: [
|
|
4457
|
+
"images",
|
|
4458
|
+
"index",
|
|
4459
|
+
"loop",
|
|
4460
|
+
"showDots",
|
|
4461
|
+
"showCounter",
|
|
4462
|
+
"aspectRatio",
|
|
4463
|
+
"maxHeight",
|
|
4464
|
+
"fit",
|
|
4465
|
+
"ariaLabel",
|
|
4466
|
+
"autofocus"
|
|
4467
|
+
],
|
|
4468
|
+
outputs: ["indexChange"]
|
|
4469
|
+
},
|
|
4470
|
+
{
|
|
4471
|
+
kind: "component",
|
|
4472
|
+
type: ButtonComponent,
|
|
4473
|
+
selector: "ui-button",
|
|
4474
|
+
inputs: [
|
|
4475
|
+
"variant",
|
|
4476
|
+
"routerLink",
|
|
4477
|
+
"queryParams",
|
|
4478
|
+
"fragment",
|
|
4479
|
+
"state",
|
|
4480
|
+
"href",
|
|
4481
|
+
"target",
|
|
4482
|
+
"rel",
|
|
4483
|
+
"shortLabel",
|
|
4484
|
+
"shortBelow",
|
|
4485
|
+
"color",
|
|
4486
|
+
"active",
|
|
4487
|
+
"size",
|
|
4488
|
+
"type",
|
|
4489
|
+
"disabled",
|
|
4490
|
+
"loading",
|
|
4491
|
+
"fullWidth",
|
|
4492
|
+
"ariaLabel",
|
|
4493
|
+
"ariaExpanded",
|
|
4494
|
+
"ariaPressed",
|
|
4495
|
+
"ariaDescribedBy",
|
|
4496
|
+
"modal-footer-left",
|
|
4497
|
+
"modal-footer-right"
|
|
4498
|
+
]
|
|
4499
|
+
}
|
|
4500
|
+
],
|
|
4501
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
};
|
|
4505
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
4506
|
+
minVersion: "12.0.0",
|
|
4507
|
+
version: "22.2.2",
|
|
4508
|
+
ngImport: i0,
|
|
4509
|
+
type: ImageGalleryDialogComponent,
|
|
4510
|
+
decorators: [{
|
|
4511
|
+
type: Component,
|
|
4512
|
+
args: [{
|
|
4513
|
+
selector: "ui-image-gallery-dialog",
|
|
4514
|
+
standalone: true,
|
|
4515
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4516
|
+
imports: [
|
|
4517
|
+
ModalComponent,
|
|
4518
|
+
ImageGalleryComponent,
|
|
4519
|
+
ButtonComponent
|
|
4520
|
+
],
|
|
4521
|
+
template: `
|
|
4522
|
+
<ui-modal [open]="open()" [title]="title()" [maxWidth]="maxWidth()" [dialogTestId]="dialogTestId()" [hideClose]="true" (close)="open.set(false)">
|
|
4523
|
+
@if (open()) {
|
|
4524
|
+
<ui-image-gallery [images]="images()" [(index)]="index" [ariaLabel]="galleryLabel()" [autofocus]="true" />
|
|
4525
|
+
}
|
|
4526
|
+
<ui-button modal-footer-right variant="secondary" size="sm" [attr.data-testid]="closeTestId() || null" (click)="open.set(false)">{{ closeLabel() }}</ui-button>
|
|
4527
|
+
</ui-modal>
|
|
4528
|
+
`
|
|
4529
|
+
}]
|
|
4530
|
+
}],
|
|
4531
|
+
ctorParameters: () => [],
|
|
4532
|
+
propDecorators: {
|
|
4533
|
+
open: [{
|
|
4534
|
+
type: i0.Input,
|
|
4535
|
+
args: [{
|
|
4536
|
+
isSignal: true,
|
|
4537
|
+
alias: "open",
|
|
4538
|
+
required: false
|
|
4539
|
+
}]
|
|
4540
|
+
}, {
|
|
4541
|
+
type: i0.Output,
|
|
4542
|
+
args: ["openChange"]
|
|
4543
|
+
}],
|
|
4544
|
+
images: [{
|
|
4545
|
+
type: i0.Input,
|
|
4546
|
+
args: [{
|
|
4547
|
+
isSignal: true,
|
|
4548
|
+
alias: "images",
|
|
4549
|
+
required: false
|
|
4550
|
+
}]
|
|
4551
|
+
}],
|
|
4552
|
+
index: [{
|
|
4553
|
+
type: i0.Input,
|
|
4554
|
+
args: [{
|
|
4555
|
+
isSignal: true,
|
|
4556
|
+
alias: "index",
|
|
4557
|
+
required: false
|
|
4558
|
+
}]
|
|
4559
|
+
}, {
|
|
4560
|
+
type: i0.Output,
|
|
4561
|
+
args: ["indexChange"]
|
|
4562
|
+
}],
|
|
4563
|
+
title: [{
|
|
4564
|
+
type: i0.Input,
|
|
4565
|
+
args: [{
|
|
4566
|
+
isSignal: true,
|
|
4567
|
+
alias: "title",
|
|
4568
|
+
required: false
|
|
4569
|
+
}]
|
|
4570
|
+
}],
|
|
4571
|
+
dialogTestId: [{
|
|
4572
|
+
type: i0.Input,
|
|
4573
|
+
args: [{
|
|
4574
|
+
isSignal: true,
|
|
4575
|
+
alias: "dialogTestId",
|
|
4576
|
+
required: false
|
|
4577
|
+
}]
|
|
4578
|
+
}],
|
|
4579
|
+
closeLabelInput: [{
|
|
4580
|
+
type: i0.Input,
|
|
4581
|
+
args: [{
|
|
4582
|
+
isSignal: true,
|
|
4583
|
+
alias: "closeLabel",
|
|
4584
|
+
required: false
|
|
4585
|
+
}]
|
|
4586
|
+
}],
|
|
4587
|
+
closeTestId: [{
|
|
4588
|
+
type: i0.Input,
|
|
4589
|
+
args: [{
|
|
4590
|
+
isSignal: true,
|
|
4591
|
+
alias: "closeTestId",
|
|
4592
|
+
required: false
|
|
4593
|
+
}]
|
|
4594
|
+
}],
|
|
4595
|
+
maxWidth: [{
|
|
4596
|
+
type: i0.Input,
|
|
4597
|
+
args: [{
|
|
4598
|
+
isSignal: true,
|
|
4599
|
+
alias: "maxWidth",
|
|
4600
|
+
required: false
|
|
4601
|
+
}]
|
|
4602
|
+
}],
|
|
4603
|
+
galleryLabelInput: [{
|
|
4604
|
+
type: i0.Input,
|
|
4605
|
+
args: [{
|
|
4606
|
+
isSignal: true,
|
|
4607
|
+
alias: "galleryLabel",
|
|
4608
|
+
required: false
|
|
4609
|
+
}]
|
|
4610
|
+
}]
|
|
4611
|
+
}
|
|
4612
|
+
});
|
|
4613
|
+
export { AudioPlayerComponent, CENTERED_FOCAL_POINT, IMAGE_FIELD_ACCEPT, IMAGE_FIELD_MAX_BYTES, ImageComponent, ImageFieldComponent, ImageGalleryComponent, ImageGalleryDialogComponent, ImageRepositionComponent, PdfHotspotComponent, QrCodeComponent, SignaturePadComponent, TourComponent, clampFocalPoint, frameAspectRatio, frameWidth, imageObjectPosition };
|
|
4614
|
+
|
|
4615
|
+
//# sourceMappingURL=forgeroute-ui-media.mjs.map
|