@six-group/ui-library 3.0.0-beta.1.7 → 3.0.0-beta.1.8
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/dist/cjs/{event-listeners-4a8d66d5.js → event-listeners-74715e62.js} +38 -38
- package/dist/cjs/{execution-control-3bc9c7c4.js → execution-control-46f388e0.js} +35 -35
- package/dist/cjs/{focus-visible-b08d956f.js → focus-visible-0b352c74.js} +40 -40
- package/dist/cjs/{form-control-9e4dffd1.js → form-control-866bbece.js} +25 -25
- package/dist/cjs/{modal-a9679ddf.js → modal-48d42228.js} +41 -41
- package/dist/cjs/{popover-e3781f5a.js → popover-1d2a037c.js} +95 -95
- package/dist/cjs/{scroll-5b8676ba.js → scroll-76e6f5d7.js} +57 -57
- package/dist/cjs/set-attributes_2.cjs.entry.js +57 -57
- package/dist/cjs/six-alert.cjs.entry.js +131 -131
- package/dist/cjs/six-avatar.cjs.entry.js +28 -28
- package/dist/cjs/six-badge.cjs.entry.js +26 -26
- package/dist/cjs/six-button.cjs.entry.js +97 -97
- package/dist/cjs/six-card.cjs.entry.js +8 -8
- package/dist/cjs/six-checkbox.cjs.entry.js +152 -152
- package/dist/cjs/six-datepicker.cjs.entry.js +1189 -1189
- package/dist/cjs/six-details.cjs.entry.js +139 -139
- package/dist/cjs/six-dialog.cjs.entry.js +152 -152
- package/dist/cjs/six-drawer.cjs.entry.js +174 -174
- package/dist/cjs/six-dropdown_3.cjs.entry.js +728 -728
- package/dist/cjs/six-error-page.cjs.entry.js +94 -94
- package/dist/cjs/six-file-list-item.cjs.entry.js +38 -38
- package/dist/cjs/six-file-list.cjs.entry.js +8 -8
- package/dist/cjs/six-file-upload.cjs.entry.js +96 -96
- package/dist/cjs/six-footer.cjs.entry.js +8 -8
- package/dist/cjs/six-form.cjs.entry.js +219 -219
- package/dist/cjs/six-group-label.cjs.entry.js +46 -46
- package/dist/cjs/six-header.cjs.entry.js +149 -149
- package/dist/cjs/six-icon-button.cjs.entry.js +33 -33
- package/dist/cjs/six-icon.cjs.entry.js +24 -24
- package/dist/cjs/six-input.cjs.entry.js +230 -230
- package/dist/cjs/six-item-picker.cjs.entry.js +361 -361
- package/dist/cjs/six-language-switcher.cjs.entry.js +52 -52
- package/dist/cjs/six-layout-grid.cjs.entry.js +19 -19
- package/dist/cjs/six-main-container.cjs.entry.js +11 -11
- package/dist/cjs/six-menu-divider.cjs.entry.js +8 -8
- package/dist/cjs/six-menu-label.cjs.entry.js +8 -8
- package/dist/cjs/six-picto.cjs.entry.js +15 -15
- package/dist/cjs/six-progress-bar.cjs.entry.js +17 -17
- package/dist/cjs/six-progress-ring.cjs.entry.js +31 -31
- package/dist/cjs/six-radio.cjs.entry.js +121 -121
- package/dist/cjs/six-range.cjs.entry.js +198 -198
- package/dist/cjs/six-root.cjs.entry.js +34 -34
- package/dist/cjs/six-search-field.cjs.entry.js +43 -43
- package/dist/cjs/six-select.cjs.entry.js +447 -447
- package/dist/cjs/six-sidebar-item-group.cjs.entry.js +42 -42
- package/dist/cjs/six-sidebar-item.cjs.entry.js +18 -18
- package/dist/cjs/six-sidebar.cjs.entry.js +171 -171
- package/dist/cjs/six-spinner.cjs.entry.js +16 -16
- package/dist/cjs/six-switch.cjs.entry.js +100 -100
- package/dist/cjs/six-tab-group.cjs.entry.js +226 -226
- package/dist/cjs/six-tab-panel.cjs.entry.js +17 -17
- package/dist/cjs/six-tab.cjs.entry.js +42 -42
- package/dist/cjs/six-table-cell_4.cjs.entry.js +70 -70
- package/dist/cjs/six-table.cjs.entry.js +145 -145
- package/dist/cjs/six-tag.cjs.entry.js +40 -40
- package/dist/cjs/six-textarea.cjs.entry.js +211 -211
- package/dist/cjs/six-tile.cjs.entry.js +89 -89
- package/dist/cjs/six-timepicker.cjs.entry.js +489 -489
- package/dist/cjs/{six-timepicker.types-c58cc88b.js → six-timepicker.types-c19ebff3.js} +43 -43
- package/dist/cjs/six-tooltip.cjs.entry.js +172 -172
- package/dist/cjs/{slot-8abe833c.js → slot-ad537f24.js} +42 -42
- package/dist/cjs/{types-65e5c95b.js → types-581e8ff0.js} +12 -12
- package/dist/cjs/{types-0c28e484.js → types-64878648.js} +12 -12
- package/dist/collection/components/six-alert/six-alert.js +366 -366
- package/dist/collection/components/six-avatar/six-avatar.js +131 -131
- package/dist/collection/components/six-badge/six-badge.js +101 -101
- package/dist/collection/components/six-button/six-button.js +466 -466
- package/dist/collection/components/six-card/six-card.js +21 -21
- package/dist/collection/components/six-checkbox/six-checkbox.js +550 -550
- package/dist/collection/components/six-datepicker/components/day-selection.js +13 -13
- package/dist/collection/components/six-datepicker/components/month-selection.js +12 -12
- package/dist/collection/components/six-datepicker/components/year-selection.js +10 -10
- package/dist/collection/components/six-datepicker/six-date-formats.js +23 -23
- package/dist/collection/components/six-datepicker/six-datepicker.js +1343 -1343
- package/dist/collection/components/six-datepicker/test/six-datepicker.test-helpers.js +16 -16
- package/dist/collection/components/six-details/six-details.js +432 -432
- package/dist/collection/components/six-dialog/six-dialog.js +401 -401
- package/dist/collection/components/six-drawer/six-drawer.js +458 -458
- package/dist/collection/components/six-dropdown/six-dropdown.js +939 -939
- package/dist/collection/components/six-error-page/six-error-page.js +199 -199
- package/dist/collection/components/six-file-list/six-file-list.js +20 -20
- package/dist/collection/components/six-file-list-item/six-file-list-item.js +203 -203
- package/dist/collection/components/six-file-upload/six-file-upload.js +272 -272
- package/dist/collection/components/six-footer/six-footer.js +21 -21
- package/dist/collection/components/six-form/six-form.js +408 -408
- package/dist/collection/components/six-group-label/six-group-label.js +166 -166
- package/dist/collection/components/six-header/six-header.js +420 -420
- package/dist/collection/components/six-icon/six-icon.js +77 -77
- package/dist/collection/components/six-icon-button/six-icon-button.js +142 -142
- package/dist/collection/components/six-input/six-input.js +1141 -1141
- package/dist/collection/components/six-item-picker/six-item-picker.js +688 -688
- package/dist/collection/components/six-item-picker/types.js +13 -13
- package/dist/collection/components/six-language-switcher/six-language-switcher.js +128 -128
- package/dist/collection/components/six-layout-grid/six-layout-grid.js +52 -52
- package/dist/collection/components/six-main-container/six-main-container.js +53 -53
- package/dist/collection/components/six-menu/six-menu.js +406 -406
- package/dist/collection/components/six-menu-divider/six-menu-divider.js +22 -22
- package/dist/collection/components/six-menu-item/six-menu-item.js +177 -177
- package/dist/collection/components/six-menu-label/six-menu-label.js +25 -25
- package/dist/collection/components/six-picto/six-picto.js +50 -50
- package/dist/collection/components/six-progress-bar/six-progress-bar.js +77 -77
- package/dist/collection/components/six-progress-ring/six-progress-ring.js +111 -111
- package/dist/collection/components/six-radio/six-radio.js +410 -410
- package/dist/collection/components/six-range/six-range.js +620 -620
- package/dist/collection/components/six-root/six-root.js +167 -167
- package/dist/collection/components/six-search-field/six-search-field.js +171 -171
- package/dist/collection/components/six-select/six-select.js +1105 -1105
- package/dist/collection/components/six-sidebar/six-sidebar.js +455 -455
- package/dist/collection/components/six-sidebar-item/six-sidebar-item.js +89 -89
- package/dist/collection/components/six-sidebar-item-group/six-sidebar-item-group.js +158 -158
- package/dist/collection/components/six-spinner/six-spinner.js +55 -55
- package/dist/collection/components/six-stage-indicator/six-stage-indicator.js +46 -46
- package/dist/collection/components/six-switch/six-switch.js +393 -393
- package/dist/collection/components/six-tab/six-tab.js +198 -198
- package/dist/collection/components/six-tab-group/six-tab-group.js +362 -362
- package/dist/collection/components/six-tab-panel/six-tab-panel.js +75 -75
- package/dist/collection/components/six-table/six-table.js +209 -209
- package/dist/collection/components/six-table/test/helpers.js +13 -13
- package/dist/collection/components/six-table/types.js +8 -8
- package/dist/collection/components/six-table/util/filter-by.js +34 -34
- package/dist/collection/components/six-table/util/from-data.js +33 -33
- package/dist/collection/components/six-table/util/is.js +3 -3
- package/dist/collection/components/six-table/util/quick-filter-by.js +13 -13
- package/dist/collection/components/six-table/util/sort-by.js +25 -25
- package/dist/collection/components/six-table-cell/six-table-cell.js +21 -21
- package/dist/collection/components/six-table-header/six-table-header.js +21 -21
- package/dist/collection/components/six-table-header-cell/get-next-state.js +7 -7
- package/dist/collection/components/six-table-header-cell/icons.js +12 -12
- package/dist/collection/components/six-table-header-cell/six-table-header-cell.js +174 -174
- package/dist/collection/components/six-table-header-cell/types.js +13 -13
- package/dist/collection/components/six-table-header-cell/util/create-model.js +6 -6
- package/dist/collection/components/six-table-header-cell/util/get-next-state.js +7 -7
- package/dist/collection/components/six-table-row/six-table-row.js +21 -21
- package/dist/collection/components/six-tag/six-tag.js +157 -157
- package/dist/collection/components/six-textarea/six-textarea.js +912 -912
- package/dist/collection/components/six-tile/six-tile.js +315 -315
- package/dist/collection/components/six-timepicker/six-time-format.js +14 -14
- package/dist/collection/components/six-timepicker/six-timepicker.js +980 -980
- package/dist/collection/components/six-timepicker/six-timepicker.types.js +40 -40
- package/dist/collection/components/six-tooltip/six-tooltip.js +435 -435
- package/dist/collection/functional-components/form-control/form-control.js +28 -28
- package/dist/collection/index.js +1 -1
- package/dist/collection/testUtil/delay.js +3 -3
- package/dist/collection/utils/as-array.js +1 -1
- package/dist/collection/utils/date-util.js +712 -712
- package/dist/collection/utils/event-listeners.js +39 -39
- package/dist/collection/utils/execution-control.js +38 -38
- package/dist/collection/utils/focus-visible.js +41 -41
- package/dist/collection/utils/matchers.js +2 -2
- package/dist/collection/utils/modal.js +28 -28
- package/dist/collection/utils/offset.js +13 -13
- package/dist/collection/utils/popover.js +113 -113
- package/dist/collection/utils/scroll.js +47 -47
- package/dist/collection/utils/slot.js +59 -59
- package/dist/collection/utils/support.js +15 -15
- package/dist/collection/utils/tabbable.js +22 -22
- package/dist/collection/utils/testing.js +38 -38
- package/dist/collection/utils/time.util.js +74 -74
- package/dist/collection/utils/type-check.js +5 -5
- package/dist/collection/utils/types.js +1 -1
- package/dist/collection/wrappers/set-attributes/set-attributes.js +68 -68
- package/dist/components.json +1 -1
- package/dist/custom-elements/index.js +7595 -7595
- package/dist/esm/{event-listeners-1bef934e.js → event-listeners-570a24ea.js} +38 -38
- package/dist/esm/{execution-control-235f5126.js → execution-control-1a60d709.js} +35 -35
- package/dist/esm/{focus-visible-4b7946aa.js → focus-visible-97933ea9.js} +40 -40
- package/dist/esm/{form-control-17478ad2.js → form-control-24f446af.js} +25 -25
- package/dist/esm/{modal-e5709f6b.js → modal-5ebdc320.js} +41 -41
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{popover-5a51f84d.js → popover-1c7a1139.js} +95 -95
- package/dist/esm/{scroll-99b214c2.js → scroll-180b53fd.js} +57 -57
- package/dist/esm/set-attributes_2.entry.js +57 -57
- package/dist/esm/six-alert.entry.js +131 -131
- package/dist/esm/six-avatar.entry.js +28 -28
- package/dist/esm/six-badge.entry.js +26 -26
- package/dist/esm/six-button.entry.js +97 -97
- package/dist/esm/six-card.entry.js +8 -8
- package/dist/esm/six-checkbox.entry.js +152 -152
- package/dist/esm/six-datepicker.entry.js +1189 -1189
- package/dist/esm/six-details.entry.js +139 -139
- package/dist/esm/six-dialog.entry.js +152 -152
- package/dist/esm/six-drawer.entry.js +174 -174
- package/dist/esm/six-dropdown_3.entry.js +728 -728
- package/dist/esm/six-error-page.entry.js +94 -94
- package/dist/esm/six-file-list-item.entry.js +38 -38
- package/dist/esm/six-file-list.entry.js +8 -8
- package/dist/esm/six-file-upload.entry.js +96 -96
- package/dist/esm/six-footer.entry.js +8 -8
- package/dist/esm/six-form.entry.js +219 -219
- package/dist/esm/six-group-label.entry.js +46 -46
- package/dist/esm/six-header.entry.js +149 -149
- package/dist/esm/six-icon-button.entry.js +33 -33
- package/dist/esm/six-icon.entry.js +24 -24
- package/dist/esm/six-input.entry.js +230 -230
- package/dist/esm/six-item-picker.entry.js +361 -361
- package/dist/esm/six-language-switcher.entry.js +52 -52
- package/dist/esm/six-layout-grid.entry.js +19 -19
- package/dist/esm/six-main-container.entry.js +11 -11
- package/dist/esm/six-menu-divider.entry.js +8 -8
- package/dist/esm/six-menu-label.entry.js +8 -8
- package/dist/esm/six-picto.entry.js +15 -15
- package/dist/esm/six-progress-bar.entry.js +17 -17
- package/dist/esm/six-progress-ring.entry.js +31 -31
- package/dist/esm/six-radio.entry.js +121 -121
- package/dist/esm/six-range.entry.js +198 -198
- package/dist/esm/six-root.entry.js +34 -34
- package/dist/esm/six-search-field.entry.js +43 -43
- package/dist/esm/six-select.entry.js +447 -447
- package/dist/esm/six-sidebar-item-group.entry.js +42 -42
- package/dist/esm/six-sidebar-item.entry.js +18 -18
- package/dist/esm/six-sidebar.entry.js +171 -171
- package/dist/esm/six-spinner.entry.js +16 -16
- package/dist/esm/six-switch.entry.js +100 -100
- package/dist/esm/six-tab-group.entry.js +226 -226
- package/dist/esm/six-tab-panel.entry.js +17 -17
- package/dist/esm/six-tab.entry.js +42 -42
- package/dist/esm/six-table-cell_4.entry.js +70 -70
- package/dist/esm/six-table.entry.js +145 -145
- package/dist/esm/six-tag.entry.js +40 -40
- package/dist/esm/six-textarea.entry.js +211 -211
- package/dist/esm/six-tile.entry.js +89 -89
- package/dist/esm/six-timepicker.entry.js +489 -489
- package/dist/esm/{six-timepicker.types-cd6bac03.js → six-timepicker.types-e161a447.js} +43 -43
- package/dist/esm/six-tooltip.entry.js +172 -172
- package/dist/esm/{slot-5253e199.js → slot-6f3984c7.js} +42 -42
- package/dist/esm/{types-a37c1695.js → types-4b10b413.js} +12 -12
- package/dist/esm/{types-33d15673.js → types-ed860f7c.js} +12 -12
- package/dist/types/components/six-alert/six-alert.d.ts +60 -60
- package/dist/types/components/six-avatar/six-avatar.d.ts +27 -27
- package/dist/types/components/six-badge/six-badge.d.ts +20 -20
- package/dist/types/components/six-button/six-button.d.ts +69 -69
- package/dist/types/components/six-card/six-card.d.ts +9 -9
- package/dist/types/components/six-checkbox/six-checkbox.d.ts +86 -86
- package/dist/types/components/six-datepicker/components/day-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/components/month-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/components/year-selection.d.ts +5 -5
- package/dist/types/components/six-datepicker/six-date-formats.d.ts +22 -22
- package/dist/types/components/six-datepicker/six-datepicker.d.ts +214 -214
- package/dist/types/components/six-datepicker/test/six-datepicker.test-helpers.d.ts +1 -1
- package/dist/types/components/six-details/six-details.d.ts +61 -61
- package/dist/types/components/six-dialog/six-dialog.d.ts +75 -75
- package/dist/types/components/six-drawer/six-drawer.d.ts +82 -82
- package/dist/types/components/six-dropdown/six-dropdown.d.ts +140 -140
- package/dist/types/components/six-error-page/six-error-page.d.ts +27 -27
- package/dist/types/components/six-file-list/six-file-list.d.ts +8 -8
- package/dist/types/components/six-file-list-item/six-file-list-item.d.ts +35 -35
- package/dist/types/components/six-file-upload/six-file-upload.d.ts +42 -42
- package/dist/types/components/six-footer/six-footer.d.ts +9 -9
- package/dist/types/components/six-form/six-form.d.ts +69 -69
- package/dist/types/components/six-group-label/six-group-label.d.ts +37 -37
- package/dist/types/components/six-header/six-header.d.ts +90 -90
- package/dist/types/components/six-icon/six-icon.d.ts +13 -13
- package/dist/types/components/six-icon-button/six-icon-button.d.ts +28 -28
- package/dist/types/components/six-input/six-input.d.ts +165 -165
- package/dist/types/components/six-item-picker/six-item-picker.d.ts +106 -106
- package/dist/types/components/six-item-picker/types.d.ts +11 -11
- package/dist/types/components/six-language-switcher/six-language-switcher.d.ts +25 -25
- package/dist/types/components/six-layout-grid/six-layout-grid.d.ts +14 -14
- package/dist/types/components/six-main-container/six-main-container.d.ts +16 -16
- package/dist/types/components/six-menu/six-menu.d.ts +81 -81
- package/dist/types/components/six-menu-divider/six-menu-divider.d.ts +11 -11
- package/dist/types/components/six-menu-item/six-menu-item.d.ts +36 -36
- package/dist/types/components/six-menu-label/six-menu-label.d.ts +13 -13
- package/dist/types/components/six-picto/six-picto.d.ts +14 -14
- package/dist/types/components/six-progress-bar/six-progress-bar.d.ts +19 -19
- package/dist/types/components/six-progress-ring/six-progress-ring.d.ts +24 -24
- package/dist/types/components/six-radio/six-radio.d.ts +66 -66
- package/dist/types/components/six-range/six-range.d.ts +101 -101
- package/dist/types/components/six-root/six-root.d.ts +34 -34
- package/dist/types/components/six-search-field/six-search-field.d.ts +32 -32
- package/dist/types/components/six-select/six-select.d.ts +163 -163
- package/dist/types/components/six-sidebar/six-sidebar.d.ts +55 -55
- package/dist/types/components/six-sidebar-item/six-sidebar-item.d.ts +15 -15
- package/dist/types/components/six-sidebar-item-group/six-sidebar-item-group.d.ts +26 -26
- package/dist/types/components/six-spinner/six-spinner.d.ts +15 -15
- package/dist/types/components/six-stage-indicator/six-stage-indicator.d.ts +6 -6
- package/dist/types/components/six-switch/six-switch.d.ts +62 -62
- package/dist/types/components/six-tab/six-tab.d.ts +35 -35
- package/dist/types/components/six-tab-group/six-tab-group.d.ts +62 -62
- package/dist/types/components/six-tab-panel/six-tab-panel.d.ts +19 -19
- package/dist/types/components/six-table/six-table.d.ts +30 -30
- package/dist/types/components/six-table/test/helpers.d.ts +2 -2
- package/dist/types/components/six-table/types.d.ts +33 -33
- package/dist/types/components/six-table/util/filter-by.d.ts +2 -2
- package/dist/types/components/six-table/util/from-data.d.ts +8 -8
- package/dist/types/components/six-table/util/is.d.ts +3 -3
- package/dist/types/components/six-table/util/quick-filter-by.d.ts +2 -2
- package/dist/types/components/six-table/util/sort-by.d.ts +2 -2
- package/dist/types/components/six-table-cell/six-table-cell.d.ts +9 -9
- package/dist/types/components/six-table-header/six-table-header.d.ts +9 -9
- package/dist/types/components/six-table-header-cell/get-next-state.d.ts +2 -2
- package/dist/types/components/six-table-header-cell/icons.d.ts +3 -3
- package/dist/types/components/six-table-header-cell/six-table-header-cell.d.ts +32 -32
- package/dist/types/components/six-table-header-cell/types.d.ts +11 -11
- package/dist/types/components/six-table-header-cell/util/create-model.d.ts +4 -4
- package/dist/types/components/six-table-header-cell/util/get-next-state.d.ts +3 -3
- package/dist/types/components/six-table-row/six-table-row.d.ts +9 -9
- package/dist/types/components/six-tag/six-tag.d.ts +30 -30
- package/dist/types/components/six-textarea/six-textarea.d.ts +134 -134
- package/dist/types/components/six-tile/six-tile.d.ts +40 -40
- package/dist/types/components/six-timepicker/six-time-format.d.ts +13 -13
- package/dist/types/components/six-timepicker/six-timepicker.d.ts +184 -184
- package/dist/types/components/six-timepicker/six-timepicker.types.d.ts +36 -36
- package/dist/types/components/six-tooltip/six-tooltip.d.ts +72 -72
- package/dist/types/functional-components/form-control/form-control.d.ts +34 -34
- package/dist/types/index.d.ts +1 -1
- package/dist/types/testUtil/delay.d.ts +1 -1
- package/dist/types/utils/as-array.d.ts +1 -1
- package/dist/types/utils/date-util.d.ts +194 -194
- package/dist/types/utils/event-listeners.d.ts +15 -15
- package/dist/types/utils/execution-control.d.ts +26 -26
- package/dist/types/utils/focus-visible.d.ts +6 -6
- package/dist/types/utils/matchers.d.ts +2 -2
- package/dist/types/utils/modal.d.ts +13 -13
- package/dist/types/utils/offset.d.ts +4 -4
- package/dist/types/utils/popover.d.ts +27 -27
- package/dist/types/utils/scroll.d.ts +3 -3
- package/dist/types/utils/slot.d.ts +9 -9
- package/dist/types/utils/support.d.ts +1 -1
- package/dist/types/utils/tabbable.d.ts +2 -2
- package/dist/types/utils/testing.d.ts +2 -2
- package/dist/types/utils/time.util.d.ts +10 -10
- package/dist/types/utils/type-check.d.ts +4 -4
- package/dist/types/utils/types.d.ts +4 -4
- package/dist/types/wrappers/set-attributes/set-attributes.d.ts +9 -9
- package/dist/ui-library/{p-a8c225f2.entry.js → p-007bc8e8.entry.js} +1 -1
- package/dist/ui-library/{p-f9c0cfb7.entry.js → p-044b784e.entry.js} +1 -1
- package/dist/ui-library/{p-c733dead.js → p-0786fa7c.js} +0 -0
- package/dist/ui-library/{p-12cc24c3.js → p-07d1e830.js} +0 -0
- package/dist/ui-library/{p-48ea4419.entry.js → p-09cb13fa.entry.js} +1 -1
- package/dist/ui-library/{p-e96dcf96.entry.js → p-0c596054.entry.js} +1 -1
- package/dist/ui-library/{p-a77a6442.entry.js → p-1b8dc7b7.entry.js} +1 -1
- package/dist/ui-library/{p-68d31736.js → p-25a3bf57.js} +0 -0
- package/dist/ui-library/{p-ebaea182.entry.js → p-281e8c2d.entry.js} +1 -1
- package/dist/ui-library/{p-9f2dc381.entry.js → p-2924f82f.entry.js} +1 -1
- package/dist/ui-library/{p-ea1fcff2.entry.js → p-2d7ed407.entry.js} +1 -1
- package/dist/ui-library/{p-89f68e76.entry.js → p-4162dcdd.entry.js} +1 -1
- package/dist/ui-library/{p-6f67f986.entry.js → p-4d3a4e93.entry.js} +1 -1
- package/dist/ui-library/{p-8bd0873f.entry.js → p-4ed023b8.entry.js} +1 -1
- package/dist/ui-library/{p-af3d757c.js → p-4f8394d7.js} +0 -0
- package/dist/ui-library/{p-1b92cc7a.entry.js → p-530ea6ec.entry.js} +1 -1
- package/dist/ui-library/{p-19543c96.entry.js → p-531ab886.entry.js} +1 -1
- package/dist/ui-library/{p-fdb455d7.entry.js → p-54c48654.entry.js} +1 -1
- package/dist/ui-library/{p-c948d3db.entry.js → p-55c64cbc.entry.js} +1 -1
- package/dist/ui-library/{p-1c9f0dc6.js → p-5f1c6a5f.js} +0 -0
- package/dist/ui-library/{p-60491176.entry.js → p-675a8243.entry.js} +1 -1
- package/dist/ui-library/{p-b9fb8455.entry.js → p-6d622ed0.entry.js} +1 -1
- package/dist/ui-library/{p-572e3690.js → p-75297ad7.js} +0 -0
- package/dist/ui-library/{p-2ff97cdf.entry.js → p-90b26447.entry.js} +1 -1
- package/dist/ui-library/{p-fcd2356c.entry.js → p-93945629.entry.js} +1 -1
- package/dist/ui-library/{p-7735d99f.js → p-9a860acc.js} +0 -0
- package/dist/ui-library/{p-4cc01afc.entry.js → p-aa37e45a.entry.js} +1 -1
- package/dist/ui-library/{p-191f958b.js → p-b1e66136.js} +0 -0
- package/dist/ui-library/{p-c09dc3a9.js → p-b4dfb7cf.js} +0 -0
- package/dist/ui-library/{p-968c5169.entry.js → p-c24292b3.entry.js} +1 -1
- package/dist/ui-library/{p-ed21cc57.entry.js → p-cd79de73.entry.js} +1 -1
- package/dist/ui-library/{p-34e6d8e8.js → p-d12c6092.js} +0 -0
- package/dist/ui-library/{p-f0e91e17.entry.js → p-d28ac80a.entry.js} +1 -1
- package/dist/ui-library/{p-5ead7b2f.entry.js → p-d837e5a8.entry.js} +1 -1
- package/dist/ui-library/{p-ec1ecc2a.entry.js → p-dd3cae68.entry.js} +1 -1
- package/dist/ui-library/{p-044c6bf9.js → p-eb8f05a9.js} +0 -0
- package/dist/ui-library/ui-library.esm.js +1 -1
- package/package.json +1 -1
|
@@ -3,502 +3,502 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-341df120.js');
|
|
6
|
-
const types = require('./types-
|
|
7
|
-
const sixTimepicker_types = require('./six-timepicker.types-
|
|
8
|
-
const executionControl = require('./execution-control-
|
|
9
|
-
const eventListeners = require('./event-listeners-
|
|
10
|
-
const slot = require('./slot-
|
|
6
|
+
const types = require('./types-64878648.js');
|
|
7
|
+
const sixTimepicker_types = require('./six-timepicker.types-c19ebff3.js');
|
|
8
|
+
const executionControl = require('./execution-control-46f388e0.js');
|
|
9
|
+
const eventListeners = require('./event-listeners-74715e62.js');
|
|
10
|
+
const slot = require('./slot-ad537f24.js');
|
|
11
11
|
|
|
12
|
-
var SixTimeFormat;
|
|
13
|
-
(function (SixTimeFormat) {
|
|
14
|
-
SixTimeFormat["HHmmss"] = "HH:mm:ss";
|
|
15
|
-
SixTimeFormat["hhmmssaa"] = "hh:mm:ss:aa";
|
|
16
|
-
SixTimeFormat["HHmmssms"] = "HH:mm:ss:ms";
|
|
17
|
-
SixTimeFormat["hhmmssmsaa"] = "hh:mm:ss:ms:aa";
|
|
18
|
-
SixTimeFormat["HHmm"] = "HH:mm";
|
|
19
|
-
SixTimeFormat["hhmmaa"] = "hh:mm:aa";
|
|
20
|
-
SixTimeFormat["HH"] = "HH";
|
|
21
|
-
SixTimeFormat["hhaa"] = "hh:aa";
|
|
22
|
-
SixTimeFormat["mm"] = "mm";
|
|
23
|
-
SixTimeFormat["ss"] = "ss";
|
|
24
|
-
SixTimeFormat["ms"] = "ms";
|
|
12
|
+
var SixTimeFormat;
|
|
13
|
+
(function (SixTimeFormat) {
|
|
14
|
+
SixTimeFormat["HHmmss"] = "HH:mm:ss";
|
|
15
|
+
SixTimeFormat["hhmmssaa"] = "hh:mm:ss:aa";
|
|
16
|
+
SixTimeFormat["HHmmssms"] = "HH:mm:ss:ms";
|
|
17
|
+
SixTimeFormat["hhmmssmsaa"] = "hh:mm:ss:ms:aa";
|
|
18
|
+
SixTimeFormat["HHmm"] = "HH:mm";
|
|
19
|
+
SixTimeFormat["hhmmaa"] = "hh:mm:aa";
|
|
20
|
+
SixTimeFormat["HH"] = "HH";
|
|
21
|
+
SixTimeFormat["hhaa"] = "hh:aa";
|
|
22
|
+
SixTimeFormat["mm"] = "mm";
|
|
23
|
+
SixTimeFormat["ss"] = "ss";
|
|
24
|
+
SixTimeFormat["ms"] = "ms";
|
|
25
25
|
})(SixTimeFormat || (SixTimeFormat = {}));
|
|
26
26
|
|
|
27
|
-
/*
|
|
28
|
-
* Returns the current time in the format of your choice
|
|
29
|
-
*/
|
|
30
|
-
const getCurrentTimeIn24Hours = () => {
|
|
31
|
-
const now = new Date();
|
|
32
|
-
return {
|
|
33
|
-
hours: now.getHours(),
|
|
34
|
-
minutes: now.getMinutes(),
|
|
35
|
-
seconds: now.getSeconds(),
|
|
36
|
-
milliseconds: now.getMilliseconds(),
|
|
37
|
-
has24Hours: true,
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const HOURS_IN_12_HOUR_CLOCK_FORMAT = 12;
|
|
41
|
-
const getHoursIn12HourFormat = (hours) => hours > HOURS_IN_12_HOUR_CLOCK_FORMAT ? hours - HOURS_IN_12_HOUR_CLOCK_FORMAT : hours;
|
|
42
|
-
const getCurrentTimeIn12Hours = () => {
|
|
43
|
-
const now = new Date();
|
|
44
|
-
const hours = now.getHours();
|
|
45
|
-
return {
|
|
46
|
-
hours: getHoursIn12HourFormat(hours),
|
|
47
|
-
minutes: now.getMinutes(),
|
|
48
|
-
seconds: now.getSeconds(),
|
|
49
|
-
milliseconds: now.getMilliseconds(),
|
|
50
|
-
has24Hours: false,
|
|
51
|
-
period: hours >= HOURS_IN_12_HOUR_CLOCK_FORMAT ? sixTimepicker_types.SixTimePeriod.PM : sixTimepicker_types.SixTimePeriod.AM,
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
const getCurrentTime = (has24Hours = true) => {
|
|
55
|
-
return has24Hours ? getCurrentTimeIn24Hours() : getCurrentTimeIn12Hours();
|
|
56
|
-
};
|
|
57
|
-
const TIME_FORMAT_SEPARATOR = ':';
|
|
58
|
-
const isValidTimeString = (timeStr, format) => {
|
|
59
|
-
const timeStringParts = timeStr.split(TIME_FORMAT_SEPARATOR);
|
|
60
|
-
const timeFormatParts = format.split(TIME_FORMAT_SEPARATOR);
|
|
61
|
-
return timeStringParts.length === timeFormatParts.length;
|
|
62
|
-
};
|
|
63
|
-
const parseTimeString = (timeStr, format) => {
|
|
64
|
-
const timeStringParts = timeStr.split(TIME_FORMAT_SEPARATOR);
|
|
65
|
-
const timeFormatParts = format.split(TIME_FORMAT_SEPARATOR);
|
|
66
|
-
if (!isValidTimeString(timeStr, format)) {
|
|
67
|
-
console.error(`Timestring did not match expected format.\nExpected format: ${format}\nReceived timestring: ${timeStr}`);
|
|
68
|
-
}
|
|
69
|
-
const sixTime = {};
|
|
70
|
-
timeStringParts.forEach((timeStringPart, i) => {
|
|
71
|
-
const formatStringPart = timeFormatParts[i];
|
|
72
|
-
const sixTimePropertyName = sixTimepicker_types.TIME_FORMAT_CHAR_TO_SIX_TIME_PROPERTY_MAP[formatStringPart];
|
|
73
|
-
if (sixTimePropertyName !== undefined) {
|
|
74
|
-
if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.PERIOD) {
|
|
75
|
-
sixTime.period = timeStringPart.toUpperCase() === sixTimepicker_types.SixTimePeriod.PM ? sixTimepicker_types.SixTimePeriod.PM : sixTimepicker_types.SixTimePeriod.AM;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
sixTime[sixTimePropertyName] = Number(timeStringPart);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_24) {
|
|
82
|
-
sixTime.has24Hours = true;
|
|
83
|
-
}
|
|
84
|
-
else if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_12) {
|
|
85
|
-
sixTime.has24Hours = false;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return sixTime;
|
|
89
|
-
};
|
|
90
|
-
const createTimeString = (time, format) => {
|
|
91
|
-
return format
|
|
92
|
-
.split(TIME_FORMAT_SEPARATOR)
|
|
93
|
-
.map((timeFormatPart) => {
|
|
94
|
-
const sixTimePropertyName = sixTimepicker_types.TIME_FORMAT_CHAR_TO_SIX_TIME_PROPERTY_MAP[timeFormatPart];
|
|
95
|
-
const paddingLength = timeFormatPart === sixTimepicker_types.TIME_FORMAT_CHAR.MILLISECOND ? 3 : 2;
|
|
96
|
-
return String(time[sixTimePropertyName]).padStart(paddingLength, '0');
|
|
97
|
-
})
|
|
98
|
-
.join(TIME_FORMAT_SEPARATOR);
|
|
27
|
+
/*
|
|
28
|
+
* Returns the current time in the format of your choice
|
|
29
|
+
*/
|
|
30
|
+
const getCurrentTimeIn24Hours = () => {
|
|
31
|
+
const now = new Date();
|
|
32
|
+
return {
|
|
33
|
+
hours: now.getHours(),
|
|
34
|
+
minutes: now.getMinutes(),
|
|
35
|
+
seconds: now.getSeconds(),
|
|
36
|
+
milliseconds: now.getMilliseconds(),
|
|
37
|
+
has24Hours: true,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const HOURS_IN_12_HOUR_CLOCK_FORMAT = 12;
|
|
41
|
+
const getHoursIn12HourFormat = (hours) => hours > HOURS_IN_12_HOUR_CLOCK_FORMAT ? hours - HOURS_IN_12_HOUR_CLOCK_FORMAT : hours;
|
|
42
|
+
const getCurrentTimeIn12Hours = () => {
|
|
43
|
+
const now = new Date();
|
|
44
|
+
const hours = now.getHours();
|
|
45
|
+
return {
|
|
46
|
+
hours: getHoursIn12HourFormat(hours),
|
|
47
|
+
minutes: now.getMinutes(),
|
|
48
|
+
seconds: now.getSeconds(),
|
|
49
|
+
milliseconds: now.getMilliseconds(),
|
|
50
|
+
has24Hours: false,
|
|
51
|
+
period: hours >= HOURS_IN_12_HOUR_CLOCK_FORMAT ? sixTimepicker_types.SixTimePeriod.PM : sixTimepicker_types.SixTimePeriod.AM,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const getCurrentTime = (has24Hours = true) => {
|
|
55
|
+
return has24Hours ? getCurrentTimeIn24Hours() : getCurrentTimeIn12Hours();
|
|
56
|
+
};
|
|
57
|
+
const TIME_FORMAT_SEPARATOR = ':';
|
|
58
|
+
const isValidTimeString = (timeStr, format) => {
|
|
59
|
+
const timeStringParts = timeStr.split(TIME_FORMAT_SEPARATOR);
|
|
60
|
+
const timeFormatParts = format.split(TIME_FORMAT_SEPARATOR);
|
|
61
|
+
return timeStringParts.length === timeFormatParts.length;
|
|
62
|
+
};
|
|
63
|
+
const parseTimeString = (timeStr, format) => {
|
|
64
|
+
const timeStringParts = timeStr.split(TIME_FORMAT_SEPARATOR);
|
|
65
|
+
const timeFormatParts = format.split(TIME_FORMAT_SEPARATOR);
|
|
66
|
+
if (!isValidTimeString(timeStr, format)) {
|
|
67
|
+
console.error(`Timestring did not match expected format.\nExpected format: ${format}\nReceived timestring: ${timeStr}`);
|
|
68
|
+
}
|
|
69
|
+
const sixTime = {};
|
|
70
|
+
timeStringParts.forEach((timeStringPart, i) => {
|
|
71
|
+
const formatStringPart = timeFormatParts[i];
|
|
72
|
+
const sixTimePropertyName = sixTimepicker_types.TIME_FORMAT_CHAR_TO_SIX_TIME_PROPERTY_MAP[formatStringPart];
|
|
73
|
+
if (sixTimePropertyName !== undefined) {
|
|
74
|
+
if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.PERIOD) {
|
|
75
|
+
sixTime.period = timeStringPart.toUpperCase() === sixTimepicker_types.SixTimePeriod.PM ? sixTimepicker_types.SixTimePeriod.PM : sixTimepicker_types.SixTimePeriod.AM;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
sixTime[sixTimePropertyName] = Number(timeStringPart);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_24) {
|
|
82
|
+
sixTime.has24Hours = true;
|
|
83
|
+
}
|
|
84
|
+
else if (formatStringPart === sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_12) {
|
|
85
|
+
sixTime.has24Hours = false;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return sixTime;
|
|
89
|
+
};
|
|
90
|
+
const createTimeString = (time, format) => {
|
|
91
|
+
return format
|
|
92
|
+
.split(TIME_FORMAT_SEPARATOR)
|
|
93
|
+
.map((timeFormatPart) => {
|
|
94
|
+
const sixTimePropertyName = sixTimepicker_types.TIME_FORMAT_CHAR_TO_SIX_TIME_PROPERTY_MAP[timeFormatPart];
|
|
95
|
+
const paddingLength = timeFormatPart === sixTimepicker_types.TIME_FORMAT_CHAR.MILLISECOND ? 3 : 2;
|
|
96
|
+
return String(time[sixTimePropertyName]).padStart(paddingLength, '0');
|
|
97
|
+
})
|
|
98
|
+
.join(TIME_FORMAT_SEPARATOR);
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
const sixTimepickerCss = ":host{position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host{display:block;font-family:var(--six-font-family)}.timepicker_clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--six-input-icon-color);border:none;background:none;padding:0;transition:var(--six-transition-fast) color;cursor:pointer}.timepicker_clear:hover{color:var(--six-input-icon-color-hover)}.timepicker_clear:focus{outline:none}.timepicker_clear--right{right:0;position:absolute}.timepicker_clear--left{right:35px;position:absolute}.timepicker__container{position:relative}.timepicker__popup{display:flex;justify-content:center;min-width:min-content;min-height:145px;background-color:white;padding:0.5em 0.5em 1.5em;box-shadow:0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);user-select:none;position:absolute;z-index:var(--six-z-index-dropdown);right:0;left:0}.timepicker__popup--is-up{bottom:100%}.timepicker__popup--is-inline{position:initial;box-shadow:none;border:1px solid var(--six-color-web-rock-400)}.timepicker__separator{display:flex;align-items:center}.timepicker__item--wide{padding-left:0.5rem;padding-right:0.5rem}.input--empty .timepicker_clear{visibility:hidden}.input--hide{display:none}.prefix{cursor:pointer}.prefix--right{right:0;display:inline-flex;position:absolute;font-size:inherit;color:var(--six-input-icon-color);border:none;background:none;margin-right:var(--six-input-spacing-medium);transition:var(--six-transition-fast) color}";
|
|
102
102
|
|
|
103
|
-
const TAG = `[SIX-TIMEPICKER]`;
|
|
104
|
-
const DEBOUNCE_TIMEPICKER_LISTENER = 'debounced-timepicker';
|
|
105
|
-
const MIN_POPUP_HEIGHT = 145;
|
|
106
|
-
let SixTimepicker = class {
|
|
107
|
-
constructor(hostRef) {
|
|
108
|
-
index.registerInstance(this, hostRef);
|
|
109
|
-
this.sixChange = index.createEvent(this, "six-timepicker-change", 7);
|
|
110
|
-
this.sixChangeDebounced = index.createEvent(this, "six-timepicker-change-debounced", 7);
|
|
111
|
-
this.sixClear = index.createEvent(this, "six-timepicker-clear", 7);
|
|
112
|
-
this.eventListeners = new eventListeners.EventListeners();
|
|
113
|
-
/**
|
|
114
|
-
* Define the time format. Valid formats are:
|
|
115
|
-
*
|
|
116
|
-
* HH:mm:ss
|
|
117
|
-
* hh:mm:ss:aa
|
|
118
|
-
* HH:mm:ss:ms
|
|
119
|
-
* hh:mm:ss:ms:aa
|
|
120
|
-
* HH:mm
|
|
121
|
-
* hh:mm:aa
|
|
122
|
-
* HH
|
|
123
|
-
* hh:aa
|
|
124
|
-
* mm
|
|
125
|
-
* ss
|
|
126
|
-
* ms
|
|
127
|
-
*
|
|
128
|
-
* where HH is the 24 hour format
|
|
129
|
-
* and hh is the 12 hour format
|
|
130
|
-
*
|
|
131
|
-
* Please notice that when using the 12-hour-clock (hh)
|
|
132
|
-
* you always need a period indicator (aa). So the time can be parsed as either am or pm
|
|
133
|
-
* */
|
|
134
|
-
this.format = SixTimeFormat.HHmmss;
|
|
135
|
-
/**
|
|
136
|
-
* Define the separator to be shown between the time unit pickers.
|
|
137
|
-
* Please be aware that this property will modify the displayed separator only.
|
|
138
|
-
* The separator for a timestring is always expected to be a colon (eg. '13:52:20')
|
|
139
|
-
* */
|
|
140
|
-
this.separator = TIME_FORMAT_SEPARATOR;
|
|
141
|
-
/** Indicates whether or not the timepicker dropdown is open on startup. You can use this in lieu of the show/hide methods. */
|
|
142
|
-
this.open = false;
|
|
143
|
-
/** Indicates whether or not the timepicker should be shown as an inline (always open) component */
|
|
144
|
-
this.inline = false;
|
|
145
|
-
/**
|
|
146
|
-
* If `true` the user can only select a time via the timepicker but not directly edit the input field.
|
|
147
|
-
*/
|
|
148
|
-
this.readonly = false;
|
|
149
|
-
/**
|
|
150
|
-
* If `true` the component is disabled.
|
|
151
|
-
*/
|
|
152
|
-
this.disabled = false;
|
|
153
|
-
/** Timepicker size. */
|
|
154
|
-
this.size = 'medium';
|
|
155
|
-
/** Set to display the error text on blur and not when typing */
|
|
156
|
-
this.errorOnBlur = false;
|
|
157
|
-
/** The input's error text. Alternatively, you can use the error-text slot. */
|
|
158
|
-
this.errorText = '';
|
|
159
|
-
/** The input's label. Alternatively, you can use the label slot. */
|
|
160
|
-
this.label = '';
|
|
161
|
-
/** The input's name attribute. */
|
|
162
|
-
this.name = '';
|
|
163
|
-
/** Set to true to add a clear button when the input is populated. */
|
|
164
|
-
this.clearable = false;
|
|
165
|
-
/** Set the position of the icon */
|
|
166
|
-
this.iconPosition = 'left';
|
|
167
|
-
/**
|
|
168
|
-
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
169
|
-
* `overflow: auto|scroll`.
|
|
170
|
-
*/
|
|
171
|
-
this.hoist = false;
|
|
172
|
-
/**
|
|
173
|
-
* Set the amount of time, in milliseconds, to wait to trigger faster switching between timeunits (e.g. hours).
|
|
174
|
-
*/
|
|
175
|
-
this.timeout = executionControl.DEFAULT_DEBOUNCE_FAST;
|
|
176
|
-
/**
|
|
177
|
-
* Set the amount of time, in milliseconds, to wait between switching to next timeunit (e.g. next hour) when mouse button is held pressed.
|
|
178
|
-
*/
|
|
179
|
-
this.interval = executionControl.DEFAULT_DEBOUNCE_INSANELY_FAST;
|
|
180
|
-
/**
|
|
181
|
-
* Set the amount of time, in milliseconds, to wait to trigger the `six-timepicker-change-debounced` event.
|
|
182
|
-
* If you want your change debounce event to not trigger when keeping the nav button pressed before, make sure debounce
|
|
183
|
-
* is a bit bigger than timeout, otherwise keeping the button pressed will trigger the event twice: once you click
|
|
184
|
-
* (and keep pressed) and once you release
|
|
185
|
-
*/
|
|
186
|
-
this.debounce = executionControl.DEFAULT_DEBOUNCE_FAST;
|
|
187
|
-
this.isPopupContentUp = false;
|
|
188
|
-
this.isDropDownContentUp = false;
|
|
189
|
-
this.defaultValue = null;
|
|
190
|
-
this.handleInputChange = (event) => {
|
|
191
|
-
event.stopPropagation();
|
|
192
|
-
const inputValue = this.inputElement.value;
|
|
193
|
-
if (!isValidTimeString(inputValue, this.format)) {
|
|
194
|
-
this.sixChange.emit({
|
|
195
|
-
value: {},
|
|
196
|
-
valueAsString: '',
|
|
197
|
-
});
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
this.internalValue = parseTimeString(inputValue, this.format);
|
|
201
|
-
this.sixChange.emit({
|
|
202
|
-
value: this.internalValue,
|
|
203
|
-
valueAsString: createTimeString(this.internalValue, this.format),
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
this.handleSixTimepickerChangeDebounced = ({ detail }) => {
|
|
207
|
-
this.sixChangeDebounced.emit(detail);
|
|
208
|
-
};
|
|
209
|
-
this.handleChange = (event, property) => {
|
|
210
|
-
// stop propagation, since the timepicker should not expose the events of the underlying item-picker
|
|
211
|
-
event.stopPropagation();
|
|
212
|
-
// update the internal state
|
|
213
|
-
this.internalValue[property] = event.detail;
|
|
214
|
-
const timeString = createTimeString(this.internalValue, this.format);
|
|
215
|
-
// fire timepicker's own event
|
|
216
|
-
this.sixChange.emit({
|
|
217
|
-
changedProperty: property,
|
|
218
|
-
value: this.internalValue,
|
|
219
|
-
valueAsString: timeString,
|
|
220
|
-
});
|
|
221
|
-
// update the input value
|
|
222
|
-
this.value = timeString;
|
|
223
|
-
};
|
|
224
|
-
this.handleDocumentMouseDown = (event) => {
|
|
225
|
-
// Close when clicking outside of the containing element
|
|
226
|
-
const path = event.composedPath();
|
|
227
|
-
if (!path.includes(this.host)) {
|
|
228
|
-
this.closePopup();
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
this.handleClearClick = (event) => {
|
|
233
|
-
event.stopPropagation();
|
|
234
|
-
this.value = undefined;
|
|
235
|
-
this.sixClear.emit();
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
async resizeHandler() {
|
|
239
|
-
this.calcIsPopupContentUp();
|
|
240
|
-
this.moveOpenHoistedPopup();
|
|
241
|
-
}
|
|
242
|
-
async scrollHandler() {
|
|
243
|
-
this.calcIsPopupContentUp();
|
|
244
|
-
this.moveOpenHoistedPopup();
|
|
245
|
-
}
|
|
246
|
-
debounceChanged() {
|
|
247
|
-
this.eventListeners.removeByIdentifier(DEBOUNCE_TIMEPICKER_LISTENER);
|
|
248
|
-
this.eventListeners.add(this.host, 'six-timepicker-change', executionControl.debounce(this.handleSixTimepickerChangeDebounced, this.debounce), DEBOUNCE_TIMEPICKER_LISTENER);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Update the native input element when the value changes
|
|
252
|
-
*/
|
|
253
|
-
valueChanged(newValue) {
|
|
254
|
-
if (this.value !== newValue) {
|
|
255
|
-
this.value = newValue;
|
|
256
|
-
}
|
|
257
|
-
this.setupInternalTime();
|
|
258
|
-
this.sixChange.emit({
|
|
259
|
-
value: this.internalValue,
|
|
260
|
-
valueAsString: createTimeString(this.internalValue, this.format),
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
264
|
-
async reportValidity() {
|
|
265
|
-
return this.inputElement.reportValidity();
|
|
266
|
-
}
|
|
267
|
-
/** Checks for validity. */
|
|
268
|
-
async checkValidity() {
|
|
269
|
-
return this.inputElement.checkValidity();
|
|
270
|
-
}
|
|
271
|
-
/** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */
|
|
272
|
-
async setCustomValidity(message) {
|
|
273
|
-
await this.inputElement.setCustomValidity(message);
|
|
274
|
-
}
|
|
275
|
-
/** Resets the formcontrol */
|
|
276
|
-
async reset() {
|
|
277
|
-
this.internalValue = this.defaultValue;
|
|
278
|
-
this.inputElement.value = createTimeString(this.internalValue, this.format);
|
|
279
|
-
await this.inputElement.reset();
|
|
280
|
-
}
|
|
281
|
-
componentWillLoad() {
|
|
282
|
-
this.setupInternalTime();
|
|
283
|
-
if (this.inline) {
|
|
284
|
-
this.open = true;
|
|
285
|
-
}
|
|
286
|
-
if (this.open) {
|
|
287
|
-
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
componentDidLoad() {
|
|
291
|
-
this.eventListeners.add(this.host, 'six-timepicker-change', executionControl.debounce(this.handleSixTimepickerChangeDebounced, this.debounce), DEBOUNCE_TIMEPICKER_LISTENER);
|
|
292
|
-
this.eventListeners.add(this.inputElement, 'six-input-input', executionControl.debounce(this.handleInputChange, this.debounce));
|
|
293
|
-
}
|
|
294
|
-
disconnectedCallback() {
|
|
295
|
-
this.eventListeners.removeAll();
|
|
296
|
-
}
|
|
297
|
-
calcIsPopupContentUp() {
|
|
298
|
-
if (!this.inputElement || !this.wrapper) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
const inputBoundingRect = this.inputElement.getBoundingClientRect();
|
|
302
|
-
const wrapperBoundingRect = this.wrapper.getBoundingClientRect();
|
|
303
|
-
const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);
|
|
304
|
-
const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;
|
|
305
|
-
this.isPopupContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;
|
|
306
|
-
}
|
|
307
|
-
/*
|
|
308
|
-
* The position of the hoisted timepicker needs to be correctly calculated since the position changes to fixed.
|
|
309
|
-
* Thus if the user scrolls or adjusts the screen size we need to recalculate the timepicker position.
|
|
310
|
-
*/
|
|
311
|
-
moveOpenHoistedPopup() {
|
|
312
|
-
if (!this.hoist || !this.open) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
const popupBoundingClientRect = this.popup.getBoundingClientRect();
|
|
316
|
-
const popupHeight = popupBoundingClientRect.height;
|
|
317
|
-
const inputBoundingClientRect = this.inputElement.getBoundingClientRect();
|
|
318
|
-
const inputTop = inputBoundingClientRect.top;
|
|
319
|
-
const inputHeight = inputBoundingClientRect.height;
|
|
320
|
-
this.calcIsPopupContentUp();
|
|
321
|
-
if (this.isPopupContentUp) {
|
|
322
|
-
this.popup.style.top = `${inputTop - popupHeight}px`;
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
this.popup.style.top = `${inputTop + inputHeight}px`;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
getSixTimeUnitPicker(params) {
|
|
329
|
-
return (index.h("six-item-picker", { class: params.class, timeout: this.timeout, interval: this.interval, padded: true, min: params.min, max: params.max, value: this.internalValue[params.propertyName], items: params.items, type: params.type || types.ItemPickerType.NUMBER, "padding-length": params.paddingLength, "onSix-item-picker-change": (event) => this.handleChange(event, params.propertyName) }));
|
|
330
|
-
}
|
|
331
|
-
setupInternalTime() {
|
|
332
|
-
if (this.is12HourClock() && !this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.PERIOD)) {
|
|
333
|
-
console.error(`${TAG} You provided a 12-hour-clock format but are missing the period (am or pm) in the time-format-string!`);
|
|
334
|
-
}
|
|
335
|
-
if (this.value === null || this.value === undefined) {
|
|
336
|
-
this.internalValue = sixTimepicker_types.isNil(this.defaultTime)
|
|
337
|
-
? getCurrentTime(this.is24HourClock())
|
|
338
|
-
: parseTimeString(this.defaultTime, this.format);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
this.internalValue = parseTimeString(this.value, this.format);
|
|
342
|
-
}
|
|
343
|
-
this.defaultValue = this.internalValue;
|
|
344
|
-
}
|
|
345
|
-
getHour24Picker() {
|
|
346
|
-
if (!this.is24HourClock()) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
return this.getSixTimeUnitPicker({ min: 0, max: 23, propertyName: sixTimepicker_types.SixTimePropertyName.HOURS });
|
|
350
|
-
}
|
|
351
|
-
is24HourClock() {
|
|
352
|
-
return this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_24);
|
|
353
|
-
}
|
|
354
|
-
getHour12Picker() {
|
|
355
|
-
if (!this.is12HourClock()) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
return this.getSixTimeUnitPicker({ min: 0, max: 11, propertyName: sixTimepicker_types.SixTimePropertyName.HOURS });
|
|
359
|
-
}
|
|
360
|
-
is12HourClock() {
|
|
361
|
-
return this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_12);
|
|
362
|
-
}
|
|
363
|
-
getAmPmPicker() {
|
|
364
|
-
if (!this.is12HourClock()) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
const items = ['AM', 'PM'];
|
|
368
|
-
return this.getSixTimeUnitPicker({
|
|
369
|
-
items,
|
|
370
|
-
type: types.ItemPickerType.CUSTOM,
|
|
371
|
-
propertyName: sixTimepicker_types.SixTimePropertyName.PERIOD,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
getMinutePicker() {
|
|
375
|
-
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.MINUTE)) {
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: sixTimepicker_types.SixTimePropertyName.MINUTES });
|
|
379
|
-
}
|
|
380
|
-
getSecondsPicker() {
|
|
381
|
-
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.SECOND)) {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: sixTimepicker_types.SixTimePropertyName.SECONDS });
|
|
385
|
-
}
|
|
386
|
-
getMillisecondsPicker() {
|
|
387
|
-
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.MILLISECOND)) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
return this.getSixTimeUnitPicker({
|
|
391
|
-
min: 0,
|
|
392
|
-
max: 999,
|
|
393
|
-
class: 'timepicker__item--wide',
|
|
394
|
-
paddingLength: 3,
|
|
395
|
-
propertyName: sixTimepicker_types.SixTimePropertyName.MILLISECONDS,
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
getSeparator() {
|
|
399
|
-
return (index.h("div", { class: "timepicker__separator" }, index.h("span", null, this.separator)));
|
|
400
|
-
}
|
|
401
|
-
getContent() {
|
|
402
|
-
const elementsInOrder = [
|
|
403
|
-
this.getHour24Picker(),
|
|
404
|
-
this.getHour12Picker(),
|
|
405
|
-
this.getMinutePicker(),
|
|
406
|
-
this.getSecondsPicker(),
|
|
407
|
-
this.getMillisecondsPicker(),
|
|
408
|
-
];
|
|
409
|
-
const visibleElements = elementsInOrder.filter((el) => el !== undefined);
|
|
410
|
-
return visibleElements.map((el, idx) => {
|
|
411
|
-
if (idx === visibleElements.length - 1) {
|
|
412
|
-
return [el];
|
|
413
|
-
}
|
|
414
|
-
return [el, this.getSeparator()];
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
openPopup() {
|
|
418
|
-
if (!this.open && !this.disabled) {
|
|
419
|
-
this.open = true;
|
|
420
|
-
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
closePopup() {
|
|
424
|
-
if (this.inline) {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
this.open = false;
|
|
428
|
-
this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);
|
|
429
|
-
}
|
|
430
|
-
renderClearable() {
|
|
431
|
-
return (this.clearable && (index.h("button", { slot: "suffix", class: {
|
|
432
|
-
timepicker_clear: true,
|
|
433
|
-
'timepicker_clear--right': this.iconPosition === 'left',
|
|
434
|
-
'timepicker_clear--left': this.iconPosition === 'right',
|
|
435
|
-
}, type: "button", onClick: this.handleClearClick, tabindex: "-1" }, index.h("six-icon", { size: "small" }, "clear"))));
|
|
436
|
-
}
|
|
437
|
-
renderCustomIcon() {
|
|
438
|
-
const icon = slot.hasSlot(this.host, 'custom-icon') ? (index.h("slot", { name: "custom-icon" })) : (index.h("six-icon", { size: this.size === 'large' ? 'medium' : this.size }, "watch_later"));
|
|
439
|
-
return (index.h("span", { slot: "prefix", part: "icon", class: {
|
|
440
|
-
prefix: true,
|
|
441
|
-
'prefix--right': this.iconPosition === 'right',
|
|
442
|
-
} }, icon));
|
|
443
|
-
}
|
|
444
|
-
calcIsDropDownContentUp() {
|
|
445
|
-
if (!this.inputElement || !this.wrapper) {
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
const inputBoundingRect = this.inputElement.getBoundingClientRect();
|
|
449
|
-
const wrapperBoundingRect = this.wrapper.getBoundingClientRect();
|
|
450
|
-
const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);
|
|
451
|
-
const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;
|
|
452
|
-
this.isDropDownContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;
|
|
453
|
-
}
|
|
454
|
-
/*
|
|
455
|
-
* If the popup is hoisted we popup is hoisted its position will change to fix to not be clipped of by a containing container.
|
|
456
|
-
* To render the popup correctly we render it normally, and then assign this screenposition to the fixed popup
|
|
457
|
-
*/
|
|
458
|
-
adjustPopupForHoisting() {
|
|
459
|
-
if (!this.hoist) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
// execute after dropdown has been rendered to make sure the popup reference is correctly set
|
|
463
|
-
setTimeout(() => {
|
|
464
|
-
if (!this.popup) {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
// take a snapshot of normally rendered popup
|
|
468
|
-
const popupBoundingClientRect = this.popup.getBoundingClientRect();
|
|
469
|
-
// apply screen position to fixed popup
|
|
470
|
-
this.popup.style.position = 'fixed';
|
|
471
|
-
['top', 'left', 'width', 'height'].forEach((property) => {
|
|
472
|
-
this.popup.style[property] = `${popupBoundingClientRect[property]}px`;
|
|
473
|
-
});
|
|
474
|
-
const inputBoundingClientRect = this.inputElement.getBoundingClientRect();
|
|
475
|
-
const inputTop = inputBoundingClientRect.top;
|
|
476
|
-
const popupTop = popupBoundingClientRect.top;
|
|
477
|
-
this.calcIsDropDownContentUp();
|
|
478
|
-
// check screen position to check whether the popup should be moved above or below the trigger element
|
|
479
|
-
if (this.isDropDownContentUp && inputTop < popupTop) {
|
|
480
|
-
// move popup above input field if timepicker is at bottom of screen
|
|
481
|
-
this.popup.style.top = `${popupTop - popupBoundingClientRect.height - inputBoundingClientRect.height}px`;
|
|
482
|
-
}
|
|
483
|
-
}, 0);
|
|
484
|
-
}
|
|
485
|
-
render() {
|
|
486
|
-
this.adjustPopupForHoisting();
|
|
487
|
-
return (index.h("div", { part: "container", ref: (el) => (this.wrapper = el), class: "timepicker__container" }, index.h("six-input", { ref: (el) => (this.inputElement = el), part: "input", onClick: () => this.openPopup(), value: this.value, placeholder: this.placeholder, readonly: this.readonly, disabled: this.disabled, size: this.size, name: this.name, label: this.label, required: this.required, "error-text": this.errorText, "error-on-blur": this.errorOnBlur, class: {
|
|
488
|
-
'input--empty': !this.value,
|
|
489
|
-
'input--hide': this.inline,
|
|
490
|
-
} }, this.renderCustomIcon(), this.renderClearable(), slot.hasSlot(this.host, 'error-text') ? (index.h("span", { slot: "error-text" }, index.h("slot", { name: "error-text" }))) : null, slot.hasSlot(this.host, 'label') ? (index.h("span", { slot: "label" }, index.h("slot", { name: "label" }))) : null), this.open && (index.h("div", { ref: (el) => (this.popup = el), part: "popup", class: {
|
|
491
|
-
timepicker__popup: true,
|
|
492
|
-
'timepicker__popup--is-up': this.placement ? this.placement === 'top' : this.isPopupContentUp,
|
|
493
|
-
'timepicker__popup--is-inline': this.inline,
|
|
494
|
-
} }, ...this.getContent(), this.getAmPmPicker()))));
|
|
495
|
-
}
|
|
496
|
-
get host() { return index.getElement(this); }
|
|
497
|
-
static get watchers() { return {
|
|
498
|
-
"debounce": ["debounceChanged"],
|
|
499
|
-
"value": ["valueChanged"]
|
|
500
|
-
}; }
|
|
501
|
-
};
|
|
103
|
+
const TAG = `[SIX-TIMEPICKER]`;
|
|
104
|
+
const DEBOUNCE_TIMEPICKER_LISTENER = 'debounced-timepicker';
|
|
105
|
+
const MIN_POPUP_HEIGHT = 145;
|
|
106
|
+
let SixTimepicker = class {
|
|
107
|
+
constructor(hostRef) {
|
|
108
|
+
index.registerInstance(this, hostRef);
|
|
109
|
+
this.sixChange = index.createEvent(this, "six-timepicker-change", 7);
|
|
110
|
+
this.sixChangeDebounced = index.createEvent(this, "six-timepicker-change-debounced", 7);
|
|
111
|
+
this.sixClear = index.createEvent(this, "six-timepicker-clear", 7);
|
|
112
|
+
this.eventListeners = new eventListeners.EventListeners();
|
|
113
|
+
/**
|
|
114
|
+
* Define the time format. Valid formats are:
|
|
115
|
+
*
|
|
116
|
+
* HH:mm:ss
|
|
117
|
+
* hh:mm:ss:aa
|
|
118
|
+
* HH:mm:ss:ms
|
|
119
|
+
* hh:mm:ss:ms:aa
|
|
120
|
+
* HH:mm
|
|
121
|
+
* hh:mm:aa
|
|
122
|
+
* HH
|
|
123
|
+
* hh:aa
|
|
124
|
+
* mm
|
|
125
|
+
* ss
|
|
126
|
+
* ms
|
|
127
|
+
*
|
|
128
|
+
* where HH is the 24 hour format
|
|
129
|
+
* and hh is the 12 hour format
|
|
130
|
+
*
|
|
131
|
+
* Please notice that when using the 12-hour-clock (hh)
|
|
132
|
+
* you always need a period indicator (aa). So the time can be parsed as either am or pm
|
|
133
|
+
* */
|
|
134
|
+
this.format = SixTimeFormat.HHmmss;
|
|
135
|
+
/**
|
|
136
|
+
* Define the separator to be shown between the time unit pickers.
|
|
137
|
+
* Please be aware that this property will modify the displayed separator only.
|
|
138
|
+
* The separator for a timestring is always expected to be a colon (eg. '13:52:20')
|
|
139
|
+
* */
|
|
140
|
+
this.separator = TIME_FORMAT_SEPARATOR;
|
|
141
|
+
/** Indicates whether or not the timepicker dropdown is open on startup. You can use this in lieu of the show/hide methods. */
|
|
142
|
+
this.open = false;
|
|
143
|
+
/** Indicates whether or not the timepicker should be shown as an inline (always open) component */
|
|
144
|
+
this.inline = false;
|
|
145
|
+
/**
|
|
146
|
+
* If `true` the user can only select a time via the timepicker but not directly edit the input field.
|
|
147
|
+
*/
|
|
148
|
+
this.readonly = false;
|
|
149
|
+
/**
|
|
150
|
+
* If `true` the component is disabled.
|
|
151
|
+
*/
|
|
152
|
+
this.disabled = false;
|
|
153
|
+
/** Timepicker size. */
|
|
154
|
+
this.size = 'medium';
|
|
155
|
+
/** Set to display the error text on blur and not when typing */
|
|
156
|
+
this.errorOnBlur = false;
|
|
157
|
+
/** The input's error text. Alternatively, you can use the error-text slot. */
|
|
158
|
+
this.errorText = '';
|
|
159
|
+
/** The input's label. Alternatively, you can use the label slot. */
|
|
160
|
+
this.label = '';
|
|
161
|
+
/** The input's name attribute. */
|
|
162
|
+
this.name = '';
|
|
163
|
+
/** Set to true to add a clear button when the input is populated. */
|
|
164
|
+
this.clearable = false;
|
|
165
|
+
/** Set the position of the icon */
|
|
166
|
+
this.iconPosition = 'left';
|
|
167
|
+
/**
|
|
168
|
+
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
|
169
|
+
* `overflow: auto|scroll`.
|
|
170
|
+
*/
|
|
171
|
+
this.hoist = false;
|
|
172
|
+
/**
|
|
173
|
+
* Set the amount of time, in milliseconds, to wait to trigger faster switching between timeunits (e.g. hours).
|
|
174
|
+
*/
|
|
175
|
+
this.timeout = executionControl.DEFAULT_DEBOUNCE_FAST;
|
|
176
|
+
/**
|
|
177
|
+
* Set the amount of time, in milliseconds, to wait between switching to next timeunit (e.g. next hour) when mouse button is held pressed.
|
|
178
|
+
*/
|
|
179
|
+
this.interval = executionControl.DEFAULT_DEBOUNCE_INSANELY_FAST;
|
|
180
|
+
/**
|
|
181
|
+
* Set the amount of time, in milliseconds, to wait to trigger the `six-timepicker-change-debounced` event.
|
|
182
|
+
* If you want your change debounce event to not trigger when keeping the nav button pressed before, make sure debounce
|
|
183
|
+
* is a bit bigger than timeout, otherwise keeping the button pressed will trigger the event twice: once you click
|
|
184
|
+
* (and keep pressed) and once you release
|
|
185
|
+
*/
|
|
186
|
+
this.debounce = executionControl.DEFAULT_DEBOUNCE_FAST;
|
|
187
|
+
this.isPopupContentUp = false;
|
|
188
|
+
this.isDropDownContentUp = false;
|
|
189
|
+
this.defaultValue = null;
|
|
190
|
+
this.handleInputChange = (event) => {
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
const inputValue = this.inputElement.value;
|
|
193
|
+
if (!isValidTimeString(inputValue, this.format)) {
|
|
194
|
+
this.sixChange.emit({
|
|
195
|
+
value: {},
|
|
196
|
+
valueAsString: '',
|
|
197
|
+
});
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this.internalValue = parseTimeString(inputValue, this.format);
|
|
201
|
+
this.sixChange.emit({
|
|
202
|
+
value: this.internalValue,
|
|
203
|
+
valueAsString: createTimeString(this.internalValue, this.format),
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
this.handleSixTimepickerChangeDebounced = ({ detail }) => {
|
|
207
|
+
this.sixChangeDebounced.emit(detail);
|
|
208
|
+
};
|
|
209
|
+
this.handleChange = (event, property) => {
|
|
210
|
+
// stop propagation, since the timepicker should not expose the events of the underlying item-picker
|
|
211
|
+
event.stopPropagation();
|
|
212
|
+
// update the internal state
|
|
213
|
+
this.internalValue[property] = event.detail;
|
|
214
|
+
const timeString = createTimeString(this.internalValue, this.format);
|
|
215
|
+
// fire timepicker's own event
|
|
216
|
+
this.sixChange.emit({
|
|
217
|
+
changedProperty: property,
|
|
218
|
+
value: this.internalValue,
|
|
219
|
+
valueAsString: timeString,
|
|
220
|
+
});
|
|
221
|
+
// update the input value
|
|
222
|
+
this.value = timeString;
|
|
223
|
+
};
|
|
224
|
+
this.handleDocumentMouseDown = (event) => {
|
|
225
|
+
// Close when clicking outside of the containing element
|
|
226
|
+
const path = event.composedPath();
|
|
227
|
+
if (!path.includes(this.host)) {
|
|
228
|
+
this.closePopup();
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
this.handleClearClick = (event) => {
|
|
233
|
+
event.stopPropagation();
|
|
234
|
+
this.value = undefined;
|
|
235
|
+
this.sixClear.emit();
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async resizeHandler() {
|
|
239
|
+
this.calcIsPopupContentUp();
|
|
240
|
+
this.moveOpenHoistedPopup();
|
|
241
|
+
}
|
|
242
|
+
async scrollHandler() {
|
|
243
|
+
this.calcIsPopupContentUp();
|
|
244
|
+
this.moveOpenHoistedPopup();
|
|
245
|
+
}
|
|
246
|
+
debounceChanged() {
|
|
247
|
+
this.eventListeners.removeByIdentifier(DEBOUNCE_TIMEPICKER_LISTENER);
|
|
248
|
+
this.eventListeners.add(this.host, 'six-timepicker-change', executionControl.debounce(this.handleSixTimepickerChangeDebounced, this.debounce), DEBOUNCE_TIMEPICKER_LISTENER);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Update the native input element when the value changes
|
|
252
|
+
*/
|
|
253
|
+
valueChanged(newValue) {
|
|
254
|
+
if (this.value !== newValue) {
|
|
255
|
+
this.value = newValue;
|
|
256
|
+
}
|
|
257
|
+
this.setupInternalTime();
|
|
258
|
+
this.sixChange.emit({
|
|
259
|
+
value: this.internalValue,
|
|
260
|
+
valueAsString: createTimeString(this.internalValue, this.format),
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
264
|
+
async reportValidity() {
|
|
265
|
+
return this.inputElement.reportValidity();
|
|
266
|
+
}
|
|
267
|
+
/** Checks for validity. */
|
|
268
|
+
async checkValidity() {
|
|
269
|
+
return this.inputElement.checkValidity();
|
|
270
|
+
}
|
|
271
|
+
/** Sets a custom validation message. If `message` is not empty, the field will be considered invalid. */
|
|
272
|
+
async setCustomValidity(message) {
|
|
273
|
+
await this.inputElement.setCustomValidity(message);
|
|
274
|
+
}
|
|
275
|
+
/** Resets the formcontrol */
|
|
276
|
+
async reset() {
|
|
277
|
+
this.internalValue = this.defaultValue;
|
|
278
|
+
this.inputElement.value = createTimeString(this.internalValue, this.format);
|
|
279
|
+
await this.inputElement.reset();
|
|
280
|
+
}
|
|
281
|
+
componentWillLoad() {
|
|
282
|
+
this.setupInternalTime();
|
|
283
|
+
if (this.inline) {
|
|
284
|
+
this.open = true;
|
|
285
|
+
}
|
|
286
|
+
if (this.open) {
|
|
287
|
+
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
componentDidLoad() {
|
|
291
|
+
this.eventListeners.add(this.host, 'six-timepicker-change', executionControl.debounce(this.handleSixTimepickerChangeDebounced, this.debounce), DEBOUNCE_TIMEPICKER_LISTENER);
|
|
292
|
+
this.eventListeners.add(this.inputElement, 'six-input-input', executionControl.debounce(this.handleInputChange, this.debounce));
|
|
293
|
+
}
|
|
294
|
+
disconnectedCallback() {
|
|
295
|
+
this.eventListeners.removeAll();
|
|
296
|
+
}
|
|
297
|
+
calcIsPopupContentUp() {
|
|
298
|
+
if (!this.inputElement || !this.wrapper) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const inputBoundingRect = this.inputElement.getBoundingClientRect();
|
|
302
|
+
const wrapperBoundingRect = this.wrapper.getBoundingClientRect();
|
|
303
|
+
const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);
|
|
304
|
+
const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;
|
|
305
|
+
this.isPopupContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;
|
|
306
|
+
}
|
|
307
|
+
/*
|
|
308
|
+
* The position of the hoisted timepicker needs to be correctly calculated since the position changes to fixed.
|
|
309
|
+
* Thus if the user scrolls or adjusts the screen size we need to recalculate the timepicker position.
|
|
310
|
+
*/
|
|
311
|
+
moveOpenHoistedPopup() {
|
|
312
|
+
if (!this.hoist || !this.open) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const popupBoundingClientRect = this.popup.getBoundingClientRect();
|
|
316
|
+
const popupHeight = popupBoundingClientRect.height;
|
|
317
|
+
const inputBoundingClientRect = this.inputElement.getBoundingClientRect();
|
|
318
|
+
const inputTop = inputBoundingClientRect.top;
|
|
319
|
+
const inputHeight = inputBoundingClientRect.height;
|
|
320
|
+
this.calcIsPopupContentUp();
|
|
321
|
+
if (this.isPopupContentUp) {
|
|
322
|
+
this.popup.style.top = `${inputTop - popupHeight}px`;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
this.popup.style.top = `${inputTop + inputHeight}px`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
getSixTimeUnitPicker(params) {
|
|
329
|
+
return (index.h("six-item-picker", { class: params.class, timeout: this.timeout, interval: this.interval, padded: true, min: params.min, max: params.max, value: this.internalValue[params.propertyName], items: params.items, type: params.type || types.ItemPickerType.NUMBER, "padding-length": params.paddingLength, "onSix-item-picker-change": (event) => this.handleChange(event, params.propertyName) }));
|
|
330
|
+
}
|
|
331
|
+
setupInternalTime() {
|
|
332
|
+
if (this.is12HourClock() && !this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.PERIOD)) {
|
|
333
|
+
console.error(`${TAG} You provided a 12-hour-clock format but are missing the period (am or pm) in the time-format-string!`);
|
|
334
|
+
}
|
|
335
|
+
if (this.value === null || this.value === undefined) {
|
|
336
|
+
this.internalValue = sixTimepicker_types.isNil(this.defaultTime)
|
|
337
|
+
? getCurrentTime(this.is24HourClock())
|
|
338
|
+
: parseTimeString(this.defaultTime, this.format);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
this.internalValue = parseTimeString(this.value, this.format);
|
|
342
|
+
}
|
|
343
|
+
this.defaultValue = this.internalValue;
|
|
344
|
+
}
|
|
345
|
+
getHour24Picker() {
|
|
346
|
+
if (!this.is24HourClock()) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
return this.getSixTimeUnitPicker({ min: 0, max: 23, propertyName: sixTimepicker_types.SixTimePropertyName.HOURS });
|
|
350
|
+
}
|
|
351
|
+
is24HourClock() {
|
|
352
|
+
return this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_24);
|
|
353
|
+
}
|
|
354
|
+
getHour12Picker() {
|
|
355
|
+
if (!this.is12HourClock()) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
return this.getSixTimeUnitPicker({ min: 0, max: 11, propertyName: sixTimepicker_types.SixTimePropertyName.HOURS });
|
|
359
|
+
}
|
|
360
|
+
is12HourClock() {
|
|
361
|
+
return this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.HOUR_12);
|
|
362
|
+
}
|
|
363
|
+
getAmPmPicker() {
|
|
364
|
+
if (!this.is12HourClock()) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const items = ['AM', 'PM'];
|
|
368
|
+
return this.getSixTimeUnitPicker({
|
|
369
|
+
items,
|
|
370
|
+
type: types.ItemPickerType.CUSTOM,
|
|
371
|
+
propertyName: sixTimepicker_types.SixTimePropertyName.PERIOD,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
getMinutePicker() {
|
|
375
|
+
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.MINUTE)) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: sixTimepicker_types.SixTimePropertyName.MINUTES });
|
|
379
|
+
}
|
|
380
|
+
getSecondsPicker() {
|
|
381
|
+
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.SECOND)) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
return this.getSixTimeUnitPicker({ min: 0, max: 59, propertyName: sixTimepicker_types.SixTimePropertyName.SECONDS });
|
|
385
|
+
}
|
|
386
|
+
getMillisecondsPicker() {
|
|
387
|
+
if (!this.format.includes(sixTimepicker_types.TIME_FORMAT_CHAR.MILLISECOND)) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
return this.getSixTimeUnitPicker({
|
|
391
|
+
min: 0,
|
|
392
|
+
max: 999,
|
|
393
|
+
class: 'timepicker__item--wide',
|
|
394
|
+
paddingLength: 3,
|
|
395
|
+
propertyName: sixTimepicker_types.SixTimePropertyName.MILLISECONDS,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
getSeparator() {
|
|
399
|
+
return (index.h("div", { class: "timepicker__separator" }, index.h("span", null, this.separator)));
|
|
400
|
+
}
|
|
401
|
+
getContent() {
|
|
402
|
+
const elementsInOrder = [
|
|
403
|
+
this.getHour24Picker(),
|
|
404
|
+
this.getHour12Picker(),
|
|
405
|
+
this.getMinutePicker(),
|
|
406
|
+
this.getSecondsPicker(),
|
|
407
|
+
this.getMillisecondsPicker(),
|
|
408
|
+
];
|
|
409
|
+
const visibleElements = elementsInOrder.filter((el) => el !== undefined);
|
|
410
|
+
return visibleElements.map((el, idx) => {
|
|
411
|
+
if (idx === visibleElements.length - 1) {
|
|
412
|
+
return [el];
|
|
413
|
+
}
|
|
414
|
+
return [el, this.getSeparator()];
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
openPopup() {
|
|
418
|
+
if (!this.open && !this.disabled) {
|
|
419
|
+
this.open = true;
|
|
420
|
+
this.eventListeners.add(document, 'mousedown', this.handleDocumentMouseDown);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
closePopup() {
|
|
424
|
+
if (this.inline) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
this.open = false;
|
|
428
|
+
this.eventListeners.remove(document, 'mousedown', this.handleDocumentMouseDown);
|
|
429
|
+
}
|
|
430
|
+
renderClearable() {
|
|
431
|
+
return (this.clearable && (index.h("button", { slot: "suffix", class: {
|
|
432
|
+
timepicker_clear: true,
|
|
433
|
+
'timepicker_clear--right': this.iconPosition === 'left',
|
|
434
|
+
'timepicker_clear--left': this.iconPosition === 'right',
|
|
435
|
+
}, type: "button", onClick: this.handleClearClick, tabindex: "-1" }, index.h("six-icon", { size: "small" }, "clear"))));
|
|
436
|
+
}
|
|
437
|
+
renderCustomIcon() {
|
|
438
|
+
const icon = slot.hasSlot(this.host, 'custom-icon') ? (index.h("slot", { name: "custom-icon" })) : (index.h("six-icon", { size: this.size === 'large' ? 'medium' : this.size }, "watch_later"));
|
|
439
|
+
return (index.h("span", { slot: "prefix", part: "icon", class: {
|
|
440
|
+
prefix: true,
|
|
441
|
+
'prefix--right': this.iconPosition === 'right',
|
|
442
|
+
} }, icon));
|
|
443
|
+
}
|
|
444
|
+
calcIsDropDownContentUp() {
|
|
445
|
+
if (!this.inputElement || !this.wrapper) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const inputBoundingRect = this.inputElement.getBoundingClientRect();
|
|
449
|
+
const wrapperBoundingRect = this.wrapper.getBoundingClientRect();
|
|
450
|
+
const minPopupHeight = Math.max(wrapperBoundingRect.height, MIN_POPUP_HEIGHT);
|
|
451
|
+
const moreSpaceInTop = inputBoundingRect.y > window.innerHeight / 2;
|
|
452
|
+
this.isDropDownContentUp = moreSpaceInTop && window.innerHeight < inputBoundingRect.bottom + minPopupHeight;
|
|
453
|
+
}
|
|
454
|
+
/*
|
|
455
|
+
* If the popup is hoisted we popup is hoisted its position will change to fix to not be clipped of by a containing container.
|
|
456
|
+
* To render the popup correctly we render it normally, and then assign this screenposition to the fixed popup
|
|
457
|
+
*/
|
|
458
|
+
adjustPopupForHoisting() {
|
|
459
|
+
if (!this.hoist) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
// execute after dropdown has been rendered to make sure the popup reference is correctly set
|
|
463
|
+
setTimeout(() => {
|
|
464
|
+
if (!this.popup) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
// take a snapshot of normally rendered popup
|
|
468
|
+
const popupBoundingClientRect = this.popup.getBoundingClientRect();
|
|
469
|
+
// apply screen position to fixed popup
|
|
470
|
+
this.popup.style.position = 'fixed';
|
|
471
|
+
['top', 'left', 'width', 'height'].forEach((property) => {
|
|
472
|
+
this.popup.style[property] = `${popupBoundingClientRect[property]}px`;
|
|
473
|
+
});
|
|
474
|
+
const inputBoundingClientRect = this.inputElement.getBoundingClientRect();
|
|
475
|
+
const inputTop = inputBoundingClientRect.top;
|
|
476
|
+
const popupTop = popupBoundingClientRect.top;
|
|
477
|
+
this.calcIsDropDownContentUp();
|
|
478
|
+
// check screen position to check whether the popup should be moved above or below the trigger element
|
|
479
|
+
if (this.isDropDownContentUp && inputTop < popupTop) {
|
|
480
|
+
// move popup above input field if timepicker is at bottom of screen
|
|
481
|
+
this.popup.style.top = `${popupTop - popupBoundingClientRect.height - inputBoundingClientRect.height}px`;
|
|
482
|
+
}
|
|
483
|
+
}, 0);
|
|
484
|
+
}
|
|
485
|
+
render() {
|
|
486
|
+
this.adjustPopupForHoisting();
|
|
487
|
+
return (index.h("div", { part: "container", ref: (el) => (this.wrapper = el), class: "timepicker__container" }, index.h("six-input", { ref: (el) => (this.inputElement = el), part: "input", onClick: () => this.openPopup(), value: this.value, placeholder: this.placeholder, readonly: this.readonly, disabled: this.disabled, size: this.size, name: this.name, label: this.label, required: this.required, "error-text": this.errorText, "error-on-blur": this.errorOnBlur, class: {
|
|
488
|
+
'input--empty': !this.value,
|
|
489
|
+
'input--hide': this.inline,
|
|
490
|
+
} }, this.renderCustomIcon(), this.renderClearable(), slot.hasSlot(this.host, 'error-text') ? (index.h("span", { slot: "error-text" }, index.h("slot", { name: "error-text" }))) : null, slot.hasSlot(this.host, 'label') ? (index.h("span", { slot: "label" }, index.h("slot", { name: "label" }))) : null), this.open && (index.h("div", { ref: (el) => (this.popup = el), part: "popup", class: {
|
|
491
|
+
timepicker__popup: true,
|
|
492
|
+
'timepicker__popup--is-up': this.placement ? this.placement === 'top' : this.isPopupContentUp,
|
|
493
|
+
'timepicker__popup--is-inline': this.inline,
|
|
494
|
+
} }, ...this.getContent(), this.getAmPmPicker()))));
|
|
495
|
+
}
|
|
496
|
+
get host() { return index.getElement(this); }
|
|
497
|
+
static get watchers() { return {
|
|
498
|
+
"debounce": ["debounceChanged"],
|
|
499
|
+
"value": ["valueChanged"]
|
|
500
|
+
}; }
|
|
501
|
+
};
|
|
502
502
|
SixTimepicker.style = sixTimepickerCss;
|
|
503
503
|
|
|
504
504
|
exports.six_timepicker = SixTimepicker;
|