@govbr-ds/webcomponents 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cem/custom-elements.json +1404 -1387
- package/cem/webcomponents.html-custom-data.json +62 -56
- package/dist/cjs/br-avatar.cjs.entry.js +1 -1
- package/dist/cjs/br-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/br-button_2.cjs.entry.js +2 -2
- package/dist/cjs/br-card.cjs.entry.js +1 -1
- package/dist/cjs/br-carousel-page.cjs.entry.js +1 -1
- package/dist/cjs/br-carousel.cjs.entry.js +1 -1
- package/dist/cjs/br-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/br-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/br-collapse_2.cjs.entry.js +2 -2
- package/dist/cjs/br-cookiebar-cookie.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-group.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-header.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-link.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-note-group.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar-note.cjs.entry.js +1 -1
- package/dist/cjs/br-cookiebar.cjs.entry.js +1 -1
- package/dist/cjs/br-date-picker_3.cjs.entry.js +868 -516
- package/dist/cjs/br-datetime-picker.cjs.entry.js +1345 -309
- package/dist/cjs/br-divider.cjs.entry.js +1 -1
- package/dist/cjs/br-dropdown_2.cjs.entry.js +248 -129
- package/dist/cjs/br-footer-category.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-item.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-legal.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-footer-social.cjs.entry.js +1 -1
- package/dist/cjs/br-footer.cjs.entry.js +1 -1
- package/dist/cjs/br-header-function.cjs.entry.js +1 -1
- package/dist/cjs/br-header-link.cjs.entry.js +1 -1
- package/dist/cjs/br-header-list.cjs.entry.js +1 -1
- package/dist/cjs/br-header-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-header.cjs.entry.js +1 -1
- package/dist/cjs/br-icon.cjs.entry.js +1 -1
- package/dist/cjs/br-input.cjs.entry.js +9 -3
- package/dist/cjs/br-item.cjs.entry.js +1 -1
- package/dist/cjs/br-link.cjs.entry.js +1 -1
- package/dist/cjs/br-loading.cjs.entry.js +1 -1
- package/dist/cjs/br-magic-button.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-group.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-header.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-info.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-link.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-logo.cjs.entry.js +1 -1
- package/dist/cjs/br-menu-social.cjs.entry.js +1 -1
- package/dist/cjs/br-menu.cjs.entry.js +1 -1
- package/dist/cjs/br-modal.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-body.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-header.cjs.entry.js +1 -1
- package/dist/cjs/br-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/br-notification.cjs.entry.js +1 -1
- package/dist/cjs/br-pagination.cjs.entry.js +1 -1
- package/dist/cjs/br-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/br-radio.cjs.entry.js +1 -1
- package/dist/cjs/br-scrim.cjs.entry.js +1 -1
- package/dist/cjs/br-select-input_3.cjs.entry.js +282 -98
- package/dist/cjs/br-sign-in.cjs.entry.js +1 -1
- package/dist/cjs/br-skip-link.cjs.entry.js +1 -1
- package/dist/cjs/br-skiplink-item.cjs.entry.js +1 -1
- package/dist/cjs/br-slider.cjs.entry.js +1 -1
- package/dist/cjs/br-step_2.cjs.entry.js +2 -2
- package/dist/cjs/br-switch.cjs.entry.js +1 -1
- package/dist/cjs/br-tab-item.cjs.entry.js +1 -1
- package/dist/cjs/br-tab.cjs.entry.js +1 -1
- package/dist/cjs/br-table-body.cjs.entry.js +1 -1
- package/dist/cjs/br-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/br-table-header-cell.cjs.entry.js +1 -1
- package/dist/cjs/br-table-header.cjs.entry.js +1 -1
- package/dist/cjs/br-table-row.cjs.entry.js +1 -1
- package/dist/cjs/br-table.cjs.entry.js +1 -1
- package/dist/cjs/br-tag.cjs.entry.js +1 -1
- package/dist/cjs/br-textarea.cjs.entry.js +1 -1
- package/dist/cjs/br-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/br-upload.cjs.entry.js +5 -21
- package/dist/cjs/br-wizard-panel.cjs.entry.js +1 -1
- package/dist/cjs/br-wizard.cjs.entry.js +1 -1
- package/dist/cjs/{datetime-picker-constants-B5pWeOn1.js → datetime-picker-constants-CCeI5iW7.js} +20 -5
- package/dist/cjs/format-bytes-Cs8SH2w0.js +24 -0
- package/dist/cjs/index-Bc30P_6z.js +14 -14
- package/dist/cjs/{index-C92n55ch.js → index-C-IpVFDH.js} +13 -13
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{datetime-picker-props-validation-DmNKSXsy.js → isValid-CduHZTFc.js} +1 -483
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/select.utils-C38f5Kea.js +62 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/avatar/avatar.css +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.css +1 -1
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/card/card.css +1 -1
- package/dist/collection/components/carousel/carousel-page/carousel-page.css +1 -1
- package/dist/collection/components/carousel/carousel.css +1 -1
- package/dist/collection/components/checkbox/checkbox.css +1 -1
- package/dist/collection/components/checkbox-group/checkbox-group.css +1 -1
- package/dist/collection/components/collapse/collapse.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-cookie/cookiebar-cookie.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-group/cookiebar-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-header/cookiebar-header.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-link/cookiebar-link.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note/cookiebar-note.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar-note-group/cookiebar-note-group.css +1 -1
- package/dist/collection/components/cookiebar/cookiebar.css +1 -1
- package/dist/collection/components/datetime-picker/date-picker/date-picker-locale.js +12 -12
- package/dist/collection/components/datetime-picker/date-picker/date-picker-props-validation.js +14 -13
- package/dist/collection/components/datetime-picker/date-picker/date-picker.css +1 -1
- package/dist/collection/components/datetime-picker/date-picker/date-picker.js +384 -280
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-constants.js +59 -0
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input-props-validation.js +19 -15
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.js +373 -211
- package/dist/collection/components/datetime-picker/datetime-input/datetime-input.types.js +1 -0
- package/dist/collection/components/datetime-picker/datetime-picker-constants.js +19 -5
- package/dist/collection/components/datetime-picker/datetime-picker-form-associated.js +92 -11
- package/dist/collection/components/datetime-picker/datetime-picker-props-validation.js +52 -33
- package/dist/collection/components/datetime-picker/datetime-picker.css +1 -1
- package/dist/collection/components/datetime-picker/datetime-picker.js +915 -362
- package/dist/collection/components/datetime-picker/datetime-picker.utils.js +62 -49
- package/dist/collection/components/datetime-picker/time-picker/time-picker-constants.js +3 -2
- package/dist/collection/components/datetime-picker/time-picker/time-picker.css +1 -1
- package/dist/collection/components/datetime-picker/time-picker/time-picker.js +148 -85
- package/dist/collection/components/divider/divider.css +1 -1
- package/dist/collection/components/dropdown/dropdown.css +1 -1
- package/dist/collection/components/footer/footer-category/footer-category.css +1 -1
- package/dist/collection/components/footer/footer-item/footer-item.css +1 -1
- package/dist/collection/components/footer/footer-legal/footer-legal.css +1 -1
- package/dist/collection/components/footer/footer-logo/footer-logo.css +1 -1
- package/dist/collection/components/footer/footer-social/footer-social.css +1 -1
- package/dist/collection/components/footer/footer.css +1 -1
- package/dist/collection/components/header/header-function/header-function.css +1 -1
- package/dist/collection/components/header/header-link/header-link.css +1 -1
- package/dist/collection/components/header/header-list/header-list.css +1 -1
- package/dist/collection/components/header/header-logo/header-logo.css +1 -1
- package/dist/collection/components/header/header.css +1 -1
- package/dist/collection/components/icon/icon.css +1 -1
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/input.js +29 -2
- package/dist/collection/components/item/item.css +1 -1
- package/dist/collection/components/link/link.css +1 -1
- package/dist/collection/components/list/list.css +1 -1
- package/dist/collection/components/loading/loading.css +1 -1
- package/dist/collection/components/magic-button/magic-button.css +1 -1
- package/dist/collection/components/menu/menu-group/menu-group.css +1 -1
- package/dist/collection/components/menu/menu-header/menu-header.css +1 -1
- package/dist/collection/components/menu/menu-info/menu-info.css +1 -1
- package/dist/collection/components/menu/menu-item/menu-item.css +1 -1
- package/dist/collection/components/menu/menu-link/menu-link.css +1 -1
- package/dist/collection/components/menu/menu-list/menu-list.css +1 -1
- package/dist/collection/components/menu/menu-logo/menu-logo.css +1 -1
- package/dist/collection/components/menu/menu-social/menu-social.css +1 -1
- package/dist/collection/components/menu/menu.css +1 -1
- package/dist/collection/components/message/message.css +1 -1
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/collection/components/notification/notification-body/notification-body.css +1 -1
- package/dist/collection/components/notification/notification-header/notification-header.css +1 -1
- package/dist/collection/components/notification/notification-item/notification-item.css +1 -1
- package/dist/collection/components/notification/notification.css +1 -1
- package/dist/collection/components/pagination/pagination.css +1 -1
- package/dist/collection/components/radio/radio.css +1 -1
- package/dist/collection/components/radio-group/radio-group.css +1 -1
- package/dist/collection/components/scrim/scrim.css +1 -1
- package/dist/collection/components/select/select-input/select-input.css +1 -1
- package/dist/collection/components/select/select-input/select-input.js +123 -17
- package/dist/collection/components/select/select-list/select-list.css +1 -1
- package/dist/collection/components/select/select-list/select-list.js +218 -66
- package/dist/collection/components/select/select-option/select-option.css +1 -1
- package/dist/collection/components/select/select-option/select-option.js +14 -5
- package/dist/collection/components/select/select.css +1 -1
- package/dist/collection/components/select/select.js +303 -94
- package/dist/collection/components/select/select.utils.js +26 -7
- package/dist/collection/components/sign-in/sign-in.css +1 -1
- package/dist/collection/components/skip-link/skip-link-item/skip-link-item.css +1 -1
- package/dist/collection/components/skip-link/skip-link.css +1 -1
- package/dist/collection/components/slider/slider.css +1 -1
- package/dist/collection/components/step/step-item/step-item.css +1 -1
- package/dist/collection/components/step/step.css +1 -1
- package/dist/collection/components/switch/switch.css +1 -1
- package/dist/collection/components/tab/tab-item/tab-item.css +1 -1
- package/dist/collection/components/tab/tab.css +1 -1
- package/dist/collection/components/table/table-body/table-body.css +1 -1
- package/dist/collection/components/table/table-cell/table-cell.css +1 -1
- package/dist/collection/components/table/table-header/table-header.css +1 -1
- package/dist/collection/components/table/table-header-cell/table-header-cell.css +1 -1
- package/dist/collection/components/table/table-row/table-row.css +1 -1
- package/dist/collection/components/table/table.css +1 -1
- package/dist/collection/components/tag/tag.css +1 -1
- package/dist/collection/components/textarea/textarea.css +1 -1
- package/dist/collection/components/tooltip/tooltip.css +1 -1
- package/dist/collection/components/upload/upload.css +1 -1
- package/dist/collection/components/wizard/wizard-panel/wizard-panel.css +1 -1
- package/dist/collection/components/wizard/wizard.css +1 -1
- package/dist/components/br-avatar.js +1 -1
- package/dist/components/br-breadcrumb.js +1 -1
- package/dist/components/br-button.js +1 -1
- package/dist/components/br-card.js +1 -1
- package/dist/components/br-carousel-page.js +1 -1
- package/dist/components/br-carousel.js +1 -1
- package/dist/components/br-checkbox-group.js +1 -1
- package/dist/components/br-checkbox.js +1 -1
- package/dist/components/br-checkgroup.js +1 -1
- package/dist/components/br-collapse.js +1 -1
- package/dist/components/br-cookiebar-cookie.js +1 -1
- package/dist/components/br-cookiebar-group.js +1 -1
- package/dist/components/br-cookiebar-header.js +1 -1
- package/dist/components/br-cookiebar-link.js +1 -1
- package/dist/components/br-cookiebar-note-group.js +1 -1
- package/dist/components/br-cookiebar-note.js +1 -1
- package/dist/components/br-cookiebar.js +1 -1
- package/dist/components/br-date-picker.js +1 -1
- package/dist/components/br-datetime-input.js +1 -1
- package/dist/components/br-datetime-picker.js +1 -1
- package/dist/components/br-divider.js +1 -1
- package/dist/components/br-dropdown.js +1 -1
- package/dist/components/br-footer-category.js +1 -1
- package/dist/components/br-footer-item.js +1 -1
- package/dist/components/br-footer-legal.js +1 -1
- package/dist/components/br-footer-logo.js +1 -1
- package/dist/components/br-footer-social.js +1 -1
- package/dist/components/br-footer.js +1 -1
- package/dist/components/br-header-function.js +1 -1
- package/dist/components/br-header-link.js +1 -1
- package/dist/components/br-header-list.js +1 -1
- package/dist/components/br-header-logo.js +1 -1
- package/dist/components/br-header.js +1 -1
- package/dist/components/br-icon.js +1 -1
- package/dist/components/br-input.js +1 -1
- package/dist/components/br-item.js +1 -1
- package/dist/components/br-link.js +1 -1
- package/dist/components/br-list.js +1 -1
- package/dist/components/br-loading.js +1 -1
- package/dist/components/br-magic-button.js +1 -1
- package/dist/components/br-menu-group.js +1 -1
- package/dist/components/br-menu-header.js +1 -1
- package/dist/components/br-menu-info.js +1 -1
- package/dist/components/br-menu-item.js +1 -1
- package/dist/components/br-menu-link.js +1 -1
- package/dist/components/br-menu-list.js +1 -1
- package/dist/components/br-menu-logo.js +1 -1
- package/dist/components/br-menu-social.js +1 -1
- package/dist/components/br-menu.js +1 -1
- package/dist/components/br-message.js +1 -1
- package/dist/components/br-modal.js +1 -1
- package/dist/components/br-notification-body.js +1 -1
- package/dist/components/br-notification-header.js +1 -1
- package/dist/components/br-notification-item.js +1 -1
- package/dist/components/br-notification.js +1 -1
- package/dist/components/br-pagination.js +1 -1
- package/dist/components/br-radio-group.js +1 -1
- package/dist/components/br-radio.js +1 -1
- package/dist/components/br-scrim.js +1 -1
- package/dist/components/br-select-input.js +1 -1
- package/dist/components/br-select-list.js +1 -1
- package/dist/components/br-select-option.js +1 -1
- package/dist/components/br-select.js +1 -1
- package/dist/components/br-sign-in.js +1 -1
- package/dist/components/br-skip-link-item.js +1 -1
- package/dist/components/br-skip-link.js +1 -1
- package/dist/components/br-skiplink-item.js +1 -1
- package/dist/components/br-slider.js +1 -1
- package/dist/components/br-step-item.js +1 -1
- package/dist/components/br-step.js +1 -1
- package/dist/components/br-switch.js +1 -1
- package/dist/components/br-tab-item.js +1 -1
- package/dist/components/br-tab.js +1 -1
- package/dist/components/br-table-body.js +1 -1
- package/dist/components/br-table-cell.js +1 -1
- package/dist/components/br-table-header-cell.js +1 -1
- package/dist/components/br-table-header.js +1 -1
- package/dist/components/br-table-row.js +1 -1
- package/dist/components/br-table.js +1 -1
- package/dist/components/br-tag.js +1 -1
- package/dist/components/br-textarea.js +1 -1
- package/dist/components/br-time-picker.js +1 -1
- package/dist/components/br-tooltip.js +1 -1
- package/dist/components/br-upload.js +1 -1
- package/dist/components/br-wizard-panel.js +1 -1
- package/dist/components/br-wizard.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-5h-W9_JR.js +5 -0
- package/dist/components/p-848QkYoM.js +5 -0
- package/dist/components/p-B7bNfmgh.js +5 -0
- package/dist/components/p-BFHvuEnN.js +5 -0
- package/dist/components/p-BH6QYnAr.js +5 -0
- package/dist/{webcomponents/p-5f422a69.entry.js → components/p-BcW8O6h2.js} +1 -1
- package/dist/components/p-BicHMcSS.js +5 -0
- package/dist/components/p-Bs7iRQTG.js +5 -0
- package/dist/components/{p-Nze3Utvd.js → p-Bvrw9yWR.js} +1 -1
- package/dist/components/p-BzQFMh9j.js +5 -0
- package/dist/components/p-CBHd0-fF.js +5 -0
- package/dist/components/p-CCPHCJjw.js +5 -0
- package/dist/components/{p-BcqVlof7.js → p-CbgKdASU.js} +1 -1
- package/dist/components/p-CeNELttN.js +5 -0
- package/dist/components/p-CjtmJTLO.js +5 -0
- package/dist/components/{p-CZZVc2gK.js → p-D-3G3Ioq.js} +1 -1
- package/dist/components/p-DDu3JV_r.js +5 -0
- package/dist/components/p-DFWqyfUe.js +5 -0
- package/dist/components/p-DL6xuxGG.js +5 -0
- package/dist/components/p-DOX9Uwk1.js +5 -0
- package/dist/components/p-DUq7uT2-.js +5 -0
- package/dist/components/p-Devw08cc.js +5 -0
- package/dist/components/p-Di96UxvH.js +5 -0
- package/dist/components/p-Dp3MsSXu.js +5 -0
- package/dist/components/p-DsO4F0Cz.js +5 -0
- package/dist/components/p-DuLHFTpa.js +5 -0
- package/dist/components/p-DusornQ0.js +5 -0
- package/dist/components/p-OQpiDEK9.js +5 -0
- package/dist/components/p-PV731d8s.js +5 -0
- package/dist/components/p-XW6Hp_Jk.js +5 -0
- package/dist/components/p-jOb1hCPi.js +5 -0
- package/dist/components/p-rMnkh3Cy.js +5 -0
- package/dist/components/p-ta-24T1Z.js +5 -0
- package/dist/esm/br-avatar.entry.js +1 -1
- package/dist/esm/br-breadcrumb.entry.js +1 -1
- package/dist/esm/br-button_2.entry.js +2 -2
- package/dist/esm/br-card.entry.js +1 -1
- package/dist/esm/br-carousel-page.entry.js +1 -1
- package/dist/esm/br-carousel.entry.js +2 -2
- package/dist/esm/br-checkbox-group.entry.js +1 -1
- package/dist/esm/br-checkbox.entry.js +2 -2
- package/dist/esm/br-collapse_2.entry.js +3 -3
- package/dist/esm/br-cookiebar-cookie.entry.js +1 -1
- package/dist/esm/br-cookiebar-group.entry.js +1 -1
- package/dist/esm/br-cookiebar-header.entry.js +1 -1
- package/dist/esm/br-cookiebar-link.entry.js +1 -1
- package/dist/esm/br-cookiebar-note-group.entry.js +1 -1
- package/dist/esm/br-cookiebar-note.entry.js +1 -1
- package/dist/esm/br-cookiebar.entry.js +2 -2
- package/dist/esm/br-date-picker_3.entry.js +843 -491
- package/dist/esm/br-datetime-picker.entry.js +1314 -278
- package/dist/esm/br-divider.entry.js +1 -1
- package/dist/esm/br-dropdown_2.entry.js +247 -128
- package/dist/esm/br-footer-category.entry.js +1 -1
- package/dist/esm/br-footer-item.entry.js +1 -1
- package/dist/esm/br-footer-legal.entry.js +1 -1
- package/dist/esm/br-footer-logo.entry.js +1 -1
- package/dist/esm/br-footer-social.entry.js +1 -1
- package/dist/esm/br-footer.entry.js +1 -1
- package/dist/esm/br-header-function.entry.js +1 -1
- package/dist/esm/br-header-link.entry.js +1 -1
- package/dist/esm/br-header-list.entry.js +2 -2
- package/dist/esm/br-header-logo.entry.js +1 -1
- package/dist/esm/br-header.entry.js +1 -1
- package/dist/esm/br-icon.entry.js +1 -1
- package/dist/esm/br-input.entry.js +10 -4
- package/dist/esm/br-item.entry.js +1 -1
- package/dist/esm/br-link.entry.js +1 -1
- package/dist/esm/br-loading.entry.js +1 -1
- package/dist/esm/br-magic-button.entry.js +1 -1
- package/dist/esm/br-menu-group.entry.js +1 -1
- package/dist/esm/br-menu-header.entry.js +1 -1
- package/dist/esm/br-menu-info.entry.js +1 -1
- package/dist/esm/br-menu-item.entry.js +1 -1
- package/dist/esm/br-menu-link.entry.js +1 -1
- package/dist/esm/br-menu-list.entry.js +1 -1
- package/dist/esm/br-menu-logo.entry.js +1 -1
- package/dist/esm/br-menu-social.entry.js +1 -1
- package/dist/esm/br-menu.entry.js +2 -2
- package/dist/esm/br-modal.entry.js +1 -1
- package/dist/esm/br-notification-body.entry.js +1 -1
- package/dist/esm/br-notification-header.entry.js +1 -1
- package/dist/esm/br-notification-item.entry.js +1 -1
- package/dist/esm/br-notification.entry.js +2 -2
- package/dist/esm/br-pagination.entry.js +1 -1
- package/dist/esm/br-radio-group.entry.js +2 -2
- package/dist/esm/br-radio.entry.js +2 -2
- package/dist/esm/br-scrim.entry.js +1 -1
- package/dist/esm/br-select-input_3.entry.js +282 -98
- package/dist/esm/br-sign-in.entry.js +1 -1
- package/dist/esm/br-skip-link.entry.js +1 -1
- package/dist/esm/br-skiplink-item.entry.js +1 -1
- package/dist/esm/br-slider.entry.js +2 -2
- package/dist/esm/br-step_2.entry.js +2 -2
- package/dist/esm/br-switch.entry.js +2 -2
- package/dist/esm/br-tab-item.entry.js +1 -1
- package/dist/esm/br-tab.entry.js +1 -1
- package/dist/esm/br-table-body.entry.js +1 -1
- package/dist/esm/br-table-cell.entry.js +1 -1
- package/dist/esm/br-table-header-cell.entry.js +1 -1
- package/dist/esm/br-table-header.entry.js +1 -1
- package/dist/esm/br-table-row.entry.js +1 -1
- package/dist/esm/br-table.entry.js +1 -1
- package/dist/esm/br-tag.entry.js +2 -2
- package/dist/esm/br-textarea.entry.js +2 -2
- package/dist/esm/br-tooltip.entry.js +2 -2
- package/dist/esm/br-upload.entry.js +3 -19
- package/dist/esm/br-wizard-panel.entry.js +1 -1
- package/dist/esm/br-wizard.entry.js +1 -1
- package/dist/esm/{datetime-picker-constants-BtRPYRvA.js → datetime-picker-constants-DDc4sADe.js} +20 -6
- package/dist/esm/{event-CfuJQ1DY.js → event-6Da1SZ3J.js} +1 -1
- package/dist/esm/format-bytes-B7bNfmgh.js +22 -0
- package/dist/esm/index-ConyRdJe.js +14 -14
- package/dist/esm/{index-BQPOWxe5.js → index-CytVKoHT.js} +13 -13
- package/dist/esm/index.js +2 -2
- package/dist/esm/{datetime-picker-props-validation-BeTcUTnE.js → isValid-Bee0Uvqc.js} +2 -477
- package/dist/esm/loader.js +1 -1
- package/dist/esm/select.utils-BYsh2ZdE.js +57 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/hydrate/index.js +2979 -1673
- package/dist/hydrate/index.mjs +2979 -1673
- package/dist/types/components/datetime-picker/date-picker/date-picker-locale.d.ts +9 -9
- package/dist/types/components/datetime-picker/date-picker/date-picker-props-validation.d.ts +14 -13
- package/dist/types/components/datetime-picker/date-picker/date-picker.d.ts +264 -161
- package/dist/types/components/datetime-picker/datetime-input/datetime-input-constants.d.ts +14 -0
- package/dist/types/components/datetime-picker/datetime-input/datetime-input-props-validation.d.ts +19 -15
- package/dist/types/components/datetime-picker/datetime-input/datetime-input.d.ts +229 -98
- package/dist/types/components/datetime-picker/datetime-input/datetime-input.types.d.ts +36 -0
- package/dist/types/components/datetime-picker/datetime-picker-constants.d.ts +19 -5
- package/dist/types/components/datetime-picker/datetime-picker-form-associated.d.ts +32 -5
- package/dist/types/components/datetime-picker/datetime-picker-props-validation.d.ts +22 -24
- package/dist/types/components/datetime-picker/datetime-picker.d.ts +508 -235
- package/dist/types/components/datetime-picker/datetime-picker.types.d.ts +75 -21
- package/dist/types/components/datetime-picker/datetime-picker.utils.d.ts +53 -47
- package/dist/types/components/datetime-picker/time-picker/time-picker-constants.d.ts +3 -2
- package/dist/types/components/datetime-picker/time-picker/time-picker.d.ts +126 -55
- package/dist/types/components/input/input.d.ts +9 -1
- package/dist/types/components/input/input.types.d.ts +4 -0
- package/dist/types/components/select/select-input/select-input.d.ts +9 -2
- package/dist/types/components/select/select-list/select-list.d.ts +14 -2
- package/dist/types/components/select/select-option/select-option.d.ts +1 -0
- package/dist/types/components/select/select.d.ts +47 -7
- package/dist/types/components/select/select.types.d.ts +12 -0
- package/dist/types/components/select/select.utils.d.ts +3 -0
- package/dist/types/components.d.ts +387 -300
- package/dist/webcomponents/index.esm.js +1 -1
- package/dist/webcomponents/p-01801ac1.entry.js +5 -0
- package/dist/webcomponents/p-05b459f2.entry.js +5 -0
- package/dist/webcomponents/p-08ac6f09.entry.js +5 -0
- package/dist/webcomponents/p-09c79c1d.entry.js +5 -0
- package/dist/webcomponents/p-0fc112fc.entry.js +5 -0
- package/dist/webcomponents/p-13babfc4.entry.js +5 -0
- package/dist/webcomponents/p-15022ab7.entry.js +5 -0
- package/dist/webcomponents/p-172d42c2.entry.js +5 -0
- package/dist/webcomponents/p-18cf093a.entry.js +5 -0
- package/dist/webcomponents/p-198aa844.entry.js +5 -0
- package/dist/webcomponents/p-1ba60d13.entry.js +5 -0
- package/dist/webcomponents/p-1bb96641.entry.js +5 -0
- package/dist/webcomponents/{p-82759002.entry.js → p-20477061.entry.js} +1 -1
- package/dist/webcomponents/p-21feda62.entry.js +5 -0
- package/dist/webcomponents/p-23a5cfd7.entry.js +5 -0
- package/dist/webcomponents/{p-0b0cf355.entry.js → p-2c8595d3.entry.js} +1 -1
- package/dist/webcomponents/{p-76d51654.entry.js → p-31a4694a.entry.js} +1 -1
- package/dist/webcomponents/p-32ea6342.entry.js +5 -0
- package/dist/webcomponents/p-3658adcf.entry.js +5 -0
- package/dist/webcomponents/p-37914e63.entry.js +5 -0
- package/dist/webcomponents/p-3b0dd0ff.entry.js +5 -0
- package/dist/webcomponents/p-42b60169.entry.js +5 -0
- package/dist/webcomponents/p-42c9c6c5.entry.js +5 -0
- package/dist/{components/p-DOJ1vYOl.js → webcomponents/p-473561f2.entry.js} +1 -1
- package/dist/webcomponents/p-47c490ef.entry.js +5 -0
- package/dist/webcomponents/p-4b01c60f.entry.js +5 -0
- package/dist/webcomponents/p-5a5ed7d8.entry.js +5 -0
- package/dist/webcomponents/p-609cf652.entry.js +5 -0
- package/dist/webcomponents/p-614683d9.entry.js +5 -0
- package/dist/webcomponents/p-67605757.entry.js +5 -0
- package/dist/webcomponents/p-67774920.entry.js +5 -0
- package/dist/webcomponents/p-67d62559.entry.js +5 -0
- package/dist/webcomponents/{p-4118b878.entry.js → p-695dbeb0.entry.js} +1 -1
- package/dist/webcomponents/{p-CfuJQ1DY.js → p-6Da1SZ3J.js} +1 -1
- package/dist/webcomponents/p-6a293be8.entry.js +5 -0
- package/dist/webcomponents/{p-d5d2205c.entry.js → p-6f1a4fbe.entry.js} +1 -1
- package/dist/webcomponents/p-7352d459.entry.js +5 -0
- package/dist/webcomponents/p-745213f7.entry.js +5 -0
- package/dist/webcomponents/p-794b701b.entry.js +5 -0
- package/dist/webcomponents/p-7ee564a1.entry.js +5 -0
- package/dist/webcomponents/{p-6850e98e.entry.js → p-7fda8b89.entry.js} +1 -1
- package/dist/webcomponents/p-8116ee93.entry.js +5 -0
- package/dist/webcomponents/p-821341dc.entry.js +5 -0
- package/dist/webcomponents/p-8aa6f07c.entry.js +5 -0
- package/dist/webcomponents/p-8ddf3ce3.entry.js +5 -0
- package/dist/webcomponents/p-95f3c44a.entry.js +5 -0
- package/dist/webcomponents/p-96dbb585.entry.js +5 -0
- package/dist/webcomponents/p-9815ab95.entry.js +5 -0
- package/dist/webcomponents/{p-b02a7218.entry.js → p-9e0324a7.entry.js} +1 -1
- package/dist/webcomponents/p-B7bNfmgh.js +5 -0
- package/dist/webcomponents/p-BYsh2ZdE.js +5 -0
- package/dist/webcomponents/p-CJipT0in.js +5 -0
- package/dist/webcomponents/{p-BtRPYRvA.js → p-DDc4sADe.js} +1 -1
- package/dist/webcomponents/p-a038be16.entry.js +5 -0
- package/dist/webcomponents/p-a32d17cb.entry.js +5 -0
- package/dist/webcomponents/p-a46f068e.entry.js +5 -0
- package/dist/webcomponents/p-a89b684d.entry.js +5 -0
- package/dist/webcomponents/{p-0d2ca2f7.entry.js → p-ac68355e.entry.js} +1 -1
- package/dist/webcomponents/{p-61977114.entry.js → p-af888d13.entry.js} +1 -1
- package/dist/webcomponents/p-b0124459.entry.js +5 -0
- package/dist/webcomponents/p-b063c12f.entry.js +5 -0
- package/dist/webcomponents/p-b07bfdc5.entry.js +5 -0
- package/dist/webcomponents/{p-c1dafd8d.entry.js → p-b5d25332.entry.js} +1 -1
- package/dist/webcomponents/p-b609b464.entry.js +5 -0
- package/dist/webcomponents/p-b66ab52d.entry.js +5 -0
- package/dist/webcomponents/p-b8d4ace3.entry.js +5 -0
- package/dist/webcomponents/p-c717c745.entry.js +5 -0
- package/dist/webcomponents/p-d08b6266.entry.js +5 -0
- package/dist/webcomponents/p-d6165aa0.entry.js +5 -0
- package/dist/webcomponents/{p-14ff5865.entry.js → p-dacb7e2c.entry.js} +1 -1
- package/dist/webcomponents/p-db309a11.entry.js +5 -0
- package/dist/webcomponents/{p-19a38e20.entry.js → p-dc23cb2e.entry.js} +1 -1
- package/dist/webcomponents/p-e241caf3.entry.js +5 -0
- package/dist/webcomponents/p-e661c024.entry.js +5 -0
- package/dist/webcomponents/p-e7107869.entry.js +5 -0
- package/dist/webcomponents/p-eb94199d.entry.js +5 -0
- package/dist/webcomponents/{p-e07e309d.entry.js → p-f8993ae4.entry.js} +1 -1
- package/dist/webcomponents/{p-513ee754.entry.js → p-f99d8c9c.entry.js} +1 -1
- package/dist/webcomponents/{p-DV-iW9Aj.js → p-fOJu6uZR.js} +1 -1
- package/dist/webcomponents/{p-b16590fc.entry.js → p-fb76b1e0.entry.js} +1 -1
- package/dist/webcomponents/p-fdcb54a3.entry.js +5 -0
- package/dist/webcomponents/{p-94848046.entry.js → p-fed02286.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-0qmYp77w.js +0 -5
- package/dist/components/p-5c3rNBXh.js +0 -5
- package/dist/components/p-B8oIvH3q.js +0 -5
- package/dist/components/p-BECz8XWJ.js +0 -5
- package/dist/components/p-BM4Ys6hX.js +0 -5
- package/dist/components/p-BXWh9s7p.js +0 -5
- package/dist/components/p-BblZlUp2.js +0 -5
- package/dist/components/p-Bezou5CQ.js +0 -5
- package/dist/components/p-BjeUETWJ.js +0 -5
- package/dist/components/p-Cd6udSDt.js +0 -5
- package/dist/components/p-Ci0_RqAE.js +0 -5
- package/dist/components/p-CuBgClZm.js +0 -5
- package/dist/components/p-D0QYZSoP.js +0 -5
- package/dist/components/p-D4SWpW6-.js +0 -5
- package/dist/components/p-D579DS7x.js +0 -5
- package/dist/components/p-D8K7rhHd.js +0 -5
- package/dist/components/p-D9nXlCuS.js +0 -5
- package/dist/components/p-DKFO6Q_g.js +0 -5
- package/dist/components/p-DNJSSCNi.js +0 -5
- package/dist/components/p-DYI30IZL.js +0 -5
- package/dist/components/p-DcVldfL0.js +0 -5
- package/dist/components/p-DhvmHPp4.js +0 -5
- package/dist/components/p-DwgiHL0b.js +0 -5
- package/dist/components/p-WxDB6Dk4.js +0 -5
- package/dist/components/p-ZLoeVagg.js +0 -5
- package/dist/components/p-gbYJ9sfc.js +0 -5
- package/dist/components/p-uc8ABlC_.js +0 -5
- package/dist/components/p-v60ypfxD.js +0 -5
- package/dist/webcomponents/p-078bd760.entry.js +0 -5
- package/dist/webcomponents/p-07c2cdff.entry.js +0 -5
- package/dist/webcomponents/p-0d79ca44.entry.js +0 -5
- package/dist/webcomponents/p-0fe3c47b.entry.js +0 -5
- package/dist/webcomponents/p-116b53c9.entry.js +0 -5
- package/dist/webcomponents/p-1240dae7.entry.js +0 -5
- package/dist/webcomponents/p-15743a02.entry.js +0 -5
- package/dist/webcomponents/p-16cebf49.entry.js +0 -5
- package/dist/webcomponents/p-1884b9d3.entry.js +0 -5
- package/dist/webcomponents/p-1d36c8fa.entry.js +0 -5
- package/dist/webcomponents/p-1fa4b5b2.entry.js +0 -5
- package/dist/webcomponents/p-212c069b.entry.js +0 -5
- package/dist/webcomponents/p-23f37cd6.entry.js +0 -5
- package/dist/webcomponents/p-24502b63.entry.js +0 -5
- package/dist/webcomponents/p-27fb81f3.entry.js +0 -5
- package/dist/webcomponents/p-28844490.entry.js +0 -5
- package/dist/webcomponents/p-2b41bdcc.entry.js +0 -5
- package/dist/webcomponents/p-2cb1e09b.entry.js +0 -5
- package/dist/webcomponents/p-2fcda70b.entry.js +0 -5
- package/dist/webcomponents/p-3378300c.entry.js +0 -5
- package/dist/webcomponents/p-3ae9cf69.entry.js +0 -5
- package/dist/webcomponents/p-3b79cd49.entry.js +0 -5
- package/dist/webcomponents/p-3c1513ec.entry.js +0 -5
- package/dist/webcomponents/p-4534a3c3.entry.js +0 -5
- package/dist/webcomponents/p-48abf568.entry.js +0 -5
- package/dist/webcomponents/p-4e5ea05c.entry.js +0 -5
- package/dist/webcomponents/p-521a1076.entry.js +0 -5
- package/dist/webcomponents/p-59fc52c0.entry.js +0 -5
- package/dist/webcomponents/p-5a9f4ea2.entry.js +0 -5
- package/dist/webcomponents/p-71853dfc.entry.js +0 -5
- package/dist/webcomponents/p-77e242f3.entry.js +0 -5
- package/dist/webcomponents/p-7b849472.entry.js +0 -5
- package/dist/webcomponents/p-7dbfb875.entry.js +0 -5
- package/dist/webcomponents/p-7fa7f052.entry.js +0 -5
- package/dist/webcomponents/p-81c65747.entry.js +0 -5
- package/dist/webcomponents/p-91a5329f.entry.js +0 -5
- package/dist/webcomponents/p-966773a9.entry.js +0 -5
- package/dist/webcomponents/p-9abb5a53.entry.js +0 -5
- package/dist/webcomponents/p-9bf2e325.entry.js +0 -5
- package/dist/webcomponents/p-9c943b40.entry.js +0 -5
- package/dist/webcomponents/p-9ec3ca00.entry.js +0 -5
- package/dist/webcomponents/p-B0PbhaxL.js +0 -5
- package/dist/webcomponents/p-ad91f149.entry.js +0 -5
- package/dist/webcomponents/p-aeea1f17.entry.js +0 -5
- package/dist/webcomponents/p-c2ca0289.entry.js +0 -5
- package/dist/webcomponents/p-c8af334e.entry.js +0 -5
- package/dist/webcomponents/p-cac49c6a.entry.js +0 -5
- package/dist/webcomponents/p-cb9ebfbe.entry.js +0 -5
- package/dist/webcomponents/p-d11f95a0.entry.js +0 -5
- package/dist/webcomponents/p-dad03b49.entry.js +0 -5
- package/dist/webcomponents/p-db8e6322.entry.js +0 -5
- package/dist/webcomponents/p-dea8015f.entry.js +0 -5
- package/dist/webcomponents/p-e53d874b.entry.js +0 -5
- package/dist/webcomponents/p-e5540387.entry.js +0 -5
- package/dist/webcomponents/p-e94a52ac.entry.js +0 -5
- package/dist/webcomponents/p-e9be4d3f.entry.js +0 -5
- package/dist/webcomponents/p-e9db9381.entry.js +0 -5
- package/dist/webcomponents/p-edca5de1.entry.js +0 -5
- package/dist/webcomponents/p-ee5b9fc9.entry.js +0 -5
- package/dist/webcomponents/p-f4ef8c63.entry.js +0 -5
|
@@ -5,13 +5,32 @@
|
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
7
|
var index = require('./index-Bc30P_6z.js');
|
|
8
|
-
var
|
|
8
|
+
var isValid = require('./isValid-CduHZTFc.js');
|
|
9
9
|
var event = require('./event-CmVdNHxl.js');
|
|
10
10
|
var validator = require('./validator-GkkueMOx.js');
|
|
11
|
+
var formatBytes$1 = require('./format-bytes-Cs8SH2w0.js');
|
|
11
12
|
var id = require('./id-DE4jSi-L.js');
|
|
12
|
-
var propWarning = require('./prop-warning-xvEHQz8H.js');
|
|
13
13
|
var slot = require('./slot-DAllytTj.js');
|
|
14
|
-
var datetimePickerConstants = require('./datetime-picker-constants-
|
|
14
|
+
var datetimePickerConstants = require('./datetime-picker-constants-CCeI5iW7.js');
|
|
15
|
+
var propWarning = require('./prop-warning-xvEHQz8H.js');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Utilitários Helpers com funções auxiliares para geração de IDs e formatação de bytes.
|
|
19
|
+
* Mantemos um `default` export com a API compatível para não quebrar importações existentes.
|
|
20
|
+
*/
|
|
21
|
+
function generateUniqueId(prefix) {
|
|
22
|
+
return id.generateUniqueId(prefix);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Formata um valor em bytes para uma representação humana (KB, MB, GB...).
|
|
26
|
+
* @param bytes Quantidade em bytes.
|
|
27
|
+
* @param decimals Número de casas decimais (padrão: 2).
|
|
28
|
+
* @returns Valor formatado com unidade.
|
|
29
|
+
*/
|
|
30
|
+
function formatBytes(bytes, decimals = 2) {
|
|
31
|
+
return formatBytes$1.formatBytes(bytes, decimals);
|
|
32
|
+
}
|
|
33
|
+
const Helpers = { generateUniqueId, formatBytes };
|
|
15
34
|
|
|
16
35
|
var isMatch = {};
|
|
17
36
|
|
|
@@ -22,7 +41,7 @@ function requireIsMatch () {
|
|
|
22
41
|
hasRequiredIsMatch = 1;
|
|
23
42
|
isMatch.isMatch = isMatch$1;
|
|
24
43
|
var _index = /*@__PURE__*/ datetimePickerConstants.requireIsValid();
|
|
25
|
-
var _index2 = /*@__PURE__*/
|
|
44
|
+
var _index2 = /*@__PURE__*/ isValid.requireParse();
|
|
26
45
|
|
|
27
46
|
/**
|
|
28
47
|
* The {@link isMatch} function options.
|
|
@@ -322,10 +341,323 @@ function requireIsMatch () {
|
|
|
322
341
|
|
|
323
342
|
var isMatchExports = /*@__PURE__*/ requireIsMatch();
|
|
324
343
|
|
|
325
|
-
|
|
344
|
+
var parseISO = {};
|
|
345
|
+
|
|
346
|
+
var hasRequiredParseISO;
|
|
347
|
+
|
|
348
|
+
function requireParseISO () {
|
|
349
|
+
if (hasRequiredParseISO) return parseISO;
|
|
350
|
+
hasRequiredParseISO = 1;
|
|
351
|
+
parseISO.parseISO = parseISO$1;
|
|
352
|
+
var _index = /*@__PURE__*/ datetimePickerConstants.requireConstants();
|
|
353
|
+
|
|
354
|
+
var _index2 = /*@__PURE__*/ datetimePickerConstants.requireConstructFrom();
|
|
355
|
+
var _index3 = /*@__PURE__*/ datetimePickerConstants.requireToDate();
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* The {@link parseISO} function options.
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @name parseISO
|
|
363
|
+
* @category Common Helpers
|
|
364
|
+
* @summary Parse ISO string
|
|
365
|
+
*
|
|
366
|
+
* @description
|
|
367
|
+
* Parse the given string in ISO 8601 format and return an instance of Date.
|
|
368
|
+
*
|
|
369
|
+
* Function accepts complete ISO 8601 formats as well as partial implementations.
|
|
370
|
+
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
|
371
|
+
*
|
|
372
|
+
* If the argument isn't a string, the function cannot parse the string or
|
|
373
|
+
* the values are invalid, it returns Invalid Date.
|
|
374
|
+
*
|
|
375
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
376
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
377
|
+
*
|
|
378
|
+
* @param argument - The value to convert
|
|
379
|
+
* @param options - An object with options
|
|
380
|
+
*
|
|
381
|
+
* @returns The parsed date in the local time zone
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* // Convert string '2014-02-11T11:30:30' to date:
|
|
385
|
+
* const result = parseISO('2014-02-11T11:30:30')
|
|
386
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* // Convert string '+02014101' to date,
|
|
390
|
+
* // if the additional number of digits in the extended year format is 1:
|
|
391
|
+
* const result = parseISO('+02014101', { additionalDigits: 1 })
|
|
392
|
+
* //=> Fri Apr 11 2014 00:00:00
|
|
393
|
+
*/
|
|
394
|
+
function parseISO$1(argument, options) {
|
|
395
|
+
const invalidDate = () => (0, _index2.constructFrom)(options?.in, NaN);
|
|
396
|
+
|
|
397
|
+
const additionalDigits = options?.additionalDigits ?? 2;
|
|
398
|
+
const dateStrings = splitDateString(argument);
|
|
399
|
+
|
|
400
|
+
let date;
|
|
401
|
+
if (dateStrings.date) {
|
|
402
|
+
const parseYearResult = parseYear(dateStrings.date, additionalDigits);
|
|
403
|
+
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (!date || isNaN(+date)) return invalidDate();
|
|
407
|
+
|
|
408
|
+
const timestamp = +date;
|
|
409
|
+
let time = 0;
|
|
410
|
+
let offset;
|
|
411
|
+
|
|
412
|
+
if (dateStrings.time) {
|
|
413
|
+
time = parseTime(dateStrings.time);
|
|
414
|
+
if (isNaN(time)) return invalidDate();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (dateStrings.timezone) {
|
|
418
|
+
offset = parseTimezone(dateStrings.timezone);
|
|
419
|
+
if (isNaN(offset)) return invalidDate();
|
|
420
|
+
} else {
|
|
421
|
+
const tmpDate = new Date(timestamp + time);
|
|
422
|
+
const result = (0, _index3.toDate)(0, options?.in);
|
|
423
|
+
result.setFullYear(
|
|
424
|
+
tmpDate.getUTCFullYear(),
|
|
425
|
+
tmpDate.getUTCMonth(),
|
|
426
|
+
tmpDate.getUTCDate(),
|
|
427
|
+
);
|
|
428
|
+
result.setHours(
|
|
429
|
+
tmpDate.getUTCHours(),
|
|
430
|
+
tmpDate.getUTCMinutes(),
|
|
431
|
+
tmpDate.getUTCSeconds(),
|
|
432
|
+
tmpDate.getUTCMilliseconds(),
|
|
433
|
+
);
|
|
434
|
+
return result;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return (0, _index3.toDate)(timestamp + time + offset, options?.in);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const patterns = {
|
|
441
|
+
dateTimeDelimiter: /[T ]/,
|
|
442
|
+
timeZoneDelimiter: /[Z ]/i,
|
|
443
|
+
timezone: /([Z+-].*)$/,
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const dateRegex =
|
|
447
|
+
/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
|
448
|
+
const timeRegex =
|
|
449
|
+
/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
|
450
|
+
const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
451
|
+
|
|
452
|
+
function splitDateString(dateString) {
|
|
453
|
+
const dateStrings = {};
|
|
454
|
+
const array = dateString.split(patterns.dateTimeDelimiter);
|
|
455
|
+
let timeString;
|
|
456
|
+
|
|
457
|
+
// The regex match should only return at maximum two array elements.
|
|
458
|
+
// [date], [time], or [date, time].
|
|
459
|
+
if (array.length > 2) {
|
|
460
|
+
return dateStrings;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if (/:/.test(array[0])) {
|
|
464
|
+
timeString = array[0];
|
|
465
|
+
} else {
|
|
466
|
+
dateStrings.date = array[0];
|
|
467
|
+
timeString = array[1];
|
|
468
|
+
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
|
469
|
+
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
|
470
|
+
timeString = dateString.substr(
|
|
471
|
+
dateStrings.date.length,
|
|
472
|
+
dateString.length,
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (timeString) {
|
|
478
|
+
const token = patterns.timezone.exec(timeString);
|
|
479
|
+
if (token) {
|
|
480
|
+
dateStrings.time = timeString.replace(token[1], "");
|
|
481
|
+
dateStrings.timezone = token[1];
|
|
482
|
+
} else {
|
|
483
|
+
dateStrings.time = timeString;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return dateStrings;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function parseYear(dateString, additionalDigits) {
|
|
491
|
+
const regex = new RegExp(
|
|
492
|
+
"^(?:(\\d{4}|[+-]\\d{" +
|
|
493
|
+
(4 + additionalDigits) +
|
|
494
|
+
"})|(\\d{2}|[+-]\\d{" +
|
|
495
|
+
(2 + additionalDigits) +
|
|
496
|
+
"})$)",
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const captures = dateString.match(regex);
|
|
500
|
+
// Invalid ISO-formatted year
|
|
501
|
+
if (!captures) return { year: NaN, restDateString: "" };
|
|
502
|
+
|
|
503
|
+
const year = captures[1] ? parseInt(captures[1]) : null;
|
|
504
|
+
const century = captures[2] ? parseInt(captures[2]) : null;
|
|
505
|
+
|
|
506
|
+
// either year or century is null, not both
|
|
507
|
+
return {
|
|
508
|
+
year: century === null ? year : century * 100,
|
|
509
|
+
restDateString: dateString.slice((captures[1] || captures[2]).length),
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function parseDate(dateString, year) {
|
|
514
|
+
// Invalid ISO-formatted year
|
|
515
|
+
if (year === null) return new Date(NaN);
|
|
516
|
+
|
|
517
|
+
const captures = dateString.match(dateRegex);
|
|
518
|
+
// Invalid ISO-formatted string
|
|
519
|
+
if (!captures) return new Date(NaN);
|
|
520
|
+
|
|
521
|
+
const isWeekDate = !!captures[4];
|
|
522
|
+
const dayOfYear = parseDateUnit(captures[1]);
|
|
523
|
+
const month = parseDateUnit(captures[2]) - 1;
|
|
524
|
+
const day = parseDateUnit(captures[3]);
|
|
525
|
+
const week = parseDateUnit(captures[4]);
|
|
526
|
+
const dayOfWeek = parseDateUnit(captures[5]) - 1;
|
|
527
|
+
|
|
528
|
+
if (isWeekDate) {
|
|
529
|
+
if (!validateWeekDate(year, week, dayOfWeek)) {
|
|
530
|
+
return new Date(NaN);
|
|
531
|
+
}
|
|
532
|
+
return dayOfISOWeekYear(year, week, dayOfWeek);
|
|
533
|
+
} else {
|
|
534
|
+
const date = new Date(0);
|
|
535
|
+
if (
|
|
536
|
+
!validateDate(year, month, day) ||
|
|
537
|
+
!validateDayOfYearDate(year, dayOfYear)
|
|
538
|
+
) {
|
|
539
|
+
return new Date(NaN);
|
|
540
|
+
}
|
|
541
|
+
date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
|
542
|
+
return date;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function parseDateUnit(value) {
|
|
547
|
+
return value ? parseInt(value) : 1;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function parseTime(timeString) {
|
|
551
|
+
const captures = timeString.match(timeRegex);
|
|
552
|
+
if (!captures) return NaN; // Invalid ISO-formatted time
|
|
553
|
+
|
|
554
|
+
const hours = parseTimeUnit(captures[1]);
|
|
555
|
+
const minutes = parseTimeUnit(captures[2]);
|
|
556
|
+
const seconds = parseTimeUnit(captures[3]);
|
|
557
|
+
|
|
558
|
+
if (!validateTime(hours, minutes, seconds)) {
|
|
559
|
+
return NaN;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return (
|
|
563
|
+
hours * _index.millisecondsInHour +
|
|
564
|
+
minutes * _index.millisecondsInMinute +
|
|
565
|
+
seconds * 1000
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function parseTimeUnit(value) {
|
|
570
|
+
return (value && parseFloat(value.replace(",", "."))) || 0;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function parseTimezone(timezoneString) {
|
|
574
|
+
if (timezoneString === "Z") return 0;
|
|
575
|
+
|
|
576
|
+
const captures = timezoneString.match(timezoneRegex);
|
|
577
|
+
if (!captures) return 0;
|
|
578
|
+
|
|
579
|
+
const sign = captures[1] === "+" ? -1 : 1;
|
|
580
|
+
const hours = parseInt(captures[2]);
|
|
581
|
+
const minutes = (captures[3] && parseInt(captures[3])) || 0;
|
|
582
|
+
|
|
583
|
+
if (!validateTimezone(hours, minutes)) {
|
|
584
|
+
return NaN;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
return (
|
|
588
|
+
sign *
|
|
589
|
+
(hours * _index.millisecondsInHour + minutes * _index.millisecondsInMinute)
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
|
594
|
+
const date = new Date(0);
|
|
595
|
+
date.setUTCFullYear(isoWeekYear, 0, 4);
|
|
596
|
+
const fourthOfJanuaryDay = date.getUTCDay() || 7;
|
|
597
|
+
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
|
598
|
+
date.setUTCDate(date.getUTCDate() + diff);
|
|
599
|
+
return date;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// Validation functions
|
|
603
|
+
|
|
604
|
+
// February is null to handle the leap year (using ||)
|
|
605
|
+
const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
606
|
+
|
|
607
|
+
function isLeapYearIndex(year) {
|
|
608
|
+
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function validateDate(year, month, date) {
|
|
612
|
+
return (
|
|
613
|
+
month >= 0 &&
|
|
614
|
+
month <= 11 &&
|
|
615
|
+
date >= 1 &&
|
|
616
|
+
date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28))
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
function validateDayOfYearDate(year, dayOfYear) {
|
|
621
|
+
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function validateWeekDate(_year, week, day) {
|
|
625
|
+
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function validateTime(hours, minutes, seconds) {
|
|
629
|
+
if (hours === 24) {
|
|
630
|
+
return minutes === 0 && seconds === 0;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return (
|
|
634
|
+
seconds >= 0 &&
|
|
635
|
+
seconds < 60 &&
|
|
636
|
+
minutes >= 0 &&
|
|
637
|
+
minutes < 60 &&
|
|
638
|
+
hours >= 0 &&
|
|
639
|
+
hours < 25
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function validateTimezone(_hours, minutes) {
|
|
644
|
+
return minutes >= 0 && minutes <= 59;
|
|
645
|
+
}
|
|
646
|
+
return parseISO;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
var parseISOExports = /*@__PURE__*/ requireParseISO();
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Serializa o valor atual para envio em FormData conforme o modo ativo.
|
|
653
|
+
*
|
|
654
|
+
* @param {Date | null} value - Valor selecionado a ser serializado para submissão.
|
|
655
|
+
* @param {DatetimePickerFormContext} context - Contexto com `mode`, `selectionMode` e limites (rangeStart/rangeEnd).
|
|
656
|
+
* @returns {string | null} Representação serializada pronta para `FormData`, ou `null` quando não houver valor.
|
|
657
|
+
*/
|
|
326
658
|
function serializeDatetimePickerFormValue(value, context) {
|
|
327
659
|
if (isDateRangeMode(context)) {
|
|
328
|
-
return serializeRangeFormValue(context.rangeStart, context.rangeEnd);
|
|
660
|
+
return serializeRangeFormValue(context.rangeStart, context.rangeEnd, context.mode);
|
|
329
661
|
}
|
|
330
662
|
if (value === null) {
|
|
331
663
|
return null;
|
|
@@ -341,7 +673,14 @@ function serializeDatetimePickerFormValue(value, context) {
|
|
|
341
673
|
return datetimePickerConstants.formatExports.format(value, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
342
674
|
}
|
|
343
675
|
}
|
|
344
|
-
/**
|
|
676
|
+
/**
|
|
677
|
+
* Analisa um valor serializado de formulário para `Date` respeitando o modo atual.
|
|
678
|
+
*
|
|
679
|
+
* @param {string} value - String serializada vinda do formulário.
|
|
680
|
+
* @param {DatetimePickerMode} mode - Modo (`date` | `time` | `datetime`) que dita o parser a ser usado.
|
|
681
|
+
* @param {Date} referenceDate - Data de referência usada ao analisar valores de hora.
|
|
682
|
+
* @returns {Date | null} Objeto Date quando a análise for bem-sucedida, ou `null` quando inválido.
|
|
683
|
+
*/
|
|
345
684
|
function parseDatetimePickerSerializedValue(value, mode, referenceDate) {
|
|
346
685
|
if (isBlankValue(value)) {
|
|
347
686
|
return null;
|
|
@@ -355,20 +694,34 @@ function parseDatetimePickerSerializedValue(value, mode, referenceDate) {
|
|
|
355
694
|
return parseIsoDate(value);
|
|
356
695
|
}
|
|
357
696
|
}
|
|
358
|
-
/**
|
|
359
|
-
|
|
697
|
+
/**
|
|
698
|
+
* Analisa um intervalo serializado no formato `start/end` conforme o modo ativo.
|
|
699
|
+
*
|
|
700
|
+
* @param {string} value - String no formato `start/end` contendo os dois lados do intervalo.
|
|
701
|
+
* @param {DatetimePickerMode} mode - Modo a ser usado para análise (padrão: `date`).
|
|
702
|
+
* @param {Date} referenceDate - Data de referência para análise de horários.
|
|
703
|
+
* @returns {DatetimePickerDateRange | null} `{ start, end }` quando válido, ou `null` quando inválido.
|
|
704
|
+
*/
|
|
705
|
+
function parseDatetimePickerSerializedRange(value, mode = datetimePickerConstants.DATETIME_PICKER_MODE.DATE, referenceDate = new Date()) {
|
|
360
706
|
const [startRaw, endRaw] = value.split('/');
|
|
361
707
|
if (startRaw === undefined || endRaw === undefined) {
|
|
362
708
|
return null;
|
|
363
709
|
}
|
|
364
|
-
const start =
|
|
365
|
-
const end =
|
|
710
|
+
const start = parseDatetimePickerSerializedValue(startRaw, mode, referenceDate);
|
|
711
|
+
const end = parseDatetimePickerSerializedValue(endRaw, mode, referenceDate);
|
|
366
712
|
if (start === null || end === null) {
|
|
367
713
|
return null;
|
|
368
714
|
}
|
|
369
715
|
return { start, end };
|
|
370
716
|
}
|
|
371
|
-
/**
|
|
717
|
+
/**
|
|
718
|
+
* Indica se o componente deve sinalizar `valueMissing` na validação nativa.
|
|
719
|
+
*
|
|
720
|
+
* A função considera `required`, `disabled` e se o valor (ou intervalo) está incompleto.
|
|
721
|
+
*
|
|
722
|
+
* @param {DatetimePickerMissingValueContext} context - Contexto contendo `required`, `disabled`, `value` e, quando aplicável, `rangeStart`/`rangeEnd`.
|
|
723
|
+
* @returns {boolean} `true` quando o controle deve reportar `valueMissing`.
|
|
724
|
+
*/
|
|
372
725
|
function hasDatetimePickerMissingValue(context) {
|
|
373
726
|
const { required, disabled, value } = context;
|
|
374
727
|
if (!required || disabled) {
|
|
@@ -377,40 +730,88 @@ function hasDatetimePickerMissingValue(context) {
|
|
|
377
730
|
const isRangeIncomplete = isDateRangeMode(context) && (context.rangeStart === null || context.rangeEnd === null);
|
|
378
731
|
return value === null || isRangeIncomplete;
|
|
379
732
|
}
|
|
733
|
+
/**
|
|
734
|
+
* Retorna `true` quando a `value` dada é vazia ou composta apenas por espaços.
|
|
735
|
+
*
|
|
736
|
+
* @param {string} value - String a ser verificada.
|
|
737
|
+
* @returns {boolean} `true` quando a string é em branco.
|
|
738
|
+
*/
|
|
380
739
|
function isBlankValue(value) {
|
|
381
740
|
return value.trim() === '';
|
|
382
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* Verifica se o contexto está no modo de intervalo (`selectionMode === 'range'`).
|
|
744
|
+
*
|
|
745
|
+
* @param {DatetimePickerFormContext} context - Contexto do formulário do componente.
|
|
746
|
+
* @returns {boolean} `true` quando `selectionMode` é `range`.
|
|
747
|
+
*/
|
|
383
748
|
function isDateRangeMode(context) {
|
|
384
|
-
return context.selectionMode === 'range'
|
|
749
|
+
return context.selectionMode === 'range';
|
|
385
750
|
}
|
|
386
|
-
|
|
751
|
+
/**
|
|
752
|
+
* Serializa um par `rangeStart`/`rangeEnd` conforme o modo para submissão.
|
|
753
|
+
*
|
|
754
|
+
* @param {Date | null} rangeStart - Data inicial do intervalo (ou `null`).
|
|
755
|
+
* @param {Date | null} rangeEnd - Data final do intervalo (ou `null`).
|
|
756
|
+
* @param {DatetimePickerMode | undefined} mode - Modo que define o formato usado na conversão (date/time/datetime).
|
|
757
|
+
* @returns {string | null} String `start/end` quando ambos existem, caso contrário `null`.
|
|
758
|
+
*/
|
|
759
|
+
function serializeRangeFormValue(rangeStart, rangeEnd, mode) {
|
|
387
760
|
if (rangeStart === null || rangeEnd === null) {
|
|
388
761
|
return null;
|
|
389
762
|
}
|
|
390
|
-
|
|
763
|
+
const serialize = (date) => {
|
|
764
|
+
if (mode === datetimePickerConstants.DATETIME_PICKER_MODE.TIME)
|
|
765
|
+
return datetimePickerConstants.formatExports.format(date, 'HH:mm');
|
|
766
|
+
if (mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATETIME)
|
|
767
|
+
return datetimePickerConstants.formatExports.format(date, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
768
|
+
return serializeDate(date);
|
|
769
|
+
};
|
|
770
|
+
return `${serialize(rangeStart)}/${serialize(rangeEnd)}`;
|
|
391
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* Converte uma string de tempo `HH:mm` em um objeto `Date` combinando-a com a `referenceDate`.
|
|
774
|
+
*
|
|
775
|
+
* @param {string} value - String no formato `HH:mm`.
|
|
776
|
+
* @param {Date} referenceDate - Data base que receberá as horas e minutos analisados.
|
|
777
|
+
* @returns {Date | null} Data ajustada com horas/minutos, ou `null` se inválida.
|
|
778
|
+
*/
|
|
392
779
|
function parseTimeValue(value, referenceDate) {
|
|
393
780
|
if (!isMatchExports.isMatch(value, 'HH:mm')) {
|
|
394
781
|
return null;
|
|
395
782
|
}
|
|
396
|
-
const parsedTime =
|
|
397
|
-
if (!
|
|
783
|
+
const parsedTime = isValid.parseExports.parse(value, 'HH:mm', new Date());
|
|
784
|
+
if (!isValid.isValidExports.isValid(parsedTime)) {
|
|
398
785
|
return null;
|
|
399
786
|
}
|
|
400
|
-
const baseDate =
|
|
787
|
+
const baseDate = isValid.toDateExports.toDate(referenceDate);
|
|
401
788
|
baseDate.setHours(parsedTime.getHours(), parsedTime.getMinutes(), 0, 0);
|
|
402
789
|
return baseDate;
|
|
403
790
|
}
|
|
791
|
+
/**
|
|
792
|
+
* Analisa uma string ISO em `Date` quando válida.
|
|
793
|
+
*
|
|
794
|
+
* @param {string} value - String ISO (ex: `2023-01-01T12:00:00-03:00`).
|
|
795
|
+
* @returns {Date | null} Objeto Date quando válido, ou `null` quando inválido.
|
|
796
|
+
*/
|
|
404
797
|
function parseIsoDate(value) {
|
|
405
|
-
const parsedDate =
|
|
406
|
-
return
|
|
798
|
+
const parsedDate = parseISOExports.parseISO(value);
|
|
799
|
+
return isValid.isValidExports.isValid(parsedDate) ? parsedDate : null;
|
|
407
800
|
}
|
|
801
|
+
/**
|
|
802
|
+
* Analisa uma string no formato `yyyy-MM-dd` em `Date`.
|
|
803
|
+
*
|
|
804
|
+
* Realiza validação estrita para evitar rollover de dias e zera horas.
|
|
805
|
+
*
|
|
806
|
+
* @param {string} value - String no formato `yyyy-MM-dd`.
|
|
807
|
+
* @returns {Date | null} Data normalizada (meia-noite) ou `null` quando inválida.
|
|
808
|
+
*/
|
|
408
809
|
function parseDate(value) {
|
|
409
810
|
if (!isMatchExports.isMatch(value, 'yyyy-MM-dd')) {
|
|
410
811
|
return null;
|
|
411
812
|
}
|
|
412
|
-
const parsedDate =
|
|
413
|
-
if (!
|
|
813
|
+
const parsedDate = isValid.parseExports.parse(value, 'yyyy-MM-dd', new Date());
|
|
814
|
+
if (!isValid.isValidExports.isValid(parsedDate)) {
|
|
414
815
|
return null;
|
|
415
816
|
}
|
|
416
817
|
// Garante aderência estrita ao formato/calendário evitando rollover silencioso.
|
|
@@ -420,16 +821,209 @@ function parseDate(value) {
|
|
|
420
821
|
parsedDate.setHours(0, 0, 0, 0);
|
|
421
822
|
return parsedDate;
|
|
422
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* Serializa uma `Date` para o formato `yyyy-MM-dd`.
|
|
826
|
+
*
|
|
827
|
+
* @param {Date} value - Data a ser serializada.
|
|
828
|
+
* @returns {string} Representação no formato `yyyy-MM-dd`.
|
|
829
|
+
*/
|
|
423
830
|
function serializeDate(value) {
|
|
424
831
|
return datetimePickerConstants.formatExports.format(value, 'yyyy-MM-dd');
|
|
425
832
|
}
|
|
426
833
|
|
|
427
|
-
const datetimePickerCss = () => `*,*::before,*::after{box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace;font-size:1em}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}code{font-family:monospace;font-size:1em}small{font-size:80%}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.d-none{display:none !important}@media (min-width: 576px){.d-sm-block{display:block !important}.d-sm-flex{display:flex !important}}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown>.br-notification{left:auto;right:0}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.justify-content-start{justify-content:flex-start !important}.justify-content-end{justify-content:flex-end !important}.justify-content-center{justify-content:center !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.col-2{flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-fluid,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-0.5);margin-right:calc(var(--grid-gutter)*-0.5)}@media (min-width: 576px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}.col-sm-4{flex-basis:33.3333333333%;max-width:33.3333333333%}}@media (min-width: 992px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}.col-lg-3{flex-basis:25%;max-width:25%}}@media (min-width: 1600px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.ease{animation-timing-function:cubic-bezier(0.25, 0.1, 0.25, 1)}.ease-out{animation-timing-function:cubic-bezier(0, 0, 0.58, 1)}.ease-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.fast{animation-duration:var(--duration-fast)}.slow{animation-duration:var(--duration-slow)}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mb-1{margin-bottom:var(--spacing-scale-half) !important}.ml-1{margin-left:var(--spacing-scale-half) !important}.mx-3{margin-left:var(--spacing-scale-2x) !important;margin-right:var(--spacing-scale-2x) !important}.mb-4{margin-bottom:var(--spacing-scale-3x) !important}.ml-auto{margin-left:auto !important}.pt-half{padding-top:var(--spacing-scale-half) !important}@media (min-width: 576px){.ml-sm-0{margin-left:var(--spacing-scale-default) !important}}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}fieldset[disabled]{opacity:1}.text-center{text-align:center !important}.text-right{text-align:right !important}.text-nowrap{white-space:nowrap !important}.text-uppercase{text-transform:uppercase !important}.text-bold{font-weight:700 !important}.text-base{font-size:var(--font-size-scale-base) !important}.text-down-01{font-size:var(--font-size-scale-down-01) !important}@media (min-width: 576px){.text-sm-center{text-align:center !important}.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half)}a:focus{outline:none}a.focus-visible,a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}a{color:var(--interactive);text-decoration:none}.main-content a{text-decoration:underline}button{cursor:pointer}img{max-width:100%;vertical-align:middle}h2,.h2{color:var(--color);font-size:var(--font-size-scale-up-03);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2xh);margin-top:var(--spacing-scale-3xh);padding-bottom:var(--spacing-scale-2xh)}@media (min-width: 576px){.h2,h2{font-size:var(--font-size-scale-up-05);font-weight:var(--font-weight-regular)}}ul,ol{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}table{--table-background:var(--background);--table-color:var(--color);--table-border-color:var(--gray-20);--table-border-style:solid;--table-border-width:1px;--table-hover:var(--color-rgb);--table-padding:var(--spacing-scale-3x);--table-font-weight:var(--font-weight-medium);--table-th-background:var(--background-alternative);--table-th-font-weight:var(--font-weight-semi-bold);--table-row-size:var(--spacing-scale-2x);border-collapse:collapse;width:100%}tr.selected,tr.is-selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}fieldset,.fieldset{border:var(--surface-width-none);margin-bottom:var(--spacing-scale-5x);margin-top:0;padding:0}legend,.legend{color:var(--color);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2x);margin-top:var(--spacing-scale-2x)}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}code,.code{background:var(--gray-5);border-radius:4px;color:var(--gray-80);display:inline-block;font-family:monospace;font-size:var(--font-size-scale-base);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);padding:var(--spacing-scale-half)}pre,.pre{background:var(--gray-5);margin:var(--spacing-scale-2x) 0 var(--spacing-scale-4x);padding:var(--spacing-scale-2x)}pre code,.pre code{display:inline;padding:0}*[data-toggle=collapse]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}*[data-toggle=collapse]:focus{outline:none}*[data-toggle=collapse].focus-visible,*[data-toggle=collapse]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}@media (prefers-reduced-motion: reduce){:host,:host::before,:host::after,:host *,:host *::before,:host *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}}:host-context([data-wbc-reduced-motion=true])::before,:host-context([data-wbc-reduced-motion=true])::after,:host-context([data-wbc-reduced-motion=true]) *,:host-context([data-wbc-reduced-motion=true]) *::before,:host-context([data-wbc-reduced-motion=true]) *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}:host{box-sizing:border-box;display:block;margin-bottom:var(--spacing-scale-base);max-width:var(--br-datetime-picker-width, none);position:relative;width:100%}:host([mode=time]){max-width:var(--br-datetime-picker-time-width, var(--br-datetime-picker-width, none));width:100%}:host([mode=date]){max-width:var(--br-datetime-picker-date-width, var(--br-datetime-picker-width, none));width:100%}:host([mode=datetime]){max-width:var(--br-datetime-picker-datetime-width, var(--br-datetime-picker-width, none));width:100%}.br-datetime-picker{width:100%}.br-datetime-picker br-datetime-input,.br-datetime-picker br-card{display:block;width:100%}.br-datetime-picker br-card{font-size:var(--font-size-scale-base);animation:none}@media (prefers-reduced-motion: no-preference){.br-datetime-picker br-card{animation:datetime-panel-open var(--duration-fast, 300ms) var(--animation-ease-out, ease-out) both}}@keyframes datetime-panel-open{from{opacity:0}to{opacity:1}}`;
|
|
834
|
+
const VALID_WEEK_START_DAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
835
|
+
const INITIAL_MOMENT_DATE_FORMATS = ['dd/MM/yyyy HH:mm', 'dd/MM/yyyy', 'yyyy-MM-dd HH:mm', 'yyyy-MM-dd'];
|
|
836
|
+
/**
|
|
837
|
+
* Tenta analisar uma string que representa um momento inicial aceitável pelo componente.
|
|
838
|
+
*
|
|
839
|
+
* Suporta formatos ISO e padrões definidos em `INITIAL_MOMENT_DATE_FORMATS`.
|
|
840
|
+
* Retorna `null` quando a string não representa uma data válida.
|
|
841
|
+
*
|
|
842
|
+
* @param {string} value - String contendo a data/hora a ser analisada.
|
|
843
|
+
* @returns {Date | null} Date normalizada quando a string é válida, ou `null` caso contrário.
|
|
844
|
+
*/
|
|
845
|
+
function parseInitialMomentString(value) {
|
|
846
|
+
const trimmedValue = value.trim();
|
|
847
|
+
if (trimmedValue === '') {
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
const isoDate = parseISOExports.parseISO(trimmedValue);
|
|
851
|
+
if (isValid.isValidExports.isValid(isoDate)) {
|
|
852
|
+
return isoDate;
|
|
853
|
+
}
|
|
854
|
+
for (const formatPattern of INITIAL_MOMENT_DATE_FORMATS) {
|
|
855
|
+
const parsedDate = isValid.parseExports.parse(trimmedValue, formatPattern, new Date());
|
|
856
|
+
if (isValid.isValidExports.isValid(parsedDate)) {
|
|
857
|
+
return parsedDate;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Normaliza um candidato a data em um objeto `Date` válido.
|
|
864
|
+
*
|
|
865
|
+
* Aceita instâncias de `Date` e strings (repassadas a `parseInitialMomentString`).
|
|
866
|
+
* Retorna `null` quando o candidato não representa uma data válida.
|
|
867
|
+
*
|
|
868
|
+
* @param {unknown} value - Valor recebido via prop (pode ser `Date`, `string` ou outro).
|
|
869
|
+
* @returns {Date | null} `Date` quando válido ou `null` quando inválido.
|
|
870
|
+
*/
|
|
871
|
+
function normalizeDateCandidate(value) {
|
|
872
|
+
if (value instanceof Date) {
|
|
873
|
+
if (!Number.isNaN(value.getTime())) {
|
|
874
|
+
return new Date(value);
|
|
875
|
+
}
|
|
876
|
+
return null;
|
|
877
|
+
}
|
|
878
|
+
if (typeof value === 'string') {
|
|
879
|
+
return parseInitialMomentString(value);
|
|
880
|
+
}
|
|
881
|
+
return null;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Divide uma string de datas desabilitadas em tokens individuais.
|
|
885
|
+
*
|
|
886
|
+
* A string pode conter várias datas separadas por espaços; tokens vazios são
|
|
887
|
+
* descartados.
|
|
888
|
+
*
|
|
889
|
+
* @param {string} value - String contendo uma ou mais datas separadas por espaço.
|
|
890
|
+
* @returns {string[]} Array de tokens não vazios representando cada data individual.
|
|
891
|
+
*/
|
|
892
|
+
function tokenizeDisabledDatesString(value) {
|
|
893
|
+
return value
|
|
894
|
+
.trim()
|
|
895
|
+
.split(/\s+/)
|
|
896
|
+
.filter((token) => token.length > 0);
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Verifica se o valor informado corresponde a um modo suportado pelo componente.
|
|
900
|
+
*
|
|
901
|
+
* @param {string} value - Valor recebido via prop ou atributo.
|
|
902
|
+
* @returns {boolean} `true` quando o valor pertence ao conjunto aceito de modos.
|
|
903
|
+
*/
|
|
904
|
+
function isValidDatetimePickerMode(value) {
|
|
905
|
+
return Object.values(datetimePickerConstants.DATETIME_PICKER_MODE).includes(value);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Normaliza o modo informado e aplica o valor padrão quando necessário.
|
|
909
|
+
*
|
|
910
|
+
* @param {string} value - Valor bruto recebido do consumidor do componente.
|
|
911
|
+
* @returns {DatetimePickerMode} O modo válido correspondente, ou o valor padrão quando o input for inválido.
|
|
912
|
+
*/
|
|
913
|
+
function normalizeDatetimePickerMode(value) {
|
|
914
|
+
if (isValidDatetimePickerMode(value))
|
|
915
|
+
return value;
|
|
916
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'mode', value, datetimePickerConstants.DATETIME_PICKER_MODE.DEFAULT);
|
|
917
|
+
return datetimePickerConstants.DATETIME_PICKER_MODE.DEFAULT;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Verifica se o valor representa um modo de seleção suportado.
|
|
921
|
+
*
|
|
922
|
+
* @param {string} value - Valor bruto recebido via prop.
|
|
923
|
+
* @returns {boolean} `true` quando o valor é `'single'` ou `'range'`.
|
|
924
|
+
*/
|
|
925
|
+
function isValidDatetimePickerSelectionMode(value) {
|
|
926
|
+
return value === 'single' || value === 'range';
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Normaliza o modo de seleção informado e aplica o valor padrão quando necessário.
|
|
930
|
+
*
|
|
931
|
+
* @param {string} value - Valor bruto recebido do consumidor do componente.
|
|
932
|
+
* @returns {DatetimePickerSelectionMode} O modo de seleção válido correspondente, ou `'single'` quando o input for inválido.
|
|
933
|
+
*/
|
|
934
|
+
function normalizeDatetimePickerSelectionMode(value) {
|
|
935
|
+
if (isValidDatetimePickerSelectionMode(value))
|
|
936
|
+
return value;
|
|
937
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'selectionMode', value, 'single');
|
|
938
|
+
return 'single';
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Normaliza a seleção inicial para um valor aplicável pelo componente.
|
|
942
|
+
*
|
|
943
|
+
* @param {unknown} value - Valor bruto recebido via prop.
|
|
944
|
+
* @returns {'now' | Date | null} `'now'`, `Date` normalizada ou `null` quando inválido.
|
|
945
|
+
*/
|
|
946
|
+
function normalizeDatetimePickerInitialMoment(value) {
|
|
947
|
+
if (value === null)
|
|
948
|
+
return null;
|
|
949
|
+
if (value === 'now')
|
|
950
|
+
return 'now';
|
|
951
|
+
const normalizedDate = normalizeDateCandidate(value);
|
|
952
|
+
if (normalizedDate !== null) {
|
|
953
|
+
return normalizedDate;
|
|
954
|
+
}
|
|
955
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'initialMoment', value, 'null');
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Normaliza a lista de datas desabilitadas para uma coleção de `Date` válidas.
|
|
960
|
+
*
|
|
961
|
+
* @param {unknown} value - Valor bruto recebido via prop.
|
|
962
|
+
* @returns {Date[]} Lista normalizada de datas; retorna array vazio quando inválido.
|
|
963
|
+
*/
|
|
964
|
+
function normalizeDatetimePickerDisabledDates(value) {
|
|
965
|
+
if (value === null) {
|
|
966
|
+
return [];
|
|
967
|
+
}
|
|
968
|
+
if (typeof value === 'string') {
|
|
969
|
+
const tokens = tokenizeDisabledDatesString(value);
|
|
970
|
+
if (tokens.length === 0) {
|
|
971
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'disabledDates', value, '[]');
|
|
972
|
+
return [];
|
|
973
|
+
}
|
|
974
|
+
const normalizedDates = tokens
|
|
975
|
+
.map((dateCandidate) => normalizeDateCandidate(dateCandidate))
|
|
976
|
+
.filter((dateCandidate) => dateCandidate !== null);
|
|
977
|
+
if (normalizedDates.length !== tokens.length) {
|
|
978
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'disabledDates', value, '[]');
|
|
979
|
+
}
|
|
980
|
+
return normalizedDates;
|
|
981
|
+
}
|
|
982
|
+
if (!Array.isArray(value)) {
|
|
983
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'disabledDates', value, '[]');
|
|
984
|
+
return [];
|
|
985
|
+
}
|
|
986
|
+
const normalizedDates = value
|
|
987
|
+
.map((dateCandidate) => normalizeDateCandidate(dateCandidate))
|
|
988
|
+
.filter((dateCandidate) => dateCandidate !== null);
|
|
989
|
+
if (normalizedDates.length !== value.length) {
|
|
990
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'disabledDates', value, '[]');
|
|
991
|
+
}
|
|
992
|
+
return normalizedDates;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Verifica se o valor informado representa um índice válido de início da semana.
|
|
996
|
+
*
|
|
997
|
+
* @param {number} value - Valor bruto recebido via prop.
|
|
998
|
+
* @returns {boolean} `true` quando o valor está entre `0` e `6`.
|
|
999
|
+
*/
|
|
1000
|
+
function isValidDatetimePickerWeekStartsOn(value) {
|
|
1001
|
+
return VALID_WEEK_START_DAYS.includes(value);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Normaliza o índice de início da semana e aplica `0` quando o valor é inválido.
|
|
1005
|
+
*
|
|
1006
|
+
* @param {unknown} value - Valor bruto recebido do consumidor do componente.
|
|
1007
|
+
* @returns {DatetimePickerWeekDayIndex} Índice normalizado para o primeiro dia da semana.
|
|
1008
|
+
*/
|
|
1009
|
+
function normalizeDatetimePickerWeekStartsOn(value) {
|
|
1010
|
+
const numericValue = typeof value === 'string' ? Number(value) : value;
|
|
1011
|
+
if (typeof numericValue === 'number' &&
|
|
1012
|
+
Number.isInteger(numericValue) &&
|
|
1013
|
+
isValidDatetimePickerWeekStartsOn(numericValue)) {
|
|
1014
|
+
return numericValue;
|
|
1015
|
+
}
|
|
1016
|
+
propWarning.warnInvalidPropValue('br-datetime-picker', 'weekStartsOn', String(value), '0');
|
|
1017
|
+
return 0;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
const datetimePickerCss = () => `*,*::before,*::after{box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace;font-size:1em}a{background-color:rgba(0,0,0,0)}b,strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.d-none{display:none !important}@media (min-width: 576px){.d-sm-block{display:block !important}.d-sm-flex{display:flex !important}}[data-toggle=dropdown]+*{position:absolute}.dropdown{position:relative}.dropdown [data-toggle=dropdown]+*{box-shadow:var(--surface-shadow-sm);left:0;position:absolute;top:100%}.dropdown>.br-notification{left:auto;right:0}.dropdown .br-item{--color:var(--color-light);--color-rgb:var(--color-light-rgb);--text-color:var(--color-light);--interactive:var(--interactive-light);--interactive-rgb:var(--color-rgb);--visited:var(--visited-light);--hover:var(--hover-light);--pressed:var(--pressed-light);--focus-color:var(--focus-color-light);--focus:var(--focus-color-light);--item-padding-y:var(--spacing-scale-2x);background-color:var(--background-light);color:var(--color)}.dropdown .br-item:not(:last-child){border-bottom:1px solid var(--border-color)}.dropdown .br-item.selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}.justify-content-start{justify-content:flex-start !important}.justify-content-end{justify-content:flex-end !important}.justify-content-center{justify-content:center !important}.align-items-center{align-items:center !important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{flex:1 0 0%;min-width:8.3333333333%}.col-auto{flex:0 0 auto;width:auto}.col-2{flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-fluid,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:flex;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-0.5);margin-right:calc(var(--grid-gutter)*-0.5)}@media (min-width: 576px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}.col-sm-4{flex-basis:33.3333333333%;max-width:33.3333333333%}}@media (min-width: 992px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width: 1280px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}.col-lg-3{flex-basis:25%;max-width:25%}}@media (min-width: 1600px){.container,.container-lg,.container-fluid{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.ease{animation-timing-function:cubic-bezier(0.25, 0.1, 0.25, 1)}.ease-out{animation-timing-function:cubic-bezier(0, 0, 0.58, 1)}.ease-in-out{animation-timing-function:cubic-bezier(0.42, 0, 0.58, 1)}.fast{animation-duration:var(--duration-fast)}.slow{animation-duration:var(--duration-slow)}.mt-1{margin-top:var(--spacing-scale-half) !important}.mr-1{margin-right:var(--spacing-scale-half) !important}.mb-1{margin-bottom:var(--spacing-scale-half) !important}.ml-1{margin-left:var(--spacing-scale-half) !important}.mx-3{margin-left:var(--spacing-scale-2x) !important;margin-right:var(--spacing-scale-2x) !important}.mb-4{margin-bottom:var(--spacing-scale-3x) !important}.ml-auto{margin-left:auto !important}.pt-half{padding-top:var(--spacing-scale-half) !important}@media (min-width: 576px){.ml-sm-0{margin-left:var(--spacing-scale-default) !important}}.highlight{background:var(--status-highlight-background) linear-gradient(var(--status-highlight-overlay), var(--status-highlight-overlay));color:var(--status-highlight-text);padding:0 var(--spacing-scale-half)}[disabled],.disabled{cursor:not-allowed;opacity:var(--disabled)}[disabled] *,.disabled *{pointer-events:none}fieldset[disabled]{opacity:1}.text-center{text-align:center !important}.text-right{text-align:right !important}.text-nowrap{white-space:nowrap !important}.text-uppercase{text-transform:uppercase !important}.text-bold{font-weight:700 !important}.text-base{font-size:var(--font-size-scale-base) !important}.text-down-01{font-size:var(--font-size-scale-down-01) !important}@media (min-width: 576px){.text-sm-center{text-align:center !important}.text-sm-left{text-align:left !important}.text-sm-right{text-align:right !important}}p{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-2x);margin-top:0}p a{text-decoration:underline}@media (min-width: 576px){p{font-size:var(--font-size-scale-up-01)}}a{--focus-offset:var(--spacing-scale-half)}a:focus{outline:none}a.focus-visible,a:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}a:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}a:not(:disabled):active{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--pressed)), rgba(var(--interactive-rgb), var(--pressed)))}a{color:var(--interactive);text-decoration:none}.main-content a{text-decoration:underline}button{cursor:pointer}img{max-width:100%;vertical-align:middle}h2,.h2{color:var(--color);font-size:var(--font-size-scale-up-03);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2xh);margin-top:var(--spacing-scale-3xh);padding-bottom:var(--spacing-scale-2xh)}@media (min-width: 576px){.h2,h2{font-size:var(--font-size-scale-up-05);font-weight:var(--font-weight-regular)}}ul,ol{margin-bottom:var(--spacing-scale-2x);margin-top:0;padding:0 0 0 var(--spacing-scale-5x)}table{--table-background:var(--background);--table-color:var(--color);--table-border-color:var(--gray-20);--table-border-style:solid;--table-border-width:1px;--table-hover:var(--color-rgb);--table-padding:var(--spacing-scale-3x);--table-font-weight:var(--font-weight-medium);--table-th-background:var(--background-alternative);--table-th-font-weight:var(--font-weight-semi-bold);--table-row-size:var(--spacing-scale-2x);border-collapse:collapse;width:100%}tr.selected,tr.is-selected{--color:var(--color-dark);--color-rgb:var(--color-dark-rgb);--text-color:var(--color-dark);--interactive:var(--interactive-dark);--interactive-rgb:var(--interactive-dark-rgb);--visited:var(--visited-dark);--hover:var(--hover-dark);--pressed:var(--pressed-dark);--focus-color:var(--focus-color-dark);--focus:var(--focus-color-dark)}label,.label{color:var(--color);font-size:var(--font-size-scale-base);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half)}fieldset,.fieldset{border:var(--surface-width-none);margin-bottom:var(--spacing-scale-5x);margin-top:0;padding:0}legend,.legend{color:var(--color);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-semi-bold);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-2x);margin-top:var(--spacing-scale-2x)}::placeholder,.placeholder{color:var(--color-light);font-size:var(--font-size-scale-base);font-style:italic;font-weight:var(--font-weight-regular);line-height:var(--font-line-height-medium);margin-bottom:var(--spacing-scale-half);margin-top:var(--spacing-scale-half);opacity:1}input,textarea,.input{color:var(--color-light);font-size:var(--font-size-scale-up-01);font-weight:var(--font-weight-medium);line-height:var(--font-line-height-low);margin-bottom:var(--spacing-scale-half)}pre,.pre{background:var(--gray-5);margin:var(--spacing-scale-2x) 0 var(--spacing-scale-4x);padding:var(--spacing-scale-2x)}*[data-toggle=collapse]:not(:disabled):hover{background-image:linear-gradient(rgba(var(--interactive-rgb), var(--hover)), rgba(var(--interactive-rgb), var(--hover)))}*[data-toggle=collapse]:focus{outline:none}*[data-toggle=collapse].focus-visible,*[data-toggle=collapse]:focus-visible{outline-color:var(--focus);outline-offset:var(--focus-offset);outline-style:var(--focus-style);outline-width:var(--focus-width)}@media (prefers-reduced-motion: reduce){:host,:host::before,:host::after,:host *,:host *::before,:host *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}}:host-context([data-wbc-reduced-motion=true])::before,:host-context([data-wbc-reduced-motion=true])::after,:host-context([data-wbc-reduced-motion=true]) *,:host-context([data-wbc-reduced-motion=true]) *::before,:host-context([data-wbc-reduced-motion=true]) *::after{animation:none !important;scroll-behavior:auto !important;transition:none !important}:host{box-sizing:border-box;display:block;margin-bottom:var(--spacing-scale-base);max-width:var(--br-datetime-picker-width, none);position:relative;width:100%}:host([mode=time]){max-width:var(--br-datetime-picker-time-width, var(--br-datetime-picker-width, none));width:100%}:host([mode=time][selection-mode=range]){width:var(--br-datetime-picker-time-range-width, 304px)}:host([mode=date]){max-width:var(--br-datetime-picker-date-width, var(--br-datetime-picker-width, none));width:100%}:host([mode=datetime]){max-width:var(--br-datetime-picker-datetime-width, var(--br-datetime-picker-width, none));width:100%}:host([mode=datetime][selection-mode=range]){width:var(--br-datetime-picker-datetime-range-width, 320px)}.br-datetime-picker{width:100%}.br-datetime-picker br-datetime-input,.br-datetime-picker br-card{display:block;width:100%}.br-datetime-picker br-card{font-size:var(--font-size-scale-base);animation:none}@media (prefers-reduced-motion: no-preference){.br-datetime-picker br-card{animation:datetime-panel-open var(--duration-fast, 300ms) var(--animation-ease-out, ease-out) both}}@keyframes datetime-panel-open{from{opacity:0}to{opacity:1}}.range-time-pickers{align-items:center;box-sizing:border-box;display:flex;gap:var(--spacing-scale-half, 4px);justify-content:center;margin-inline:auto;max-width:304px;padding:0;width:100%}.range-time-picker{align-items:center;display:flex;flex:0 0 144px;flex-direction:column;min-width:0}.range-time-label{font-size:var(--font-size-scale-down-01, 0.875rem);font-weight:var(--font-weight-semi-bold, 600);margin-bottom:var(--spacing-scale-base, 8px)}.range-time-separator{align-self:center;color:var(--gray-70);flex:0 0 auto;font-size:var(--font-size-scale-up-01, 1.2rem);font-weight:var(--font-weight-semi-bold, 600);margin-top:calc(var(--font-size-scale-down-01, 0.875rem) + var(--spacing-scale-base, 8px))}.br-datetime-picker br-date-picker{margin-inline:auto}:host([selection-mode=range]) br-card{text-align:initial}`;
|
|
428
1021
|
|
|
429
1022
|
const DatetimePicker = class {
|
|
430
1023
|
constructor(hostRef) {
|
|
431
1024
|
index.registerInstance(this, hostRef);
|
|
432
1025
|
this.dateStateChange = index.createEvent(this, "dateStateChange", 7);
|
|
1026
|
+
this.brDatetimePickerChange = index.createEvent(this, "brDatetimePickerChange", 7);
|
|
433
1027
|
this.valueChange = index.createEvent(this, "valueChange", 7);
|
|
434
1028
|
this.brDatetimePickerValidationChange = index.createEvent(this, "brDatetimePickerValidationChange", 7);
|
|
435
1029
|
if (hostRef.$hostElement$["s-ei"]) {
|
|
@@ -440,188 +1034,334 @@ const DatetimePicker = class {
|
|
|
440
1034
|
hostRef.$hostElement$["s-ei"] = this.elementInternals;
|
|
441
1035
|
}
|
|
442
1036
|
/**
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
this.isPickerOpen = false;
|
|
446
|
-
this.formDisabled = false;
|
|
447
|
-
this.hasFeedbackSlot = false;
|
|
448
|
-
this.customValidationMessage = '';
|
|
449
|
-
this.validatorMessage = null;
|
|
450
|
-
this.isValidating = false;
|
|
451
|
-
this.feedbackId = id.generateUniqueId('br-datetime-picker-feedback');
|
|
452
|
-
/** Lista normalizada de datas indisponíveis para seleção. */
|
|
453
|
-
this.normalizedDisabledDates = [];
|
|
454
|
-
/** Data final selecionada no modo de intervalo. */
|
|
455
|
-
this.rangeEnd = null;
|
|
456
|
-
/** Data inicial selecionada no modo de intervalo. */
|
|
457
|
-
this.rangeStart = null;
|
|
458
|
-
/**
|
|
459
|
-
* Mantém a data de referência que orienta a navegação visual do calendário.
|
|
460
|
-
*/
|
|
461
|
-
this.referenceDate = new Date();
|
|
462
|
-
/**
|
|
463
|
-
* Define o modo de seleção exibido pelo componente: data, horário ou ambos.
|
|
1037
|
+
* Modo exibido pelo componente.
|
|
464
1038
|
*
|
|
465
|
-
* Valores
|
|
466
|
-
* Valores inválidos são
|
|
467
|
-
* mantendo o atributo refletido sempre consistente com o modo exibido.
|
|
1039
|
+
* Valores: `date` | `time` | `datetime`.
|
|
1040
|
+
* Valores inválidos são normalizados para o padrão.
|
|
468
1041
|
*
|
|
469
1042
|
* @default 'datetime'
|
|
470
1043
|
*/
|
|
471
1044
|
this.mode = datetimePickerConstants.DATETIME_PICKER_MODE.DEFAULT;
|
|
472
1045
|
/**
|
|
473
|
-
*
|
|
1046
|
+
* Locale usado para formatação e rótulos.
|
|
474
1047
|
*
|
|
475
1048
|
* @default 'pt-BR'
|
|
476
1049
|
*/
|
|
477
1050
|
this.locale = datetimePickerConstants.DATETIME_PICKER_LOCALE.DEFAULT;
|
|
478
1051
|
/**
|
|
479
|
-
*
|
|
1052
|
+
* Texto placeholder exibido no input.
|
|
480
1053
|
*
|
|
481
1054
|
* @default ''
|
|
482
1055
|
*/
|
|
483
1056
|
this.placeholder = '';
|
|
484
|
-
/**
|
|
1057
|
+
/**
|
|
1058
|
+
* Nome do campo para submissão em formulários nativos.
|
|
1059
|
+
*
|
|
1060
|
+
* @default ''
|
|
1061
|
+
*/
|
|
485
1062
|
this.name = '';
|
|
486
|
-
/**
|
|
1063
|
+
/**
|
|
1064
|
+
* Indica se o campo é requerido para submissão do formulário.
|
|
1065
|
+
*
|
|
1066
|
+
* @default false
|
|
1067
|
+
*/
|
|
487
1068
|
this.required = false;
|
|
488
1069
|
/**
|
|
489
|
-
* Menor data/
|
|
490
|
-
* Aceita texto no atributo HTML ou uma instância de `Date` por property binding.
|
|
1070
|
+
* Menor data/hora aceito (Date | string | null).
|
|
491
1071
|
*
|
|
492
|
-
* @
|
|
493
|
-
* ```html
|
|
494
|
-
* <br-datetime-picker mode="date" min="2026-01-01"></br-datetime-picker>
|
|
495
|
-
* ```
|
|
1072
|
+
* @default null
|
|
496
1073
|
*/
|
|
497
1074
|
this.min = null;
|
|
498
1075
|
/**
|
|
499
|
-
* Maior data/
|
|
500
|
-
* Aceita texto no atributo HTML ou uma instância de `Date` por property binding.
|
|
1076
|
+
* Maior data/hora aceito (Date | string | null).
|
|
501
1077
|
*
|
|
502
|
-
* @
|
|
503
|
-
* ```html
|
|
504
|
-
* <br-datetime-picker mode="date" max="2026-12-31"></br-datetime-picker>
|
|
505
|
-
* ```
|
|
1078
|
+
* @default null
|
|
506
1079
|
*/
|
|
507
1080
|
this.max = null;
|
|
508
1081
|
/**
|
|
509
|
-
*
|
|
1082
|
+
* Tipo de seleção: `single` ou `range`.
|
|
510
1083
|
*
|
|
511
|
-
*
|
|
512
|
-
* Se `selectionMode="range"` for informado, o componente ajusta automaticamente
|
|
513
|
-
* `mode` para `date`. Se `mode` mudar para `time` ou `datetime`, o componente
|
|
514
|
-
* normaliza `selectionMode` para `single` quando necessário.
|
|
515
|
-
* Valores inválidos usam `single`.
|
|
1084
|
+
* @default 'single'
|
|
516
1085
|
*/
|
|
517
1086
|
this.selectionMode = 'single';
|
|
518
1087
|
/**
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* Valores suportados: 0 (domingo) a 6 (sábado).
|
|
1088
|
+
* Dia inicial da semana exibido no calendário (0 = Dom, 6 = Sáb).
|
|
522
1089
|
*
|
|
523
1090
|
* @default 0
|
|
524
1091
|
*/
|
|
525
1092
|
this.weekStartsOn = 0;
|
|
526
1093
|
/**
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
* Aceita:
|
|
530
|
-
* - `'now'`: seleciona o momento atual.
|
|
531
|
-
* - `Date` ou `string`: seleciona uma data arbitrária.
|
|
532
|
-
* - `null`: inicia sem seleção.
|
|
533
|
-
*
|
|
534
|
-
* Reativo em runtime: mudanças na prop atualizam estado e subcomponentes.
|
|
1094
|
+
* Valor inicial da seleção: `'now' | Date | string | null`.
|
|
535
1095
|
*
|
|
536
1096
|
* @default null
|
|
537
|
-
* @example
|
|
538
|
-
* ```html
|
|
539
|
-
* <br-datetime-picker initial-moment="now"></br-datetime-picker>
|
|
540
|
-
* ```
|
|
541
1097
|
*/
|
|
542
1098
|
this.initialMoment = null;
|
|
543
1099
|
/**
|
|
544
|
-
*
|
|
545
|
-
* Pode ser controlada por property binding e é atualizada pelo evento `valueChange`.
|
|
546
|
-
* Para formulários e atributos textuais, use `serializedValue`.
|
|
1100
|
+
* Valor selecionado pelo usuário (Date | null).
|
|
547
1101
|
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
* picker.value = new Date(2026, 8, 7, 14, 30);
|
|
552
|
-
* ```
|
|
1102
|
+
* Pode ser controlado externamente e é refletido internamente.
|
|
1103
|
+
*
|
|
1104
|
+
* @default null
|
|
553
1105
|
*/
|
|
554
1106
|
this.value = null;
|
|
555
1107
|
/**
|
|
556
1108
|
* Desabilita toda a interação do componente.
|
|
557
1109
|
*
|
|
558
|
-
* Quando `true`, impede abrir o picker, alterar valores e navegar entre datas/horários.
|
|
559
|
-
*
|
|
560
1110
|
* @default false
|
|
561
1111
|
*/
|
|
562
1112
|
this.disabled = false;
|
|
563
1113
|
/**
|
|
564
|
-
*
|
|
1114
|
+
* Datas indisponíveis para seleção. Aceita `Date[]`, `string` ou `null`.
|
|
565
1115
|
*
|
|
566
|
-
*
|
|
567
|
-
* separadas por espaço em branco. Datas inválidas são ignoradas com warning.
|
|
568
|
-
* A comparação considera apenas o dia (ano/mês/dia), ignorando hora.
|
|
1116
|
+
* Datas inválidas são ignoradas. A comparação considera apenas o dia.
|
|
569
1117
|
*
|
|
570
1118
|
* @default null
|
|
571
|
-
* @example
|
|
572
|
-
* ```html
|
|
573
|
-
* <br-datetime-picker mode="date" disabled-dates="2026-09-07 2026-09-08"></br-datetime-picker>
|
|
574
|
-
* ```
|
|
575
|
-
* @example
|
|
576
|
-
* ```js
|
|
577
|
-
* const picker = document.querySelector('br-datetime-picker');
|
|
578
|
-
* picker.disabledDates = [new Date(2026, 8, 7), '2026-09-08'];
|
|
579
|
-
* ```
|
|
580
1119
|
*/
|
|
581
1120
|
this.disabledDates = null;
|
|
582
1121
|
/**
|
|
583
|
-
*
|
|
584
|
-
* ou variar conforme o mês.
|
|
585
|
-
*
|
|
586
|
-
* Quando `true`, o calendário sempre exibe 6 semanas completas.
|
|
587
|
-
* Quando `false`, o calendário adapta-se ao mês, exibindo apenas as semanas necessárias.
|
|
1122
|
+
* Mantém número fixo de linhas no calendário (6 semanas) quando `true`.
|
|
588
1123
|
*
|
|
589
1124
|
* @default false
|
|
590
1125
|
*/
|
|
591
1126
|
this.fixedRowCount = false;
|
|
592
|
-
/**
|
|
1127
|
+
/**
|
|
1128
|
+
* Controla se o conteúdo do picker está visível.
|
|
1129
|
+
*
|
|
1130
|
+
* @internal Estado reativo interno; não usar externamente.
|
|
1131
|
+
*/
|
|
1132
|
+
this.isPickerOpen = false;
|
|
1133
|
+
/**
|
|
1134
|
+
* Indica se o formulário associado desabilitou o componente.
|
|
1135
|
+
*
|
|
1136
|
+
* @internal Estado reativo interno.
|
|
1137
|
+
*/
|
|
1138
|
+
this.formDisabled = false;
|
|
1139
|
+
/**
|
|
1140
|
+
* Indica se existe slot `feedback` presente no host.
|
|
1141
|
+
*
|
|
1142
|
+
* @internal Estado reativo interno.
|
|
1143
|
+
*/
|
|
1144
|
+
this.hasFeedbackSlot = false;
|
|
1145
|
+
/**
|
|
1146
|
+
* Mensagem de validação customizada definida por `setCustomValidity`.
|
|
1147
|
+
*
|
|
1148
|
+
* @internal Estado reativo interno.
|
|
1149
|
+
*/
|
|
1150
|
+
this.customValidationMessage = '';
|
|
1151
|
+
/**
|
|
1152
|
+
* Mensagem retornada pelo validator customizado, se houver.
|
|
1153
|
+
*
|
|
1154
|
+
* @internal Estado reativo interno.
|
|
1155
|
+
*/
|
|
1156
|
+
this.validatorMessage = null;
|
|
1157
|
+
/**
|
|
1158
|
+
* Mensagem textual de validação proveniente do input interno.
|
|
1159
|
+
*
|
|
1160
|
+
* @internal Estado reativo interno.
|
|
1161
|
+
*/
|
|
1162
|
+
this.inputValidationMessage = '';
|
|
1163
|
+
/**
|
|
1164
|
+
* Indica que o usuário está editando o texto do input e que a validação
|
|
1165
|
+
* textual está pendente (mensagem escondida até commit/blur).
|
|
1166
|
+
*
|
|
1167
|
+
* @internal
|
|
1168
|
+
*/
|
|
1169
|
+
this.inputValidationPending = false;
|
|
1170
|
+
/**
|
|
1171
|
+
* Indicador de execução do validator assíncrono.
|
|
1172
|
+
*
|
|
1173
|
+
* @internal Estado reativo interno.
|
|
1174
|
+
*/
|
|
1175
|
+
this.isValidating = false;
|
|
1176
|
+
/**
|
|
1177
|
+
* Lista normalizada de datas indisponíveis para seleção.
|
|
1178
|
+
*
|
|
1179
|
+
* @internal Mantida em formato `Date[]` para uso interno pelo calendário.
|
|
1180
|
+
*/
|
|
1181
|
+
this.normalizedDisabledDates = [];
|
|
1182
|
+
/**
|
|
1183
|
+
* Data final selecionada no modo de intervalo.
|
|
1184
|
+
*
|
|
1185
|
+
* @internal Estado reativo interno.
|
|
1186
|
+
*/
|
|
1187
|
+
this.rangeEnd = null;
|
|
1188
|
+
/**
|
|
1189
|
+
* Data inicial selecionada no modo de intervalo.
|
|
1190
|
+
*
|
|
1191
|
+
* @internal Estado reativo interno.
|
|
1192
|
+
*/
|
|
1193
|
+
this.rangeStart = null;
|
|
1194
|
+
/**
|
|
1195
|
+
* Data de referência usada para navegação visual (mês/semana exibidos).
|
|
1196
|
+
*
|
|
1197
|
+
* @internal Controle de navegação do calendário.
|
|
1198
|
+
*/
|
|
1199
|
+
this.referenceDate = new Date();
|
|
1200
|
+
/**
|
|
1201
|
+
* ID único do contêiner de feedback interno.
|
|
1202
|
+
* Gerado por `Helpers.generateUniqueId` no momento da criação da instância
|
|
1203
|
+
* e usado para associar mensagens de validação ao input interno.
|
|
1204
|
+
*
|
|
1205
|
+
* @internal
|
|
1206
|
+
*/
|
|
1207
|
+
this.feedbackId = Helpers.generateUniqueId('br-datetime-picker-feedback');
|
|
1208
|
+
/**
|
|
1209
|
+
* Snapshot da seleção inicial usada para restaurar em reset de formulário.
|
|
1210
|
+
* Mantém uma cópia imutável do valor original para `formResetCallback`.
|
|
1211
|
+
*
|
|
1212
|
+
* @internal
|
|
1213
|
+
*/
|
|
593
1214
|
this.initialFormValue = null;
|
|
1215
|
+
/**
|
|
1216
|
+
* Contador monótono usado para invalidar execuções assíncronas de validação.
|
|
1217
|
+
* Incrementado antes de cada execução; resultados com `runId` diferente são ignorados.
|
|
1218
|
+
*
|
|
1219
|
+
* @internal
|
|
1220
|
+
*/
|
|
594
1221
|
this.validationRunId = 0;
|
|
1222
|
+
/**
|
|
1223
|
+
* Indica se o componente já completou o ciclo `componentDidLoad`.
|
|
1224
|
+
* Evita executar lógica de inicialização mais de uma vez.
|
|
1225
|
+
*
|
|
1226
|
+
* @internal
|
|
1227
|
+
*/
|
|
595
1228
|
this.isInitialized = false;
|
|
1229
|
+
/**
|
|
1230
|
+
* Flag para evitar loops de sincronização entre `value`, `valueAsDate` e `serializedValue`.
|
|
1231
|
+
* Setada temporariamente durante operações programáticas de sincronização.
|
|
1232
|
+
*
|
|
1233
|
+
* @internal
|
|
1234
|
+
*/
|
|
596
1235
|
this.syncingCanonicalValues = false;
|
|
597
|
-
/**
|
|
1236
|
+
/**
|
|
1237
|
+
* Flag que sinaliza atualizações internas em `rangeValue`.
|
|
1238
|
+
* Usada para distinguir atribuições programáticas de alterações externas.
|
|
1239
|
+
*
|
|
1240
|
+
* @internal
|
|
1241
|
+
*/
|
|
1242
|
+
this.syncingRangeValueInternally = false;
|
|
1243
|
+
/**
|
|
1244
|
+
* Mapeia cada modo para a função responsável por renderizar seu conteúdo.
|
|
1245
|
+
* Facilita seleção de renderer sem condicionais espalhadas pelo código.
|
|
1246
|
+
*
|
|
1247
|
+
* @internal
|
|
1248
|
+
*/
|
|
598
1249
|
this.modeRendererMap = {
|
|
599
1250
|
[datetimePickerConstants.DATETIME_PICKER_MODE.DATE]: () => this.renderDatePicker(),
|
|
600
|
-
[datetimePickerConstants.DATETIME_PICKER_MODE.TIME]: () => this.renderTimePicker(),
|
|
1251
|
+
[datetimePickerConstants.DATETIME_PICKER_MODE.TIME]: () => this.selectionMode === 'range' ? this.renderRangeTimePickers() : this.renderTimePicker(),
|
|
601
1252
|
[datetimePickerConstants.DATETIME_PICKER_MODE.DATETIME]: () => this.renderDateTimePicker(),
|
|
602
1253
|
};
|
|
603
1254
|
/**
|
|
604
|
-
*
|
|
1255
|
+
* Indica se o listener global de clique fora do componente está anexado.
|
|
1256
|
+
* Evita anexações/remoções redundantes do mesmo handler.
|
|
605
1257
|
*
|
|
606
|
-
* @
|
|
1258
|
+
* @internal
|
|
1259
|
+
*/
|
|
1260
|
+
this.outsideClickListenerAttached = false;
|
|
1261
|
+
/**
|
|
1262
|
+
* Handler disparado por `br-datetime-input` para propagar mensagens de
|
|
1263
|
+
* validação do input interno para o estado do componente.
|
|
1264
|
+
*
|
|
1265
|
+
* @param event CustomEvent<{ valid: boolean; message: string }> — detalhe com `valid` e `message`.
|
|
1266
|
+
* @returns void
|
|
1267
|
+
*/
|
|
1268
|
+
this.handleInputValidationChange = (event) => {
|
|
1269
|
+
event.stopPropagation();
|
|
1270
|
+
const valid = event.detail.valid;
|
|
1271
|
+
if (valid === null) {
|
|
1272
|
+
// usuário está editando: escondemos a mensagem visual, mas mantemos
|
|
1273
|
+
// o estado de validade indefinido até commit/blur/enter
|
|
1274
|
+
this.inputValidationMessage = '';
|
|
1275
|
+
this.inputValidationPending = true;
|
|
1276
|
+
}
|
|
1277
|
+
else {
|
|
1278
|
+
this.inputValidationMessage = valid ? '' : event.detail.message;
|
|
1279
|
+
this.inputValidationPending = false;
|
|
1280
|
+
}
|
|
1281
|
+
this.syncFormValidity();
|
|
1282
|
+
};
|
|
1283
|
+
/**
|
|
1284
|
+
* Handler principal que consolida eventos de `br-date-picker` / `br-time-picker`.
|
|
1285
|
+
* Contém lógica de proteção contra valores desabilitados, navegação e emissão
|
|
1286
|
+
* de eventos públicos apropriados.
|
|
1287
|
+
*
|
|
1288
|
+
* @param event CustomEvent<DatetimePickerDateState> — detalhe com `referenceDate`, `value` e `range`.
|
|
607
1289
|
*/
|
|
608
1290
|
this.handleDateStateChange = (event) => {
|
|
609
|
-
// Evita que o evento interno dos subcomponentes vaze para fora do host.
|
|
610
1291
|
event.stopPropagation();
|
|
611
1292
|
if (this.isDisabled()) {
|
|
612
1293
|
return;
|
|
613
1294
|
}
|
|
1295
|
+
const origin = event.detail.origin;
|
|
1296
|
+
if (origin !== 'BR-DATETIME-INPUT') {
|
|
1297
|
+
this.inputValidationMessage = '';
|
|
1298
|
+
}
|
|
614
1299
|
const { referenceDate, value, range } = event.detail;
|
|
1300
|
+
if (this.isRangeNavigationState(value, range)) {
|
|
1301
|
+
this.referenceDate = isValid.toDateExports.toDate(referenceDate);
|
|
1302
|
+
this.updateFormInternals();
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
615
1305
|
const selectedDate = this.resolveSelectedDateFromEvent(range, value);
|
|
616
1306
|
if (selectedDate !== null && this.isDateDisabled(selectedDate)) {
|
|
617
1307
|
return;
|
|
618
1308
|
}
|
|
619
|
-
this.referenceDate =
|
|
1309
|
+
this.referenceDate = isValid.toDateExports.toDate(referenceDate);
|
|
620
1310
|
const shouldEmitPublicEvent = this.resolvePublicEventEmissionForRange(range);
|
|
621
|
-
|
|
1311
|
+
const nextValue = value === null ? null : isValid.toDateExports.toDate(value);
|
|
1312
|
+
if (this.sameDate(this.value, nextValue)) {
|
|
1313
|
+
this.handleUnchangedDateState(range, shouldEmitPublicEvent);
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
this.setComponentValue(nextValue, shouldEmitPublicEvent && this.isInitialized);
|
|
1317
|
+
this.emitPendingRangeChange(range, shouldEmitPublicEvent);
|
|
622
1318
|
};
|
|
1319
|
+
/**
|
|
1320
|
+
* Atualiza somente o horário de um dos limites do intervalo.
|
|
1321
|
+
*
|
|
1322
|
+
* @param boundary 'start' | 'end' — qual limite será atualizado.
|
|
1323
|
+
* @param event CustomEvent<DatetimePickerDateState> — detalhe com novo `value`.
|
|
1324
|
+
*/
|
|
1325
|
+
this.handleRangeTimeStateChange = (boundary, event) => {
|
|
1326
|
+
event.stopPropagation();
|
|
1327
|
+
if (this.isDisabled() || event.detail.value === null)
|
|
1328
|
+
return;
|
|
1329
|
+
const displayedStart = this.cloneDate(this.rangeStart ?? this.referenceDate);
|
|
1330
|
+
const displayedEnd = this.cloneDate(this.rangeEnd ?? this.referenceDate);
|
|
1331
|
+
if (this.rangeStart === null)
|
|
1332
|
+
this.rangeStart = displayedStart;
|
|
1333
|
+
if (this.rangeEnd === null)
|
|
1334
|
+
this.rangeEnd = displayedEnd;
|
|
1335
|
+
const selected = isValid.toDateExports.toDate(event.detail.value);
|
|
1336
|
+
const current = boundary === 'start' ? this.rangeStart : this.rangeEnd;
|
|
1337
|
+
const base = current ?? this.referenceDate;
|
|
1338
|
+
const next = isValid.setExports.set(base, {
|
|
1339
|
+
hours: selected.getHours(),
|
|
1340
|
+
minutes: selected.getMinutes(),
|
|
1341
|
+
seconds: 0,
|
|
1342
|
+
milliseconds: 0,
|
|
1343
|
+
});
|
|
1344
|
+
if (boundary === 'start')
|
|
1345
|
+
this.rangeStart = next;
|
|
1346
|
+
else
|
|
1347
|
+
this.rangeEnd = next;
|
|
1348
|
+
const nextComponentValue = this.rangeEnd ?? this.rangeStart;
|
|
1349
|
+
if (!this.sameDate(this.value, nextComponentValue)) {
|
|
1350
|
+
this.value = this.cloneDate(nextComponentValue);
|
|
1351
|
+
}
|
|
1352
|
+
this.syncCanonicalValues();
|
|
1353
|
+
if (this.isInitialized) {
|
|
1354
|
+
this.emitDateStateChange();
|
|
1355
|
+
void this.validate();
|
|
1356
|
+
}
|
|
1357
|
+
this.updateFormInternals();
|
|
1358
|
+
};
|
|
1359
|
+
this.handleRangeStartTimeStateChange = (event) => this.handleRangeTimeStateChange('start', event);
|
|
1360
|
+
this.handleRangeEndTimeStateChange = (event) => this.handleRangeTimeStateChange('end', event);
|
|
623
1361
|
/**
|
|
624
1362
|
* Alterna visibilidade do picker quando o input solicita.
|
|
1363
|
+
*
|
|
1364
|
+
* @param event Event — evento de toggle vindo do input.
|
|
625
1365
|
*/
|
|
626
1366
|
this.handleTogglePicker = (event) => {
|
|
627
1367
|
if (this.isDisabled()) {
|
|
@@ -630,12 +1370,15 @@ const DatetimePicker = class {
|
|
|
630
1370
|
event.stopPropagation();
|
|
631
1371
|
const willOpen = !this.isPickerOpen;
|
|
632
1372
|
if (willOpen) {
|
|
633
|
-
this.referenceDate = this.value === null ?
|
|
1373
|
+
this.referenceDate = this.value === null ? isValid.toDateExports.toDate(new Date()) : isValid.toDateExports.toDate(this.value);
|
|
1374
|
+
this.initializeTimeRangeBoundaries();
|
|
634
1375
|
}
|
|
635
1376
|
this.isPickerOpen = willOpen;
|
|
636
1377
|
};
|
|
637
1378
|
/**
|
|
638
1379
|
* Fecha o picker quando o clique acontece fora do host.
|
|
1380
|
+
*
|
|
1381
|
+
* @param event MouseEvent — clique ocorrido no documento.
|
|
639
1382
|
*/
|
|
640
1383
|
this.handleOutsideClick = (event) => {
|
|
641
1384
|
const eventPath = event.composedPath();
|
|
@@ -644,7 +1387,6 @@ const DatetimePicker = class {
|
|
|
644
1387
|
}
|
|
645
1388
|
this.isPickerOpen = false;
|
|
646
1389
|
};
|
|
647
|
-
this.outsideClickListenerAttached = false;
|
|
648
1390
|
/**
|
|
649
1391
|
* Fecha o picker ao pressionar Escape, devolvendo o foco ao input interno.
|
|
650
1392
|
*
|
|
@@ -655,42 +1397,17 @@ const DatetimePicker = class {
|
|
|
655
1397
|
return;
|
|
656
1398
|
event.stopPropagation();
|
|
657
1399
|
this.isPickerOpen = false;
|
|
658
|
-
|
|
1400
|
+
this.getNativeInputElement()?.focus();
|
|
659
1401
|
};
|
|
660
1402
|
}
|
|
661
|
-
formDisabledCallback(disabled) {
|
|
662
|
-
this.formDisabled = disabled;
|
|
663
|
-
}
|
|
664
|
-
/** API nativa de reset de form-associated custom elements. */
|
|
665
|
-
formResetCallback() {
|
|
666
|
-
this.customValidationMessage = '';
|
|
667
|
-
this.validatorMessage = null;
|
|
668
|
-
this.validationRunId++;
|
|
669
|
-
this.restoreSelection(this.initialFormValue);
|
|
670
|
-
}
|
|
671
|
-
/** API nativa de restauração de estado (histórico/autofill) do formulário. */
|
|
672
|
-
formStateRestoreCallback(state) {
|
|
673
|
-
if (typeof state !== 'string') {
|
|
674
|
-
this.restoreSelection(null);
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if (this.isRangeRestoreMode()) {
|
|
678
|
-
this.restoreRangeStateFromSerialized(state);
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
this.restoreSingleStateFromSerialized(state);
|
|
682
|
-
}
|
|
683
1403
|
/**
|
|
684
1404
|
* Revalida o modo sempre que a prop mudar.
|
|
685
1405
|
*
|
|
686
|
-
* @param newValue - Valor recebido via atributo/prop.
|
|
1406
|
+
* @param {string} newValue - Valor recebido via atributo/prop.
|
|
687
1407
|
*/
|
|
688
1408
|
handleModeChange(newValue) {
|
|
689
1409
|
this.ensureValidMode(newValue);
|
|
690
|
-
|
|
691
|
-
this.selectionMode = 'single';
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
1410
|
+
this.initializeTimeRangeBoundaries();
|
|
694
1411
|
this.updateFormInternals();
|
|
695
1412
|
}
|
|
696
1413
|
/** Revalida o estado do formulário quando required mudar. */
|
|
@@ -707,14 +1424,11 @@ const DatetimePicker = class {
|
|
|
707
1424
|
/** Reage a mudanças no modo de seleção e limpa intervalo quando necessário. */
|
|
708
1425
|
handleSelectionModeChange(newValue) {
|
|
709
1426
|
this.ensureValidSelectionMode(newValue);
|
|
710
|
-
if (this.selectionMode === 'range' && this.mode !== datetimePickerConstants.DATETIME_PICKER_MODE.DATE) {
|
|
711
|
-
this.mode = datetimePickerConstants.DATETIME_PICKER_MODE.DATE;
|
|
712
|
-
return;
|
|
713
|
-
}
|
|
714
1427
|
if (this.selectionMode === 'single') {
|
|
715
1428
|
this.clearRangeState();
|
|
716
1429
|
return;
|
|
717
1430
|
}
|
|
1431
|
+
this.initializeTimeRangeBoundaries();
|
|
718
1432
|
this.updateFormInternals();
|
|
719
1433
|
}
|
|
720
1434
|
/** Revalida o dia inicial da semana sempre que a prop mudar. */
|
|
@@ -724,15 +1438,18 @@ const DatetimePicker = class {
|
|
|
724
1438
|
/**
|
|
725
1439
|
* Aplica ou limpa a seleção da data atual conforme o novo valor da prop.
|
|
726
1440
|
*
|
|
727
|
-
* @param newValue - Novo estado da prop.
|
|
1441
|
+
* @param {DatetimePickerInitialMoment} newValue - Novo estado da prop.
|
|
728
1442
|
*/
|
|
729
1443
|
handleInitialMomentChange(newValue) {
|
|
730
1444
|
this.applyInitialMoment(newValue, this.isInitialized);
|
|
731
1445
|
this.initialFormValue = this.cloneDate(this.value);
|
|
732
1446
|
}
|
|
733
1447
|
/** Sincroniza alterações externas do valor com o estado visual e o formulário nativo. */
|
|
1448
|
+
/**
|
|
1449
|
+
* @param {Date | null} newValue - Novo valor recebido via prop.
|
|
1450
|
+
*/
|
|
734
1451
|
handleValueChange(newValue) {
|
|
735
|
-
const normalizedValue = newValue instanceof Date && !Number.isNaN(newValue.getTime()) ?
|
|
1452
|
+
const normalizedValue = newValue instanceof Date && !Number.isNaN(newValue.getTime()) ? isValid.toDateExports.toDate(newValue) : null;
|
|
736
1453
|
if (newValue !== null && normalizedValue === null) {
|
|
737
1454
|
this.value = null;
|
|
738
1455
|
return;
|
|
@@ -753,7 +1470,7 @@ const DatetimePicker = class {
|
|
|
753
1470
|
handleValueAsDateChange(newValue) {
|
|
754
1471
|
if (this.syncingCanonicalValues || newValue === undefined)
|
|
755
1472
|
return;
|
|
756
|
-
const normalizedValue = newValue instanceof Date && !Number.isNaN(newValue.getTime()) ?
|
|
1473
|
+
const normalizedValue = newValue instanceof Date && !Number.isNaN(newValue.getTime()) ? isValid.toDateExports.toDate(newValue) : null;
|
|
757
1474
|
if (this.sameDate(this.value, normalizedValue))
|
|
758
1475
|
return;
|
|
759
1476
|
this.value = normalizedValue;
|
|
@@ -775,45 +1492,33 @@ const DatetimePicker = class {
|
|
|
775
1492
|
this.syncDisabledDates(newValue);
|
|
776
1493
|
}
|
|
777
1494
|
handleRangeValueChange(newValue) {
|
|
778
|
-
if (!newValue || this.selectionMode !== 'range')
|
|
779
|
-
return;
|
|
780
|
-
if (!datetimePickerPropsValidation.isValidDatetimePickerDateRange(newValue)) {
|
|
781
|
-
propWarning.reportInvalidPropValue(this.el, 'rangeValue', newValue, 'Informe um objeto com `start` e `end` como Date válido ou null.', 'Mantendo o último intervalo efetivo.');
|
|
1495
|
+
if (this.syncingRangeValueInternally || !newValue || this.selectionMode !== 'range')
|
|
782
1496
|
return;
|
|
783
|
-
}
|
|
784
1497
|
this.rangeStart = this.cloneDate(newValue.start);
|
|
785
1498
|
this.rangeEnd = this.cloneDate(newValue.end);
|
|
786
|
-
const nextValue =
|
|
787
|
-
this.
|
|
788
|
-
this.setComponentValue(nextValue);
|
|
1499
|
+
const nextValue = this.rangeEnd ?? this.rangeStart;
|
|
1500
|
+
this.setComponentValue(nextValue, false);
|
|
789
1501
|
}
|
|
790
|
-
/** Registra o listener global somente enquanto o picker está aberto. */
|
|
791
1502
|
connectedCallback() {
|
|
792
1503
|
if (this.isPickerOpen)
|
|
793
1504
|
this.attachOutsideClickListener();
|
|
794
1505
|
}
|
|
795
|
-
/** Remove o listener global para evitar vazamento de eventos ao desmontar. */
|
|
796
|
-
disconnectedCallback() {
|
|
797
|
-
this.detachOutsideClickListener();
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Normaliza o modo antes da primeira renderização e aplica a data atual quando solicitado.
|
|
801
|
-
*/
|
|
802
1506
|
componentWillLoad() {
|
|
803
|
-
|
|
804
|
-
const
|
|
805
|
-
this.referenceDate =
|
|
1507
|
+
const initialSerializedValue = this.serializedValue;
|
|
1508
|
+
const initialValueAsDate = this.valueAsDate;
|
|
1509
|
+
this.referenceDate = isValid.resolveSsrLocalDate(this.el, this.referenceDate);
|
|
806
1510
|
this.initializeMode();
|
|
807
1511
|
this.initializeSelectionMode();
|
|
808
1512
|
this.initializeWeekStartsOn();
|
|
809
1513
|
this.initializeDisabledDates();
|
|
810
1514
|
this.initializeDefaultValue();
|
|
811
|
-
if (
|
|
812
|
-
this.restoreSerializedValue(
|
|
1515
|
+
if (initialSerializedValue !== undefined) {
|
|
1516
|
+
this.restoreSerializedValue(initialSerializedValue);
|
|
813
1517
|
}
|
|
814
|
-
else if (
|
|
815
|
-
this.handleValueAsDateChange(
|
|
1518
|
+
else if (initialValueAsDate !== undefined) {
|
|
1519
|
+
this.handleValueAsDateChange(initialValueAsDate);
|
|
816
1520
|
}
|
|
1521
|
+
this.initializeTimeRangeBoundaries(true);
|
|
817
1522
|
this.initialFormValue = this.cloneDate(this.value);
|
|
818
1523
|
this.syncCanonicalValues();
|
|
819
1524
|
this.updateFormInternals();
|
|
@@ -822,18 +1527,58 @@ const DatetimePicker = class {
|
|
|
822
1527
|
this.isInitialized = true;
|
|
823
1528
|
this.hasFeedbackSlot = this.el.querySelector('[slot="feedback"]') !== null;
|
|
824
1529
|
}
|
|
1530
|
+
disconnectedCallback() {
|
|
1531
|
+
this.detachOutsideClickListener();
|
|
1532
|
+
}
|
|
1533
|
+
formDisabledCallback(disabled) {
|
|
1534
|
+
this.formDisabled = disabled;
|
|
1535
|
+
}
|
|
1536
|
+
/** Restaura o estado do componente quando o formulário é restaurado. */
|
|
1537
|
+
formResetCallback() {
|
|
1538
|
+
this.customValidationMessage = '';
|
|
1539
|
+
this.validatorMessage = null;
|
|
1540
|
+
this.inputValidationMessage = '';
|
|
1541
|
+
this.validationRunId++;
|
|
1542
|
+
this.restoreSelection(this.initialFormValue);
|
|
1543
|
+
}
|
|
825
1544
|
/**
|
|
826
|
-
*
|
|
1545
|
+
* Restaura o estado do formulário (autofill / histórico).
|
|
827
1546
|
*
|
|
828
|
-
*
|
|
829
|
-
|
|
1547
|
+
* @param {string | File | FormData | null} state Estado serializado fornecido pelo navegador.
|
|
1548
|
+
*/
|
|
1549
|
+
formStateRestoreCallback(state) {
|
|
1550
|
+
if (typeof state !== 'string') {
|
|
1551
|
+
this.restoreSelection(null);
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
if (this.isRangeRestoreMode()) {
|
|
1555
|
+
this.restoreRangeStateFromSerialized(state);
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
this.restoreSingleStateFromSerialized(state);
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Define programaticamente as datas desabilitadas.
|
|
1562
|
+
*
|
|
1563
|
+
* Use quando scripts externos precisam fornecer uma lista tipada de
|
|
1564
|
+
* datas a bloquear no calendário. Substitui a prop `disabledDates` para
|
|
1565
|
+
* atualizações imperativas.
|
|
830
1566
|
*
|
|
831
|
-
* @param dates
|
|
1567
|
+
* @param dates Lista de datas (`Date` | `string`) a bloquear, ou `null` para limpar.
|
|
1568
|
+
* @returns Promise<void> — resolve quando a atualização interna for aplicada.
|
|
832
1569
|
*/
|
|
833
1570
|
async setDisabledDates(dates) {
|
|
834
1571
|
this.syncDisabledDates(dates);
|
|
835
1572
|
}
|
|
836
|
-
/**
|
|
1573
|
+
/**
|
|
1574
|
+
* Define o valor do componente de forma imperativa.
|
|
1575
|
+
*
|
|
1576
|
+
* Aceita `Date`, string compatível com o `mode`, ou `null` para limpar a seleção.
|
|
1577
|
+
* Validação de datas desabilitadas é aplicada antes da atribuição.
|
|
1578
|
+
*
|
|
1579
|
+
* @param value Date | string | null — valor a aplicar; `null` limpa a seleção.
|
|
1580
|
+
* @returns Promise<void> — resolve quando o componente aplicar e sincronizar o valor.
|
|
1581
|
+
*/
|
|
837
1582
|
async setValue(value) {
|
|
838
1583
|
if (this.isDisabled()) {
|
|
839
1584
|
return;
|
|
@@ -847,33 +1592,55 @@ const DatetimePicker = class {
|
|
|
847
1592
|
this.rangeStart = null;
|
|
848
1593
|
this.rangeEnd = null;
|
|
849
1594
|
}
|
|
850
|
-
this.referenceDate = nextValue === null ?
|
|
1595
|
+
this.referenceDate = nextValue === null ? isValid.toDateExports.toDate(new Date()) : isValid.toDateExports.toDate(nextValue);
|
|
851
1596
|
this.setComponentValue(nextValue);
|
|
852
1597
|
}
|
|
853
|
-
/**
|
|
1598
|
+
/**
|
|
1599
|
+
* Retorna uma cópia do valor selecionado atualmente.
|
|
1600
|
+
*
|
|
1601
|
+
* @returns Promise<Date | null> — cópia imutável do `value` atual, ou `null`.
|
|
1602
|
+
*/
|
|
854
1603
|
async getValue() {
|
|
855
1604
|
return this.cloneDate(this.value);
|
|
856
1605
|
}
|
|
857
|
-
/**
|
|
1606
|
+
/**
|
|
1607
|
+
* Limpa valor e intervalo selecionados.
|
|
1608
|
+
*
|
|
1609
|
+
* Remove seleção atual e restaura a referência de navegação para a data atual.
|
|
1610
|
+
*
|
|
1611
|
+
* @returns Promise<void> — resolve após a limpeza e sincronização internas.
|
|
1612
|
+
*/
|
|
858
1613
|
async clear() {
|
|
859
1614
|
this.rangeStart = null;
|
|
860
1615
|
this.rangeEnd = null;
|
|
861
|
-
this.referenceDate =
|
|
1616
|
+
this.referenceDate = isValid.toDateExports.toDate(new Date());
|
|
862
1617
|
this.setComponentValue(null);
|
|
863
1618
|
}
|
|
864
|
-
/**
|
|
1619
|
+
/**
|
|
1620
|
+
* Abre o picker quando o componente estiver habilitado.
|
|
1621
|
+
*
|
|
1622
|
+
* @returns Promise<void> — resolve quando o estado visual for atualizado.
|
|
1623
|
+
*/
|
|
865
1624
|
async open() {
|
|
866
1625
|
if (this.isDisabled()) {
|
|
867
1626
|
return;
|
|
868
1627
|
}
|
|
869
|
-
this.referenceDate = this.value === null ?
|
|
1628
|
+
this.referenceDate = this.value === null ? isValid.toDateExports.toDate(new Date()) : isValid.toDateExports.toDate(this.value);
|
|
870
1629
|
this.isPickerOpen = true;
|
|
871
1630
|
}
|
|
872
|
-
/**
|
|
1631
|
+
/**
|
|
1632
|
+
* Fecha o picker.
|
|
1633
|
+
*
|
|
1634
|
+
* @returns Promise<void> — resolve após atualização do estado de visibilidade.
|
|
1635
|
+
*/
|
|
873
1636
|
async close() {
|
|
874
1637
|
this.isPickerOpen = false;
|
|
875
1638
|
}
|
|
876
|
-
/**
|
|
1639
|
+
/**
|
|
1640
|
+
* Alterna o estado de abertura do picker.
|
|
1641
|
+
*
|
|
1642
|
+
* @returns Promise<void> — resolve quando a transição de estado terminar.
|
|
1643
|
+
*/
|
|
877
1644
|
async toggle() {
|
|
878
1645
|
if (this.isPickerOpen) {
|
|
879
1646
|
await this.close();
|
|
@@ -881,20 +1648,32 @@ const DatetimePicker = class {
|
|
|
881
1648
|
}
|
|
882
1649
|
await this.open();
|
|
883
1650
|
}
|
|
884
|
-
/**
|
|
1651
|
+
/**
|
|
1652
|
+
* Move o foco para o input nativo interno.
|
|
1653
|
+
*
|
|
1654
|
+
* @returns Promise<void> — resolve imediatamente após tentar focar o elemento.
|
|
1655
|
+
*/
|
|
885
1656
|
async focusInput() {
|
|
886
|
-
|
|
887
|
-
await input?.focusInput?.();
|
|
1657
|
+
this.getNativeInputElement()?.focus();
|
|
888
1658
|
}
|
|
889
|
-
/**
|
|
1659
|
+
/**
|
|
1660
|
+
* Define um intervalo no modo atual e ativa `selectionMode="range"`.
|
|
1661
|
+
*
|
|
1662
|
+
* Valida datas contra bloqueios e sincroniza estado visual e de formulário.
|
|
1663
|
+
* Em `datetime`, mantém os limites informados e sinaliza intervalo inválido
|
|
1664
|
+
* quando o término precede o início, sem ajustar datas automaticamente.
|
|
1665
|
+
*
|
|
1666
|
+
* @param start Date | string | null — data inicial do intervalo.
|
|
1667
|
+
* @param end Date | string | null — data final do intervalo.
|
|
1668
|
+
* @returns Promise<void> — resolve quando o intervalo for aplicado e sincronizado.
|
|
1669
|
+
*/
|
|
890
1670
|
async setRange(start, end) {
|
|
891
1671
|
if (this.isDisabled()) {
|
|
892
1672
|
return;
|
|
893
1673
|
}
|
|
894
1674
|
this.selectionMode = 'range';
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
const normalizedEnd = this.parseMethodValue(end, datetimePickerConstants.DATETIME_PICKER_MODE.DATE);
|
|
1675
|
+
const normalizedStart = this.parseMethodValue(start, this.mode);
|
|
1676
|
+
const normalizedEnd = this.parseMethodValue(end, this.mode);
|
|
898
1677
|
if ((normalizedStart !== null && this.isDateDisabled(normalizedStart)) ||
|
|
899
1678
|
(normalizedEnd !== null && this.isDateDisabled(normalizedEnd))) {
|
|
900
1679
|
this.clearRangeState();
|
|
@@ -902,17 +1681,18 @@ const DatetimePicker = class {
|
|
|
902
1681
|
}
|
|
903
1682
|
this.rangeStart = this.cloneDate(normalizedStart);
|
|
904
1683
|
this.rangeEnd = this.cloneDate(normalizedEnd);
|
|
905
|
-
const nextValue =
|
|
906
|
-
this.referenceDate = nextValue === null ?
|
|
1684
|
+
const nextValue = this.rangeEnd ?? this.rangeStart;
|
|
1685
|
+
this.referenceDate = nextValue === null ? isValid.toDateExports.toDate(new Date()) : isValid.toDateExports.toDate(nextValue);
|
|
907
1686
|
this.setComponentValue(nextValue);
|
|
908
1687
|
}
|
|
909
1688
|
/**
|
|
910
1689
|
* Retorna o intervalo de datas selecionado quando em modo `selectionMode="range"`.
|
|
911
1690
|
*
|
|
912
|
-
* @returns
|
|
1691
|
+
* @returns Promise<{ start: Date | null; end: Date | null } | null> — objeto com `start`/`end` ou `null` quando
|
|
1692
|
+
* não estiver em modo `range`.
|
|
913
1693
|
*/
|
|
914
1694
|
async getRange() {
|
|
915
|
-
if (this.selectionMode !== 'range'
|
|
1695
|
+
if (this.selectionMode !== 'range') {
|
|
916
1696
|
return null;
|
|
917
1697
|
}
|
|
918
1698
|
return {
|
|
@@ -923,29 +1703,52 @@ const DatetimePicker = class {
|
|
|
923
1703
|
/**
|
|
924
1704
|
* Consulta se o picker está atualmente aberto.
|
|
925
1705
|
*
|
|
926
|
-
* @returns `true` se o picker está visível, `false` caso contrário.
|
|
1706
|
+
* @returns Promise<boolean> — `true` se o picker está visível, `false` caso contrário.
|
|
927
1707
|
*/
|
|
928
1708
|
async isOpen() {
|
|
929
1709
|
return this.isPickerOpen;
|
|
930
1710
|
}
|
|
931
|
-
/**
|
|
1711
|
+
/**
|
|
1712
|
+
* Restaura o estado inicial atualmente registrado para reset.
|
|
1713
|
+
*
|
|
1714
|
+
* @returns Promise<void> — resolve quando a seleção inicial for restaurada.
|
|
1715
|
+
*/
|
|
932
1716
|
async resetToInitial() {
|
|
933
1717
|
this.restoreSelection(this.initialFormValue);
|
|
934
1718
|
}
|
|
935
|
-
/**
|
|
1719
|
+
/**
|
|
1720
|
+
* Permite que consumidores acionem validação nativa do formulário via host.
|
|
1721
|
+
*
|
|
1722
|
+
* @returns Promise<boolean> — resultado da Constraint Validation API para o host.
|
|
1723
|
+
*/
|
|
936
1724
|
async checkValidity() {
|
|
937
1725
|
return this.elementInternals.checkValidity();
|
|
938
1726
|
}
|
|
939
|
-
/**
|
|
1727
|
+
/**
|
|
1728
|
+
* Permite exibir mensagens nativas de validação no host.
|
|
1729
|
+
*
|
|
1730
|
+
* @returns Promise<boolean> — `true` se a mensagem foi exibida e o formulário é válido.
|
|
1731
|
+
*/
|
|
940
1732
|
async reportValidity() {
|
|
941
1733
|
return this.elementInternals.reportValidity();
|
|
942
1734
|
}
|
|
943
|
-
/**
|
|
1735
|
+
/**
|
|
1736
|
+
* Define ou limpa uma mensagem de validade customizada.
|
|
1737
|
+
*
|
|
1738
|
+
* @param message string — mensagem de validação; string vazia remove a mensagem.
|
|
1739
|
+
* @returns Promise<void> — resolve após sincronizar a validade no host.
|
|
1740
|
+
*/
|
|
944
1741
|
async setCustomValidity(message) {
|
|
945
1742
|
this.customValidationMessage = message;
|
|
946
1743
|
this.syncFormValidity();
|
|
947
1744
|
}
|
|
948
|
-
/**
|
|
1745
|
+
/**
|
|
1746
|
+
* Executa o validator customizado (se houver) e valida o controle.
|
|
1747
|
+
*
|
|
1748
|
+
* Emite eventos de início/conclusão da validação e atualiza mensagens internas.
|
|
1749
|
+
*
|
|
1750
|
+
* @returns Promise<boolean> — `true` se a seleção for considerada válida.
|
|
1751
|
+
*/
|
|
949
1752
|
async validate() {
|
|
950
1753
|
const validator$1 = validator.resolveFormValidator(this.validator);
|
|
951
1754
|
if (!validator$1 || this.isDisabled())
|
|
@@ -954,9 +1757,16 @@ const DatetimePicker = class {
|
|
|
954
1757
|
this.isValidating = true;
|
|
955
1758
|
this.validatorMessage = null;
|
|
956
1759
|
this.syncFormValidity();
|
|
957
|
-
this.brDatetimePickerValidationChange.emit({
|
|
1760
|
+
this.brDatetimePickerValidationChange.emit({
|
|
1761
|
+
validating: true,
|
|
1762
|
+
valid: null,
|
|
1763
|
+
message: null,
|
|
1764
|
+
});
|
|
958
1765
|
const value = this.selectionMode === 'range'
|
|
959
|
-
? {
|
|
1766
|
+
? {
|
|
1767
|
+
start: this.cloneDate(this.rangeStart),
|
|
1768
|
+
end: this.cloneDate(this.rangeEnd),
|
|
1769
|
+
}
|
|
960
1770
|
: this.cloneDate(this.value);
|
|
961
1771
|
const message = await validator.runFormValidator(validator$1, value);
|
|
962
1772
|
if (runId !== this.validationRunId)
|
|
@@ -965,10 +1775,19 @@ const DatetimePicker = class {
|
|
|
965
1775
|
this.isValidating = false;
|
|
966
1776
|
this.syncFormValidity();
|
|
967
1777
|
const valid = message === null && (await this.checkValidity());
|
|
968
|
-
this.brDatetimePickerValidationChange.emit({
|
|
1778
|
+
this.brDatetimePickerValidationChange.emit({
|
|
1779
|
+
validating: false,
|
|
1780
|
+
valid,
|
|
1781
|
+
message,
|
|
1782
|
+
});
|
|
969
1783
|
return valid;
|
|
970
1784
|
}
|
|
971
|
-
/**
|
|
1785
|
+
/**
|
|
1786
|
+
* Retorna um snapshot serializável da Constraint Validation API.
|
|
1787
|
+
*
|
|
1788
|
+
* @returns Promise<FormValidationState> — estado atual de validação do host,
|
|
1789
|
+
* pronto para conversão e restauração via `formStateRestoreCallback`.
|
|
1790
|
+
*/
|
|
972
1791
|
async getValidationState() {
|
|
973
1792
|
return validator.getFormValidationState(this.elementInternals);
|
|
974
1793
|
}
|
|
@@ -978,38 +1797,54 @@ const DatetimePicker = class {
|
|
|
978
1797
|
* @param value - Modo informado pelo consumidor do componente.
|
|
979
1798
|
*/
|
|
980
1799
|
ensureValidSelectionMode(value) {
|
|
981
|
-
this.selectionMode =
|
|
1800
|
+
this.selectionMode = normalizeDatetimePickerSelectionMode(value);
|
|
982
1801
|
}
|
|
983
|
-
/**
|
|
984
|
-
* Normaliza o modo de seleção logo na inicialização.
|
|
985
|
-
*/
|
|
986
1802
|
initializeSelectionMode() {
|
|
987
1803
|
this.handleSelectionModeChange(this.selectionMode);
|
|
988
1804
|
}
|
|
989
|
-
/** Normaliza o dia inicial da semana logo na inicialização. */
|
|
990
1805
|
initializeWeekStartsOn() {
|
|
991
1806
|
this.handleWeekStartsOnChange(this.weekStartsOn);
|
|
992
1807
|
}
|
|
993
|
-
/** Valida o dia inicial da semana e corrige para padrão quando necessário. */
|
|
994
|
-
ensureValidWeekStartsOn(value) {
|
|
995
|
-
this.weekStartsOn = datetimePickerPropsValidation.normalizeDatetimePickerWeekStartsOn(value);
|
|
996
|
-
}
|
|
997
1808
|
/**
|
|
998
|
-
*
|
|
1809
|
+
* Valida o dia inicial da semana e corrige para padrão quando necessário.
|
|
1810
|
+
*
|
|
1811
|
+
* @param value unknown — valor recebido via prop/atributo a ser normalizado.
|
|
999
1812
|
*/
|
|
1813
|
+
ensureValidWeekStartsOn(value) {
|
|
1814
|
+
this.weekStartsOn = normalizeDatetimePickerWeekStartsOn(value);
|
|
1815
|
+
}
|
|
1000
1816
|
clearRangeState() {
|
|
1001
1817
|
this.rangeStart = null;
|
|
1002
1818
|
this.rangeEnd = null;
|
|
1003
1819
|
this.updateFormInternals();
|
|
1004
1820
|
}
|
|
1005
|
-
/**
|
|
1821
|
+
/**
|
|
1822
|
+
* Materializa os horários exibidos pelos dois timers como limites reais.
|
|
1823
|
+
* Assim o range de horário já nasce completo, o input pode representá-lo na
|
|
1824
|
+
* primeira renderização e nenhum timer depende da referência do outro.
|
|
1825
|
+
*/
|
|
1826
|
+
initializeTimeRangeBoundaries(duringInitialization = false) {
|
|
1827
|
+
if ((!this.isInitialized && !duringInitialization) ||
|
|
1828
|
+
this.selectionMode !== 'range' ||
|
|
1829
|
+
this.mode !== datetimePickerConstants.DATETIME_PICKER_MODE.TIME) {
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
const fallback = this.cloneDate(this.value ?? this.referenceDate);
|
|
1833
|
+
if (this.rangeStart === null)
|
|
1834
|
+
this.rangeStart = this.cloneDate(fallback);
|
|
1835
|
+
if (this.rangeEnd === null)
|
|
1836
|
+
this.rangeEnd = this.cloneDate(fallback);
|
|
1837
|
+
this.value = this.cloneDate(this.rangeEnd);
|
|
1838
|
+
}
|
|
1006
1839
|
isRangeDateSelectionMode() {
|
|
1007
|
-
return this.selectionMode === 'range'
|
|
1840
|
+
return this.selectionMode === 'range';
|
|
1008
1841
|
}
|
|
1009
1842
|
/**
|
|
1010
|
-
*
|
|
1843
|
+
* Decide se um evento público deve ser emitido após atualização vinda de
|
|
1844
|
+
* subcomponentes (calendário/relógio).
|
|
1011
1845
|
*
|
|
1012
|
-
*
|
|
1846
|
+
* @param range DatetimePickerDateRange | undefined — estado parcial do range vindo do subcomponente.
|
|
1847
|
+
* @returns boolean — `true` quando o evento deve ser emitido externamente.
|
|
1013
1848
|
*/
|
|
1014
1849
|
resolvePublicEventEmissionForRange(range) {
|
|
1015
1850
|
if (!this.isRangeDateSelectionMode()) {
|
|
@@ -1022,13 +1857,63 @@ const DatetimePicker = class {
|
|
|
1022
1857
|
this.setRangeState(range);
|
|
1023
1858
|
return isFinalRangeClick;
|
|
1024
1859
|
}
|
|
1025
|
-
/**
|
|
1860
|
+
/**
|
|
1861
|
+
* Resolve a data efetivamente selecionada no evento para validações e bloqueios.
|
|
1862
|
+
*
|
|
1863
|
+
* @param range DatetimePickerDateRange | undefined — intervalo parcial (quando aplicável).
|
|
1864
|
+
* @param value Date | null — valor principal vindo do subcomponente.
|
|
1865
|
+
* @returns Date | null — data final a ser considerada para validação.
|
|
1866
|
+
*/
|
|
1026
1867
|
resolveSelectedDateFromEvent(range, value) {
|
|
1027
1868
|
if (!this.isRangeDateSelectionMode() || range === undefined) {
|
|
1028
1869
|
return value;
|
|
1029
1870
|
}
|
|
1030
1871
|
return range.end ?? range.start ?? value;
|
|
1031
1872
|
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Identifica navegação visual que preserva integralmente o range selecionado.
|
|
1875
|
+
*
|
|
1876
|
+
* @param value Date | null — valor principal do evento.
|
|
1877
|
+
* @param range DatetimePickerDateRange | undefined — range parcial do evento.
|
|
1878
|
+
* @returns boolean — `true` quando a navegação não altera a seleção atual.
|
|
1879
|
+
*/
|
|
1880
|
+
isRangeNavigationState(value, range) {
|
|
1881
|
+
return (range !== undefined &&
|
|
1882
|
+
this.sameDate(range.start, this.rangeStart) &&
|
|
1883
|
+
this.sameDate(range.end, this.rangeEnd) &&
|
|
1884
|
+
this.sameDate(value, this.value));
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Consolida um evento cujo valor principal permaneceu inalterado.
|
|
1888
|
+
*
|
|
1889
|
+
* @param range DatetimePickerDateRange | undefined — estado parcial do range.
|
|
1890
|
+
* @param shouldEmitPublicEvent boolean — indica se o evento público deve ser emitido.
|
|
1891
|
+
*/
|
|
1892
|
+
handleUnchangedDateState(range, shouldEmitPublicEvent) {
|
|
1893
|
+
this.syncCanonicalValues();
|
|
1894
|
+
const shouldNotifyRange = this.isInitialized && this.isRangeDateSelectionMode() && range !== undefined;
|
|
1895
|
+
if (shouldNotifyRange && shouldEmitPublicEvent) {
|
|
1896
|
+
this.emitDateStateChange();
|
|
1897
|
+
void this.validate();
|
|
1898
|
+
}
|
|
1899
|
+
else if (shouldNotifyRange) {
|
|
1900
|
+
this.emitCanonicalChange(range);
|
|
1901
|
+
}
|
|
1902
|
+
this.updateFormInternals();
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Emite a seleção parcial de range quando os eventos públicos foram adiados
|
|
1906
|
+
* para evitar duplicidade com listeners legados.
|
|
1907
|
+
*
|
|
1908
|
+
* @param range DatetimePickerDateRange | undefined — snapshot parcial do range.
|
|
1909
|
+
* @param shouldEmitPublicEvent boolean — se deve ser emitido publicamente.
|
|
1910
|
+
*/
|
|
1911
|
+
emitPendingRangeChange(range, shouldEmitPublicEvent) {
|
|
1912
|
+
if (shouldEmitPublicEvent || !this.isInitialized || !this.isRangeDateSelectionMode() || range === undefined) {
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
this.emitCanonicalChange(range);
|
|
1916
|
+
}
|
|
1032
1917
|
attachOutsideClickListener() {
|
|
1033
1918
|
if (this.outsideClickListenerAttached)
|
|
1034
1919
|
return;
|
|
@@ -1041,15 +1926,9 @@ const DatetimePicker = class {
|
|
|
1041
1926
|
document.removeEventListener('click', this.handleOutsideClick);
|
|
1042
1927
|
this.outsideClickListenerAttached = false;
|
|
1043
1928
|
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Garante que o componente inicie com um modo suportado.
|
|
1046
|
-
*/
|
|
1047
1929
|
initializeMode() {
|
|
1048
1930
|
this.ensureValidMode(this.mode);
|
|
1049
1931
|
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Normaliza a coleção de datas desabilitadas na inicialização.
|
|
1052
|
-
*/
|
|
1053
1932
|
initializeDisabledDates() {
|
|
1054
1933
|
this.syncDisabledDates(this.disabledDates);
|
|
1055
1934
|
}
|
|
@@ -1059,7 +1938,7 @@ const DatetimePicker = class {
|
|
|
1059
1938
|
* @param value - Valor bruto recebido por prop/atributo ou método público.
|
|
1060
1939
|
*/
|
|
1061
1940
|
syncDisabledDates(value) {
|
|
1062
|
-
this.normalizedDisabledDates =
|
|
1941
|
+
this.normalizedDisabledDates = normalizeDatetimePickerDisabledDates(value);
|
|
1063
1942
|
if (this.rangeStart !== null && this.isDateDisabled(this.rangeStart)) {
|
|
1064
1943
|
this.rangeStart = null;
|
|
1065
1944
|
}
|
|
@@ -1070,12 +1949,9 @@ const DatetimePicker = class {
|
|
|
1070
1949
|
this.setComponentValue(null);
|
|
1071
1950
|
}
|
|
1072
1951
|
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Aplica a seleção inicial configurada na prop.
|
|
1075
|
-
*/
|
|
1076
1952
|
initializeDefaultValue() {
|
|
1077
1953
|
if (this.value instanceof Date && !Number.isNaN(this.value.getTime())) {
|
|
1078
|
-
this.referenceDate =
|
|
1954
|
+
this.referenceDate = isValid.toDateExports.toDate(this.value);
|
|
1079
1955
|
return;
|
|
1080
1956
|
}
|
|
1081
1957
|
this.value = null;
|
|
@@ -1090,9 +1966,9 @@ const DatetimePicker = class {
|
|
|
1090
1966
|
if (this.isDisabled()) {
|
|
1091
1967
|
return;
|
|
1092
1968
|
}
|
|
1093
|
-
const normalizedSelection =
|
|
1969
|
+
const normalizedSelection = normalizeDatetimePickerInitialMoment(selection);
|
|
1094
1970
|
if (normalizedSelection === 'now') {
|
|
1095
|
-
const now =
|
|
1971
|
+
const now = isValid.toDateExports.toDate(new Date());
|
|
1096
1972
|
this.referenceDate = now;
|
|
1097
1973
|
this.setComponentValue(now, shouldEmitEvents);
|
|
1098
1974
|
return;
|
|
@@ -1103,7 +1979,7 @@ const DatetimePicker = class {
|
|
|
1103
1979
|
this.setComponentValue(null, shouldEmitEvents);
|
|
1104
1980
|
return;
|
|
1105
1981
|
}
|
|
1106
|
-
const selectedDate =
|
|
1982
|
+
const selectedDate = isValid.toDateExports.toDate(normalizedSelection);
|
|
1107
1983
|
if (this.isDateDisabled(selectedDate)) {
|
|
1108
1984
|
this.setComponentValue(null, shouldEmitEvents);
|
|
1109
1985
|
return;
|
|
@@ -1113,13 +1989,16 @@ const DatetimePicker = class {
|
|
|
1113
1989
|
this.rangeEnd = null;
|
|
1114
1990
|
this.setComponentValue(selectedDate, shouldEmitEvents);
|
|
1115
1991
|
}
|
|
1116
|
-
/** Indica se o estado serializado deve ser interpretado como intervalo. */
|
|
1117
1992
|
isRangeRestoreMode() {
|
|
1118
|
-
return this.selectionMode === 'range'
|
|
1993
|
+
return this.selectionMode === 'range';
|
|
1119
1994
|
}
|
|
1120
|
-
/**
|
|
1995
|
+
/**
|
|
1996
|
+
* Restaura estado de intervalo a partir do valor serializado do formulário.
|
|
1997
|
+
*
|
|
1998
|
+
* @param serializedState string — valor serializado vindo do formulário.
|
|
1999
|
+
*/
|
|
1121
2000
|
restoreRangeStateFromSerialized(serializedState) {
|
|
1122
|
-
const restoredRange = parseDatetimePickerSerializedRange(serializedState);
|
|
2001
|
+
const restoredRange = parseDatetimePickerSerializedRange(serializedState, this.mode, this.referenceDate);
|
|
1123
2002
|
if (restoredRange === null) {
|
|
1124
2003
|
this.restoreSelection(null);
|
|
1125
2004
|
return;
|
|
@@ -1129,7 +2008,11 @@ const DatetimePicker = class {
|
|
|
1129
2008
|
this.rangeEnd = end;
|
|
1130
2009
|
this.restoreSelection(end);
|
|
1131
2010
|
}
|
|
1132
|
-
/**
|
|
2011
|
+
/**
|
|
2012
|
+
* Restaura estado de seleção única a partir do valor serializado do formulário.
|
|
2013
|
+
*
|
|
2014
|
+
* @param serializedState string — valor serializado vindo do formulário.
|
|
2015
|
+
*/
|
|
1133
2016
|
restoreSingleStateFromSerialized(serializedState) {
|
|
1134
2017
|
const restoredValue = parseDatetimePickerSerializedValue(serializedState, this.mode, this.referenceDate);
|
|
1135
2018
|
if (restoredValue !== null && this.isDateDisabled(restoredValue)) {
|
|
@@ -1138,17 +2021,27 @@ const DatetimePicker = class {
|
|
|
1138
2021
|
}
|
|
1139
2022
|
this.restoreSelection(restoredValue);
|
|
1140
2023
|
}
|
|
1141
|
-
/**
|
|
2024
|
+
/**
|
|
2025
|
+
* Converte entradas aceitas por métodos públicos em `Date | null`.
|
|
2026
|
+
*
|
|
2027
|
+
* @param value Date | string | null — valor bruto recebido pelo método público.
|
|
2028
|
+
* @param mode DatetimePickerMode — modo atual para parsing de strings.
|
|
2029
|
+
* @returns Date | null — representação normalizada ou `null` se inválida.
|
|
2030
|
+
*/
|
|
1142
2031
|
parseMethodValue(value, mode) {
|
|
1143
2032
|
if (value === null) {
|
|
1144
2033
|
return null;
|
|
1145
2034
|
}
|
|
1146
2035
|
if (value instanceof Date) {
|
|
1147
|
-
return Number.isNaN(value.getTime()) ? null :
|
|
2036
|
+
return Number.isNaN(value.getTime()) ? null : isValid.toDateExports.toDate(value);
|
|
1148
2037
|
}
|
|
1149
2038
|
return parseDatetimePickerSerializedValue(value, mode, this.referenceDate);
|
|
1150
2039
|
}
|
|
1151
|
-
/**
|
|
2040
|
+
/**
|
|
2041
|
+
* Aplica a ponte serializada usando os mesmos parsers já usados por restore de formulário.
|
|
2042
|
+
*
|
|
2043
|
+
* @param serializedValue string — valor serializado a ser restaurado.
|
|
2044
|
+
*/
|
|
1152
2045
|
restoreSerializedValue(serializedValue) {
|
|
1153
2046
|
if (this.isRangeRestoreMode()) {
|
|
1154
2047
|
this.restoreRangeStateFromSerialized(serializedValue);
|
|
@@ -1167,9 +2060,13 @@ const DatetimePicker = class {
|
|
|
1167
2060
|
this.valueAsDate = nextValueAsDate;
|
|
1168
2061
|
this.syncingCanonicalValues = false;
|
|
1169
2062
|
}
|
|
1170
|
-
/**
|
|
2063
|
+
/**
|
|
2064
|
+
* Retorna o mesmo valor que será submetido pelo ElementInternals.
|
|
2065
|
+
*
|
|
2066
|
+
* @returns string — valor serializado pronto para `setFormValue`.
|
|
2067
|
+
*/
|
|
1171
2068
|
getSerializedValue() {
|
|
1172
|
-
const zero = (date) => (date === null ? null :
|
|
2069
|
+
const zero = (date) => (date === null ? null : isValid.setExports.set(date, { seconds: 0, milliseconds: 0 }));
|
|
1173
2070
|
return (serializeDatetimePickerFormValue(this.value === null ? null : zero(this.value), {
|
|
1174
2071
|
mode: this.mode,
|
|
1175
2072
|
selectionMode: this.selectionMode,
|
|
@@ -1181,11 +2078,24 @@ const DatetimePicker = class {
|
|
|
1181
2078
|
sameDate(left, right) {
|
|
1182
2079
|
return left === right || (left !== null && right !== null && left.getTime() === right.getTime());
|
|
1183
2080
|
}
|
|
1184
|
-
/**
|
|
2081
|
+
/**
|
|
2082
|
+
* Busca o input nativo interno para ações imperativas de foco.
|
|
2083
|
+
*
|
|
2084
|
+
* @returns HTMLElement | undefined — elemento `input` nativo interno, quando disponível.
|
|
2085
|
+
*/
|
|
1185
2086
|
getNativeInputElement() {
|
|
1186
|
-
return
|
|
2087
|
+
return this.el.shadowRoot
|
|
2088
|
+
?.querySelector('br-datetime-input')
|
|
2089
|
+
?.shadowRoot?.querySelector('br-input')
|
|
2090
|
+
?.shadowRoot?.querySelector('input');
|
|
1187
2091
|
}
|
|
1188
|
-
/**
|
|
2092
|
+
/**
|
|
2093
|
+
* Atualiza estado interno, FormData e validação com uma única chamada.
|
|
2094
|
+
*
|
|
2095
|
+
* @param nextValue Date | null — próximo valor a ser aplicado no componente.
|
|
2096
|
+
* @param shouldEmitPublicEvent boolean — controla emissão de eventos públicos.
|
|
2097
|
+
* @returns void
|
|
2098
|
+
*/
|
|
1189
2099
|
setComponentValue(nextValue, shouldEmitPublicEvent = true) {
|
|
1190
2100
|
this.value = this.cloneDate(nextValue);
|
|
1191
2101
|
this.syncCanonicalValues();
|
|
@@ -1197,13 +2107,13 @@ const DatetimePicker = class {
|
|
|
1197
2107
|
}
|
|
1198
2108
|
/** Propaga o estado atual consolidado para consumidores externos do componente raiz. */
|
|
1199
2109
|
emitDateStateChange() {
|
|
1200
|
-
const range = this.selectionMode === 'range'
|
|
2110
|
+
const range = this.selectionMode === 'range'
|
|
1201
2111
|
? {
|
|
1202
2112
|
start: this.cloneDate(this.rangeStart),
|
|
1203
2113
|
end: this.cloneDate(this.rangeEnd),
|
|
1204
2114
|
}
|
|
1205
2115
|
: undefined;
|
|
1206
|
-
const rangeDates = range !== undefined && range.start !== null && range.end !== null
|
|
2116
|
+
const rangeDates = this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATE && range !== undefined && range.start !== null && range.end !== null
|
|
1207
2117
|
? this.buildRangeDatesState(range.start, range.end)
|
|
1208
2118
|
: undefined;
|
|
1209
2119
|
this.dateStateChange.emit({
|
|
@@ -1212,41 +2122,152 @@ const DatetimePicker = class {
|
|
|
1212
2122
|
range,
|
|
1213
2123
|
rangeDates,
|
|
1214
2124
|
});
|
|
1215
|
-
|
|
1216
|
-
this.rangeValue = range;
|
|
2125
|
+
this.emitCanonicalChange(range);
|
|
1217
2126
|
this.valueChange.emit(this.cloneDate(this.value));
|
|
1218
2127
|
event.dispatchNativeFormEvent(this.el, 'input');
|
|
1219
2128
|
event.dispatchNativeFormEvent(this.el, 'change');
|
|
1220
2129
|
}
|
|
1221
|
-
/**
|
|
2130
|
+
/** Emite o contrato público sem expor detalhes incidentais do estado interno. */
|
|
2131
|
+
emitCanonicalChange(rangeSnapshot) {
|
|
2132
|
+
const serializedValue = this.getSerializedValue();
|
|
2133
|
+
if (this.selectionMode === 'range') {
|
|
2134
|
+
const range = rangeSnapshot ?? {
|
|
2135
|
+
start: this.rangeStart,
|
|
2136
|
+
end: this.rangeEnd,
|
|
2137
|
+
};
|
|
2138
|
+
const rangeValue = {
|
|
2139
|
+
start: this.cloneDate(range.start),
|
|
2140
|
+
end: this.cloneDate(range.end),
|
|
2141
|
+
};
|
|
2142
|
+
this.syncingRangeValueInternally = true;
|
|
2143
|
+
this.rangeValue = rangeValue;
|
|
2144
|
+
this.syncingRangeValueInternally = false;
|
|
2145
|
+
const value = {
|
|
2146
|
+
start: this.serializeRangeBoundary(rangeValue.start),
|
|
2147
|
+
end: this.serializeRangeBoundary(rangeValue.end),
|
|
2148
|
+
};
|
|
2149
|
+
const detail = {
|
|
2150
|
+
selectionMode: 'range',
|
|
2151
|
+
value,
|
|
2152
|
+
serializedValue,
|
|
2153
|
+
complete: value.start !== null && value.end !== null,
|
|
2154
|
+
};
|
|
2155
|
+
if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATE) {
|
|
2156
|
+
this.brDatetimePickerChange.emit({ mode: 'date', ...detail });
|
|
2157
|
+
}
|
|
2158
|
+
else if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.TIME) {
|
|
2159
|
+
this.brDatetimePickerChange.emit({ mode: 'time', ...detail });
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
this.brDatetimePickerChange.emit({ mode: 'datetime', ...detail });
|
|
2163
|
+
}
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.TIME) {
|
|
2167
|
+
this.brDatetimePickerChange.emit({
|
|
2168
|
+
mode: 'time',
|
|
2169
|
+
selectionMode: 'single',
|
|
2170
|
+
value: this.value === null
|
|
2171
|
+
? null
|
|
2172
|
+
: {
|
|
2173
|
+
hours: this.value.getHours(),
|
|
2174
|
+
minutes: this.value.getMinutes(),
|
|
2175
|
+
},
|
|
2176
|
+
serializedValue,
|
|
2177
|
+
});
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATE) {
|
|
2181
|
+
this.brDatetimePickerChange.emit({
|
|
2182
|
+
mode: 'date',
|
|
2183
|
+
selectionMode: 'single',
|
|
2184
|
+
value: this.cloneDate(this.value),
|
|
2185
|
+
serializedValue,
|
|
2186
|
+
});
|
|
2187
|
+
return;
|
|
2188
|
+
}
|
|
2189
|
+
this.brDatetimePickerChange.emit({
|
|
2190
|
+
mode: 'datetime',
|
|
2191
|
+
selectionMode: 'single',
|
|
2192
|
+
value: this.cloneDate(this.value),
|
|
2193
|
+
serializedValue,
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Serializa uma data civil sem conversão para UTC ou mudança de dia.
|
|
2198
|
+
*
|
|
2199
|
+
* @param value Date — data a serializar (somente componente civil).
|
|
2200
|
+
* @returns string — formato `YYYY-MM-DD`.
|
|
2201
|
+
*/
|
|
2202
|
+
serializeDateOnly(value) {
|
|
2203
|
+
const year = String(value.getFullYear()).padStart(4, '0');
|
|
2204
|
+
const month = String(value.getMonth() + 1).padStart(2, '0');
|
|
2205
|
+
const day = String(value.getDate()).padStart(2, '0');
|
|
2206
|
+
return `${year}-${month}-${day}`;
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Serializa um limite do intervalo conforme o modo sem expor objetos Date no payload.
|
|
2210
|
+
*
|
|
2211
|
+
* @param value Date | null — limite a serializar.
|
|
2212
|
+
* @returns string | null — representação serializada do limite ou `null`.
|
|
2213
|
+
*/
|
|
2214
|
+
serializeRangeBoundary(value) {
|
|
2215
|
+
if (value === null)
|
|
2216
|
+
return null;
|
|
2217
|
+
if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATE)
|
|
2218
|
+
return this.serializeDateOnly(value);
|
|
2219
|
+
if (this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.TIME) {
|
|
2220
|
+
return `${String(value.getHours()).padStart(2, '0')}:${String(value.getMinutes()).padStart(2, '0')}`;
|
|
2221
|
+
}
|
|
2222
|
+
return serializeDatetimePickerFormValue(value, {
|
|
2223
|
+
mode: datetimePickerConstants.DATETIME_PICKER_MODE.DATETIME,
|
|
2224
|
+
selectionMode: 'single',
|
|
2225
|
+
rangeStart: null,
|
|
2226
|
+
rangeEnd: null});
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Expande o intervalo completo e marca quais dias estão desabilitados.
|
|
2230
|
+
*
|
|
2231
|
+
* @param start Date — início do intervalo.
|
|
2232
|
+
* @param end Date — fim do intervalo.
|
|
2233
|
+
* @returns Array<{date: Date, disabled: boolean}> — lista diária com flags.
|
|
2234
|
+
*/
|
|
1222
2235
|
buildRangeDatesState(start, end) {
|
|
1223
2236
|
const intervalStart = start.getTime() <= end.getTime() ? start : end;
|
|
1224
2237
|
const intervalEnd = start.getTime() <= end.getTime() ? end : start;
|
|
1225
|
-
return
|
|
2238
|
+
return isValid.eachDayOfIntervalExports.eachDayOfInterval({
|
|
1226
2239
|
start: intervalStart,
|
|
1227
2240
|
end: intervalEnd,
|
|
1228
2241
|
}).map((date) => ({
|
|
1229
|
-
date:
|
|
2242
|
+
date: isValid.toDateExports.toDate(date),
|
|
1230
2243
|
disabled: this.isDateDisabled(date),
|
|
1231
2244
|
}));
|
|
1232
2245
|
}
|
|
1233
|
-
/**
|
|
2246
|
+
/**
|
|
2247
|
+
* Restaura seleção e data de referência a partir de uma data já validada.
|
|
2248
|
+
*
|
|
2249
|
+
* @param nextValue Date | null — valor validado a ser restaurado como seleção.
|
|
2250
|
+
*/
|
|
1234
2251
|
restoreSelection(nextValue) {
|
|
2252
|
+
this.inputValidationMessage = '';
|
|
1235
2253
|
this.value = this.cloneDate(nextValue);
|
|
1236
2254
|
if (this.selectionMode === 'single') {
|
|
1237
2255
|
this.rangeStart = null;
|
|
1238
2256
|
this.rangeEnd = null;
|
|
1239
2257
|
}
|
|
1240
|
-
this.referenceDate = nextValue === null ?
|
|
2258
|
+
this.referenceDate = nextValue === null ? isValid.toDateExports.toDate(new Date()) : isValid.toDateExports.toDate(nextValue);
|
|
1241
2259
|
this.syncCanonicalValues();
|
|
1242
2260
|
this.updateFormInternals();
|
|
1243
2261
|
}
|
|
1244
|
-
/**
|
|
2262
|
+
/**
|
|
2263
|
+
* Atualiza o estado local de intervalo a partir do evento do calendário.
|
|
2264
|
+
*
|
|
2265
|
+
* @param nextRange DatetimePickerDateRange | undefined — novo snapshot do intervalo.
|
|
2266
|
+
*/
|
|
1245
2267
|
setRangeState(nextRange) {
|
|
1246
2268
|
this.rangeStart = this.cloneDate(nextRange?.start ?? null);
|
|
1247
2269
|
this.rangeEnd = this.cloneDate(nextRange?.end ?? null);
|
|
1248
2270
|
}
|
|
1249
|
-
/** Mantém ElementInternals sincronizado com estado e regras do componente. */
|
|
1250
2271
|
updateFormInternals() {
|
|
1251
2272
|
this.syncFormValue();
|
|
1252
2273
|
this.syncFormValidity();
|
|
@@ -1254,7 +2275,7 @@ const DatetimePicker = class {
|
|
|
1254
2275
|
/** Atualiza o valor submetido no FormData do form-associated custom element. */
|
|
1255
2276
|
syncFormValue() {
|
|
1256
2277
|
try {
|
|
1257
|
-
const zero = (d) => (d === null ? null :
|
|
2278
|
+
const zero = (d) => (d === null ? null : isValid.setExports.set(d, { seconds: 0, milliseconds: 0 }));
|
|
1258
2279
|
const nextValue = this.isDisabled()
|
|
1259
2280
|
? null
|
|
1260
2281
|
: serializeDatetimePickerFormValue(this.value === null ? null : zero(this.value), {
|
|
@@ -1266,9 +2287,20 @@ const DatetimePicker = class {
|
|
|
1266
2287
|
});
|
|
1267
2288
|
this.elementInternals.setFormValue(nextValue);
|
|
1268
2289
|
}
|
|
1269
|
-
catch {
|
|
1270
|
-
|
|
1271
|
-
|
|
2290
|
+
catch { }
|
|
2291
|
+
}
|
|
2292
|
+
/** Deriva o erro de ordenação sem modificar os limites escolhidos. */
|
|
2293
|
+
getRangeOrderValidationMessage() {
|
|
2294
|
+
const invalidRange = this.selectionMode === 'range' &&
|
|
2295
|
+
this.mode !== datetimePickerConstants.DATETIME_PICKER_MODE.TIME &&
|
|
2296
|
+
this.rangeStart !== null &&
|
|
2297
|
+
this.rangeEnd !== null &&
|
|
2298
|
+
this.rangeStart.getTime() > this.rangeEnd.getTime();
|
|
2299
|
+
if (!invalidRange)
|
|
2300
|
+
return '';
|
|
2301
|
+
return this.mode === datetimePickerConstants.DATETIME_PICKER_MODE.DATETIME
|
|
2302
|
+
? datetimePickerConstants.DATETIME_RANGE_ORDER_MESSAGE
|
|
2303
|
+
: 'A data inicial deve anteceder a data final.';
|
|
1272
2304
|
}
|
|
1273
2305
|
/** Espelha a regra de required no mecanismo nativo de validade. */
|
|
1274
2306
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: consolida flags nativos relacionados sem esconder a precedência das mensagens.
|
|
@@ -1278,61 +2310,50 @@ const DatetimePicker = class {
|
|
|
1278
2310
|
required: this.required,
|
|
1279
2311
|
disabled: this.isDisabled(),
|
|
1280
2312
|
value: this.value,
|
|
1281
|
-
mode: this.mode,
|
|
1282
2313
|
selectionMode: this.selectionMode,
|
|
1283
2314
|
rangeStart: this.rangeStart,
|
|
1284
2315
|
rangeEnd: this.rangeEnd});
|
|
1285
|
-
const min = this.parseConstraintValue(this.min
|
|
1286
|
-
const max = this.parseConstraintValue(this.max
|
|
2316
|
+
const min = this.parseConstraintValue(this.min);
|
|
2317
|
+
const max = this.parseConstraintValue(this.max);
|
|
1287
2318
|
const values = this.selectionMode === 'range' ? [this.rangeStart, this.rangeEnd] : [this.value];
|
|
1288
2319
|
const rangeUnderflow = min !== null && values.some((value) => value !== null && value.getTime() < min.getTime());
|
|
1289
2320
|
const rangeOverflow = max !== null && values.some((value) => value !== null && value.getTime() > max.getTime());
|
|
1290
|
-
const
|
|
1291
|
-
this.rangeStart !== null &&
|
|
1292
|
-
this.rangeEnd !== null &&
|
|
1293
|
-
this.rangeStart.getTime() > this.rangeEnd.getTime();
|
|
2321
|
+
const rangeOrderMessage = this.getRangeOrderValidationMessage();
|
|
1294
2322
|
const flags = {
|
|
1295
|
-
customError: this.customValidationMessage !== '' ||
|
|
2323
|
+
customError: this.customValidationMessage !== '' ||
|
|
2324
|
+
this.inputValidationMessage !== '' ||
|
|
2325
|
+
Boolean(this.validatorMessage) ||
|
|
2326
|
+
rangeOrderMessage !== '' ||
|
|
2327
|
+
this.inputValidationPending,
|
|
1296
2328
|
rangeOverflow,
|
|
1297
2329
|
rangeUnderflow,
|
|
1298
2330
|
valueMissing: missing,
|
|
1299
2331
|
};
|
|
1300
2332
|
const message = this.customValidationMessage ||
|
|
2333
|
+
this.inputValidationMessage ||
|
|
1301
2334
|
this.validatorMessage ||
|
|
1302
2335
|
(missing
|
|
1303
2336
|
? 'Preencha este campo.'
|
|
1304
|
-
:
|
|
1305
|
-
?
|
|
2337
|
+
: rangeOrderMessage
|
|
2338
|
+
? rangeOrderMessage
|
|
1306
2339
|
: rangeUnderflow
|
|
1307
2340
|
? 'Selecione uma data igual ou posterior ao mínimo.'
|
|
1308
2341
|
: rangeOverflow
|
|
1309
2342
|
? 'Selecione uma data igual ou anterior ao máximo.'
|
|
1310
2343
|
: '');
|
|
1311
|
-
validator.setFormValidity(this.elementInternals, flags, message, this.getNativeInputElement());
|
|
1312
|
-
}
|
|
1313
|
-
catch {
|
|
1314
|
-
// Ambientes sem ElementInternals completo não devem falhar.
|
|
2344
|
+
validator.setFormValidity(this.elementInternals, flags, message, this.getNativeInputElement() ?? undefined);
|
|
1315
2345
|
}
|
|
2346
|
+
catch { }
|
|
1316
2347
|
}
|
|
1317
|
-
parseConstraintValue(value
|
|
1318
|
-
|
|
1319
|
-
return null;
|
|
1320
|
-
if (!(value instanceof Date) && typeof value !== 'string') {
|
|
1321
|
-
propWarning.reportInvalidPropValue(this.el, propertyName, value, 'Informe uma data válida como Date ou string compatível com o modo atual.', 'Aplicando fallback null (sem limite).');
|
|
1322
|
-
return null;
|
|
1323
|
-
}
|
|
1324
|
-
const parsedValue = this.parseMethodValue(value, this.mode);
|
|
1325
|
-
if (parsedValue !== null)
|
|
1326
|
-
return parsedValue;
|
|
1327
|
-
propWarning.reportInvalidPropValue(this.el, propertyName, value, 'Informe uma data válida como Date ou string compatível com o modo atual.', 'Aplicando fallback null (sem limite).');
|
|
1328
|
-
return null;
|
|
2348
|
+
parseConstraintValue(value) {
|
|
2349
|
+
return value === null ? null : this.parseMethodValue(value, this.mode);
|
|
1329
2350
|
}
|
|
1330
2351
|
isDisabled() {
|
|
1331
2352
|
return validator.isFormControlDisabled(this.disabled, this.formDisabled);
|
|
1332
2353
|
}
|
|
1333
2354
|
/** Duplica datas para evitar compartilhamento de referência mutável. */
|
|
1334
2355
|
cloneDate(value) {
|
|
1335
|
-
return value === null ? null :
|
|
2356
|
+
return value === null ? null : isValid.toDateExports.toDate(value);
|
|
1336
2357
|
}
|
|
1337
2358
|
/**
|
|
1338
2359
|
* Verifica se a data pertence ao conjunto de dias bloqueados.
|
|
@@ -1341,7 +2362,7 @@ const DatetimePicker = class {
|
|
|
1341
2362
|
* @returns `true` quando o dia estiver desabilitado.
|
|
1342
2363
|
*/
|
|
1343
2364
|
isDateDisabled(date) {
|
|
1344
|
-
return this.normalizedDisabledDates.some((disabledDate) =>
|
|
2365
|
+
return this.normalizedDisabledDates.some((disabledDate) => isValid.isSameDayExports.isSameDay(disabledDate, date));
|
|
1345
2366
|
}
|
|
1346
2367
|
/**
|
|
1347
2368
|
* Corrige valores inválidos para o modo padrão, preservando a consistência do estado refletido.
|
|
@@ -1349,7 +2370,7 @@ const DatetimePicker = class {
|
|
|
1349
2370
|
* @param value - Modo informado pelo consumidor do componente.
|
|
1350
2371
|
*/
|
|
1351
2372
|
ensureValidMode(value) {
|
|
1352
|
-
const normalizedMode =
|
|
2373
|
+
const normalizedMode = normalizeDatetimePickerMode(value);
|
|
1353
2374
|
if (normalizedMode !== value) {
|
|
1354
2375
|
this.mode = normalizedMode;
|
|
1355
2376
|
}
|
|
@@ -1383,24 +2404,35 @@ const DatetimePicker = class {
|
|
|
1383
2404
|
}
|
|
1384
2405
|
/** Renderiza o campo de entrada responsável por abrir e sincronizar o picker. */
|
|
1385
2406
|
renderInputField() {
|
|
1386
|
-
return (index.h("br-datetime-input", {
|
|
1387
|
-
this.datetimeInputElement = element;
|
|
1388
|
-
}, referenceDate: this.referenceDate, value: this.value, selectionMode: this.selectionMode, rangeStart: this.rangeStart, rangeEnd: this.rangeEnd, placeholder: this.placeholder, mode: this.mode, disabled: this.isDisabled(), onDateStateChange: this.handleDateStateChange, onTogglePicker: this.handleTogglePicker, exportparts: "container: input-container, input: input-field, icon: input-icon" }));
|
|
2407
|
+
return (index.h("br-datetime-input", { referenceDate: this.referenceDate, value: this.value, selectionMode: this.selectionMode, rangeStart: this.rangeStart, rangeEnd: this.rangeEnd, placeholder: this.placeholder, mode: this.mode, disabled: this.isDisabled(), onDateStateChange: this.handleDateStateChange, onInputValidationChange: this.handleInputValidationChange, onTogglePicker: this.handleTogglePicker, exportparts: "container: input-container, input: input-field, icon: input-icon" }));
|
|
1389
2408
|
}
|
|
1390
2409
|
/** Renderiza apenas o seletor de data. */
|
|
1391
2410
|
renderDatePicker() {
|
|
1392
|
-
const effectiveSelectionMode = this.
|
|
2411
|
+
const effectiveSelectionMode = this.selectionMode;
|
|
1393
2412
|
return (index.h("br-date-picker", { ...this.getSharedDateStateBindings(), selectionMode: effectiveSelectionMode, weekStartsOn: this.weekStartsOn, locale: this.locale, disabled: this.isDisabled(), disabledDates: this.normalizedDisabledDates, fixedRowCount: this.fixedRowCount }));
|
|
1394
2413
|
}
|
|
1395
|
-
/** Renderiza
|
|
1396
|
-
renderTimePicker() {
|
|
1397
|
-
|
|
2414
|
+
/** Renderiza um seletor de hora simples ou um limite do intervalo. */
|
|
2415
|
+
renderTimePicker(boundary) {
|
|
2416
|
+
const rangeValue = boundary === 'start' ? this.rangeStart : this.rangeEnd;
|
|
2417
|
+
const referenceDate = this.cloneDate(rangeValue ?? this.referenceDate);
|
|
2418
|
+
const selectedValue = this.cloneDate(rangeValue);
|
|
2419
|
+
const timerKey = boundary === undefined ? 'single' : `${boundary}-${rangeValue?.getTime() ?? `empty-${referenceDate.getTime()}`}`;
|
|
2420
|
+
const handler = boundary === 'start'
|
|
2421
|
+
? this.handleRangeStartTimeStateChange
|
|
2422
|
+
: boundary === 'end'
|
|
2423
|
+
? this.handleRangeEndTimeStateChange
|
|
2424
|
+
: this.handleDateStateChange;
|
|
2425
|
+
return (index.h("br-time-picker", { key: timerKey, referenceDate: referenceDate, value: boundary === undefined ? this.cloneDate(this.value) : selectedValue, onDateStateChange: handler, disabled: this.isDisabled() }));
|
|
2426
|
+
}
|
|
2427
|
+
/** Renderiza os horários inicial e final lado a lado no modo range. */
|
|
2428
|
+
renderRangeTimePickers() {
|
|
2429
|
+
return (index.h("div", { class: "range-time-pickers", role: "group", "aria-label": "Intervalo de hor\u00E1rios" }, index.h("div", { class: "range-time-picker" }, index.h("span", { class: "range-time-label" }, "In\u00EDcio"), this.renderTimePicker('start')), index.h("span", { class: "range-time-separator", "aria-hidden": "true" }, "-"), index.h("div", { class: "range-time-picker" }, index.h("span", { class: "range-time-label" }, "Fim"), this.renderTimePicker('end'))));
|
|
1398
2430
|
}
|
|
1399
2431
|
/**
|
|
1400
2432
|
* Renderiza a combinação de data e horário no modo `datetime`.
|
|
1401
2433
|
*/
|
|
1402
2434
|
renderDateTimePicker() {
|
|
1403
|
-
return (index.h(index.Fragment, null, this.renderDatePicker(), this.renderDivider(), this.renderTimePicker()));
|
|
2435
|
+
return (index.h(index.Fragment, null, this.renderDatePicker(), this.renderDivider(), this.selectionMode === 'range' ? this.renderRangeTimePickers() : this.renderTimePicker()));
|
|
1404
2436
|
}
|
|
1405
2437
|
/** Renderiza o separador visual entre data e hora no modo combinado. */
|
|
1406
2438
|
renderDivider() {
|
|
@@ -1420,7 +2452,11 @@ const DatetimePicker = class {
|
|
|
1420
2452
|
* Renderização principal do componente.
|
|
1421
2453
|
*/
|
|
1422
2454
|
render() {
|
|
1423
|
-
|
|
2455
|
+
const validationMessage = this.customValidationMessage ||
|
|
2456
|
+
this.inputValidationMessage ||
|
|
2457
|
+
this.validatorMessage ||
|
|
2458
|
+
(this.inputValidationPending ? '' : this.getRangeOrderValidationMessage());
|
|
2459
|
+
return (index.h(index.Host, { key: '0640504e844713daaf31d7c8a34b96fb48bcf499', onKeyDown: this.handlePickerKeydown, "aria-busy": this.isValidating ? 'true' : null, "aria-describedby": this.hasFeedbackSlot || validationMessage ? this.feedbackId : null, "aria-errormessage": validationMessage || this.hasFeedbackSlot ? this.feedbackId : null }, index.h("div", { key: '7512ed8a4437a99d6d0702351af659bfa1d270b0', class: this.getCssClassMap(), part: "container" }, this.renderInputField(), this.renderPickerContent()), index.h("div", { key: '80a8d3a717ceacc4dfb6bd0ac4850b61e3b2d311', id: this.feedbackId, part: "feedback", hidden: !this.hasFeedbackSlot && !validationMessage }, index.h("slot", { key: '41a8e4fad5edaa3729d63b7ee469f248a53129a1', name: "feedback", onSlotchange: (event) => (this.hasFeedbackSlot = slot.hasAssignedSlotContent(event.currentTarget)) }), !this.hasFeedbackSlot && validationMessage ? (index.h("br-message", { state: "danger", "attr:message": validationMessage, feedback: true })) : null)));
|
|
1424
2460
|
}
|
|
1425
2461
|
static get formAssociated() { return true; }
|
|
1426
2462
|
get el() { return index.getElement(this); }
|