@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,760 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component, output, EventEmitter, Output, Input, ViewEncapsulation, Injectable, inject, HostBinding, ElementRef, forwardRef, Directive } from '@angular/core';
|
|
3
|
+
import { WattIconComponent } from '@energinet/watt/icon';
|
|
4
|
+
import * as i1 from '@angular/material/datepicker';
|
|
5
|
+
import { MatDatepickerModule, DefaultMatCalendarRangeStrategy, DateRange, MAT_DATE_RANGE_SELECTION_STRATEGY } from '@angular/material/datepicker';
|
|
6
|
+
import { WattDatePipe, dayjs } from '@energinet/watt/core/date';
|
|
7
|
+
import { WattFieldComponent } from '@energinet/watt/field';
|
|
8
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import { DateAdapter } from '@angular/material/core';
|
|
10
|
+
import { WattButtonComponent } from '@energinet/watt/button';
|
|
11
|
+
import { WattDatepickerIntlService } from '@energinet/watt/picker/datepicker';
|
|
12
|
+
|
|
13
|
+
//#region License
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
17
|
+
*
|
|
18
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
19
|
+
* you may not use this file except in compliance with the License.
|
|
20
|
+
* You may obtain a copy of the License at
|
|
21
|
+
*
|
|
22
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
+
*
|
|
24
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
+
* See the License for the specific language governing permissions and
|
|
28
|
+
* limitations under the License.
|
|
29
|
+
*/
|
|
30
|
+
//#endregion
|
|
31
|
+
class WattChipComponent {
|
|
32
|
+
selected = input(false);
|
|
33
|
+
disabled = input(false);
|
|
34
|
+
readonly = input(false);
|
|
35
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
36
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattChipComponent, isStandalone: true, selector: "watt-chip", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
37
|
+
<label
|
|
38
|
+
[class.selected]="selected()"
|
|
39
|
+
[class.disabled]="disabled()"
|
|
40
|
+
[class.read-only]="readonly()"
|
|
41
|
+
>
|
|
42
|
+
@if (selected()) {
|
|
43
|
+
<watt-icon class="selected-icon" name="checkmark" size="s" [attr.aria-hidden]="true" />
|
|
44
|
+
}
|
|
45
|
+
<ng-content />
|
|
46
|
+
</label>
|
|
47
|
+
`, isInline: true, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);color:var(--watt-on-dark-high-emphasis);border-color:transparent}label.selected:hover,label.selected:focus-within{background:var(--watt-color-primary-dark);border-color:transparent}label.disabled{border:1px solid var(--watt-on-light-surface-overlay);color:var(--watt-on-light-low-emphasis);cursor:not-allowed}label.read-only{cursor:inherit}label .selected-icon{margin-right:var(--watt-space-s)}\n"], dependencies: [{ kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattChipComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ imports: [WattIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'watt-chip', template: `
|
|
52
|
+
<label
|
|
53
|
+
[class.selected]="selected()"
|
|
54
|
+
[class.disabled]="disabled()"
|
|
55
|
+
[class.read-only]="readonly()"
|
|
56
|
+
>
|
|
57
|
+
@if (selected()) {
|
|
58
|
+
<watt-icon class="selected-icon" name="checkmark" size="s" [attr.aria-hidden]="true" />
|
|
59
|
+
}
|
|
60
|
+
<ng-content />
|
|
61
|
+
</label>
|
|
62
|
+
`, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);color:var(--watt-on-dark-high-emphasis);border-color:transparent}label.selected:hover,label.selected:focus-within{background:var(--watt-color-primary-dark);border-color:transparent}label.disabled{border:1px solid var(--watt-on-light-surface-overlay);color:var(--watt-on-light-low-emphasis);cursor:not-allowed}label.read-only{cursor:inherit}label .selected-icon{margin-right:var(--watt-space-s)}\n"] }]
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
//#region License
|
|
66
|
+
/**
|
|
67
|
+
* @license
|
|
68
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
69
|
+
*
|
|
70
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
71
|
+
* you may not use this file except in compliance with the License.
|
|
72
|
+
* You may obtain a copy of the License at
|
|
73
|
+
*
|
|
74
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
75
|
+
*
|
|
76
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
77
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
78
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
79
|
+
* See the License for the specific language governing permissions and
|
|
80
|
+
* limitations under the License.
|
|
81
|
+
*/
|
|
82
|
+
//#endregion
|
|
83
|
+
class WattActionChipComponent {
|
|
84
|
+
disabled = input(false);
|
|
85
|
+
icon = input.required();
|
|
86
|
+
action = output();
|
|
87
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattActionChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
88
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: WattActionChipComponent, isStandalone: true, selector: "watt-action-chip", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { action: "action" }, ngImport: i0, template: `
|
|
89
|
+
<watt-chip [disabled]="disabled()">
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
class="cdk-visually-hidden"
|
|
93
|
+
(click)="$event.stopImmediatePropagation(); action.emit()"
|
|
94
|
+
[disabled]="disabled()"
|
|
95
|
+
></button>
|
|
96
|
+
<ng-content />
|
|
97
|
+
<watt-icon
|
|
98
|
+
size="s"
|
|
99
|
+
[name]="icon()"
|
|
100
|
+
class="menu-icon"
|
|
101
|
+
[attr.aria-hidden]="true"
|
|
102
|
+
[class.disabled]="disabled()"
|
|
103
|
+
/>
|
|
104
|
+
</watt-chip>
|
|
105
|
+
`, isInline: true, styles: [":host{display:block}.disabled{color:var(--watt-on-light-low-emphasis)}\n"], dependencies: [{ kind: "component", type: WattChipComponent, selector: "watt-chip", inputs: ["selected", "disabled", "readonly"] }, { kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }] });
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattActionChipComponent, decorators: [{
|
|
108
|
+
type: Component,
|
|
109
|
+
args: [{ imports: [WattChipComponent, WattIconComponent], selector: 'watt-action-chip', template: `
|
|
110
|
+
<watt-chip [disabled]="disabled()">
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
class="cdk-visually-hidden"
|
|
114
|
+
(click)="$event.stopImmediatePropagation(); action.emit()"
|
|
115
|
+
[disabled]="disabled()"
|
|
116
|
+
></button>
|
|
117
|
+
<ng-content />
|
|
118
|
+
<watt-icon
|
|
119
|
+
size="s"
|
|
120
|
+
[name]="icon()"
|
|
121
|
+
class="menu-icon"
|
|
122
|
+
[attr.aria-hidden]="true"
|
|
123
|
+
[class.disabled]="disabled()"
|
|
124
|
+
/>
|
|
125
|
+
</watt-chip>
|
|
126
|
+
`, styles: [":host{display:block}.disabled{color:var(--watt-on-light-low-emphasis)}\n"] }]
|
|
127
|
+
}] });
|
|
128
|
+
|
|
129
|
+
//#region License
|
|
130
|
+
/**
|
|
131
|
+
* @license
|
|
132
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
133
|
+
*
|
|
134
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
135
|
+
* you may not use this file except in compliance with the License.
|
|
136
|
+
* You may obtain a copy of the License at
|
|
137
|
+
*
|
|
138
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
139
|
+
*
|
|
140
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
141
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
142
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
143
|
+
* See the License for the specific language governing permissions and
|
|
144
|
+
* limitations under the License.
|
|
145
|
+
*/
|
|
146
|
+
//#endregion
|
|
147
|
+
class WattMenuChipComponent {
|
|
148
|
+
opened = false;
|
|
149
|
+
disabled = false;
|
|
150
|
+
name;
|
|
151
|
+
value;
|
|
152
|
+
selected = false;
|
|
153
|
+
hasPopup = 'menu';
|
|
154
|
+
// eslint-disable-next-line @angular-eslint/no-output-native
|
|
155
|
+
toggle = new EventEmitter();
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattMenuChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
157
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattMenuChipComponent, isStandalone: true, selector: "watt-menu-chip", inputs: { opened: "opened", disabled: "disabled", name: "name", value: "value", selected: "selected", hasPopup: "hasPopup" }, outputs: { toggle: "toggle" }, ngImport: i0, template: `
|
|
158
|
+
<watt-chip [disabled]="disabled" [selected]="selected">
|
|
159
|
+
<button
|
|
160
|
+
class="cdk-visually-hidden"
|
|
161
|
+
[attr.aria-haspopup]="hasPopup"
|
|
162
|
+
[attr.aria-expanded]="opened"
|
|
163
|
+
[attr.aria-pressed]="selected"
|
|
164
|
+
(click)="toggle.emit()"
|
|
165
|
+
[disabled]="disabled"
|
|
166
|
+
></button>
|
|
167
|
+
<ng-content />
|
|
168
|
+
<watt-icon
|
|
169
|
+
size="s"
|
|
170
|
+
name="arrowDropDown"
|
|
171
|
+
class="menu-icon"
|
|
172
|
+
[attr.aria-hidden]="true"
|
|
173
|
+
[class.opened]="opened"
|
|
174
|
+
[class.selected]="selected"
|
|
175
|
+
[class.disabled]="disabled"
|
|
176
|
+
/>
|
|
177
|
+
</watt-chip>
|
|
178
|
+
`, isInline: true, styles: [":host{display:block}.menu-icon{margin-left:var(--watt-space-xs);transition:linear .2s all;color:var(--watt-color-primary)}.menu-icon.disabled{color:var(--watt-on-light-low-emphasis)}.opened{transform:rotate(180deg)}.selected{color:var(--watt-color-neutral-white)}.disabled{color:var(--watt-on-light-low-emphasis)}\n"], dependencies: [{ kind: "component", type: WattChipComponent, selector: "watt-chip", inputs: ["selected", "disabled", "readonly"] }, { kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }] });
|
|
179
|
+
}
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattMenuChipComponent, decorators: [{
|
|
181
|
+
type: Component,
|
|
182
|
+
args: [{ imports: [WattChipComponent, WattIconComponent], selector: 'watt-menu-chip', template: `
|
|
183
|
+
<watt-chip [disabled]="disabled" [selected]="selected">
|
|
184
|
+
<button
|
|
185
|
+
class="cdk-visually-hidden"
|
|
186
|
+
[attr.aria-haspopup]="hasPopup"
|
|
187
|
+
[attr.aria-expanded]="opened"
|
|
188
|
+
[attr.aria-pressed]="selected"
|
|
189
|
+
(click)="toggle.emit()"
|
|
190
|
+
[disabled]="disabled"
|
|
191
|
+
></button>
|
|
192
|
+
<ng-content />
|
|
193
|
+
<watt-icon
|
|
194
|
+
size="s"
|
|
195
|
+
name="arrowDropDown"
|
|
196
|
+
class="menu-icon"
|
|
197
|
+
[attr.aria-hidden]="true"
|
|
198
|
+
[class.opened]="opened"
|
|
199
|
+
[class.selected]="selected"
|
|
200
|
+
[class.disabled]="disabled"
|
|
201
|
+
/>
|
|
202
|
+
</watt-chip>
|
|
203
|
+
`, styles: [":host{display:block}.menu-icon{margin-left:var(--watt-space-xs);transition:linear .2s all;color:var(--watt-color-primary)}.menu-icon.disabled{color:var(--watt-on-light-low-emphasis)}.opened{transform:rotate(180deg)}.selected{color:var(--watt-color-neutral-white)}.disabled{color:var(--watt-on-light-low-emphasis)}\n"] }]
|
|
204
|
+
}], propDecorators: { opened: [{
|
|
205
|
+
type: Input
|
|
206
|
+
}], disabled: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], name: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], value: [{
|
|
211
|
+
type: Input
|
|
212
|
+
}], selected: [{
|
|
213
|
+
type: Input
|
|
214
|
+
}], hasPopup: [{
|
|
215
|
+
type: Input
|
|
216
|
+
}], toggle: [{
|
|
217
|
+
type: Output
|
|
218
|
+
}] } });
|
|
219
|
+
|
|
220
|
+
//#region License
|
|
221
|
+
/**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
224
|
+
*
|
|
225
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
226
|
+
* you may not use this file except in compliance with the License.
|
|
227
|
+
* You may obtain a copy of the License at
|
|
228
|
+
*
|
|
229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
230
|
+
*
|
|
231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
234
|
+
* See the License for the specific language governing permissions and
|
|
235
|
+
* limitations under the License.
|
|
236
|
+
*/
|
|
237
|
+
//#endregion
|
|
238
|
+
class WattDateChipComponent {
|
|
239
|
+
disabled = false;
|
|
240
|
+
label;
|
|
241
|
+
placeholder;
|
|
242
|
+
value;
|
|
243
|
+
formControl;
|
|
244
|
+
selectionChange = new EventEmitter();
|
|
245
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
246
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattDateChipComponent, isStandalone: true, selector: "watt-date-chip", inputs: { disabled: "disabled", label: "label", placeholder: "placeholder", value: "value", formControl: "formControl" }, outputs: { selectionChange: "selectionChange" }, ngImport: i0, template: `
|
|
247
|
+
<mat-datepicker #picker />
|
|
248
|
+
<watt-field [control]="formControl" [chipMode]="true">
|
|
249
|
+
<watt-menu-chip
|
|
250
|
+
hasPopup="dialog"
|
|
251
|
+
[disabled]="disabled"
|
|
252
|
+
[selected]="!!value"
|
|
253
|
+
[opened]="picker.opened"
|
|
254
|
+
(toggle)="picker.open()"
|
|
255
|
+
>
|
|
256
|
+
<input
|
|
257
|
+
tabindex="-1"
|
|
258
|
+
class="cdk-visually-hidden"
|
|
259
|
+
type="text"
|
|
260
|
+
[value]="value"
|
|
261
|
+
[matDatepicker]="picker"
|
|
262
|
+
(dateChange)="value = $event.value"
|
|
263
|
+
(dateChange)="selectionChange.emit($event.value)"
|
|
264
|
+
/>
|
|
265
|
+
{{ placeholder }}
|
|
266
|
+
<span>
|
|
267
|
+
@if (value) {
|
|
268
|
+
@if (placeholder) {
|
|
269
|
+
:
|
|
270
|
+
}
|
|
271
|
+
{{ value | wattDate }}
|
|
272
|
+
}
|
|
273
|
+
</span>
|
|
274
|
+
</watt-menu-chip>
|
|
275
|
+
<ng-content ngProjectAs="watt-field-hint" select="watt-field-hint" />
|
|
276
|
+
<ng-content ngProjectAs="watt-field-error" select="watt-field-error" />
|
|
277
|
+
</watt-field>
|
|
278
|
+
`, isInline: true, styles: ["watt-date-chip input{top:0;bottom:0;height:auto;visibility:hidden}watt-date-chip watt-field label .watt-field-wrapper{background-color:transparent}\n"], dependencies: [{ kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: WattMenuChipComponent, selector: "watt-menu-chip", inputs: ["opened", "disabled", "name", "value", "selected", "hasPopup"], outputs: ["toggle"] }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }, { kind: "pipe", type: WattDatePipe, name: "wattDate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
279
|
+
}
|
|
280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateChipComponent, decorators: [{
|
|
281
|
+
type: Component,
|
|
282
|
+
args: [{ imports: [MatDatepickerModule, WattMenuChipComponent, WattFieldComponent, WattDatePipe], selector: 'watt-date-chip', encapsulation: ViewEncapsulation.None, template: `
|
|
283
|
+
<mat-datepicker #picker />
|
|
284
|
+
<watt-field [control]="formControl" [chipMode]="true">
|
|
285
|
+
<watt-menu-chip
|
|
286
|
+
hasPopup="dialog"
|
|
287
|
+
[disabled]="disabled"
|
|
288
|
+
[selected]="!!value"
|
|
289
|
+
[opened]="picker.opened"
|
|
290
|
+
(toggle)="picker.open()"
|
|
291
|
+
>
|
|
292
|
+
<input
|
|
293
|
+
tabindex="-1"
|
|
294
|
+
class="cdk-visually-hidden"
|
|
295
|
+
type="text"
|
|
296
|
+
[value]="value"
|
|
297
|
+
[matDatepicker]="picker"
|
|
298
|
+
(dateChange)="value = $event.value"
|
|
299
|
+
(dateChange)="selectionChange.emit($event.value)"
|
|
300
|
+
/>
|
|
301
|
+
{{ placeholder }}
|
|
302
|
+
<span>
|
|
303
|
+
@if (value) {
|
|
304
|
+
@if (placeholder) {
|
|
305
|
+
:
|
|
306
|
+
}
|
|
307
|
+
{{ value | wattDate }}
|
|
308
|
+
}
|
|
309
|
+
</span>
|
|
310
|
+
</watt-menu-chip>
|
|
311
|
+
<ng-content ngProjectAs="watt-field-hint" select="watt-field-hint" />
|
|
312
|
+
<ng-content ngProjectAs="watt-field-error" select="watt-field-error" />
|
|
313
|
+
</watt-field>
|
|
314
|
+
`, styles: ["watt-date-chip input{top:0;bottom:0;height:auto;visibility:hidden}watt-date-chip watt-field label .watt-field-wrapper{background-color:transparent}\n"] }]
|
|
315
|
+
}], propDecorators: { disabled: [{
|
|
316
|
+
type: Input
|
|
317
|
+
}], label: [{
|
|
318
|
+
type: Input
|
|
319
|
+
}], placeholder: [{
|
|
320
|
+
type: Input
|
|
321
|
+
}], value: [{
|
|
322
|
+
type: Input
|
|
323
|
+
}], formControl: [{
|
|
324
|
+
type: Input,
|
|
325
|
+
args: [{ required: true }]
|
|
326
|
+
}], selectionChange: [{
|
|
327
|
+
type: Output
|
|
328
|
+
}] } });
|
|
329
|
+
|
|
330
|
+
//#region License
|
|
331
|
+
/**
|
|
332
|
+
* @license
|
|
333
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
334
|
+
*
|
|
335
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
336
|
+
* you may not use this file except in compliance with the License.
|
|
337
|
+
* You may obtain a copy of the License at
|
|
338
|
+
*
|
|
339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
340
|
+
*
|
|
341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
|
+
* See the License for the specific language governing permissions and
|
|
345
|
+
* limitations under the License.
|
|
346
|
+
*/
|
|
347
|
+
//#endregion
|
|
348
|
+
class WattDateRangeSelectionStrategy extends DefaultMatCalendarRangeStrategy {
|
|
349
|
+
customSelectionStrategy;
|
|
350
|
+
setCustomSelectionStrategy(strategy) {
|
|
351
|
+
this.customSelectionStrategy = strategy;
|
|
352
|
+
}
|
|
353
|
+
selectionFinished(date, currentRange) {
|
|
354
|
+
let range = super.selectionFinished(date, currentRange);
|
|
355
|
+
if (this.customSelectionStrategy) {
|
|
356
|
+
range = this.customSelectionStrategy(date);
|
|
357
|
+
}
|
|
358
|
+
return range.end ? new DateRange(range.start, dayjs(range.end).endOf('day').toDate()) : range;
|
|
359
|
+
}
|
|
360
|
+
createPreview(activeDate, currentRange) {
|
|
361
|
+
if (!this.customSelectionStrategy) {
|
|
362
|
+
return super.createPreview(activeDate, currentRange);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
return this.customSelectionStrategy(activeDate);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateRangeSelectionStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
369
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateRangeSelectionStrategy, providedIn: 'root' });
|
|
370
|
+
}
|
|
371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateRangeSelectionStrategy, decorators: [{
|
|
372
|
+
type: Injectable,
|
|
373
|
+
args: [{
|
|
374
|
+
providedIn: 'root',
|
|
375
|
+
}]
|
|
376
|
+
}] });
|
|
377
|
+
class WattDateRangeChipComponent {
|
|
378
|
+
disabled = false;
|
|
379
|
+
label;
|
|
380
|
+
value;
|
|
381
|
+
formControl;
|
|
382
|
+
placeholder = true;
|
|
383
|
+
showActions = false;
|
|
384
|
+
customSelectionStrategy;
|
|
385
|
+
get hasPlaceholderClass() {
|
|
386
|
+
return this.placeholder;
|
|
387
|
+
}
|
|
388
|
+
selectionChange = new EventEmitter();
|
|
389
|
+
_dateAdapter = inject(DateAdapter);
|
|
390
|
+
intl = inject(WattDatepickerIntlService);
|
|
391
|
+
selectionStrategy() {
|
|
392
|
+
const strategy = new WattDateRangeSelectionStrategy(this._dateAdapter);
|
|
393
|
+
strategy.setCustomSelectionStrategy(this.customSelectionStrategy);
|
|
394
|
+
return strategy;
|
|
395
|
+
}
|
|
396
|
+
clearInput() {
|
|
397
|
+
this.value = undefined;
|
|
398
|
+
this.selectionChange.emit(null);
|
|
399
|
+
}
|
|
400
|
+
onSelectionChange(value) {
|
|
401
|
+
this.selectionChange.emit(value);
|
|
402
|
+
}
|
|
403
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateRangeChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
404
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattDateRangeChipComponent, isStandalone: true, selector: "watt-date-range-chip", inputs: { disabled: "disabled", label: "label", value: "value", formControl: "formControl", placeholder: "placeholder", showActions: "showActions", customSelectionStrategy: "customSelectionStrategy" }, outputs: { selectionChange: "selectionChange" }, host: { properties: { "class.has-placeholder": "this.hasPlaceholderClass" } }, providers: [
|
|
405
|
+
{
|
|
406
|
+
provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
|
|
407
|
+
useFactory: (comp) => comp.selectionStrategy(),
|
|
408
|
+
deps: [WattDateRangeChipComponent],
|
|
409
|
+
},
|
|
410
|
+
], ngImport: i0, template: `
|
|
411
|
+
<mat-date-range-picker #picker>
|
|
412
|
+
@if (showActions) {
|
|
413
|
+
<mat-date-range-picker-actions>
|
|
414
|
+
<watt-button variant="text" (click)="clearInput()" icon="remove">{{
|
|
415
|
+
intl.clear
|
|
416
|
+
}}</watt-button>
|
|
417
|
+
<watt-button variant="primary" matDateRangePickerApply>{{ intl.select }}</watt-button>
|
|
418
|
+
</mat-date-range-picker-actions>
|
|
419
|
+
}
|
|
420
|
+
</mat-date-range-picker>
|
|
421
|
+
|
|
422
|
+
<watt-field [control]="formControl" [chipMode]="true">
|
|
423
|
+
<watt-menu-chip
|
|
424
|
+
hasPopup="dialog"
|
|
425
|
+
[disabled]="disabled"
|
|
426
|
+
[selected]="value?.start && value?.end ? true : false"
|
|
427
|
+
[opened]="picker.opened"
|
|
428
|
+
(toggle)="picker.open()"
|
|
429
|
+
>
|
|
430
|
+
<mat-date-range-input
|
|
431
|
+
#input
|
|
432
|
+
class="cdk-visually-hidden"
|
|
433
|
+
separator=""
|
|
434
|
+
[rangePicker]="picker"
|
|
435
|
+
>
|
|
436
|
+
<input
|
|
437
|
+
type="text"
|
|
438
|
+
matStartDate
|
|
439
|
+
tabindex="-1"
|
|
440
|
+
role="none"
|
|
441
|
+
[value]="value?.start"
|
|
442
|
+
(dateChange)="value = input.value!"
|
|
443
|
+
(dateChange)="showActions && onSelectionChange($event.value ? input.value! : null)"
|
|
444
|
+
/>
|
|
445
|
+
<input
|
|
446
|
+
type="text"
|
|
447
|
+
matEndDate
|
|
448
|
+
tabindex="-1"
|
|
449
|
+
role="none"
|
|
450
|
+
[value]="value?.end"
|
|
451
|
+
(dateChange)="value = input.value!"
|
|
452
|
+
(dateChange)="onSelectionChange($event.value ? input.value! : null)"
|
|
453
|
+
/>
|
|
454
|
+
</mat-date-range-input>
|
|
455
|
+
<ng-content />
|
|
456
|
+
@if (value?.start && value?.end) {
|
|
457
|
+
<span class="value">
|
|
458
|
+
{{ value | wattDate }}
|
|
459
|
+
</span>
|
|
460
|
+
}
|
|
461
|
+
</watt-menu-chip>
|
|
462
|
+
<ng-content ngProjectAs="watt-field-hint" select="watt-field-hint" />
|
|
463
|
+
<ng-content ngProjectAs="watt-field-error" select="watt-field-error" />
|
|
464
|
+
</watt-field>
|
|
465
|
+
`, isInline: true, styles: ["watt-date-range-chip mat-date-range-input{top:0;bottom:0;height:auto;visibility:hidden}watt-date-range-chip.has-placeholder .value:before{content:\":\"}watt-date-range-chip watt-field label .watt-field-wrapper{background-color:transparent}\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: "component", type: i1.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "component", type: i1.MatDatepickerActions, selector: "mat-datepicker-actions, mat-date-range-picker-actions" }, { kind: "directive", type: i1.MatDatepickerApply, selector: "[matDatepickerApply], [matDateRangePickerApply]" }, { kind: "component", type: WattMenuChipComponent, selector: "watt-menu-chip", inputs: ["opened", "disabled", "name", "value", "selected", "hasPopup"], outputs: ["toggle"] }, { kind: "pipe", type: WattDatePipe, name: "wattDate" }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
466
|
+
}
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDateRangeChipComponent, decorators: [{
|
|
468
|
+
type: Component,
|
|
469
|
+
args: [{ imports: [
|
|
470
|
+
MatDatepickerModule,
|
|
471
|
+
WattMenuChipComponent,
|
|
472
|
+
WattDatePipe,
|
|
473
|
+
WattFieldComponent,
|
|
474
|
+
WattButtonComponent,
|
|
475
|
+
], providers: [
|
|
476
|
+
{
|
|
477
|
+
provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
|
|
478
|
+
useFactory: (comp) => comp.selectionStrategy(),
|
|
479
|
+
deps: [WattDateRangeChipComponent],
|
|
480
|
+
},
|
|
481
|
+
], selector: 'watt-date-range-chip', encapsulation: ViewEncapsulation.None, template: `
|
|
482
|
+
<mat-date-range-picker #picker>
|
|
483
|
+
@if (showActions) {
|
|
484
|
+
<mat-date-range-picker-actions>
|
|
485
|
+
<watt-button variant="text" (click)="clearInput()" icon="remove">{{
|
|
486
|
+
intl.clear
|
|
487
|
+
}}</watt-button>
|
|
488
|
+
<watt-button variant="primary" matDateRangePickerApply>{{ intl.select }}</watt-button>
|
|
489
|
+
</mat-date-range-picker-actions>
|
|
490
|
+
}
|
|
491
|
+
</mat-date-range-picker>
|
|
492
|
+
|
|
493
|
+
<watt-field [control]="formControl" [chipMode]="true">
|
|
494
|
+
<watt-menu-chip
|
|
495
|
+
hasPopup="dialog"
|
|
496
|
+
[disabled]="disabled"
|
|
497
|
+
[selected]="value?.start && value?.end ? true : false"
|
|
498
|
+
[opened]="picker.opened"
|
|
499
|
+
(toggle)="picker.open()"
|
|
500
|
+
>
|
|
501
|
+
<mat-date-range-input
|
|
502
|
+
#input
|
|
503
|
+
class="cdk-visually-hidden"
|
|
504
|
+
separator=""
|
|
505
|
+
[rangePicker]="picker"
|
|
506
|
+
>
|
|
507
|
+
<input
|
|
508
|
+
type="text"
|
|
509
|
+
matStartDate
|
|
510
|
+
tabindex="-1"
|
|
511
|
+
role="none"
|
|
512
|
+
[value]="value?.start"
|
|
513
|
+
(dateChange)="value = input.value!"
|
|
514
|
+
(dateChange)="showActions && onSelectionChange($event.value ? input.value! : null)"
|
|
515
|
+
/>
|
|
516
|
+
<input
|
|
517
|
+
type="text"
|
|
518
|
+
matEndDate
|
|
519
|
+
tabindex="-1"
|
|
520
|
+
role="none"
|
|
521
|
+
[value]="value?.end"
|
|
522
|
+
(dateChange)="value = input.value!"
|
|
523
|
+
(dateChange)="onSelectionChange($event.value ? input.value! : null)"
|
|
524
|
+
/>
|
|
525
|
+
</mat-date-range-input>
|
|
526
|
+
<ng-content />
|
|
527
|
+
@if (value?.start && value?.end) {
|
|
528
|
+
<span class="value">
|
|
529
|
+
{{ value | wattDate }}
|
|
530
|
+
</span>
|
|
531
|
+
}
|
|
532
|
+
</watt-menu-chip>
|
|
533
|
+
<ng-content ngProjectAs="watt-field-hint" select="watt-field-hint" />
|
|
534
|
+
<ng-content ngProjectAs="watt-field-error" select="watt-field-error" />
|
|
535
|
+
</watt-field>
|
|
536
|
+
`, styles: ["watt-date-range-chip mat-date-range-input{top:0;bottom:0;height:auto;visibility:hidden}watt-date-range-chip.has-placeholder .value:before{content:\":\"}watt-date-range-chip watt-field label .watt-field-wrapper{background-color:transparent}\n"] }]
|
|
537
|
+
}], propDecorators: { disabled: [{
|
|
538
|
+
type: Input
|
|
539
|
+
}], label: [{
|
|
540
|
+
type: Input
|
|
541
|
+
}], value: [{
|
|
542
|
+
type: Input
|
|
543
|
+
}], formControl: [{
|
|
544
|
+
type: Input,
|
|
545
|
+
args: [{ required: true }]
|
|
546
|
+
}], placeholder: [{
|
|
547
|
+
type: Input
|
|
548
|
+
}], showActions: [{
|
|
549
|
+
type: Input
|
|
550
|
+
}], customSelectionStrategy: [{
|
|
551
|
+
type: Input
|
|
552
|
+
}], hasPlaceholderClass: [{
|
|
553
|
+
type: HostBinding,
|
|
554
|
+
args: ['class.has-placeholder']
|
|
555
|
+
}], selectionChange: [{
|
|
556
|
+
type: Output
|
|
557
|
+
}] } });
|
|
558
|
+
|
|
559
|
+
//#region License
|
|
560
|
+
/**
|
|
561
|
+
* @license
|
|
562
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
563
|
+
*
|
|
564
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
565
|
+
* you may not use this file except in compliance with the License.
|
|
566
|
+
* You may obtain a copy of the License at
|
|
567
|
+
*
|
|
568
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
569
|
+
*
|
|
570
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
571
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
572
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
573
|
+
* See the License for the specific language governing permissions and
|
|
574
|
+
* limitations under the License.
|
|
575
|
+
*/
|
|
576
|
+
//#endregion
|
|
577
|
+
function isFirstRender() {
|
|
578
|
+
let isFirstRender = true;
|
|
579
|
+
return () => {
|
|
580
|
+
if (!isFirstRender)
|
|
581
|
+
return false;
|
|
582
|
+
isFirstRender = false;
|
|
583
|
+
return true;
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
class WattFilterChipComponent {
|
|
587
|
+
selected = false;
|
|
588
|
+
disabled = false;
|
|
589
|
+
name;
|
|
590
|
+
value;
|
|
591
|
+
choice;
|
|
592
|
+
selectionChange = new EventEmitter();
|
|
593
|
+
isFirstRender = isFirstRender();
|
|
594
|
+
onChange(input) {
|
|
595
|
+
const value = this.choice !== undefined ? input.value : input.checked;
|
|
596
|
+
this.selectionChange.emit(value);
|
|
597
|
+
}
|
|
598
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattFilterChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
599
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattFilterChipComponent, isStandalone: true, selector: "watt-filter-chip", inputs: { selected: "selected", disabled: "disabled", name: "name", value: "value", choice: "choice" }, outputs: { selectionChange: "selectionChange" }, ngImport: i0, template: `
|
|
600
|
+
<watt-chip [disabled]="disabled" [selected]="isFirstRender() ? selected : input.checked">
|
|
601
|
+
<input
|
|
602
|
+
#input
|
|
603
|
+
class="cdk-visually-hidden"
|
|
604
|
+
[type]="choice === undefined ? 'checkbox' : 'radio'"
|
|
605
|
+
[name]="name"
|
|
606
|
+
[value]="value"
|
|
607
|
+
[checked]="selected"
|
|
608
|
+
[disabled]="disabled"
|
|
609
|
+
(change)="onChange(input)"
|
|
610
|
+
/>
|
|
611
|
+
<ng-content />
|
|
612
|
+
</watt-chip>
|
|
613
|
+
`, isInline: true, dependencies: [{ kind: "component", type: WattChipComponent, selector: "watt-chip", inputs: ["selected", "disabled", "readonly"] }] });
|
|
614
|
+
}
|
|
615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattFilterChipComponent, decorators: [{
|
|
616
|
+
type: Component,
|
|
617
|
+
args: [{
|
|
618
|
+
imports: [WattChipComponent],
|
|
619
|
+
selector: 'watt-filter-chip',
|
|
620
|
+
template: `
|
|
621
|
+
<watt-chip [disabled]="disabled" [selected]="isFirstRender() ? selected : input.checked">
|
|
622
|
+
<input
|
|
623
|
+
#input
|
|
624
|
+
class="cdk-visually-hidden"
|
|
625
|
+
[type]="choice === undefined ? 'checkbox' : 'radio'"
|
|
626
|
+
[name]="name"
|
|
627
|
+
[value]="value"
|
|
628
|
+
[checked]="selected"
|
|
629
|
+
[disabled]="disabled"
|
|
630
|
+
(change)="onChange(input)"
|
|
631
|
+
/>
|
|
632
|
+
<ng-content />
|
|
633
|
+
</watt-chip>
|
|
634
|
+
`,
|
|
635
|
+
}]
|
|
636
|
+
}], propDecorators: { selected: [{
|
|
637
|
+
type: Input
|
|
638
|
+
}], disabled: [{
|
|
639
|
+
type: Input
|
|
640
|
+
}], name: [{
|
|
641
|
+
type: Input
|
|
642
|
+
}], value: [{
|
|
643
|
+
type: Input
|
|
644
|
+
}], choice: [{
|
|
645
|
+
type: Input
|
|
646
|
+
}], selectionChange: [{
|
|
647
|
+
type: Output
|
|
648
|
+
}] } });
|
|
649
|
+
|
|
650
|
+
//#region License
|
|
651
|
+
/**
|
|
652
|
+
* @license
|
|
653
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
654
|
+
*
|
|
655
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
656
|
+
* you may not use this file except in compliance with the License.
|
|
657
|
+
* You may obtain a copy of the License at
|
|
658
|
+
*
|
|
659
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
660
|
+
*
|
|
661
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
662
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
663
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
664
|
+
* See the License for the specific language governing permissions and
|
|
665
|
+
* limitations under the License.
|
|
666
|
+
*/
|
|
667
|
+
//#endregion
|
|
668
|
+
class WattFormChipDirective {
|
|
669
|
+
filterChip = inject(WattFilterChipComponent, { host: true, optional: true, self: true });
|
|
670
|
+
dateChip = inject(WattDateChipComponent, { host: true, optional: true, self: true });
|
|
671
|
+
dateRangeChip = inject(WattDateRangeChipComponent, {
|
|
672
|
+
host: true,
|
|
673
|
+
optional: true,
|
|
674
|
+
self: true,
|
|
675
|
+
});
|
|
676
|
+
element = inject(ElementRef);
|
|
677
|
+
component;
|
|
678
|
+
constructor() {
|
|
679
|
+
if (this.filterChip) {
|
|
680
|
+
this.component = this.filterChip;
|
|
681
|
+
}
|
|
682
|
+
else if (this.dateChip) {
|
|
683
|
+
this.component = this.dateChip;
|
|
684
|
+
}
|
|
685
|
+
else if (this.dateRangeChip) {
|
|
686
|
+
this.component = this.dateRangeChip;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
writeValue(value) {
|
|
690
|
+
if (this.component) {
|
|
691
|
+
this.component.value = value;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
registerOnChange(fn) {
|
|
695
|
+
this.component?.selectionChange.subscribe(fn);
|
|
696
|
+
}
|
|
697
|
+
registerOnTouched(fn) {
|
|
698
|
+
this.element.nativeElement.addEventListener('focusout', fn);
|
|
699
|
+
}
|
|
700
|
+
setDisabledState(disabled) {
|
|
701
|
+
if (this.component) {
|
|
702
|
+
this.component.disabled = disabled;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattFormChipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
706
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.1", type: WattFormChipDirective, isStandalone: true, selector: "\n watt-filter-chip[formControl],\n watt-date-chip[formControl],\n watt-date-range-chip[formControl],\n watt-filter-chip[formControlName],\n watt-date-chip[formControlName],\n watt-date-range-chip[formControlName],\n ", providers: [
|
|
707
|
+
{
|
|
708
|
+
provide: NG_VALUE_ACCESSOR,
|
|
709
|
+
useExisting: forwardRef(() => WattFormChipDirective),
|
|
710
|
+
multi: true,
|
|
711
|
+
},
|
|
712
|
+
], ngImport: i0 });
|
|
713
|
+
}
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattFormChipDirective, decorators: [{
|
|
715
|
+
type: Directive,
|
|
716
|
+
args: [{
|
|
717
|
+
providers: [
|
|
718
|
+
{
|
|
719
|
+
provide: NG_VALUE_ACCESSOR,
|
|
720
|
+
useExisting: forwardRef(() => WattFormChipDirective),
|
|
721
|
+
multi: true,
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
725
|
+
selector: `
|
|
726
|
+
watt-filter-chip[formControl],
|
|
727
|
+
watt-date-chip[formControl],
|
|
728
|
+
watt-date-range-chip[formControl],
|
|
729
|
+
watt-filter-chip[formControlName],
|
|
730
|
+
watt-date-chip[formControlName],
|
|
731
|
+
watt-date-range-chip[formControlName],
|
|
732
|
+
`,
|
|
733
|
+
}]
|
|
734
|
+
}], ctorParameters: () => [] });
|
|
735
|
+
|
|
736
|
+
//#region License
|
|
737
|
+
/**
|
|
738
|
+
* @license
|
|
739
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
740
|
+
*
|
|
741
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
742
|
+
* you may not use this file except in compliance with the License.
|
|
743
|
+
* You may obtain a copy of the License at
|
|
744
|
+
*
|
|
745
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
746
|
+
*
|
|
747
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
748
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
749
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
750
|
+
* See the License for the specific language governing permissions and
|
|
751
|
+
* limitations under the License.
|
|
752
|
+
*/
|
|
753
|
+
//#endregion
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Generated bundle index. Do not edit.
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
export { WattActionChipComponent, WattChipComponent, WattDateChipComponent, WattDateRangeChipComponent, WattFilterChipComponent, WattFormChipDirective, WattMenuChipComponent };
|
|
760
|
+
//# sourceMappingURL=energinet-watt-chip.mjs.map
|