@energinet/watt 0.0.1
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/LICENSE +201 -0
- package/badge/index.d.ts +17 -0
- package/badge/watt-badge.component.d.ts +15 -0
- package/breadcrumbs/index.d.ts +17 -0
- package/breadcrumbs/watt-breadcrumbs.component.d.ts +23 -0
- package/button/index.d.ts +17 -0
- package/button/watt-button.component.d.ts +20 -0
- package/card/index.d.ts +18 -0
- package/card/watt-card-title.component.d.ts +6 -0
- package/card/watt-card.component.d.ts +15 -0
- package/checkbox/index.d.ts +17 -0
- package/checkbox/watt-checkbox.component.d.ts +17 -0
- package/chip/index.d.ts +23 -0
- package/chip/watt-action-chip.component.d.ts +8 -0
- package/chip/watt-chip.component.d.ts +8 -0
- package/chip/watt-chip.directive.d.ts +16 -0
- package/chip/watt-date-chip.component.d.ts +29 -0
- package/chip/watt-date-range-chip.component.d.ts +50 -0
- package/chip/watt-filter-chip.component.d.ts +30 -0
- package/chip/watt-menu-chip.component.d.ts +30 -0
- package/clipboard/index.d.ts +18 -0
- package/clipboard/watt-clipboard-intl.service.d.ts +7 -0
- package/clipboard/watt-copy-to-clipboard.directive.d.ts +12 -0
- package/code/index.d.ts +18 -0
- package/code/watt-code.component.d.ts +32 -0
- package/code/watt-code.worker.token.d.ts +18 -0
- package/core/breakpoints/_breakpoints.import.scss +53 -0
- package/core/breakpoints/_include-media.scss +568 -0
- package/core/breakpoints/breakpoints-observer.d.ts +39 -0
- package/core/breakpoints/breakpoints.d.ts +29 -0
- package/core/breakpoints/index.d.ts +18 -0
- package/core/color/+storybook/storybook-colors-overview.component.scss +50 -0
- package/core/color/color-helper.service.d.ts +12 -0
- package/core/color/colors.d.ts +51 -0
- package/core/color/index.d.ts +18 -0
- package/core/date/dayjs.d.ts +22 -0
- package/core/date/index.d.ts +23 -0
- package/core/date/watt-danish-datetime.providers.d.ts +1 -0
- package/core/date/watt-date-adapter.d.ts +31 -0
- package/core/date/watt-date-range.d.ts +25 -0
- package/core/date/watt-date.pipe.d.ts +28 -0
- package/core/date/watt-format-date.d.ts +11 -0
- package/core/date/watt-locale.service.d.ts +13 -0
- package/core/styles/@energinet-datahub/watt/_index.scss +52 -0
- package/core/styles/@energinet-datahub/watt/_utils.scss +16 -0
- package/core/styles/@energinet-datahub/watt/theme/light-theme.scss +71 -0
- package/core/styles/@energinet-datahub/watt/theme/material-overwrites/datepicker.scss +69 -0
- package/core/styles/@energinet-datahub/watt/theme/material-overwrites/snack-bar.scss +26 -0
- package/core/styles/_box-sizing.scss +22 -0
- package/core/styles/_chips.scss +22 -0
- package/core/styles/_elevation.scss +18 -0
- package/core/styles/_hr.scss +20 -0
- package/core/styles/_table.scss +89 -0
- package/core/styles/_tokens.scss +134 -0
- package/core/styles/_tooltip.scss +64 -0
- package/core/styles/_variables.scss +106 -0
- package/core/styles/_vater.scss +69 -0
- package/core/styles/spacing/+storybook/storybook-spacing-overview.component.scss +25 -0
- package/core/styles/spacing/_baseline.scss +23 -0
- package/core/styles/spacing/_inline.scss +38 -0
- package/core/styles/spacing/_inset.scss +61 -0
- package/core/styles/spacing/_spacing.import.scss +113 -0
- package/core/styles/spacing/_stack.scss +38 -0
- package/core/styles/spacing/_variables.scss +14 -0
- package/core/styles/spacing/index.scss +18 -0
- package/core/styles/typography/+storybook/storybook-typography-overview.component.scss +78 -0
- package/core/styles/typography/_rem.scss +24 -0
- package/core/styles/typography/_typography.import.scss +195 -0
- package/core/styles/typography/index.scss +118 -0
- package/data/index.d.ts +20 -0
- package/data/watt-data-actions.component.d.ts +5 -0
- package/data/watt-data-filters.component.d.ts +5 -0
- package/data/watt-data-intl.service.d.ts +15 -0
- package/data/watt-data-table.component.d.ts +27 -0
- package/datetime-field/index.d.ts +17 -0
- package/datetime-field/watt-datetime-field.component.d.ts +39 -0
- package/description-list/index.d.ts +17 -0
- package/description-list/watt-description-list-item.component.d.ts +27 -0
- package/description-list/watt-description-list.component.d.ts +19 -0
- package/drawer/index.d.ts +21 -0
- package/drawer/watt-drawer-actions.component.d.ts +5 -0
- package/drawer/watt-drawer-content.component.d.ts +5 -0
- package/drawer/watt-drawer-heading.component.d.ts +5 -0
- package/drawer/watt-drawer-topbar.component.d.ts +5 -0
- package/drawer/watt-drawer.component.d.ts +61 -0
- package/dropdown/index.d.ts +19 -0
- package/dropdown/watt-dropdown-option.d.ts +22 -0
- package/dropdown/watt-dropdown-value.d.ts +17 -0
- package/dropdown/watt-dropdown.component.d.ts +195 -0
- package/empty-state/icons/explore.d.ts +5 -0
- package/empty-state/icons/no-results.d.ts +5 -0
- package/empty-state/icons/power.d.ts +5 -0
- package/empty-state/index.d.ts +20 -0
- package/empty-state/watt-empty-state.component.d.ts +16 -0
- package/expandable-card/index.d.ts +19 -0
- package/expandable-card/watt-expandable-card.component.d.ts +34 -0
- package/expansion/expansion.component.d.ts +18 -0
- package/expansion/index.d.ts +17 -0
- package/fesm2022/energinet-watt-badge.mjs +66 -0
- package/fesm2022/energinet-watt-badge.mjs.map +1 -0
- package/fesm2022/energinet-watt-breadcrumbs.mjs +116 -0
- package/fesm2022/energinet-watt-breadcrumbs.mjs.map +1 -0
- package/fesm2022/energinet-watt-button.mjs +120 -0
- package/fesm2022/energinet-watt-button.mjs.map +1 -0
- package/fesm2022/energinet-watt-card.mjs +117 -0
- package/fesm2022/energinet-watt-card.mjs.map +1 -0
- package/fesm2022/energinet-watt-checkbox.mjs +118 -0
- package/fesm2022/energinet-watt-checkbox.mjs.map +1 -0
- package/fesm2022/energinet-watt-chip.mjs +760 -0
- package/fesm2022/energinet-watt-chip.mjs.map +1 -0
- package/fesm2022/energinet-watt-clipboard.mjs +118 -0
- package/fesm2022/energinet-watt-clipboard.mjs.map +1 -0
- package/fesm2022/energinet-watt-code.mjs +119 -0
- package/fesm2022/energinet-watt-code.mjs.map +1 -0
- package/fesm2022/energinet-watt-core-breakpoints.mjs +100 -0
- package/fesm2022/energinet-watt-core-breakpoints.mjs.map +1 -0
- package/fesm2022/energinet-watt-core-color.mjs +127 -0
- package/fesm2022/energinet-watt-core-color.mjs.map +1 -0
- package/fesm2022/energinet-watt-core-date.mjs +260 -0
- package/fesm2022/energinet-watt-core-date.mjs.map +1 -0
- package/fesm2022/energinet-watt-data.mjs +286 -0
- package/fesm2022/energinet-watt-data.mjs.map +1 -0
- package/fesm2022/energinet-watt-datetime-field.mjs +233 -0
- package/fesm2022/energinet-watt-datetime-field.mjs.map +1 -0
- package/fesm2022/energinet-watt-description-list.mjs +130 -0
- package/fesm2022/energinet-watt-description-list.mjs.map +1 -0
- package/fesm2022/energinet-watt-drawer.mjs +271 -0
- package/fesm2022/energinet-watt-drawer.mjs.map +1 -0
- package/fesm2022/energinet-watt-dropdown.mjs +423 -0
- package/fesm2022/energinet-watt-dropdown.mjs.map +1 -0
- package/fesm2022/energinet-watt-empty-state.mjs +299 -0
- package/fesm2022/energinet-watt-empty-state.mjs.map +1 -0
- package/fesm2022/energinet-watt-expandable-card.mjs +151 -0
- package/fesm2022/energinet-watt-expandable-card.mjs.map +1 -0
- package/fesm2022/energinet-watt-expansion.mjs +78 -0
- package/fesm2022/energinet-watt-expansion.mjs.map +1 -0
- package/fesm2022/energinet-watt-field.mjs +249 -0
- package/fesm2022/energinet-watt-field.mjs.map +1 -0
- package/fesm2022/energinet-watt-icon-flags.mjs +376 -0
- package/fesm2022/energinet-watt-icon-flags.mjs.map +1 -0
- package/fesm2022/energinet-watt-icon.mjs +195 -0
- package/fesm2022/energinet-watt-icon.mjs.map +1 -0
- package/fesm2022/energinet-watt-modal.mjs +260 -0
- package/fesm2022/energinet-watt-modal.mjs.map +1 -0
- package/fesm2022/energinet-watt-paginator.mjs +164 -0
- package/fesm2022/energinet-watt-paginator.mjs.map +1 -0
- package/fesm2022/energinet-watt-phone-field.mjs +322 -0
- package/fesm2022/energinet-watt-phone-field.mjs.map +1 -0
- package/fesm2022/energinet-watt-picker-__shared.mjs +384 -0
- package/fesm2022/energinet-watt-picker-__shared.mjs.map +1 -0
- package/fesm2022/energinet-watt-picker-datepicker.mjs +430 -0
- package/fesm2022/energinet-watt-picker-datepicker.mjs.map +1 -0
- package/fesm2022/energinet-watt-picker-timepicker.mjs +394 -0
- package/fesm2022/energinet-watt-picker-timepicker.mjs.map +1 -0
- package/fesm2022/energinet-watt-progress-tracker.mjs +141 -0
- package/fesm2022/energinet-watt-progress-tracker.mjs.map +1 -0
- package/fesm2022/energinet-watt-query-params.mjs +95 -0
- package/fesm2022/energinet-watt-query-params.mjs.map +1 -0
- package/fesm2022/energinet-watt-radio.mjs +125 -0
- package/fesm2022/energinet-watt-radio.mjs.map +1 -0
- package/fesm2022/energinet-watt-search.mjs +126 -0
- package/fesm2022/energinet-watt-search.mjs.map +1 -0
- package/fesm2022/energinet-watt-shell.mjs +315 -0
- package/fesm2022/energinet-watt-shell.mjs.map +1 -0
- package/fesm2022/energinet-watt-slider.mjs +159 -0
- package/fesm2022/energinet-watt-slider.mjs.map +1 -0
- package/fesm2022/energinet-watt-spinner.mjs +72 -0
- package/fesm2022/energinet-watt-spinner.mjs.map +1 -0
- package/fesm2022/energinet-watt-stepper.mjs +185 -0
- package/fesm2022/energinet-watt-stepper.mjs.map +1 -0
- package/fesm2022/energinet-watt-table.mjs +423 -0
- package/fesm2022/energinet-watt-table.mjs.map +1 -0
- package/fesm2022/energinet-watt-tabs.mjs +254 -0
- package/fesm2022/energinet-watt-tabs.mjs.map +1 -0
- package/fesm2022/energinet-watt-text-field.mjs +316 -0
- package/fesm2022/energinet-watt-text-field.mjs.map +1 -0
- package/fesm2022/energinet-watt-textarea-field.mjs +136 -0
- package/fesm2022/energinet-watt-textarea-field.mjs.map +1 -0
- package/fesm2022/energinet-watt-toast.mjs +174 -0
- package/fesm2022/energinet-watt-toast.mjs.map +1 -0
- package/fesm2022/energinet-watt-tooltip.mjs +214 -0
- package/fesm2022/energinet-watt-tooltip.mjs.map +1 -0
- package/fesm2022/energinet-watt-utils-css.mjs +72 -0
- package/fesm2022/energinet-watt-utils-css.mjs.map +1 -0
- package/fesm2022/energinet-watt-utils-intersection-observer.mjs +83 -0
- package/fesm2022/energinet-watt-utils-intersection-observer.mjs.map +1 -0
- package/fesm2022/energinet-watt-utils-resize-observer.mjs +144 -0
- package/fesm2022/energinet-watt-utils-resize-observer.mjs.map +1 -0
- package/fesm2022/energinet-watt-validation-message.mjs +114 -0
- package/fesm2022/energinet-watt-validation-message.mjs.map +1 -0
- package/fesm2022/energinet-watt-validators.mjs +40 -0
- package/fesm2022/energinet-watt-validators.mjs.map +1 -0
- package/fesm2022/energinet-watt-vater.mjs +287 -0
- package/fesm2022/energinet-watt-vater.mjs.map +1 -0
- package/fesm2022/energinet-watt.mjs +47 -0
- package/fesm2022/energinet-watt.mjs.map +1 -0
- package/field/index.d.ts +20 -0
- package/field/watt-field-error.component.d.ts +5 -0
- package/field/watt-field-hint.component.d.ts +5 -0
- package/field/watt-field-intl.service.d.ts +8 -0
- package/field/watt-field.component.d.ts +42 -0
- package/icon/flags/index.d.ts +23 -0
- package/icon/flags/watt-flag-de.d.ts +5 -0
- package/icon/flags/watt-flag-dk.d.ts +5 -0
- package/icon/flags/watt-flag-fi.d.ts +5 -0
- package/icon/flags/watt-flag-no.d.ts +5 -0
- package/icon/flags/watt-flag-pl.d.ts +5 -0
- package/icon/flags/watt-flag-se.d.ts +5 -0
- package/icon/flags/watt-flag.d.ts +13 -0
- package/icon/icon.component.d.ts +20 -0
- package/icon/icons.d.ts +82 -0
- package/icon/index.d.ts +17 -0
- package/index.d.ts +33 -0
- package/modal/index.d.ts +18 -0
- package/modal/watt-modal.component.d.ts +86 -0
- package/modal/watt-modal.service.d.ts +62 -0
- package/package.json +237 -0
- package/paginator/index.d.ts +18 -0
- package/paginator/watt-paginator-intl.service.d.ts +14 -0
- package/paginator/watt-paginator.component.d.ts +53 -0
- package/phone-field/index.d.ts +18 -0
- package/phone-field/watt-phone-field-intl.service.d.ts +14 -0
- package/phone-field/watt-phone-field.component.d.ts +75 -0
- package/picker/__shared/index.d.ts +19 -0
- package/picker/__shared/placeholder-mask/watt-placeholder-mask.component.d.ts +34 -0
- package/picker/__shared/watt-picker-base.d.ts +201 -0
- package/picker/__shared/watt-picker-value.d.ts +18 -0
- package/picker/datepicker/index.d.ts +19 -0
- package/picker/datepicker/watt-datepicker-intl.service.d.ts +7 -0
- package/picker/datepicker/watt-datepicker.component.d.ts +149 -0
- package/picker/timepicker/index.d.ts +17 -0
- package/picker/timepicker/maskito-time-range-mask.d.ts +18 -0
- package/picker/timepicker/watt-timepicker.component.d.ts +132 -0
- package/progress-tracker/index.d.ts +20 -0
- package/progress-tracker/watt-progress-tracker-step.component.d.ts +10 -0
- package/progress-tracker/watt-progress-tracker.component.d.ts +5 -0
- package/query-params/index.d.ts +17 -0
- package/query-params/watt-query-params.directive.d.ts +27 -0
- package/radio/index.d.ts +17 -0
- package/radio/watt-radio.component.d.ts +24 -0
- package/search/index.d.ts +17 -0
- package/search/watt-search.component.d.ts +31 -0
- package/shell/index.d.ts +18 -0
- package/shell/nav-list/index.d.ts +18 -0
- package/shell/nav-list/watt-expand-on-active-link.directive.d.ts +26 -0
- package/shell/nav-list/watt-nav-list-item.component.d.ts +16 -0
- package/shell/nav-list/watt-nav-list.component.d.ts +12 -0
- package/shell/shell.component.d.ts +28 -0
- package/slider/index.d.ts +17 -0
- package/slider/watt-slider.component.d.ts +57 -0
- package/spinner/index.d.ts +17 -0
- package/spinner/watt-spinner.component.d.ts +15 -0
- package/stepper/index.d.ts +18 -0
- package/stepper/watt-stepper-step.component.d.ts +34 -0
- package/stepper/watt-stepper.component.d.ts +40 -0
- package/table/index.d.ts +18 -0
- package/table/watt-table-data-source.d.ts +37 -0
- package/table/watt-table.component.d.ts +239 -0
- package/tabs/index.d.ts +26 -0
- package/tabs/watt-link-tab.component.d.ts +7 -0
- package/tabs/watt-link-tabs.component.d.ts +7 -0
- package/tabs/watt-tab.component.d.ts +26 -0
- package/tabs/watt-tabs-action.component.d.ts +5 -0
- package/tabs/watt-tabs.component.d.ts +36 -0
- package/text-field/index.d.ts +17 -0
- package/text-field/watt-text-field.component.d.ts +77 -0
- package/textarea-field/index.d.ts +17 -0
- package/textarea-field/watt-textarea-field.component.d.ts +27 -0
- package/toast/index.d.ts +19 -0
- package/toast/watt-toast.component.d.ts +47 -0
- package/toast/watt-toast.service.d.ts +13 -0
- package/tooltip/index.d.ts +17 -0
- package/tooltip/watt-tooltip.component.d.ts +47 -0
- package/tooltip/watt-tooltip.directive.d.ts +31 -0
- package/utils/css/css-custom-properties.service.d.ts +10 -0
- package/utils/css/index.d.ts +17 -0
- package/utils/intersection-observer/index.d.ts +17 -0
- package/utils/intersection-observer/watt-intersection-observer.service.d.ts +21 -0
- package/utils/resize-observer/index.d.ts +18 -0
- package/utils/resize-observer/watt-resize-observer.directive.d.ts +35 -0
- package/utils/resize-observer/watt-resize-observer.service.d.ts +39 -0
- package/validation-message/index.d.ts +17 -0
- package/validation-message/watt-validation-message.component.d.ts +50 -0
- package/validators/index.d.ts +17 -0
- package/validators/watt-range.validators.d.ts +23 -0
- package/vater/index.d.ts +20 -0
- package/vater/types.d.ts +21 -0
- package/vater/vater-flex.component.d.ts +19 -0
- package/vater/vater-spacer.component.d.ts +5 -0
- package/vater/vater-stack.component.d.ts +14 -0
- package/vater/vater-utility.directive.d.ts +16 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export { default as dayjs } from 'dayjs';
|
|
3
|
+
import utc from 'dayjs/plugin/utc';
|
|
4
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
5
|
+
import duration from 'dayjs/plugin/duration';
|
|
6
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
7
|
+
import * as i1 from '@angular/material/core';
|
|
8
|
+
import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_NATIVE_DATE_FORMATS, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
9
|
+
import * as i0 from '@angular/core';
|
|
10
|
+
import { makeEnvironmentProviders, Pipe, signal, inject, LOCALE_ID, computed, Injectable } from '@angular/core';
|
|
11
|
+
|
|
12
|
+
//#region License
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
29
|
+
//#endregion
|
|
30
|
+
dayjs.extend(utc);
|
|
31
|
+
dayjs.extend(timezone);
|
|
32
|
+
dayjs.extend(duration);
|
|
33
|
+
dayjs.extend(customParseFormat);
|
|
34
|
+
|
|
35
|
+
//#region License
|
|
36
|
+
/**
|
|
37
|
+
* @license
|
|
38
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
39
|
+
*
|
|
40
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
41
|
+
* you may not use this file except in compliance with the License.
|
|
42
|
+
* You may obtain a copy of the License at
|
|
43
|
+
*
|
|
44
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
45
|
+
*
|
|
46
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
47
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
48
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
49
|
+
* See the License for the specific language governing permissions and
|
|
50
|
+
* limitations under the License.
|
|
51
|
+
*/
|
|
52
|
+
//#endregion
|
|
53
|
+
const danishLocale = 'da';
|
|
54
|
+
class WattDateAdapter extends NativeDateAdapter {
|
|
55
|
+
setActiveLocale(language) {
|
|
56
|
+
this.setLocale(language === danishLocale ? danishLocale : 'en-GB');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* This is necessary to remove the dots from the date (ordinals) for danish locale in the calendar view.
|
|
60
|
+
* due to `Intl.DateTimeFormat`
|
|
61
|
+
*/
|
|
62
|
+
getDateNames() {
|
|
63
|
+
const dateNames = super.getDateNames();
|
|
64
|
+
return this.locale === danishLocale
|
|
65
|
+
? dateNames.map((dateName) => dateName.replace(/\./g, ''))
|
|
66
|
+
: dateNames;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Our week starts on Monday
|
|
70
|
+
* @returns 0 for Sunday, 1 for Monday, etc.
|
|
71
|
+
*/
|
|
72
|
+
getFirstDayOfWeek() {
|
|
73
|
+
return 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#region License
|
|
78
|
+
/**
|
|
79
|
+
* @license
|
|
80
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
81
|
+
*
|
|
82
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
83
|
+
* you may not use this file except in compliance with the License.
|
|
84
|
+
* You may obtain a copy of the License at
|
|
85
|
+
*
|
|
86
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
87
|
+
*
|
|
88
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
89
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
90
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
91
|
+
* See the License for the specific language governing permissions and
|
|
92
|
+
* limitations under the License.
|
|
93
|
+
*/
|
|
94
|
+
//#endregion
|
|
95
|
+
const danishDatetimeProviders = makeEnvironmentProviders([
|
|
96
|
+
{ provide: MAT_DATE_LOCALE, useValue: 'da' },
|
|
97
|
+
{
|
|
98
|
+
provide: DateAdapter,
|
|
99
|
+
useClass: WattDateAdapter,
|
|
100
|
+
deps: [MAT_DATE_LOCALE],
|
|
101
|
+
},
|
|
102
|
+
{ provide: MAT_DATE_FORMATS, useValue: MAT_NATIVE_DATE_FORMATS },
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
//#region License
|
|
106
|
+
/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
120
|
+
* limitations under the License.
|
|
121
|
+
*/
|
|
122
|
+
//#endregion
|
|
123
|
+
const formatStrings = {
|
|
124
|
+
monthYear: 'MMMM YYYY',
|
|
125
|
+
short: 'DD-MM-YYYY',
|
|
126
|
+
shortAbbr: 'DD. MMM YYYY',
|
|
127
|
+
long: 'DD-MM-YYYY HH:mm',
|
|
128
|
+
longAbbr: 'DD. MMM YYYY HH:mm',
|
|
129
|
+
time: 'HH:mm',
|
|
130
|
+
longAbbrWithSeconds: 'DD-MMM YYYY HH:mm:ss',
|
|
131
|
+
};
|
|
132
|
+
function wattFormatDate(input, format = 'short', timeZone = 'Europe/Copenhagen') {
|
|
133
|
+
if (!input)
|
|
134
|
+
return null;
|
|
135
|
+
if (input instanceof Date || typeof input === 'string') {
|
|
136
|
+
return dayjs(input).tz(timeZone).format(formatStrings[format]);
|
|
137
|
+
}
|
|
138
|
+
else if (typeof input === 'number') {
|
|
139
|
+
return dayjs(new Date(input)).tz(timeZone).format(formatStrings[format]);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return transformRange(input, format);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function transformRange(input, format) {
|
|
146
|
+
if (dayjs(input.start).isSame(dayjs(input.end), 'day') || input.end === null) {
|
|
147
|
+
return wattFormatDate(input.start, format);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return `${wattFormatDate(input.start, format)} ― ${wattFormatDate(input.end, format)}`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
//#region License
|
|
155
|
+
/**
|
|
156
|
+
* @license
|
|
157
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
158
|
+
*
|
|
159
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
160
|
+
* you may not use this file except in compliance with the License.
|
|
161
|
+
* You may obtain a copy of the License at
|
|
162
|
+
*
|
|
163
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
164
|
+
*
|
|
165
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
166
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
167
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
168
|
+
* See the License for the specific language governing permissions and
|
|
169
|
+
* limitations under the License.
|
|
170
|
+
*/
|
|
171
|
+
//#endregion
|
|
172
|
+
class WattDatePipe {
|
|
173
|
+
/**
|
|
174
|
+
* @param input WattDateRange or string in ISO 8601 format or unix timestamp number
|
|
175
|
+
*/
|
|
176
|
+
transform(input, format = 'short', timeZone = 'Europe/Copenhagen') {
|
|
177
|
+
return wattFormatDate(input, format, timeZone);
|
|
178
|
+
}
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
180
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: WattDatePipe, isStandalone: true, name: "wattDate" });
|
|
181
|
+
}
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDatePipe, decorators: [{
|
|
183
|
+
type: Pipe,
|
|
184
|
+
args: [{
|
|
185
|
+
name: 'wattDate',
|
|
186
|
+
}]
|
|
187
|
+
}] });
|
|
188
|
+
|
|
189
|
+
//#region License
|
|
190
|
+
/**
|
|
191
|
+
* @license
|
|
192
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
193
|
+
*
|
|
194
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
195
|
+
* you may not use this file except in compliance with the License.
|
|
196
|
+
* You may obtain a copy of the License at
|
|
197
|
+
*
|
|
198
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
*
|
|
200
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
* See the License for the specific language governing permissions and
|
|
204
|
+
* limitations under the License.
|
|
205
|
+
*/
|
|
206
|
+
//#endregion
|
|
207
|
+
class WattLocaleService {
|
|
208
|
+
dateAdapter;
|
|
209
|
+
locale = signal(inject(LOCALE_ID));
|
|
210
|
+
isDanish = computed(() => this.locale() == 'da');
|
|
211
|
+
isEnglish = computed(() => this.locale() == 'en');
|
|
212
|
+
constructor(dateAdapter) {
|
|
213
|
+
this.dateAdapter = dateAdapter;
|
|
214
|
+
}
|
|
215
|
+
async setActiveLocale(locale) {
|
|
216
|
+
if (locale === 'da') {
|
|
217
|
+
await import('dayjs/locale/da');
|
|
218
|
+
}
|
|
219
|
+
if (locale === 'en') {
|
|
220
|
+
await import('dayjs/locale/en');
|
|
221
|
+
}
|
|
222
|
+
dayjs.locale(locale);
|
|
223
|
+
this.dateAdapter.setActiveLocale(locale);
|
|
224
|
+
this.locale.set(locale);
|
|
225
|
+
}
|
|
226
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattLocaleService, deps: [{ token: i1.DateAdapter }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
227
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattLocaleService, providedIn: 'root' });
|
|
228
|
+
}
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattLocaleService, decorators: [{
|
|
230
|
+
type: Injectable,
|
|
231
|
+
args: [{
|
|
232
|
+
providedIn: 'root',
|
|
233
|
+
}]
|
|
234
|
+
}], ctorParameters: () => [{ type: i1.DateAdapter }] });
|
|
235
|
+
|
|
236
|
+
//#region License
|
|
237
|
+
/**
|
|
238
|
+
* @license
|
|
239
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
240
|
+
*
|
|
241
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
242
|
+
* you may not use this file except in compliance with the License.
|
|
243
|
+
* You may obtain a copy of the License at
|
|
244
|
+
*
|
|
245
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
246
|
+
*
|
|
247
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
248
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
249
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
250
|
+
* See the License for the specific language governing permissions and
|
|
251
|
+
* limitations under the License.
|
|
252
|
+
*/
|
|
253
|
+
//#endregion
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Generated bundle index. Do not edit.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
export { WattDateAdapter, WattDatePipe, WattLocaleService, danishDatetimeProviders, wattFormatDate };
|
|
260
|
+
//# sourceMappingURL=energinet-watt-core-date.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"energinet-watt-core-date.mjs","sources":["../../../libs/watt/package/core/date/dayjs.ts","../../../libs/watt/package/core/date/watt-date-adapter.ts","../../../libs/watt/package/core/date/watt-danish-datetime.providers.ts","../../../libs/watt/package/core/date/watt-format-date.ts","../../../libs/watt/package/core/date/watt-date.pipe.ts","../../../libs/watt/package/core/date/watt-locale.service.ts","../../../libs/watt/package/core/date/index.ts","../../../libs/watt/package/core/date/energinet-watt-core-date.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 dayjs from 'dayjs'; // eslint-disable-line no-restricted-imports\nimport utc from 'dayjs/plugin/utc';\nimport timezone from 'dayjs/plugin/timezone';\nimport duration from 'dayjs/plugin/duration';\nimport 'dayjs/plugin/customParseFormat';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\n// Required for the packaging process to register these modules as \"side effectful\"\nimport 'dayjs/plugin/utc';\nimport 'dayjs/plugin/timezone';\nimport 'dayjs/plugin/duration';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(duration);\ndayjs.extend(customParseFormat);\n\nexport { dayjs };\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 { NativeDateAdapter } from '@angular/material/core';\n\nexport type WattSupportedLocales = 'da' | 'en';\nconst danishLocale = 'da';\n\nexport class WattDateAdapter extends NativeDateAdapter {\n setActiveLocale(language: WattSupportedLocales): void {\n this.setLocale(language === danishLocale ? danishLocale : 'en-GB');\n }\n\n /**\n * This is necessary to remove the dots from the date (ordinals) for danish locale in the calendar view.\n * due to `Intl.DateTimeFormat`\n */\n override getDateNames(): string[] {\n const dateNames = super.getDateNames();\n\n return this.locale === danishLocale\n ? dateNames.map((dateName) => dateName.replace(/\\./g, ''))\n : dateNames;\n }\n\n /**\n * Our week starts on Monday\n * @returns 0 for Sunday, 1 for Monday, etc.\n */\n override getFirstDayOfWeek(): number {\n return 1;\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\nimport {\n DateAdapter,\n MAT_DATE_FORMATS,\n MAT_DATE_LOCALE,\n MAT_NATIVE_DATE_FORMATS,\n} from '@angular/material/core';\nimport { makeEnvironmentProviders } from '@angular/core';\n\nimport { WattDateAdapter } from './watt-date-adapter';\n\nexport const danishDatetimeProviders = makeEnvironmentProviders([\n { provide: MAT_DATE_LOCALE, useValue: 'da' },\n {\n provide: DateAdapter,\n useClass: WattDateAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n { provide: MAT_DATE_FORMATS, useValue: MAT_NATIVE_DATE_FORMATS },\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 { dayjs } from './dayjs';\nimport { WattRange } from './watt-date-range';\n\nexport const formatStrings = {\n monthYear: 'MMMM YYYY',\n short: 'DD-MM-YYYY',\n shortAbbr: 'DD. MMM YYYY',\n long: 'DD-MM-YYYY HH:mm',\n longAbbr: 'DD. MMM YYYY HH:mm',\n time: 'HH:mm',\n longAbbrWithSeconds: 'DD-MMM YYYY HH:mm:ss',\n};\n\nexport function wattFormatDate(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n): string | null {\n if (!input) return null;\n\n if (input instanceof Date || typeof input === 'string') {\n return dayjs(input).tz(timeZone).format(formatStrings[format]);\n } else if (typeof input === 'number') {\n return dayjs(new Date(input)).tz(timeZone).format(formatStrings[format]);\n } else {\n return transformRange(input, format);\n }\n}\n\nfunction transformRange(\n input: WattRange<Date | string>,\n format: keyof typeof formatStrings\n): string | null {\n if (dayjs(input.start).isSame(dayjs(input.end), 'day') || input.end === null) {\n return wattFormatDate(input.start, format);\n } else {\n return `${wattFormatDate(input.start, format)} ― ${wattFormatDate(input.end, format)}`;\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\nimport { Pipe, PipeTransform } from '@angular/core';\n\nimport { WattRange } from './watt-date-range';\nimport { formatStrings, wattFormatDate } from './watt-format-date';\n\n@Pipe({\n name: 'wattDate',\n})\nexport class WattDatePipe implements PipeTransform {\n /**\n * @param input WattDateRange or string in ISO 8601 format or unix timestamp number\n */\n transform(\n input?: WattRange<Date> | WattRange<string> | Date | string | number | null,\n format: keyof typeof formatStrings = 'short',\n timeZone = 'Europe/Copenhagen'\n ): string | null {\n return wattFormatDate(input, format, timeZone);\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\nimport { computed, inject, Injectable, LOCALE_ID, signal } from '@angular/core';\nimport { DateAdapter } from '@angular/material/core';\n\nimport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nimport { dayjs } from './dayjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WattLocaleService {\n locale = signal(inject<WattSupportedLocales>(LOCALE_ID));\n isDanish = computed(() => this.locale() == 'da');\n isEnglish = computed(() => this.locale() == 'en');\n\n constructor(private dateAdapter: DateAdapter<unknown>) {}\n\n async setActiveLocale(locale: WattSupportedLocales): Promise<void> {\n if (locale === 'da') {\n await import('dayjs/locale/da');\n }\n\n if (locale === 'en') {\n await import('dayjs/locale/en');\n }\n\n dayjs.locale(locale);\n (this.dateAdapter as WattDateAdapter).setActiveLocale(locale);\n this.locale.set(locale);\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 { dayjs } from './dayjs';\nexport { danishDatetimeProviders } from './watt-danish-datetime.providers';\nexport { WattDateAdapter, WattSupportedLocales } from './watt-date-adapter';\nexport { type WattRange, type WattDateRange } from './watt-date-range';\nexport { WattDatePipe } from './watt-date.pipe';\nexport { wattFormatDate } from './watt-format-date';\nexport { WattLocaleService } from './watt-locale.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAaA,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;AACjB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACtB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACtB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;;ACjC/B;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAIA,MAAM,YAAY,GAAG,IAAI;AAEnB,MAAO,eAAgB,SAAQ,iBAAiB,CAAA;AACpD,IAAA,eAAe,CAAC,QAA8B,EAAA;AAC5C,QAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,KAAK,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC;;AAGpE;;;AAGG;IACM,YAAY,GAAA;AACnB,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE;AAEtC,QAAA,OAAO,IAAI,CAAC,MAAM,KAAK;AACrB,cAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,OA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sulation } from '@angular/core';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { VaterFlexComponent, VaterSpacerComponent, VaterStackComponent, VaterUtilityDirective } from '@energinet/watt/vater';
|
|
5
|
+
import { WattCardComponent } from '@energinet/watt/card';
|
|
6
|
+
import { WattButtonComponent } from '@energinet/watt/button';
|
|
7
|
+
import { WattEmptyStateComponent } from '@energinet/watt/empty-state';
|
|
8
|
+
import { WattPaginatorComponent } from '@energinet/watt/paginator';
|
|
9
|
+
import { WattSearchComponent } from '@energinet/watt/search';
|
|
10
|
+
import { WattTableComponent } from '@energinet/watt/table';
|
|
11
|
+
|
|
12
|
+
//#region License
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
29
|
+
//#endregion
|
|
30
|
+
class WattDataFiltersComponent {
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataFiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
32
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattDataFiltersComponent, isStandalone: true, selector: "watt-data-filters", ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataFiltersComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
selector: 'watt-data-filters',
|
|
38
|
+
template: `<ng-content />`,
|
|
39
|
+
}]
|
|
40
|
+
}] });
|
|
41
|
+
|
|
42
|
+
//#region License
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
46
|
+
*
|
|
47
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
48
|
+
* you may not use this file except in compliance with the License.
|
|
49
|
+
* You may obtain a copy of the License at
|
|
50
|
+
*
|
|
51
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
52
|
+
*
|
|
53
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
54
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
55
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
56
|
+
* See the License for the specific language governing permissions and
|
|
57
|
+
* limitations under the License.
|
|
58
|
+
*/
|
|
59
|
+
//#endregion
|
|
60
|
+
class WattDataActionsComponent {
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
62
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattDataActionsComponent, isStandalone: true, selector: "watt-data-actions", ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataActionsComponent, decorators: [{
|
|
65
|
+
type: Component,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: 'watt-data-actions',
|
|
68
|
+
template: `<ng-content />`,
|
|
69
|
+
}]
|
|
70
|
+
}] });
|
|
71
|
+
|
|
72
|
+
//#region License
|
|
73
|
+
/**
|
|
74
|
+
* @license
|
|
75
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
76
|
+
*
|
|
77
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
78
|
+
* you may not use this file except in compliance with the License.
|
|
79
|
+
* You may obtain a copy of the License at
|
|
80
|
+
*
|
|
81
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
*
|
|
83
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
84
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
85
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
|
+
* See the License for the specific language governing permissions and
|
|
87
|
+
* limitations under the License.
|
|
88
|
+
*/
|
|
89
|
+
//#endregion
|
|
90
|
+
class WattDataIntlService {
|
|
91
|
+
changes = new Subject();
|
|
92
|
+
search = 'Search';
|
|
93
|
+
emptyTitle = 'No results found';
|
|
94
|
+
emptyText = 'Try changing the search criteria.';
|
|
95
|
+
emptyRetry = 'Retry';
|
|
96
|
+
errorTitle = 'An unexpected error occured';
|
|
97
|
+
errorText = 'Unfortunately, an error occurred while retrieving the necessary information.';
|
|
98
|
+
defaultTitle = 'An unexpected error occured';
|
|
99
|
+
defaultText = 'Unfortunately, an error occurred while retrieving the necessary information.';
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataIntlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
101
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataIntlService, providedIn: 'root' });
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataIntlService, decorators: [{
|
|
104
|
+
type: Injectable,
|
|
105
|
+
args: [{ providedIn: 'root' }]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
//#region License
|
|
109
|
+
/**
|
|
110
|
+
* @license
|
|
111
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
112
|
+
*
|
|
113
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
114
|
+
* you may not use this file except in compliance with the License.
|
|
115
|
+
* You may obtain a copy of the License at
|
|
116
|
+
*
|
|
117
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
118
|
+
*
|
|
119
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
120
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
121
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
|
+
* See the License for the specific language governing permissions and
|
|
123
|
+
* limitations under the License.
|
|
124
|
+
*/
|
|
125
|
+
//#endregion
|
|
126
|
+
class WattDataTableComponent {
|
|
127
|
+
intl = inject(WattDataIntlService);
|
|
128
|
+
error = input();
|
|
129
|
+
ready = input(true);
|
|
130
|
+
enableSearch = input(true);
|
|
131
|
+
enableRetry = input(false);
|
|
132
|
+
queryTime = input();
|
|
133
|
+
searchLabel = input();
|
|
134
|
+
enablePaginator = input(true);
|
|
135
|
+
count = input();
|
|
136
|
+
variant = input('elevation');
|
|
137
|
+
clear = output();
|
|
138
|
+
pageChanged = output();
|
|
139
|
+
retry = output();
|
|
140
|
+
table = contentChild.required((WattTableComponent), { descendants: true });
|
|
141
|
+
search = viewChild(WattSearchComponent);
|
|
142
|
+
reset = () => this.search()?.clear();
|
|
143
|
+
onSearch(value) {
|
|
144
|
+
this.table().dataSource.filter = value;
|
|
145
|
+
if (!value)
|
|
146
|
+
this.clear.emit();
|
|
147
|
+
}
|
|
148
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
149
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattDataTableComponent, isStandalone: true, selector: "watt-data-table", inputs: { error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, ready: { classPropertyName: "ready", publicName: "ready", isSignal: true, isRequired: false, transformFunction: null }, enableSearch: { classPropertyName: "enableSearch", publicName: "enableSearch", isSignal: true, isRequired: false, transformFunction: null }, enableRetry: { classPropertyName: "enableRetry", publicName: "enableRetry", isSignal: true, isRequired: false, transformFunction: null }, queryTime: { classPropertyName: "queryTime", publicName: "queryTime", isSignal: true, isRequired: false, transformFunction: null }, searchLabel: { classPropertyName: "searchLabel", publicName: "searchLabel", isSignal: true, isRequired: false, transformFunction: null }, enablePaginator: { classPropertyName: "enablePaginator", publicName: "enablePaginator", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clear: "clear", pageChanged: "pageChanged", retry: "retry" }, queries: [{ propertyName: "table", first: true, predicate: (WattTableComponent), descendants: true, isSignal: true }], viewQueries: [{ propertyName: "search", first: true, predicate: WattSearchComponent, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
150
|
+
<watt-card vater fill="vertical" [variant]="variant()">
|
|
151
|
+
<vater-flex fill="vertical" gap="m">
|
|
152
|
+
<vater-stack direction="row" gap="m">
|
|
153
|
+
<vater-stack direction="row" gap="s">
|
|
154
|
+
<ng-content select="h3" />
|
|
155
|
+
<ng-content select="h4" />
|
|
156
|
+
<span class="watt-chip-label">{{ count() ?? table().dataSource.totalCount }}</span>
|
|
157
|
+
@if (queryTime()) {
|
|
158
|
+
<span class="watt-label">in {{ queryTime() }} ms</span>
|
|
159
|
+
}
|
|
160
|
+
</vater-stack>
|
|
161
|
+
<ng-content />
|
|
162
|
+
<vater-spacer />
|
|
163
|
+
@if (enableSearch()) {
|
|
164
|
+
<watt-search [label]="searchLabel() ?? intl.search" (search)="onSearch($event)" />
|
|
165
|
+
}
|
|
166
|
+
<ng-content select="watt-data-actions" />
|
|
167
|
+
<ng-content select="watt-button" />
|
|
168
|
+
</vater-stack>
|
|
169
|
+
<ng-content select="watt-data-filters" />
|
|
170
|
+
<vater-flex scrollable fill="vertical">
|
|
171
|
+
<ng-content select="watt-table" />
|
|
172
|
+
@if (!table().loading && table().dataSource.filteredData.length === 0) {
|
|
173
|
+
<div class="watt-data-table--empty-state">
|
|
174
|
+
<watt-empty-state
|
|
175
|
+
[icon]="error() ? 'custom-power' : ready() ? 'cancel' : 'custom-explore'"
|
|
176
|
+
[title]="error() ? intl.errorTitle : ready() ? intl.emptyTitle : intl.defaultTitle"
|
|
177
|
+
[message]="error() ? intl.errorText : ready() ? intl.emptyText : intl.defaultText"
|
|
178
|
+
>
|
|
179
|
+
@if (enableRetry()) {
|
|
180
|
+
<watt-button variant="secondary" (click)="retry.emit()">{{
|
|
181
|
+
intl.emptyRetry
|
|
182
|
+
}}</watt-button>
|
|
183
|
+
}
|
|
184
|
+
</watt-empty-state>
|
|
185
|
+
</div>
|
|
186
|
+
}
|
|
187
|
+
</vater-flex>
|
|
188
|
+
@if (enablePaginator()) {
|
|
189
|
+
<watt-paginator
|
|
190
|
+
[for]="table().dataSource"
|
|
191
|
+
[length]="count() ?? 0"
|
|
192
|
+
(changed)="pageChanged.emit($event)"
|
|
193
|
+
/>
|
|
194
|
+
}
|
|
195
|
+
</vater-flex>
|
|
196
|
+
</watt-card>
|
|
197
|
+
`, isInline: true, styles: [":root{--watt-data-table-empty-state-margin: auto}watt-data-table h3,watt-data-table h4{line-height:44px;min-height:44px;margin:0}watt-data-table watt-data-filters{min-height:44px}watt-data-table watt-paginator{display:block;margin:calc(-1 * var(--watt-space-m)) -24px -24px}watt-data-table watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:none}.watt-data-table--empty-state{margin-bottom:var(--watt-space-m);overflow:auto}.watt-data-table--empty-state>watt-empty-state{margin:var(--watt-data-table-empty-state-margin)}\n"], dependencies: [{ kind: "component", type: VaterFlexComponent, selector: "vater-flex, [vater-flex]", inputs: ["direction", "grow", "shrink", "basis", "gap", "justify", "wrap", "scrollable", "offset"] }, { kind: "component", type: VaterSpacerComponent, selector: "vater-spacer, [vater-spacer]" }, { kind: "component", type: VaterStackComponent, selector: "vater-stack, [vater-stack]", inputs: ["align", "direction", "gap", "justify", "offset"] }, { kind: "directive", type: VaterUtilityDirective, selector: "[vater]", inputs: ["fill", "inset", "center"] }, { kind: "component", type: WattCardComponent, selector: "watt-card", inputs: ["variant", "loading"] }, { kind: "component", type: WattEmptyStateComponent, selector: "watt-empty-state", inputs: ["icon", "size", "title", "message", "useHTML"] }, { kind: "component", type: WattPaginatorComponent, selector: "watt-paginator", inputs: ["length", "pageSizeOptions", "pageSize", "pageIndex", "for"], outputs: ["changed"] }, { kind: "component", type: WattSearchComponent, selector: "watt-search", inputs: ["label", "debounceTime"], outputs: ["search"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
198
|
+
}
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDataTableComponent, decorators: [{
|
|
200
|
+
type: Component,
|
|
201
|
+
args: [{ selector: 'watt-data-table', imports: [
|
|
202
|
+
VaterFlexComponent,
|
|
203
|
+
VaterSpacerComponent,
|
|
204
|
+
VaterStackComponent,
|
|
205
|
+
VaterUtilityDirective,
|
|
206
|
+
WattCardComponent,
|
|
207
|
+
WattEmptyStateComponent,
|
|
208
|
+
WattPaginatorComponent,
|
|
209
|
+
WattSearchComponent,
|
|
210
|
+
WattButtonComponent,
|
|
211
|
+
], encapsulation: ViewEncapsulation.None, template: `
|
|
212
|
+
<watt-card vater fill="vertical" [variant]="variant()">
|
|
213
|
+
<vater-flex fill="vertical" gap="m">
|
|
214
|
+
<vater-stack direction="row" gap="m">
|
|
215
|
+
<vater-stack direction="row" gap="s">
|
|
216
|
+
<ng-content select="h3" />
|
|
217
|
+
<ng-content select="h4" />
|
|
218
|
+
<span class="watt-chip-label">{{ count() ?? table().dataSource.totalCount }}</span>
|
|
219
|
+
@if (queryTime()) {
|
|
220
|
+
<span class="watt-label">in {{ queryTime() }} ms</span>
|
|
221
|
+
}
|
|
222
|
+
</vater-stack>
|
|
223
|
+
<ng-content />
|
|
224
|
+
<vater-spacer />
|
|
225
|
+
@if (enableSearch()) {
|
|
226
|
+
<watt-search [label]="searchLabel() ?? intl.search" (search)="onSearch($event)" />
|
|
227
|
+
}
|
|
228
|
+
<ng-content select="watt-data-actions" />
|
|
229
|
+
<ng-content select="watt-button" />
|
|
230
|
+
</vater-stack>
|
|
231
|
+
<ng-content select="watt-data-filters" />
|
|
232
|
+
<vater-flex scrollable fill="vertical">
|
|
233
|
+
<ng-content select="watt-table" />
|
|
234
|
+
@if (!table().loading && table().dataSource.filteredData.length === 0) {
|
|
235
|
+
<div class="watt-data-table--empty-state">
|
|
236
|
+
<watt-empty-state
|
|
237
|
+
[icon]="error() ? 'custom-power' : ready() ? 'cancel' : 'custom-explore'"
|
|
238
|
+
[title]="error() ? intl.errorTitle : ready() ? intl.emptyTitle : intl.defaultTitle"
|
|
239
|
+
[message]="error() ? intl.errorText : ready() ? intl.emptyText : intl.defaultText"
|
|
240
|
+
>
|
|
241
|
+
@if (enableRetry()) {
|
|
242
|
+
<watt-button variant="secondary" (click)="retry.emit()">{{
|
|
243
|
+
intl.emptyRetry
|
|
244
|
+
}}</watt-button>
|
|
245
|
+
}
|
|
246
|
+
</watt-empty-state>
|
|
247
|
+
</div>
|
|
248
|
+
}
|
|
249
|
+
</vater-flex>
|
|
250
|
+
@if (enablePaginator()) {
|
|
251
|
+
<watt-paginator
|
|
252
|
+
[for]="table().dataSource"
|
|
253
|
+
[length]="count() ?? 0"
|
|
254
|
+
(changed)="pageChanged.emit($event)"
|
|
255
|
+
/>
|
|
256
|
+
}
|
|
257
|
+
</vater-flex>
|
|
258
|
+
</watt-card>
|
|
259
|
+
`, styles: [":root{--watt-data-table-empty-state-margin: auto}watt-data-table h3,watt-data-table h4{line-height:44px;min-height:44px;margin:0}watt-data-table watt-data-filters{min-height:44px}watt-data-table watt-paginator{display:block;margin:calc(-1 * var(--watt-space-m)) -24px -24px}watt-data-table watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:none}.watt-data-table--empty-state{margin-bottom:var(--watt-space-m);overflow:auto}.watt-data-table--empty-state>watt-empty-state{margin:var(--watt-data-table-empty-state-margin)}\n"] }]
|
|
260
|
+
}] });
|
|
261
|
+
|
|
262
|
+
//#region License
|
|
263
|
+
/**
|
|
264
|
+
* @license
|
|
265
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
266
|
+
*
|
|
267
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
268
|
+
* you may not use this file except in compliance with the License.
|
|
269
|
+
* You may obtain a copy of the License at
|
|
270
|
+
*
|
|
271
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
272
|
+
*
|
|
273
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
274
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
275
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
276
|
+
* See the License for the specific language governing permissions and
|
|
277
|
+
* limitations under the License.
|
|
278
|
+
*/
|
|
279
|
+
//#endregion
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Generated bundle index. Do not edit.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
export { WattDataActionsComponent, WattDataFiltersComponent, WattDataIntlService, WattDataTableComponent };
|
|
286
|
+
//# sourceMappingURL=energinet-watt-data.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"energinet-watt-data.mjs","sources":["../../../libs/watt/package/data/watt-data-filters.component.ts","../../../libs/watt/package/data/watt-data-actions.component.ts","../../../libs/watt/package/data/watt-data-intl.service.ts","../../../libs/watt/package/data/watt-data-table.component.ts","../../../libs/watt/package/data/index.ts","../../../libs/watt/package/data/energinet-watt-data.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 { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-data-filters',\n template: `<ng-content />`,\n})\nexport class WattDataFiltersComponent {}\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 { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-data-actions',\n template: `<ng-content />`,\n})\nexport class WattDataActionsComponent {}\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 { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class WattDataIntlService {\n readonly changes: Subject<void> = new Subject<void>();\n search = 'Search';\n emptyTitle = 'No results found';\n emptyText = 'Try changing the search criteria.';\n emptyRetry = 'Retry';\n errorTitle = 'An unexpected error occured';\n errorText = 'Unfortunately, an error occurred while retrieving the necessary information.';\n defaultTitle = 'An unexpected error occured';\n defaultText = 'Unfortunately, an error occurred while retrieving the necessary information.';\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 {\n Component,\n ViewEncapsulation,\n contentChild,\n inject,\n input,\n output,\n viewChild,\n} from '@angular/core';\nimport { PageEvent } from '@angular/material/paginator';\n\nimport {\n VaterFlexComponent,\n VaterSpacerComponent,\n VaterStackComponent,\n VaterUtilityDirective,\n} from '@energinet/watt/vater';\nimport { WATT_CARD_VARIANT, WattCardComponent } from '@energinet/watt/card';\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattEmptyStateComponent } from '@energinet/watt/empty-state';\nimport { WattPaginatorComponent } from '@energinet/watt/paginator';\nimport { WattSearchComponent } from '@energinet/watt/search';\nimport { WattTableComponent } from '@energinet/watt/table';\n\nimport { WattDataIntlService } from './watt-data-intl.service';\n\n@Component({\n selector: 'watt-data-table',\n imports: [\n VaterFlexComponent,\n VaterSpacerComponent,\n VaterStackComponent,\n VaterUtilityDirective,\n WattCardComponent,\n WattEmptyStateComponent,\n WattPaginatorComponent,\n WattSearchComponent,\n WattButtonComponent,\n ],\n encapsulation: ViewEncapsulation.None,\n styles: [\n `\n :root {\n --watt-data-table-empty-state-margin: auto;\n }\n\n watt-data-table h3,\n watt-data-table h4 {\n line-height: 44px;\n min-height: 44px;\n margin: 0;\n }\n\n watt-data-table watt-data-filters {\n min-height: 44px;\n }\n\n watt-data-table watt-paginator {\n display: block;\n margin: calc(-1 * var(--watt-space-m)) -24px -24px;\n }\n\n watt-data-table watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell {\n border-bottom: none;\n }\n\n .watt-data-table--empty-state {\n margin-bottom: var(--watt-space-m);\n overflow: auto;\n\n & > watt-empty-state {\n margin: var(--watt-data-table-empty-state-margin);\n }\n }\n `,\n ],\n template: `\n <watt-card vater fill=\"vertical\" [variant]=\"variant()\">\n <vater-flex fill=\"vertical\" gap=\"m\">\n <vater-stack direction=\"row\" gap=\"m\">\n <vater-stack direction=\"row\" gap=\"s\">\n <ng-content select=\"h3\" />\n <ng-content select=\"h4\" />\n <span class=\"watt-chip-label\">{{ count() ?? table().dataSource.totalCount }}</span>\n @if (queryTime()) {\n <span class=\"watt-label\">in {{ queryTime() }} ms</span>\n }\n </vater-stack>\n <ng-content />\n <vater-spacer />\n @if (enableSearch()) {\n <watt-search [label]=\"searchLabel() ?? intl.search\" (search)=\"onSearch($event)\" />\n }\n <ng-content select=\"watt-data-actions\" />\n <ng-content select=\"watt-button\" />\n </vater-stack>\n <ng-content select=\"watt-data-filters\" />\n <vater-flex scrollable fill=\"vertical\">\n <ng-content select=\"watt-table\" />\n @if (!table().loading && table().dataSource.filteredData.length === 0) {\n <div class=\"watt-data-table--empty-state\">\n <watt-empty-state\n [icon]=\"error() ? 'custom-power' : ready() ? 'cancel' : 'custom-explore'\"\n [title]=\"error() ? intl.errorTitle : ready() ? intl.emptyTitle : intl.defaultTitle\"\n [message]=\"error() ? intl.errorText : ready() ? intl.emptyText : intl.defaultText\"\n >\n @if (enableRetry()) {\n <watt-button variant=\"secondary\" (click)=\"retry.emit()\">{{\n intl.emptyRetry\n }}</watt-button>\n }\n </watt-empty-state>\n </div>\n }\n </vater-flex>\n @if (enablePaginator()) {\n <watt-paginator\n [for]=\"table().dataSource\"\n [length]=\"count() ?? 0\"\n (changed)=\"pageChanged.emit($event)\"\n />\n }\n </vater-flex>\n </watt-card>\n `,\n})\nexport class WattDataTableComponent {\n intl = inject(WattDataIntlService);\n\n error = input<unknown>();\n ready = input(true);\n enableSearch = input(true);\n enableRetry = input(false);\n queryTime = input<number>();\n searchLabel = input<string>();\n enablePaginator = input(true);\n count = input<number>();\n variant = input<WATT_CARD_VARIANT>('elevation');\n\n clear = output();\n pageChanged = output<PageEvent>();\n retry = output();\n\n table = contentChild.required(WattTableComponent<unknown>, { descendants: true });\n\n search = viewChild(WattSearchComponent);\n reset = () => this.search()?.clear();\n\n onSearch(value: string) {\n this.table().dataSource.filter = value;\n if (!value) this.clear.emit();\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 { WattDataFiltersComponent } from './watt-data-filters.component';\nexport { WattDataActionsComponent } from './watt-data-actions.component';\nexport { WattDataIntlService } from './watt-data-intl.service';\nexport { WattDataTableComponent } from './watt-data-table.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAOa,wBAAwB,CAAA;uGAAxB,wBAAwB,EAAA,IA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