@energinet/watt 2.0.13 → 2.1.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/badge/energinet-watt-badge.d.ts +5 -0
- package/breadcrumbs/energinet-watt-breadcrumbs.d.ts +5 -0
- package/button/energinet-watt-button.d.ts +5 -0
- package/card/energinet-watt-card.d.ts +5 -0
- package/checkbox/energinet-watt-checkbox.d.ts +5 -0
- package/chip/energinet-watt-chip.d.ts +5 -0
- package/clipboard/energinet-watt-clipboard.d.ts +5 -0
- package/code/energinet-watt-code.d.ts +5 -0
- package/core/breakpoints/breakpoints-observer.d.ts +1 -19
- package/core/breakpoints/energinet-watt-core-breakpoints.d.ts +5 -0
- package/core/color/color-helper.service.d.ts +2 -4
- package/core/color/energinet-watt-core-color.d.ts +5 -0
- package/core/date/energinet-watt-core-date.d.ts +5 -0
- package/core/date/watt-locale.service.d.ts +1 -3
- package/data/energinet-watt-data.d.ts +5 -0
- package/datetime-field/energinet-watt-datetime-field.d.ts +5 -0
- package/description-list/energinet-watt-description-list.d.ts +5 -0
- package/drawer/energinet-watt-drawer.d.ts +5 -0
- package/dropdown/energinet-watt-dropdown.d.ts +5 -0
- package/dropzone/energinet-watt-dropzone.d.ts +5 -0
- package/empty-state/energinet-watt-empty-state.d.ts +5 -0
- package/energinet-watt.d.ts +5 -0
- package/esm2022/badge/energinet-watt-badge.js +5 -0
- package/esm2022/badge/index.js +20 -0
- package/{fesm2022/energinet-watt-badge.mjs → esm2022/badge/watt-badge.component.js} +7 -33
- package/esm2022/breadcrumbs/energinet-watt-breadcrumbs.js +5 -0
- package/esm2022/breadcrumbs/index.js +20 -0
- package/esm2022/breadcrumbs/watt-breadcrumbs.component.js +90 -0
- package/esm2022/button/energinet-watt-button.js +5 -0
- package/esm2022/button/index.js +20 -0
- package/{fesm2022/energinet-watt-button.mjs → esm2022/button/watt-button.component.js} +14 -40
- package/esm2022/card/energinet-watt-card.js +5 -0
- package/esm2022/card/index.js +21 -0
- package/esm2022/card/watt-card-title.component.js +33 -0
- package/esm2022/card/watt-card.component.js +61 -0
- package/esm2022/checkbox/energinet-watt-checkbox.js +5 -0
- package/esm2022/checkbox/index.js +20 -0
- package/{fesm2022/energinet-watt-checkbox.mjs → esm2022/checkbox/watt-checkbox.component.js} +9 -35
- package/esm2022/chip/energinet-watt-chip.js +5 -0
- package/esm2022/chip/index.js +26 -0
- package/esm2022/chip/watt-action-chip.component.js +68 -0
- package/esm2022/chip/watt-chip.component.js +55 -0
- package/esm2022/chip/watt-chip.directive.js +92 -0
- package/esm2022/chip/watt-date-chip.component.js +118 -0
- package/esm2022/chip/watt-date-range-chip.component.js +240 -0
- package/esm2022/chip/watt-filter-chip.component.js +94 -0
- package/esm2022/chip/watt-menu-chip.component.js +95 -0
- package/esm2022/clipboard/energinet-watt-clipboard.js +5 -0
- package/esm2022/clipboard/index.js +21 -0
- package/esm2022/clipboard/watt-clipboard-intl.service.js +31 -0
- package/esm2022/clipboard/watt-copy-to-clipboard.directive.js +64 -0
- package/esm2022/code/energinet-watt-code.js +5 -0
- package/esm2022/code/index.js +21 -0
- package/esm2022/code/watt-code.component.js +74 -0
- package/esm2022/code/watt-code.worker.token.js +21 -0
- package/esm2022/core/breakpoints/breakpoints-observer.js +41 -0
- package/esm2022/core/breakpoints/breakpoints.js +31 -0
- package/esm2022/core/breakpoints/energinet-watt-core-breakpoints.js +5 -0
- package/esm2022/core/breakpoints/index.js +21 -0
- package/esm2022/core/color/color-helper.service.js +41 -0
- package/esm2022/core/color/colors.js +58 -0
- package/esm2022/core/color/energinet-watt-core-color.js +5 -0
- package/esm2022/core/color/index.js +21 -0
- package/esm2022/core/date/dayjs.js +34 -0
- package/esm2022/core/date/energinet-watt-core-date.js +5 -0
- package/esm2022/core/date/index.js +25 -0
- package/esm2022/core/date/watt-danish-datetime.providers.js +31 -0
- package/esm2022/core/date/watt-date-adapter.js +43 -0
- package/esm2022/core/date/watt-date-range.js +2 -0
- package/esm2022/core/date/watt-date.pipe.js +38 -0
- package/esm2022/core/date/watt-format-date.js +50 -0
- package/esm2022/core/date/watt-locale.service.js +48 -0
- package/esm2022/data/energinet-watt-data.js +5 -0
- package/esm2022/data/index.js +23 -0
- package/esm2022/data/watt-data-actions.component.js +32 -0
- package/esm2022/data/watt-data-filters.component.js +32 -0
- package/esm2022/data/watt-data-intl.service.js +39 -0
- package/{fesm2022/energinet-watt-data.mjs → esm2022/data/watt-data-table.component.js} +15 -137
- package/esm2022/datetime-field/energinet-watt-datetime-field.js +5 -0
- package/esm2022/datetime-field/index.js +20 -0
- package/esm2022/datetime-field/watt-datetime-field.component.js +207 -0
- package/esm2022/description-list/energinet-watt-description-list.js +5 -0
- package/esm2022/description-list/index.js +20 -0
- package/esm2022/description-list/watt-description-list-item.component.js +49 -0
- package/{fesm2022/energinet-watt-description-list.mjs → esm2022/description-list/watt-description-list.component.js} +10 -79
- package/esm2022/drawer/energinet-watt-drawer.js +5 -0
- package/esm2022/drawer/index.js +24 -0
- package/esm2022/drawer/watt-drawer-actions.component.js +29 -0
- package/esm2022/drawer/watt-drawer-content.component.js +29 -0
- package/esm2022/drawer/watt-drawer-heading.component.js +29 -0
- package/esm2022/drawer/watt-drawer-topbar.component.js +29 -0
- package/esm2022/drawer/watt-drawer.component.js +177 -0
- package/esm2022/dropdown/energinet-watt-dropdown.js +5 -0
- package/esm2022/dropdown/index.js +20 -0
- package/esm2022/dropdown/watt-dropdown-option.js +2 -0
- package/esm2022/dropdown/watt-dropdown-value.js +2 -0
- package/esm2022/dropdown/watt-dropdown.component.js +396 -0
- package/esm2022/dropzone/energinet-watt-dropzone.js +5 -0
- package/esm2022/dropzone/index.js +22 -0
- package/esm2022/dropzone/watt-dropzone-intl.js +35 -0
- package/esm2022/dropzone/watt-dropzone-validators.js +67 -0
- package/esm2022/dropzone/watt-dropzone.js +179 -0
- package/esm2022/empty-state/energinet-watt-empty-state.js +5 -0
- package/esm2022/empty-state/icons/explore.js +54 -0
- package/esm2022/empty-state/icons/no-results.js +62 -0
- package/esm2022/empty-state/icons/power.js +46 -0
- package/esm2022/empty-state/index.js +23 -0
- package/esm2022/empty-state/watt-empty-state.component.js +120 -0
- package/esm2022/energinet-watt.js +5 -0
- package/esm2022/expandable-card/energinet-watt-expandable-card.js +5 -0
- package/esm2022/expandable-card/index.js +26 -0
- package/{fesm2022/energinet-watt-expandable-card.mjs → esm2022/expandable-card/watt-expandable-card.component.js} +18 -49
- package/esm2022/expansion/energinet-watt-expansion.js +5 -0
- package/{fesm2022/energinet-watt-expansion.mjs → esm2022/expansion/expansion.component.js} +10 -36
- package/esm2022/expansion/index.js +20 -0
- package/esm2022/field/energinet-watt-field.js +5 -0
- package/esm2022/field/index.js +23 -0
- package/esm2022/field/watt-field-error.component.js +29 -0
- package/esm2022/field/watt-field-hint.component.js +29 -0
- package/esm2022/field/watt-field-intl.service.js +32 -0
- package/{fesm2022/energinet-watt-field.mjs → esm2022/field/watt-field.component.js} +17 -125
- package/esm2022/icon/energinet-watt-icon.js +5 -0
- package/esm2022/icon/flags/energinet-watt-icon-flags.js +5 -0
- package/esm2022/icon/flags/index.js +26 -0
- package/esm2022/icon/flags/watt-flag-ch.js +52 -0
- package/esm2022/icon/flags/watt-flag-de.js +44 -0
- package/esm2022/icon/flags/watt-flag-dk.js +44 -0
- package/esm2022/icon/flags/watt-flag-fi.js +44 -0
- package/esm2022/icon/flags/watt-flag-nl.js +44 -0
- package/esm2022/icon/flags/watt-flag-no.js +48 -0
- package/esm2022/icon/flags/watt-flag-pl.js +46 -0
- package/esm2022/icon/flags/watt-flag-se.js +42 -0
- package/esm2022/icon/flags/watt-flag.js +116 -0
- package/{fesm2022/energinet-watt-icon.mjs → esm2022/icon/icon.component.js} +9 -131
- package/esm2022/icon/icons.js +97 -0
- package/esm2022/icon/index.js +20 -0
- package/esm2022/index.js +25 -0
- package/esm2022/modal/energinet-watt-modal.js +5 -0
- package/esm2022/modal/index.js +21 -0
- package/{fesm2022/energinet-watt-modal.mjs → esm2022/modal/watt-modal.component.js} +19 -127
- package/esm2022/modal/watt-modal.service.js +86 -0
- package/esm2022/paginator/energinet-watt-paginator.js +5 -0
- package/esm2022/paginator/index.js +21 -0
- package/esm2022/paginator/watt-paginator-intl.service.js +38 -0
- package/esm2022/paginator/watt-paginator.component.js +104 -0
- package/esm2022/phone-field/energinet-watt-phone-field.js +5 -0
- package/esm2022/phone-field/index.js +21 -0
- package/esm2022/phone-field/watt-phone-field-intl.service.js +40 -0
- package/esm2022/phone-field/watt-phone-field.component.js +262 -0
- package/esm2022/picker/__shared/energinet-watt-picker-__shared.js +5 -0
- package/esm2022/picker/__shared/index.js +21 -0
- package/esm2022/picker/__shared/placeholder-mask/watt-placeholder-mask.component.js +71 -0
- package/esm2022/picker/__shared/watt-picker-base.js +292 -0
- package/esm2022/picker/__shared/watt-picker-value.js +2 -0
- package/esm2022/picker/datepicker/energinet-watt-picker-datepicker.js +5 -0
- package/esm2022/picker/datepicker/index.js +22 -0
- package/esm2022/picker/datepicker/watt-datepicker-intl.service.js +31 -0
- package/esm2022/picker/datepicker/watt-datepicker.component.js +422 -0
- package/esm2022/picker/timepicker/energinet-watt-picker-timepicker.js +5 -0
- package/esm2022/picker/timepicker/index.js +20 -0
- package/esm2022/picker/timepicker/maskito-time-range-mask.js +81 -0
- package/esm2022/picker/timepicker/watt-timepicker.component.js +288 -0
- package/esm2022/progress-tracker/energinet-watt-progress-tracker.js +5 -0
- package/esm2022/progress-tracker/index.js +27 -0
- package/{fesm2022/energinet-watt-progress-tracker.mjs → esm2022/progress-tracker/watt-progress-tracker-step.component.js} +9 -67
- package/esm2022/progress-tracker/watt-progress-tracker.component.js +30 -0
- package/esm2022/query-params/energinet-watt-query-params.js +5 -0
- package/esm2022/query-params/index.js +20 -0
- package/esm2022/query-params/watt-query-params.directive.js +91 -0
- package/esm2022/radio/energinet-watt-radio.js +5 -0
- package/esm2022/radio/index.js +20 -0
- package/{fesm2022/energinet-watt-radio.mjs → esm2022/radio/watt-radio.component.js} +9 -35
- package/esm2022/search/energinet-watt-search.js +5 -0
- package/esm2022/search/index.js +20 -0
- package/{fesm2022/energinet-watt-search.mjs → esm2022/search/watt-search.component.js} +10 -36
- package/esm2022/segmented-buttons/energinet-watt-segmented-buttons.js +5 -0
- package/esm2022/segmented-buttons/index.js +21 -0
- package/esm2022/segmented-buttons/watt-segmented-button.component.js +38 -0
- package/esm2022/segmented-buttons/watt-segmented-buttons.component.js +88 -0
- package/esm2022/shell/energinet-watt-shell.js +5 -0
- package/esm2022/shell/index.js +21 -0
- package/esm2022/shell/nav-list/index.js +21 -0
- package/esm2022/shell/nav-list/watt-expand-on-active-link.directive.js +45 -0
- package/esm2022/shell/nav-list/watt-nav-list-item.component.js +84 -0
- package/esm2022/shell/nav-list/watt-nav-list.component.js +81 -0
- package/esm2022/shell/shell.component.js +75 -0
- package/esm2022/slide-toggle/energinet-watt-slide-toggle.js +5 -0
- package/esm2022/slide-toggle/index.js +20 -0
- package/esm2022/slide-toggle/watt-slide-toggle.component.js +78 -0
- package/esm2022/slider/energinet-watt-slider.js +5 -0
- package/esm2022/slider/index.js +20 -0
- package/esm2022/slider/watt-slider.component.js +133 -0
- package/esm2022/spinner/energinet-watt-spinner.js +5 -0
- package/esm2022/spinner/index.js +20 -0
- package/esm2022/spinner/watt-spinner.component.js +46 -0
- package/esm2022/stepper/energinet-watt-stepper.js +5 -0
- package/esm2022/stepper/index.js +21 -0
- package/esm2022/stepper/watt-stepper-step.component.js +52 -0
- package/{fesm2022/energinet-watt-stepper.mjs → esm2022/stepper/watt-stepper.component.js} +18 -91
- package/esm2022/table/energinet-watt-table.js +5 -0
- package/esm2022/table/index.js +21 -0
- package/esm2022/table/watt-table-data-source.js +17 -0
- package/esm2022/table/watt-table.component.js +400 -0
- package/esm2022/tabs/energinet-watt-tabs.js +5 -0
- package/esm2022/tabs/index.js +31 -0
- package/esm2022/tabs/watt-link-tab.component.js +34 -0
- package/esm2022/tabs/watt-link-tabs.component.js +71 -0
- package/esm2022/tabs/watt-tab.component.js +42 -0
- package/esm2022/tabs/watt-tabs-action.component.js +32 -0
- package/esm2022/tabs/watt-tabs.component.js +60 -0
- package/esm2022/text-field/energinet-watt-text-field.js +5 -0
- package/esm2022/text-field/index.js +20 -0
- package/esm2022/text-field/watt-text-field.component.js +289 -0
- package/esm2022/textarea-field/energinet-watt-textarea-field.js +5 -0
- package/esm2022/textarea-field/index.js +20 -0
- package/esm2022/textarea-field/watt-textarea-field.component.js +110 -0
- package/esm2022/toast/energinet-watt-toast.js +5 -0
- package/esm2022/toast/index.js +21 -0
- package/esm2022/toast/watt-toast.component.js +97 -0
- package/esm2022/toast/watt-toast.service.js +51 -0
- package/esm2022/tooltip/energinet-watt-tooltip.js +5 -0
- package/esm2022/tooltip/index.js +20 -0
- package/esm2022/tooltip/watt-tooltip.component.js +131 -0
- package/esm2022/tooltip/watt-tooltip.directive.js +60 -0
- package/esm2022/utils/css/css-custom-properties.service.js +39 -0
- package/esm2022/utils/css/energinet-watt-utils-css.js +5 -0
- package/esm2022/utils/css/index.js +20 -0
- package/esm2022/utils/intersection-observer/energinet-watt-utils-intersection-observer.js +5 -0
- package/esm2022/utils/intersection-observer/index.js +20 -0
- package/esm2022/utils/intersection-observer/watt-intersection-observer.service.js +57 -0
- package/esm2022/utils/resize-observer/energinet-watt-utils-resize-observer.js +5 -0
- package/esm2022/utils/resize-observer/index.js +21 -0
- package/esm2022/utils/resize-observer/watt-resize-observer.directive.js +53 -0
- package/esm2022/utils/resize-observer/watt-resize-observer.service.js +67 -0
- package/esm2022/validation-message/energinet-watt-validation-message.js +5 -0
- package/esm2022/validation-message/index.js +20 -0
- package/{fesm2022/energinet-watt-validation-message.mjs → esm2022/validation-message/watt-validation-message.component.js} +8 -34
- package/esm2022/validators/energinet-watt-validators.js +5 -0
- package/esm2022/validators/index.js +20 -0
- package/esm2022/validators/watt-range.validators.js +23 -0
- package/esm2022/vater/energinet-watt-vater.js +5 -0
- package/esm2022/vater/index.js +24 -0
- package/esm2022/vater/types.js +20 -0
- package/esm2022/vater/vater-flex.component.js +49 -0
- package/esm2022/vater/vater-layout.directive.js +65 -0
- package/esm2022/vater/vater-spacer.component.js +29 -0
- package/esm2022/vater/vater-stack.component.js +42 -0
- package/esm2022/vater/vater-utility.directive.js +53 -0
- package/esm2022/year-field/energinet-watt-year-field.js +5 -0
- package/esm2022/year-field/index.js +20 -0
- package/esm2022/year-field/watt-year-field.component.js +256 -0
- package/esm2022/yearmonth-field/energinet-watt-yearmonth-field.js +5 -0
- package/esm2022/yearmonth-field/index.js +21 -0
- package/esm2022/yearmonth-field/watt-yearmonth-field.component.js +258 -0
- package/esm2022/yearmonth-field/year-month.js +42 -0
- package/expandable-card/energinet-watt-expandable-card.d.ts +5 -0
- package/expansion/energinet-watt-expansion.d.ts +5 -0
- package/field/energinet-watt-field.d.ts +5 -0
- package/icon/energinet-watt-icon.d.ts +5 -0
- package/icon/flags/energinet-watt-icon-flags.d.ts +5 -0
- package/modal/energinet-watt-modal.d.ts +5 -0
- package/package.json +117 -117
- package/paginator/energinet-watt-paginator.d.ts +5 -0
- package/phone-field/energinet-watt-phone-field.d.ts +5 -0
- package/picker/__shared/energinet-watt-picker-__shared.d.ts +5 -0
- package/picker/__shared/watt-picker-base.d.ts +4 -1
- package/picker/datepicker/energinet-watt-picker-datepicker.d.ts +5 -0
- package/picker/timepicker/energinet-watt-picker-timepicker.d.ts +5 -0
- package/progress-tracker/energinet-watt-progress-tracker.d.ts +5 -0
- package/query-params/energinet-watt-query-params.d.ts +5 -0
- package/radio/energinet-watt-radio.d.ts +5 -0
- package/search/energinet-watt-search.d.ts +5 -0
- package/segmented-buttons/energinet-watt-segmented-buttons.d.ts +5 -0
- package/shell/energinet-watt-shell.d.ts +5 -0
- package/slide-toggle/energinet-watt-slide-toggle.d.ts +5 -0
- package/slider/energinet-watt-slider.d.ts +5 -0
- package/spinner/energinet-watt-spinner.d.ts +5 -0
- package/stepper/energinet-watt-stepper.d.ts +5 -0
- package/table/energinet-watt-table.d.ts +5 -0
- package/tabs/energinet-watt-tabs.d.ts +5 -0
- package/text-field/energinet-watt-text-field.d.ts +5 -0
- package/textarea-field/energinet-watt-textarea-field.d.ts +5 -0
- package/toast/energinet-watt-toast.d.ts +5 -0
- package/toast/watt-toast.service.d.ts +2 -3
- package/tooltip/energinet-watt-tooltip.d.ts +5 -0
- package/utils/css/css-custom-properties.service.d.ts +1 -2
- package/utils/css/energinet-watt-utils-css.d.ts +5 -0
- package/utils/intersection-observer/energinet-watt-utils-intersection-observer.d.ts +5 -0
- package/utils/resize-observer/energinet-watt-utils-resize-observer.d.ts +5 -0
- package/utils/resize-observer/watt-resize-observer.service.d.ts +2 -19
- package/validation-message/energinet-watt-validation-message.d.ts +5 -0
- package/validators/energinet-watt-validators.d.ts +5 -0
- package/vater/energinet-watt-vater.d.ts +5 -0
- package/year-field/energinet-watt-year-field.d.ts +5 -0
- package/yearmonth-field/energinet-watt-yearmonth-field.d.ts +5 -0
- package/fesm2022/energinet-watt-badge.mjs.map +0 -1
- package/fesm2022/energinet-watt-breadcrumbs.mjs +0 -116
- package/fesm2022/energinet-watt-breadcrumbs.mjs.map +0 -1
- package/fesm2022/energinet-watt-button.mjs.map +0 -1
- package/fesm2022/energinet-watt-card.mjs +0 -117
- package/fesm2022/energinet-watt-card.mjs.map +0 -1
- package/fesm2022/energinet-watt-checkbox.mjs.map +0 -1
- package/fesm2022/energinet-watt-chip.mjs +0 -760
- package/fesm2022/energinet-watt-chip.mjs.map +0 -1
- package/fesm2022/energinet-watt-clipboard.mjs +0 -118
- package/fesm2022/energinet-watt-clipboard.mjs.map +0 -1
- package/fesm2022/energinet-watt-code.mjs +0 -119
- package/fesm2022/energinet-watt-code.mjs.map +0 -1
- package/fesm2022/energinet-watt-core-breakpoints.mjs +0 -100
- package/fesm2022/energinet-watt-core-breakpoints.mjs.map +0 -1
- package/fesm2022/energinet-watt-core-color.mjs +0 -127
- package/fesm2022/energinet-watt-core-color.mjs.map +0 -1
- package/fesm2022/energinet-watt-core-date.mjs +0 -260
- package/fesm2022/energinet-watt-core-date.mjs.map +0 -1
- package/fesm2022/energinet-watt-data.mjs.map +0 -1
- package/fesm2022/energinet-watt-datetime-field.mjs +0 -233
- package/fesm2022/energinet-watt-datetime-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-description-list.mjs.map +0 -1
- package/fesm2022/energinet-watt-drawer.mjs +0 -307
- package/fesm2022/energinet-watt-drawer.mjs.map +0 -1
- package/fesm2022/energinet-watt-dropdown.mjs +0 -423
- package/fesm2022/energinet-watt-dropdown.mjs.map +0 -1
- package/fesm2022/energinet-watt-dropzone.mjs +0 -298
- package/fesm2022/energinet-watt-dropzone.mjs.map +0 -1
- package/fesm2022/energinet-watt-empty-state.mjs +0 -299
- package/fesm2022/energinet-watt-empty-state.mjs.map +0 -1
- package/fesm2022/energinet-watt-expandable-card.mjs.map +0 -1
- package/fesm2022/energinet-watt-expansion.mjs.map +0 -1
- package/fesm2022/energinet-watt-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-icon-flags.mjs +0 -482
- package/fesm2022/energinet-watt-icon-flags.mjs.map +0 -1
- package/fesm2022/energinet-watt-icon.mjs.map +0 -1
- package/fesm2022/energinet-watt-modal.mjs.map +0 -1
- package/fesm2022/energinet-watt-paginator.mjs +0 -164
- package/fesm2022/energinet-watt-paginator.mjs.map +0 -1
- package/fesm2022/energinet-watt-phone-field.mjs +0 -326
- package/fesm2022/energinet-watt-phone-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-picker-__shared.mjs +0 -384
- package/fesm2022/energinet-watt-picker-__shared.mjs.map +0 -1
- package/fesm2022/energinet-watt-picker-datepicker.mjs +0 -477
- package/fesm2022/energinet-watt-picker-datepicker.mjs.map +0 -1
- package/fesm2022/energinet-watt-picker-timepicker.mjs +0 -394
- package/fesm2022/energinet-watt-picker-timepicker.mjs.map +0 -1
- package/fesm2022/energinet-watt-progress-tracker.mjs.map +0 -1
- package/fesm2022/energinet-watt-query-params.mjs +0 -117
- package/fesm2022/energinet-watt-query-params.mjs.map +0 -1
- package/fesm2022/energinet-watt-radio.mjs.map +0 -1
- package/fesm2022/energinet-watt-search.mjs.map +0 -1
- package/fesm2022/energinet-watt-segmented-buttons.mjs +0 -149
- package/fesm2022/energinet-watt-segmented-buttons.mjs.map +0 -1
- package/fesm2022/energinet-watt-shell.mjs +0 -315
- package/fesm2022/energinet-watt-shell.mjs.map +0 -1
- package/fesm2022/energinet-watt-slide-toggle.mjs +0 -104
- package/fesm2022/energinet-watt-slide-toggle.mjs.map +0 -1
- package/fesm2022/energinet-watt-slider.mjs +0 -159
- package/fesm2022/energinet-watt-slider.mjs.map +0 -1
- package/fesm2022/energinet-watt-spinner.mjs +0 -72
- package/fesm2022/energinet-watt-spinner.mjs.map +0 -1
- package/fesm2022/energinet-watt-stepper.mjs.map +0 -1
- package/fesm2022/energinet-watt-table.mjs +0 -441
- package/fesm2022/energinet-watt-table.mjs.map +0 -1
- package/fesm2022/energinet-watt-tabs.mjs +0 -254
- package/fesm2022/energinet-watt-tabs.mjs.map +0 -1
- package/fesm2022/energinet-watt-text-field.mjs +0 -316
- package/fesm2022/energinet-watt-text-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-textarea-field.mjs +0 -136
- package/fesm2022/energinet-watt-textarea-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-toast.mjs +0 -174
- package/fesm2022/energinet-watt-toast.mjs.map +0 -1
- package/fesm2022/energinet-watt-tooltip.mjs +0 -214
- package/fesm2022/energinet-watt-tooltip.mjs.map +0 -1
- package/fesm2022/energinet-watt-utils-css.mjs +0 -72
- package/fesm2022/energinet-watt-utils-css.mjs.map +0 -1
- package/fesm2022/energinet-watt-utils-intersection-observer.mjs +0 -83
- package/fesm2022/energinet-watt-utils-intersection-observer.mjs.map +0 -1
- package/fesm2022/energinet-watt-utils-resize-observer.mjs +0 -144
- package/fesm2022/energinet-watt-utils-resize-observer.mjs.map +0 -1
- package/fesm2022/energinet-watt-validation-message.mjs.map +0 -1
- package/fesm2022/energinet-watt-validators.mjs +0 -49
- package/fesm2022/energinet-watt-validators.mjs.map +0 -1
- package/fesm2022/energinet-watt-vater.mjs +0 -248
- package/fesm2022/energinet-watt-vater.mjs.map +0 -1
- package/fesm2022/energinet-watt-year-field.mjs +0 -282
- package/fesm2022/energinet-watt-year-field.mjs.map +0 -1
- package/fesm2022/energinet-watt-yearmonth-field.mjs +0 -324
- package/fesm2022/energinet-watt-yearmonth-field.mjs.map +0 -1
- package/fesm2022/energinet-watt.mjs +0 -31
- package/fesm2022/energinet-watt.mjs.map +0 -1
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import * as i3 from '@angular/cdk/overlay';
|
|
2
|
-
import { OverlayModule } from '@angular/cdk/overlay';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, ElementRef, ChangeDetectorRef, DestroyRef, HostBinding, ViewChild, Input, ViewEncapsulation, Component } from '@angular/core';
|
|
5
|
-
import { NgControl } from '@angular/forms';
|
|
6
|
-
import * as i1 from '@angular/material/datepicker';
|
|
7
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
8
|
-
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
9
|
-
import * as i2 from '@angular/material/input';
|
|
10
|
-
import { MatInputModule } from '@angular/material/input';
|
|
11
|
-
import { Subject } from 'rxjs';
|
|
12
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
13
|
-
import { maskitoTimeOptionsGenerator } from '@maskito/kit';
|
|
14
|
-
import { WattButtonComponent } from '@energinet/watt/button';
|
|
15
|
-
import { WattFieldComponent } from '@energinet/watt/field';
|
|
16
|
-
import { WattSliderComponent } from '@energinet/watt/slider';
|
|
17
|
-
import { MASKITO_DEFAULT_OPTIONS } from '@maskito/core';
|
|
18
|
-
import { WattPickerBase, WattPlaceholderMaskComponent } from '@energinet/watt/picker/__shared';
|
|
19
|
-
|
|
20
|
-
//#region License
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2020 Energinet DataHub A/S
|
|
24
|
-
*
|
|
25
|
-
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
26
|
-
* you may not use this file except in compliance with the License.
|
|
27
|
-
* You may obtain a copy of the License at
|
|
28
|
-
*
|
|
29
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
-
*
|
|
31
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
-
* See the License for the specific language governing permissions and
|
|
35
|
-
* limitations under the License.
|
|
36
|
-
*/
|
|
37
|
-
//#endregion
|
|
38
|
-
const TIME_FIXED_CHARACTERS = [':', '.'];
|
|
39
|
-
const SEPARATOR = ' - ';
|
|
40
|
-
function maskitoTimeRangeOptionsGenerator() {
|
|
41
|
-
return {
|
|
42
|
-
...MASKITO_DEFAULT_OPTIONS,
|
|
43
|
-
mask: [
|
|
44
|
-
...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\d/)),
|
|
45
|
-
...Array.from(SEPARATOR),
|
|
46
|
-
...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\d/)),
|
|
47
|
-
],
|
|
48
|
-
preprocessors: [
|
|
49
|
-
({ elementState, data }, actionType) => {
|
|
50
|
-
if (actionType !== 'insert' || data.length > 1) {
|
|
51
|
-
return {
|
|
52
|
-
elementState,
|
|
53
|
-
data,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (Number.parseInt(data) > 2 && isFirstHourSegment(elementState)) {
|
|
57
|
-
return {
|
|
58
|
-
elementState: {
|
|
59
|
-
selection: elementState.selection,
|
|
60
|
-
value: elementState.value + '0' + data,
|
|
61
|
-
},
|
|
62
|
-
data: '0' + data,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (Number.parseInt(data) > 5 &&
|
|
66
|
-
(elementState.value.length === 3 || elementState.value.length === 10)) {
|
|
67
|
-
return {
|
|
68
|
-
elementState: {
|
|
69
|
-
selection: elementState.selection,
|
|
70
|
-
value: elementState.value + '0' + data,
|
|
71
|
-
},
|
|
72
|
-
data: '0' + data,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
elementState,
|
|
77
|
-
data,
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
overwriteMode: 'replace',
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function isFirstHourSegment(elementState) {
|
|
85
|
-
if (elementState.value.length === 0) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
if (elementState.value.endsWith(SEPARATOR)) {
|
|
89
|
-
return elementState.value.length === 8;
|
|
90
|
-
}
|
|
91
|
-
if (elementState.value.endsWith(' -')) {
|
|
92
|
-
return elementState.value.length === 7;
|
|
93
|
-
}
|
|
94
|
-
if (elementState.value.endsWith(' ')) {
|
|
95
|
-
return elementState.value.length === 6;
|
|
96
|
-
}
|
|
97
|
-
return elementState.value.length === 5;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#region License
|
|
101
|
-
/**
|
|
102
|
-
* @license
|
|
103
|
-
* Copyright 2020 Energinet DataHub A/S
|
|
104
|
-
*
|
|
105
|
-
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
106
|
-
* you may not use this file except in compliance with the License.
|
|
107
|
-
* You may obtain a copy of the License at
|
|
108
|
-
*
|
|
109
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
-
*
|
|
111
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
112
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
-
* See the License for the specific language governing permissions and
|
|
115
|
-
* limitations under the License.
|
|
116
|
-
*/
|
|
117
|
-
//#endregion
|
|
118
|
-
// Constants for working with time intervals
|
|
119
|
-
const minutesInADay = 24 * 60;
|
|
120
|
-
const quartersInADay = minutesInADay / 15;
|
|
121
|
-
// Show slider initially as "00:00 - 23:59"
|
|
122
|
-
const initialSliderValue = { min: 0, max: minutesInADay - 1 };
|
|
123
|
-
/** Converts string time format (HH:MM) to number of minutes. */
|
|
124
|
-
function timeToMinutes(value) {
|
|
125
|
-
const [hours, minutes] = value.split(':');
|
|
126
|
-
return Number(hours) * 60 + Number(minutes);
|
|
127
|
-
}
|
|
128
|
-
/** Converts number of minutes to string time format (HH:MM). */
|
|
129
|
-
function minutesToTime(value) {
|
|
130
|
-
const hours = `${Math.floor(value / 60)}`;
|
|
131
|
-
const minutes = `${value % 60}`;
|
|
132
|
-
return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}`;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Usage:
|
|
136
|
-
* `import { WattTimepickerComponent } from '@energinet-datahub/watt/timepicker';`
|
|
137
|
-
*
|
|
138
|
-
* IMPORTANT:
|
|
139
|
-
* The styling is calculated based on our monospaced font.
|
|
140
|
-
*/
|
|
141
|
-
class WattTimepickerComponent extends WattPickerBase {
|
|
142
|
-
elementRef = inject(ElementRef);
|
|
143
|
-
changeDetectionRef = inject(ChangeDetectorRef);
|
|
144
|
-
ngControl = inject(NgControl, { optional: true, self: true });
|
|
145
|
-
label = '';
|
|
146
|
-
/**
|
|
147
|
-
* Text to display on label for time range slider.
|
|
148
|
-
*/
|
|
149
|
-
sliderLabel = '';
|
|
150
|
-
/**
|
|
151
|
-
* @ignore
|
|
152
|
-
*/
|
|
153
|
-
input;
|
|
154
|
-
/**
|
|
155
|
-
* @ignore
|
|
156
|
-
*/
|
|
157
|
-
startInput;
|
|
158
|
-
/**
|
|
159
|
-
* @ignore
|
|
160
|
-
*/
|
|
161
|
-
endInput;
|
|
162
|
-
/**
|
|
163
|
-
* @ignore
|
|
164
|
-
*/
|
|
165
|
-
sliderId = `${this.id}-slider`;
|
|
166
|
-
/**
|
|
167
|
-
* Used for defining a relationship between the time picker and
|
|
168
|
-
* the slider overlay (since the DOM hierarchy cannot be used).
|
|
169
|
-
* @ignore
|
|
170
|
-
*/
|
|
171
|
-
get ariaOwns() {
|
|
172
|
-
// Only range input has slider
|
|
173
|
-
return this.range && this.sliderOpen ? this.sliderId : undefined;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @ignore
|
|
177
|
-
*/
|
|
178
|
-
hoursMinutesPlaceholder = 'HH:MM';
|
|
179
|
-
/**
|
|
180
|
-
* @ignore
|
|
181
|
-
*/
|
|
182
|
-
rangeSeparator = ' - ';
|
|
183
|
-
/**
|
|
184
|
-
* @ignore
|
|
185
|
-
*/
|
|
186
|
-
rangePlaceholder = this.hoursMinutesPlaceholder + this.rangeSeparator + this.hoursMinutesPlaceholder;
|
|
187
|
-
/**
|
|
188
|
-
* @ignore
|
|
189
|
-
*/
|
|
190
|
-
_placeholder = this.hoursMinutesPlaceholder;
|
|
191
|
-
/**
|
|
192
|
-
* Whether the slider is open.
|
|
193
|
-
* @ignore
|
|
194
|
-
*/
|
|
195
|
-
sliderOpen = false;
|
|
196
|
-
/**
|
|
197
|
-
* @ignore
|
|
198
|
-
*/
|
|
199
|
-
sliderSteps = [...Array(quartersInADay).keys()].map((x) => x * 15).concat(minutesInADay - 1);
|
|
200
|
-
/**
|
|
201
|
-
* @ignore
|
|
202
|
-
*/
|
|
203
|
-
sliderChange$ = new Subject();
|
|
204
|
-
/**
|
|
205
|
-
* @ignore
|
|
206
|
-
*/
|
|
207
|
-
get sliderValue() {
|
|
208
|
-
if (this.value?.start && this.value?.end) {
|
|
209
|
-
return {
|
|
210
|
-
min: timeToMinutes(this.value.start),
|
|
211
|
-
max: timeToMinutes(this.value.end),
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
// Retain last slider value if input value is incomplete
|
|
215
|
-
return initialSliderValue;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Toggles the visibility of the slider overlay.
|
|
219
|
-
* @ignore
|
|
220
|
-
*/
|
|
221
|
-
toggleSlider() {
|
|
222
|
-
this.sliderOpen = !this.sliderOpen;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Override to automatically close the slider overlay on blur.
|
|
226
|
-
* @ignore
|
|
227
|
-
*/
|
|
228
|
-
onFocusOut(event) {
|
|
229
|
-
super.onFocusOut(event);
|
|
230
|
-
if (!this.focused)
|
|
231
|
-
this.sliderOpen = false;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @ignore
|
|
235
|
-
*/
|
|
236
|
-
inputMask = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
|
|
237
|
-
/**
|
|
238
|
-
* @ignore
|
|
239
|
-
*/
|
|
240
|
-
rangeInputMask = maskitoTimeRangeOptionsGenerator();
|
|
241
|
-
/**
|
|
242
|
-
* @ignore
|
|
243
|
-
*/
|
|
244
|
-
destroyRef = inject(DestroyRef);
|
|
245
|
-
constructor() {
|
|
246
|
-
super(`watt-timepicker-${WattTimepickerComponent.nextId++}`);
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* @ignore
|
|
250
|
-
*/
|
|
251
|
-
initSingleInput() {
|
|
252
|
-
if (this.initialValue) {
|
|
253
|
-
this.input.nativeElement.value = this.initialValue;
|
|
254
|
-
this.input.nativeElement.dispatchEvent(new InputEvent('input'));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* @ignore
|
|
259
|
-
*/
|
|
260
|
-
inputChanged(value) {
|
|
261
|
-
const time = value.slice(0, this.hoursMinutesPlaceholder.length);
|
|
262
|
-
if (time.length === 0) {
|
|
263
|
-
this.control?.setValue(null);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
if (time.length !== this.hoursMinutesPlaceholder.length) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
this.control?.setValue(time);
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* @ignore
|
|
273
|
-
*/
|
|
274
|
-
rangeInputChanged(value) {
|
|
275
|
-
const start = value.slice(0, this.hoursMinutesPlaceholder.length);
|
|
276
|
-
if (start.length !== this.hoursMinutesPlaceholder.length) {
|
|
277
|
-
this.control?.setValue({ start: '', end: '' });
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (value.length < this.rangePlaceholder.length) {
|
|
281
|
-
this.control?.setValue({ start, end: '' });
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
let end = value.slice(this.hoursMinutesPlaceholder.length + this.rangeSeparator.length);
|
|
285
|
-
if (timeToMinutes(end) > timeToMinutes(start)) {
|
|
286
|
-
this.control?.setValue({ start, end });
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
end = minutesToTime(timeToMinutes(start) + 1);
|
|
290
|
-
this.setRangeValueAndNotify(start, end);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* @ignore
|
|
295
|
-
*/
|
|
296
|
-
initRangeInput() {
|
|
297
|
-
if (this.initialValue) {
|
|
298
|
-
const { start, end } = this.initialValue;
|
|
299
|
-
this.setRangeValueAndNotify(start, end);
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
this.control?.setValue({ start: '', end: '' });
|
|
303
|
-
}
|
|
304
|
-
this.sliderChange$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((sliderValue) => {
|
|
305
|
-
const start = minutesToTime(sliderValue.min);
|
|
306
|
-
const end = minutesToTime(sliderValue.max);
|
|
307
|
-
if (end > start) {
|
|
308
|
-
this.setRangeValueAndNotify(start, end);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* @ignore
|
|
314
|
-
*/
|
|
315
|
-
setRangeValueAndNotify(start, end) {
|
|
316
|
-
this.control?.setValue({ start, end });
|
|
317
|
-
this.input.nativeElement.value = start + this.rangeSeparator + end;
|
|
318
|
-
this.input.nativeElement.dispatchEvent(new InputEvent('input'));
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* @ignore
|
|
322
|
-
*/
|
|
323
|
-
setSingleValue(value, input) {
|
|
324
|
-
input.value = value ?? '';
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* @ignore
|
|
328
|
-
*/
|
|
329
|
-
setRangeValue(value, startInput, endInput) {
|
|
330
|
-
const { start, end } = value;
|
|
331
|
-
if (start) {
|
|
332
|
-
startInput.value = start;
|
|
333
|
-
}
|
|
334
|
-
if (end) {
|
|
335
|
-
endInput.value = end;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTimepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
339
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattTimepickerComponent, isStandalone: true, selector: "watt-timepicker", inputs: { label: "label", sliderLabel: "sliderLabel" }, host: { properties: { "attr.aria-owns": "this.ariaOwns" } }, providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }], viewQueries: [{ propertyName: "input", first: true, predicate: ["timeInput"], descendants: true }, { propertyName: "startInput", first: true, predicate: ["startTimeInput"], descendants: true }, { propertyName: "endInput", first: true, predicate: ["endTimeInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n", styles: ["watt-timepicker{display:flex;align-items:center;width:100%}watt-timepicker watt-button[variant=icon]{margin-left:auto}watt-timepicker watt-button[variant=icon] .watt-button--icon{height:42px}watt-timepicker mat-datepicker,watt-timepicker mat-date-range-picker{display:none}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker .mat-date-range-input-mirror,watt-timepicker input.mask-input{font-family:Droid Sans Mono,monospace}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker input.mask-input{border:none;caret-color:var(--watt-color-neutral-black);letter-spacing:-.03em;-webkit-background-clip:text;-moz-background-clip:text;background-clip:text;color:transparent}watt-timepicker input.mask-input{color:#000}watt-timepicker input.mask-input{position:absolute;min-width:100%;padding:2px 1px}watt-timepicker input.mask-input:focus-visible{outline:none}watt-timepicker .mat-date-range-input-container{align-items:initial}watt-timepicker .mat-date-range-input-start-wrapper,watt-timepicker .mat-date-range-input-end-wrapper{max-width:calc(50% - var(--watt-space-s));overflow:visible;position:relative}watt-timepicker .mat-date-range-input-separator{display:flex;align-items:center}watt-timepicker .mat-date-range-input-separator-hidden,watt-timepicker .mat-date-range-input-separator{opacity:0!important}watt-timepicker .mat-date-range-input-inner::-webkit-input-placeholder{color:var(--watt-color-neutral-grey-500)!important;-webkit-text-fill-color:var(--watt-color-neutral-grey-500)}.watt-timepicker-slider{width:340px;padding:var(--watt-space-s) 12px var(--watt-space-m);background:var(--watt-color-neutral-white);box-shadow:0 1px 6px #0b3c5d1f,0 4px 18px 3px #2e323414;border-radius:3px}\n"], dependencies: [{ kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i1.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i1.MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i1.MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "size", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattSliderComponent, selector: "watt-slider", inputs: ["min", "max", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }, { kind: "component", type: WattPlaceholderMaskComponent, selector: "watt-placeholder-mask", inputs: ["primaryInputElement", "secondaryInputElement", "mask", "placeholder"], outputs: ["maskApplied"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
340
|
-
}
|
|
341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTimepickerComponent, decorators: [{
|
|
342
|
-
type: Component,
|
|
343
|
-
args: [{ selector: 'watt-timepicker', providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }], encapsulation: ViewEncapsulation.None, imports: [
|
|
344
|
-
MatDatepickerModule,
|
|
345
|
-
MatInputModule,
|
|
346
|
-
OverlayModule,
|
|
347
|
-
WattButtonComponent,
|
|
348
|
-
WattSliderComponent,
|
|
349
|
-
WattFieldComponent,
|
|
350
|
-
WattPlaceholderMaskComponent,
|
|
351
|
-
], template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n", styles: ["watt-timepicker{display:flex;align-items:center;width:100%}watt-timepicker watt-button[variant=icon]{margin-left:auto}watt-timepicker watt-button[variant=icon] .watt-button--icon{height:42px}watt-timepicker mat-datepicker,watt-timepicker mat-date-range-picker{display:none}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker .mat-date-range-input-mirror,watt-timepicker input.mask-input{font-family:Droid Sans Mono,monospace}watt-timepicker input.mat-date-range-input-inner,watt-timepicker input.mat-mdc-input-element,watt-timepicker input.mask-input{border:none;caret-color:var(--watt-color-neutral-black);letter-spacing:-.03em;-webkit-background-clip:text;-moz-background-clip:text;background-clip:text;color:transparent}watt-timepicker input.mask-input{color:#000}watt-timepicker input.mask-input{position:absolute;min-width:100%;padding:2px 1px}watt-timepicker input.mask-input:focus-visible{outline:none}watt-timepicker .mat-date-range-input-container{align-items:initial}watt-timepicker .mat-date-range-input-start-wrapper,watt-timepicker .mat-date-range-input-end-wrapper{max-width:calc(50% - var(--watt-space-s));overflow:visible;position:relative}watt-timepicker .mat-date-range-input-separator{display:flex;align-items:center}watt-timepicker .mat-date-range-input-separator-hidden,watt-timepicker .mat-date-range-input-separator{opacity:0!important}watt-timepicker .mat-date-range-input-inner::-webkit-input-placeholder{color:var(--watt-color-neutral-grey-500)!important;-webkit-text-fill-color:var(--watt-color-neutral-grey-500)}.watt-timepicker-slider{width:340px;padding:var(--watt-space-s) 12px var(--watt-space-m);background:var(--watt-color-neutral-white);box-shadow:0 1px 6px #0b3c5d1f,0 4px 18px 3px #2e323414;border-radius:3px}\n"] }]
|
|
352
|
-
}], ctorParameters: () => [], propDecorators: { label: [{
|
|
353
|
-
type: Input
|
|
354
|
-
}], sliderLabel: [{
|
|
355
|
-
type: Input
|
|
356
|
-
}], input: [{
|
|
357
|
-
type: ViewChild,
|
|
358
|
-
args: ['timeInput']
|
|
359
|
-
}], startInput: [{
|
|
360
|
-
type: ViewChild,
|
|
361
|
-
args: ['startTimeInput']
|
|
362
|
-
}], endInput: [{
|
|
363
|
-
type: ViewChild,
|
|
364
|
-
args: ['endTimeInput']
|
|
365
|
-
}], ariaOwns: [{
|
|
366
|
-
type: HostBinding,
|
|
367
|
-
args: ['attr.aria-owns']
|
|
368
|
-
}] } });
|
|
369
|
-
|
|
370
|
-
//#region License
|
|
371
|
-
/**
|
|
372
|
-
* @license
|
|
373
|
-
* Copyright 2020 Energinet DataHub A/S
|
|
374
|
-
*
|
|
375
|
-
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
376
|
-
* you may not use this file except in compliance with the License.
|
|
377
|
-
* You may obtain a copy of the License at
|
|
378
|
-
*
|
|
379
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
-
*
|
|
381
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
382
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
383
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
384
|
-
* See the License for the specific language governing permissions and
|
|
385
|
-
* limitations under the License.
|
|
386
|
-
*/
|
|
387
|
-
//#endregion
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Generated bundle index. Do not edit.
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
export { WattTimepickerComponent };
|
|
394
|
-
//# sourceMappingURL=energinet-watt-picker-timepicker.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-picker-timepicker.mjs","sources":["../../../libs/watt/package/picker/timepicker/maskito-time-range-mask.ts","../../../libs/watt/package/picker/timepicker/watt-timepicker.component.ts","../../../libs/watt/package/picker/timepicker/watt-timepicker.component.html","../../../libs/watt/package/picker/timepicker/index.ts","../../../libs/watt/package/picker/timepicker/energinet-watt-picker-timepicker.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { MASKITO_DEFAULT_OPTIONS, MaskitoOptions } from '@maskito/core';\nimport { ElementState } from '@maskito/core/src/lib/types';\n\nconst TIME_FIXED_CHARACTERS = [':', '.'];\n\nconst SEPARATOR = ' - ';\n\nexport function maskitoTimeRangeOptionsGenerator(): Required<MaskitoOptions> {\n return {\n ...MASKITO_DEFAULT_OPTIONS,\n mask: [\n ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\\d/)),\n ...Array.from(SEPARATOR),\n ...Array.from('HH:MM').map((char) => (TIME_FIXED_CHARACTERS.includes(char) ? char : /\\d/)),\n ],\n preprocessors: [\n ({ elementState, data }, actionType) => {\n if (actionType !== 'insert' || data.length > 1) {\n return {\n elementState,\n data,\n };\n }\n if (Number.parseInt(data) > 2 && isFirstHourSegment(elementState)) {\n return {\n elementState: {\n selection: elementState.selection,\n value: elementState.value + '0' + data,\n },\n data: '0' + data,\n };\n }\n if (\n Number.parseInt(data) > 5 &&\n (elementState.value.length === 3 || elementState.value.length === 10)\n ) {\n return {\n elementState: {\n selection: elementState.selection,\n value: elementState.value + '0' + data,\n },\n data: '0' + data,\n };\n }\n return {\n elementState,\n data,\n };\n },\n ],\n overwriteMode: 'replace',\n };\n}\nfunction isFirstHourSegment(elementState: ElementState) {\n if (elementState.value.length === 0) {\n return true;\n }\n if (elementState.value.endsWith(SEPARATOR)) {\n return elementState.value.length === 8;\n }\n if (elementState.value.endsWith(' -')) {\n return elementState.value.length === 7;\n }\n if (elementState.value.endsWith(' ')) {\n return elementState.value.length === 6;\n }\n return elementState.value.length === 5;\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport {\n ChangeDetectorRef,\n Component,\n DestroyRef,\n ElementRef,\n HostBinding,\n Input,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { MatDatepickerModule } from '@angular/material/datepicker';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { Subject } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { maskitoTimeOptionsGenerator } from '@maskito/kit';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattDateRange } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattSliderComponent, WattSliderValue } from '@energinet/watt/slider';\n\nimport { maskitoTimeRangeOptionsGenerator } from './maskito-time-range-mask';\nimport {\n WattPickerBase,\n WattPickerValue,\n WattPlaceholderMaskComponent,\n} from '@energinet/watt/picker/__shared';\n\n// Constants for working with time intervals\nconst minutesInADay = 24 * 60;\nconst quartersInADay = minutesInADay / 15;\n\n// Show slider initially as \"00:00 - 23:59\"\nconst initialSliderValue: WattSliderValue = { min: 0, max: minutesInADay - 1 };\n\n/** Converts string time format (HH:MM) to number of minutes. */\nfunction timeToMinutes(value: string): number {\n const [hours, minutes] = value.split(':');\n return Number(hours) * 60 + Number(minutes);\n}\n\n/** Converts number of minutes to string time format (HH:MM). */\nfunction minutesToTime(value: number): string {\n const hours = `${Math.floor(value / 60)}`;\n const minutes = `${value % 60}`;\n return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}`;\n}\n/**\n * Usage:\n * `import { WattTimepickerComponent } from '@energinet-datahub/watt/timepicker';`\n *\n * IMPORTANT:\n * The styling is calculated based on our monospaced font.\n */\n@Component({\n selector: 'watt-timepicker',\n templateUrl: './watt-timepicker.component.html',\n styleUrls: ['./watt-timepicker.component.scss'],\n providers: [{ provide: MatFormFieldControl, useExisting: WattTimepickerComponent }],\n encapsulation: ViewEncapsulation.None,\n imports: [\n MatDatepickerModule,\n MatInputModule,\n OverlayModule,\n\n WattButtonComponent,\n WattSliderComponent,\n WattFieldComponent,\n WattPlaceholderMaskComponent,\n ],\n})\nexport class WattTimepickerComponent extends WattPickerBase {\n protected override elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n protected override changeDetectionRef = inject(ChangeDetectorRef);\n protected override ngControl = inject(NgControl, { optional: true, self: true });\n @Input() label = '';\n /**\n * Text to display on label for time range slider.\n */\n @Input()\n sliderLabel = '';\n\n /**\n * @ignore\n */\n @ViewChild('timeInput')\n input!: ElementRef;\n\n /**\n * @ignore\n */\n @ViewChild('startTimeInput')\n startInput!: ElementRef;\n\n /**\n * @ignore\n */\n @ViewChild('endTimeInput')\n endInput!: ElementRef;\n\n /**\n * @ignore\n */\n sliderId = `${this.id}-slider`;\n\n /**\n * Used for defining a relationship between the time picker and\n * the slider overlay (since the DOM hierarchy cannot be used).\n * @ignore\n */\n @HostBinding('attr.aria-owns')\n get ariaOwns() {\n // Only range input has slider\n return this.range && this.sliderOpen ? this.sliderId : undefined;\n }\n /**\n * @ignore\n */\n hoursMinutesPlaceholder = 'HH:MM';\n /**\n * @ignore\n */\n rangeSeparator = ' - ';\n /**\n * @ignore\n */\n rangePlaceholder =\n this.hoursMinutesPlaceholder + this.rangeSeparator + this.hoursMinutesPlaceholder;\n /**\n * @ignore\n */\n protected _placeholder = this.hoursMinutesPlaceholder;\n\n /**\n * Whether the slider is open.\n * @ignore\n */\n sliderOpen = false;\n\n /**\n * @ignore\n */\n sliderSteps = [...Array(quartersInADay).keys()].map((x) => x * 15).concat(minutesInADay - 1);\n\n /**\n * @ignore\n */\n sliderChange$ = new Subject<WattSliderValue>();\n\n /**\n * @ignore\n */\n get sliderValue(): WattSliderValue {\n if (this.value?.start && this.value?.end) {\n return {\n min: timeToMinutes(this.value.start),\n max: timeToMinutes(this.value.end),\n };\n }\n\n // Retain last slider value if input value is incomplete\n return initialSliderValue;\n }\n\n /**\n * Toggles the visibility of the slider overlay.\n * @ignore\n */\n toggleSlider() {\n this.sliderOpen = !this.sliderOpen;\n }\n\n /**\n * Override to automatically close the slider overlay on blur.\n * @ignore\n */\n override onFocusOut(event: FocusEvent) {\n super.onFocusOut(event);\n if (!this.focused) this.sliderOpen = false;\n }\n\n /**\n * @ignore\n */\n inputMask = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });\n /**\n * @ignore\n */\n rangeInputMask = maskitoTimeRangeOptionsGenerator();\n /**\n * @ignore\n */\n destroyRef = inject(DestroyRef);\n\n constructor() {\n super(`watt-timepicker-${WattTimepickerComponent.nextId++}`);\n }\n\n /**\n * @ignore\n */\n protected initSingleInput() {\n if (this.initialValue) {\n (this.input.nativeElement as HTMLInputElement).value = this.initialValue as string;\n this.input.nativeElement.dispatchEvent(new InputEvent('input'));\n }\n }\n\n /**\n * @ignore\n */\n inputChanged(value: string) {\n const time = value.slice(0, this.hoursMinutesPlaceholder.length);\n if (time.length === 0) {\n this.control?.setValue(null);\n return;\n }\n if (time.length !== this.hoursMinutesPlaceholder.length) {\n return;\n }\n this.control?.setValue(time);\n }\n\n /**\n * @ignore\n */\n rangeInputChanged(value: string) {\n const start = value.slice(0, this.hoursMinutesPlaceholder.length);\n if (start.length !== this.hoursMinutesPlaceholder.length) {\n this.control?.setValue({ start: '', end: '' });\n return;\n }\n if (value.length < this.rangePlaceholder.length) {\n this.control?.setValue({ start, end: '' });\n return;\n }\n let end = value.slice(this.hoursMinutesPlaceholder.length + this.rangeSeparator.length);\n if (timeToMinutes(end) > timeToMinutes(start)) {\n this.control?.setValue({ start, end });\n } else {\n end = minutesToTime(timeToMinutes(start) + 1);\n this.setRangeValueAndNotify(start, end);\n }\n }\n\n /**\n * @ignore\n */\n protected initRangeInput() {\n if (this.initialValue) {\n const { start, end } = this.initialValue as WattDateRange;\n this.setRangeValueAndNotify(start, end);\n } else {\n this.control?.setValue({ start: '', end: '' });\n }\n this.sliderChange$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((sliderValue) => {\n const start = minutesToTime(sliderValue.min);\n const end = minutesToTime(sliderValue.max);\n if (end > start) {\n this.setRangeValueAndNotify(start, end);\n }\n });\n }\n\n /**\n * @ignore\n */\n setRangeValueAndNotify(start: string, end: string | null) {\n this.control?.setValue({ start, end });\n (this.input.nativeElement as HTMLInputElement).value = start + this.rangeSeparator + end;\n this.input.nativeElement.dispatchEvent(new InputEvent('input'));\n }\n\n /**\n * @ignore\n */\n protected setSingleValue(\n value: Exclude<WattPickerValue, WattDateRange>,\n input: HTMLInputElement\n ) {\n input.value = value ?? '';\n }\n\n /**\n * @ignore\n */\n protected setRangeValue(\n value: WattDateRange,\n startInput: HTMLInputElement,\n endInput: HTMLInputElement\n ) {\n const { start, end } = value;\n\n if (start) {\n startInput.value = start;\n }\n\n if (end) {\n endInput.value = end;\n }\n }\n}\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<watt-field [id]=\"id\" [control]=\"control\" [label]=\"label\">\n @if (!range) {\n <input\n inert\n matInput\n aria-label=\"time-input\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"inputMask\"\n [placeholder]=\"hoursMinutesPlaceholder\"\n (maskApplied)=\"inputChanged($event)\"\n />\n } @else {\n <mat-date-range-input\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"disabled\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <input\n inert\n aria-label=\"start-time-input\"\n matStartDate\n #startTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n <input\n inert\n aria-label=\"end-time-input\"\n matEndDate\n #endTimeInput\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </mat-date-range-input>\n <input #timeInput class=\"mask-input\" [disabled]=\"disabled\" />\n <watt-placeholder-mask\n [primaryInputElement]=\"timeInput\"\n [mask]=\"rangeInputMask\"\n [placeholder]=\"rangePlaceholder\"\n (maskApplied)=\"rangeInputChanged($event)\"\n />\n\n <watt-button\n variant=\"icon\"\n icon=\"time\"\n [disabled]=\"disabled\"\n [attr.aria-pressed]=\"sliderOpen\"\n (click)=\"toggleSlider()\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"sliderOpen\"\n [cdkConnectedOverlayOffsetY]=\"12\"\n >\n <div\n [id]=\"sliderId\"\n role=\"dialog\"\n class=\"watt-timepicker-slider\"\n tabindex=\"-1\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\"\n >\n <span class=\"watt-label\">{{ sliderLabel }}</span>\n <watt-slider\n [min]=\"sliderSteps[0]\"\n [max]=\"sliderSteps[sliderSteps.length - 1]\"\n [step]=\"1\"\n [value]=\"sliderValue\"\n (valueChange)=\"sliderChange$.next($event)\"\n />\n </div>\n </ng-template>\n }\n\n <ng-content />\n <ng-content ngProjectAs=\"watt-field-hint\" select=\"watt-field-hint\" />\n <ng-content ngProjectAs=\"watt-field-error\" select=\"watt-field-error\" />\n</watt-field>\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattTimepickerComponent } from './watt-timepicker.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAIA,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;AAExC,MAAM,SAAS,GAAG,KAAK;SAEP,gCAAgC,GAAA;IAC9C,OAAO;AACL,QAAA,GAAG,uBAAuB;AAC1B,QAAA,IAAI,EAAE;AACJ,YAAA,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC1F,YAAA,GAAG,KAAK,CAAC,IAAI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,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAGnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAjBnC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,SAAA,EAGhB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAA,uBAAyB,EAAE,CAAC,EAAA,aAAA,EACpE,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B;wBACP,mBAAmB;wBACnB,cAAc;wBACd,aAAa;wBAEb,mBAAmB;wBACnB,mBAAmB;wBACnB,kBAAkB;wBAClB,4BAA4B;AAC7B,qBAAA,EAAA,QAAA,EAAA,stGAAA,EAAA,MAAA,EAAA,CAAA,+wDAAA,CAAA,EAAA;wDAMQ,KAAK,EAAA,CAAA;sBAAb;gBAKD,WAAW,EAAA,CAAA;sBADV;gBAOD,KAAK,EAAA,CAAA;sBADJ,SAAS;uBAAC,WAAW;gBAOtB,UAAU,EAAA,CAAA;sBADT,SAAS;uBAAC,gBAAgB;gBAO3B,QAAQ,EAAA,CAAA;sBADP,SAAS;uBAAC,cAAc;gBAcrB,QAAQ,EAAA,CAAA;sBADX,WAAW;uBAAC,gBAAgB;;;AEpI/B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-progress-tracker.mjs","sources":["../../../libs/watt/package/progress-tracker/watt-progress-tracker.component.ts","../../../libs/watt/package/progress-tracker/watt-progress-tracker-step.component.ts","../../../libs/watt/package/progress-tracker/index.ts","../../../libs/watt/package/progress-tracker/energinet-watt-progress-tracker.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\nimport { VaterStackComponent } from '@energinet/watt/vater';\n\n@Component({\n imports: [VaterStackComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n selector: 'watt-progress-tracker',\n styles: [\n `\n watt-progress-tracker {\n display: block;\n }\n `,\n ],\n template: `<vater-stack direction=\"row\"><ng-content /></vater-stack>`,\n})\nexport class WattProgressTrackerComponent {}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\nimport { WattIconComponent } from '@energinet/watt/icon';\nimport { WattSpinnerComponent } from '@energinet/watt/spinner';\n\n@Component({\n imports: [WattIconComponent, WattSpinnerComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n selector: 'watt-progress-tracker-step',\n host: {\n '[attr.role]': 'current() ? \"status\" : \"presentation\"',\n '[attr.class]': 'class()',\n '[attr.aria-current]': 'ariaCurrent()',\n '[attr.aria-label]': 'label()',\n },\n styleUrl: './watt-progress-tracker-step.component.scss',\n template: `\n <div class=\"watt-progress-tracker-step-icon\">\n @switch (status()) {\n @case ('running') {\n <watt-spinner [diameter]=\"26\" [strokeWidth]=\"2\" />\n }\n @case ('skipped') {\n <watt-icon name=\"horizontalRule\" size=\"xs\" />\n }\n @case ('canceled') {\n <watt-icon name=\"close\" size=\"xs\" />\n }\n @case ('failed') {\n <watt-icon name=\"priorityHigh\" size=\"xs\" />\n }\n @case ('succeeded') {\n <watt-icon name=\"checkmark\" size=\"xs\" />\n }\n }\n </div>\n <div class=\"watt-progress-tracker-step-text\"><ng-content /></div>\n `,\n})\nexport class WattProgressTrackerStepComponent {\n status = input.required<\n 'pending' | 'running' | 'skipped' | 'canceled' | 'failed' | 'succeeded'\n >();\n label = input<string>();\n current = input(false);\n ariaCurrent = computed(() => (this.current() ? 'step' : false));\n class = computed(() => `watt-progress-tracker-step-${this.status()}`);\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { WattProgressTrackerComponent } from './watt-progress-tracker.component';\nimport { WattProgressTrackerStepComponent } from './watt-progress-tracker-step.component';\n\nexport { WattProgressTrackerComponent } from './watt-progress-tracker.component';\nexport { WattProgressTrackerStepComponent } from './watt-progress-tracker-step.component';\n\nexport const WATT_PROGRESS_TRACKER = [\n WattProgressTrackerComponent,\n WattProgressTrackerStepComponent,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAkBa,4BAA4B,CAAA;uGAA5B,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAA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AAA,IAAA,EAAA,CAAA;;2FAkCtC,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAnC5C,SAAS;AACC,YAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,mBACjC,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAC3B,4BAA4B,EAAA,IAAA,EAChC;AACJ,wBAAA,aAAa,EAAE,uCAAuC;AACtD,wBAAA,cAAc,EAAE,SAAS;AACzB,wBAAA,qBAAqB,EAAE,eAAe;AACtC,wBAAA,mBAAmB,EAAE,SAAS;qBAC/B,EAAA,QAAA,EAES;;;;;;;;;;;;;;;;;;;;;AAqBT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,0yFAAA,CAAA,EAAA;;;AC7DH;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAOO,MAAM,qBAAqB,GAAG;IACnC,4BAA4B;IAC5B,gCAAgC;;;AC1BlC;;AAEG;;;;"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, DestroyRef, Directive } from '@angular/core';
|
|
3
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
-
import { FormGroupDirective } from '@angular/forms';
|
|
5
|
-
import { Router, ActivatedRoute } from '@angular/router';
|
|
6
|
-
import qs from 'qs';
|
|
7
|
-
|
|
8
|
-
//#region License
|
|
9
|
-
/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2020 Energinet DataHub A/S
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
14
|
-
* you may not use this file except in compliance with the License.
|
|
15
|
-
* You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
//#endregion
|
|
26
|
-
const filtersKey = 'filters';
|
|
27
|
-
class WattQueryParamsDirective {
|
|
28
|
-
formGroup = inject(FormGroupDirective);
|
|
29
|
-
destoryRef = inject(DestroyRef);
|
|
30
|
-
router = inject(Router);
|
|
31
|
-
route = inject(ActivatedRoute);
|
|
32
|
-
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
33
|
-
ngOnInit() {
|
|
34
|
-
this.formGroup.valueChanges
|
|
35
|
-
?.pipe(takeUntilDestroyed(this.destoryRef))
|
|
36
|
-
.subscribe((formValues) => {
|
|
37
|
-
const formValuesClone = structuredClone(formValues);
|
|
38
|
-
for (const key in formValuesClone) {
|
|
39
|
-
if (formValuesClone[key] === null || formValuesClone[key] === undefined) {
|
|
40
|
-
delete formValuesClone[key];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const hasSetProperties = Object.keys(formValuesClone).length > 0;
|
|
44
|
-
this.router.navigate([], {
|
|
45
|
-
replaceUrl: true,
|
|
46
|
-
relativeTo: this.route,
|
|
47
|
-
queryParams: { [filtersKey]: hasSetProperties ? qs.stringify(formValuesClone) : null },
|
|
48
|
-
queryParamsHandling: 'merge',
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
if (Object.keys(this.route.snapshot.queryParams).length > 0) {
|
|
52
|
-
const value = qs.parse(this.route.snapshot.queryParams[filtersKey] ?? '', {
|
|
53
|
-
// Needed because `qs` library has a default value of 20 elements
|
|
54
|
-
// after which arrays are parsed as objects
|
|
55
|
-
// See https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays
|
|
56
|
-
arrayLimit: 200,
|
|
57
|
-
// See https://github.com/ljharb/qs/issues/91#issuecomment-1833694874
|
|
58
|
-
decoder(str, defaultDecoder, charset, type) {
|
|
59
|
-
// Custom logic not part of the GitHub comment above
|
|
60
|
-
// Handles "YYYY-MM" dates
|
|
61
|
-
if (type === 'value' && /\d{4}-\d{2}$/.test(str)) {
|
|
62
|
-
return defaultDecoder(str, defaultDecoder, charset);
|
|
63
|
-
}
|
|
64
|
-
if (type === 'value' &&
|
|
65
|
-
/^(?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|)$/.test(str)) {
|
|
66
|
-
return parseFloat(str);
|
|
67
|
-
}
|
|
68
|
-
const keywords = {
|
|
69
|
-
true: true,
|
|
70
|
-
false: false,
|
|
71
|
-
null: null,
|
|
72
|
-
undefined: undefined,
|
|
73
|
-
};
|
|
74
|
-
if (type === 'value' && str in keywords) {
|
|
75
|
-
return keywords[str];
|
|
76
|
-
}
|
|
77
|
-
return defaultDecoder(str, defaultDecoder, charset);
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
this.formGroup.control.patchValue(value);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattQueryParamsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
84
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.1", type: WattQueryParamsDirective, isStandalone: true, selector: "[formGroup][wattQueryParams]", ngImport: i0 });
|
|
85
|
-
}
|
|
86
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattQueryParamsDirective, decorators: [{
|
|
87
|
-
type: Directive,
|
|
88
|
-
args: [{
|
|
89
|
-
selector: '[formGroup][wattQueryParams]',
|
|
90
|
-
}]
|
|
91
|
-
}] });
|
|
92
|
-
|
|
93
|
-
//#region License
|
|
94
|
-
/**
|
|
95
|
-
* @license
|
|
96
|
-
* Copyright 2020 Energinet DataHub A/S
|
|
97
|
-
*
|
|
98
|
-
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
99
|
-
* you may not use this file except in compliance with the License.
|
|
100
|
-
* You may obtain a copy of the License at
|
|
101
|
-
*
|
|
102
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
103
|
-
*
|
|
104
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
105
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
106
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
107
|
-
* See the License for the specific language governing permissions and
|
|
108
|
-
* limitations under the License.
|
|
109
|
-
*/
|
|
110
|
-
//#endregion
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Generated bundle index. Do not edit.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
export { WattQueryParamsDirective };
|
|
117
|
-
//# sourceMappingURL=energinet-watt-query-params.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-query-params.mjs","sources":["../../../libs/watt/package/query-params/watt-query-params.directive.ts","../../../libs/watt/package/query-params/index.ts","../../../libs/watt/package/query-params/energinet-watt-query-params.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { DestroyRef, Directive, OnInit, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroupDirective } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport qs from 'qs';\n\nconst filtersKey = 'filters';\n\n@Directive({\n selector: '[formGroup][wattQueryParams]',\n})\nexport class WattQueryParamsDirective implements OnInit {\n private formGroup = inject(FormGroupDirective);\n private destoryRef = inject(DestroyRef);\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n ngOnInit(): void {\n this.formGroup.valueChanges\n ?.pipe(takeUntilDestroyed(this.destoryRef))\n .subscribe((formValues) => {\n const formValuesClone = structuredClone(formValues);\n\n for (const key in formValuesClone) {\n if (formValuesClone[key] === null || formValuesClone[key] === undefined) {\n delete formValuesClone[key];\n }\n }\n\n const hasSetProperties = Object.keys(formValuesClone).length > 0;\n\n this.router.navigate([], {\n replaceUrl: true,\n relativeTo: this.route,\n queryParams: { [filtersKey]: hasSetProperties ? qs.stringify(formValuesClone) : null },\n queryParamsHandling: 'merge',\n });\n });\n\n if (Object.keys(this.route.snapshot.queryParams).length > 0) {\n const value = qs.parse(this.route.snapshot.queryParams[filtersKey] ?? '', {\n // Needed because `qs` library has a default value of 20 elements\n // after which arrays are parsed as objects\n // See https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays\n arrayLimit: 200,\n // See https://github.com/ljharb/qs/issues/91#issuecomment-1833694874\n decoder(\n str: string,\n defaultDecoder: qs.defaultDecoder,\n charset: string,\n type: 'key' | 'value'\n ) {\n // Custom logic not part of the GitHub comment above\n // Handles \"YYYY-MM\" dates\n if (type === 'value' && /\\d{4}-\\d{2}$/.test(str)) {\n return defaultDecoder(str, defaultDecoder, charset);\n }\n\n if (\n type === 'value' &&\n /^(?:-(?:[1-9](?:\\d{0,2}(?:,\\d{3})+|\\d*))|(?:0|(?:[1-9](?:\\d{0,2}(?:,\\d{3})+|\\d*))))(?:.\\d+|)$/.test(\n str\n )\n ) {\n return parseFloat(str);\n }\n\n const keywords: Record<string, boolean | null | undefined> = {\n true: true,\n false: false,\n null: null,\n undefined: undefined,\n };\n if (type === 'value' && str in keywords) {\n return keywords[str];\n }\n\n return defaultDecoder(str, defaultDecoder, charset);\n },\n });\n\n this.formGroup.control.patchValue(value);\n }\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattQueryParamsDirective } from './watt-query-params.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAOA,MAAM,UAAU,GAAG,SAAS;MAKf,wBAAwB,CAAA;AAC3B,IAAA,SAAS,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACtC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;;IAGtC,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,CAAC;cACX,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;AACzC,aAAA,SAAS,CAAC,CAAC,UAAU,KAAI;AACxB,YAAA,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC;AAEnD,YAAA,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;AACjC,gBAAA,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;AACvE,oBAAA,OAAO,eAAe,CAAC,GAAG,CAAC;;;AAI/B,YAAA,MAAM,gBAAg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