@energinet/watt 1.2.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,234 @@
1
+ import * as i0 from '@angular/core';
2
+ import { computed, signal, input, output, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormControl, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { takeUntilDestroyed, toSignal, outputFromObservable } from '@angular/core/rxjs-interop';
6
+ import { MatCalendar } from '@angular/material/datepicker';
7
+ import { map, share } from 'rxjs';
8
+ import { WattFieldComponent } from '@energinet/watt/field';
9
+ import { WattButtonComponent } from '@energinet/watt/button';
10
+ import { dayjs } from '@energinet/watt/core/date';
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
+ /** Represents a year and month. */
31
+ class YearMonth {
32
+ date;
33
+ static VIEW_FORMAT = 'MMMM YYYY';
34
+ static MODEL_FORMAT = 'YYYY-MM';
35
+ constructor(date) {
36
+ this.date = date;
37
+ }
38
+ /** Creates a `YearMonth` instance from a `Date` object. */
39
+ static fromDate = (value) => new YearMonth(dayjs(value));
40
+ /** Creates a `YearMonth` instance from a `string` in the view format. */
41
+ static fromView = (value) => new YearMonth(value ? dayjs(value, YearMonth.VIEW_FORMAT, true) : null);
42
+ /** Creates a `YearMonth` instance from a `string` in the model format. */
43
+ static fromModel = (value) => new YearMonth(value ? dayjs(value, YearMonth.MODEL_FORMAT, true) : null);
44
+ /** Converts the `YearMonth` instance to a `Date` object. */
45
+ toDate = () => this.date?.toDate() ?? null;
46
+ /** Converts the `YearMonth` instance to a `string` in the view format. */
47
+ toView = () => this.date?.format(YearMonth.VIEW_FORMAT) ?? '';
48
+ /** Converts the `YearMonth` instance to a `string` in the model format. */
49
+ toModel = () => this.date?.format(YearMonth.MODEL_FORMAT) ?? null;
50
+ }
51
+ const YEARMONTH_FORMAT = YearMonth.MODEL_FORMAT;
52
+
53
+ //#region License
54
+ /**
55
+ * @license
56
+ * Copyright 2020 Energinet DataHub A/S
57
+ *
58
+ * Licensed under the Apache License, Version 2.0 (the "License2");
59
+ * you may not use this file except in compliance with the License.
60
+ * You may obtain a copy of the License at
61
+ *
62
+ * http://www.apache.org/licenses/LICENSE-2.0
63
+ *
64
+ * Unless required by applicable law or agreed to in writing, software
65
+ * distributed under the License is distributed on an "AS IS" BASIS,
66
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67
+ * See the License for the specific language governing permissions and
68
+ * limitations under the License.
69
+ */
70
+ //#endregion
71
+ /* eslint-disable @angular-eslint/component-class-suffix */
72
+ class WattYearMonthField {
73
+ // Popovers exists on an entirely different layer, meaning that for anchor positioning they
74
+ // look at the entire tree for the anchor name. This gives each field a unique anchor name.
75
+ static instance = 0;
76
+ instance = WattYearMonthField.instance++;
77
+ anchorName = `--watt-yearmonth-field-popover-anchor-${this.instance}`;
78
+ // The format of the inner FormControl is different from that of the outer FormControl
79
+ control = new FormControl('', { nonNullable: true });
80
+ // `registerOnChange` may subscribe to this component after it has been destroyed, thus
81
+ // triggering an NG0911 from the `takeUntilDestroyed` operator. By sharing the observable,
82
+ // the observable will already be closed and `subscribe` becomes a proper noop.
83
+ yearMonthChanges = this.control.valueChanges.pipe(map(YearMonth.fromView));
84
+ valueChanges = this.yearMonthChanges.pipe(map((yearMonth) => yearMonth.toModel()), takeUntilDestroyed(), share());
85
+ yearMonth = toSignal(this.yearMonthChanges);
86
+ selected = computed(() => this.yearMonth()?.toDate());
87
+ // This is used to reset the MatCalendar component by destroying and then recreating it
88
+ // whenever the picker is opened. There is no methods to do it programatically.
89
+ isOpen = signal(false);
90
+ /** Set the label text for `watt-field`. */
91
+ label = input('');
92
+ /** The minimum selectable date. */
93
+ min = input();
94
+ /** The maximum selectable date. */
95
+ max = input();
96
+ /** Emits when the selected month has changed. */
97
+ monthChange = outputFromObservable(this.valueChanges);
98
+ /** Emits when the field loses focus. */
99
+ // eslint-disable-next-line @angular-eslint/no-output-native
100
+ blur = output();
101
+ handleFocus = (picker) => {
102
+ this.isOpen.set(true);
103
+ picker.showPopover();
104
+ };
105
+ handleBlur = (picker, event) => {
106
+ if (event.relatedTarget instanceof HTMLElement && picker.contains(event.relatedTarget)) {
107
+ const target = event.target; // safe type assertion
108
+ setTimeout(() => target.focus()); // keep focus on input element while using the picker
109
+ }
110
+ else {
111
+ picker.hidePopover();
112
+ this.isOpen.set(false);
113
+ this.blur.emit(event);
114
+ }
115
+ };
116
+ handleSelectedChange = (field, date) => {
117
+ field.value = YearMonth.fromDate(date).toView();
118
+ field.dispatchEvent(new Event('input', { bubbles: true }));
119
+ field.blur();
120
+ };
121
+ // Implementation for ControlValueAccessor
122
+ writeValue = (value) => this.control.setValue(YearMonth.fromModel(value).toView());
123
+ setDisabledState = (x) => (x ? this.control.disable() : this.control.enable());
124
+ registerOnTouched = (fn) => this.blur.subscribe(fn);
125
+ registerOnChange = (fn) => this.valueChanges.subscribe(fn);
126
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattYearMonthField, deps: [], target: i0.ɵɵFactoryTarget.Component });
127
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattYearMonthField, isStandalone: true, selector: "watt-yearmonth-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { monthChange: "monthChange", blur: "blur" }, providers: [
128
+ {
129
+ provide: NG_VALUE_ACCESSOR,
130
+ useExisting: forwardRef(() => WattYearMonthField),
131
+ multi: true,
132
+ },
133
+ ], ngImport: i0, template: `
134
+ <watt-field [label]="label()" [control]="control" [anchorName]="anchorName">
135
+ <input
136
+ #field
137
+ readonly
138
+ [formControl]="control"
139
+ (focus)="handleFocus(picker)"
140
+ (blur)="handleBlur(picker, $event)"
141
+ />
142
+ <watt-button icon="date" variant="icon" (click)="field.focus()" />
143
+ <div
144
+ #picker
145
+ class="watt-elevation watt-yearmonth-field-picker"
146
+ popover="manual"
147
+ tabindex="0"
148
+ [style.position-anchor]="anchorName"
149
+ >
150
+ @if (isOpen()) {
151
+ <mat-calendar
152
+ startView="multi-year"
153
+ [startAt]="selected()"
154
+ [selected]="selected()"
155
+ [minDate]="min()"
156
+ [maxDate]="max()"
157
+ (monthSelected)="handleSelectedChange(field, $event)"
158
+ />
159
+ }
160
+ </div>
161
+ <ng-content />
162
+ <ng-content select="watt-field-error" ngProjectAs="watt-field-error" />
163
+ <ng-content select="watt-field-hint" ngProjectAs="watt-field-hint" />
164
+ </watt-field>
165
+ `, isInline: true, styles: ["watt-yearmonth-field{display:block;width:100%}watt-yearmonth-field input{text-transform:capitalize}.watt-yearmonth-field-picker{position:fixed;position-area:bottom span-right;position-try-fallbacks:flip-block;width:296px;height:354px;inset:unset;margin:unset;border:0}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
166
+ }
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattYearMonthField, decorators: [{
168
+ type: Component,
169
+ args: [{ selector: 'watt-yearmonth-field', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
170
+ {
171
+ provide: NG_VALUE_ACCESSOR,
172
+ useExisting: forwardRef(() => WattYearMonthField),
173
+ multi: true,
174
+ },
175
+ ], imports: [ReactiveFormsModule, MatCalendar, WattButtonComponent, WattFieldComponent], template: `
176
+ <watt-field [label]="label()" [control]="control" [anchorName]="anchorName">
177
+ <input
178
+ #field
179
+ readonly
180
+ [formControl]="control"
181
+ (focus)="handleFocus(picker)"
182
+ (blur)="handleBlur(picker, $event)"
183
+ />
184
+ <watt-button icon="date" variant="icon" (click)="field.focus()" />
185
+ <div
186
+ #picker
187
+ class="watt-elevation watt-yearmonth-field-picker"
188
+ popover="manual"
189
+ tabindex="0"
190
+ [style.position-anchor]="anchorName"
191
+ >
192
+ @if (isOpen()) {
193
+ <mat-calendar
194
+ startView="multi-year"
195
+ [startAt]="selected()"
196
+ [selected]="selected()"
197
+ [minDate]="min()"
198
+ [maxDate]="max()"
199
+ (monthSelected)="handleSelectedChange(field, $event)"
200
+ />
201
+ }
202
+ </div>
203
+ <ng-content />
204
+ <ng-content select="watt-field-error" ngProjectAs="watt-field-error" />
205
+ <ng-content select="watt-field-hint" ngProjectAs="watt-field-hint" />
206
+ </watt-field>
207
+ `, styles: ["watt-yearmonth-field{display:block;width:100%}watt-yearmonth-field input{text-transform:capitalize}.watt-yearmonth-field-picker{position:fixed;position-area:bottom span-right;position-try-fallbacks:flip-block;width:296px;height:354px;inset:unset;margin:unset;border:0}\n"] }]
208
+ }] });
209
+
210
+ //#region License
211
+ /**
212
+ * @license
213
+ * Copyright 2020 Energinet DataHub A/S
214
+ *
215
+ * Licensed under the Apache License, Version 2.0 (the "License2");
216
+ * you may not use this file except in compliance with the License.
217
+ * You may obtain a copy of the License at
218
+ *
219
+ * http://www.apache.org/licenses/LICENSE-2.0
220
+ *
221
+ * Unless required by applicable law or agreed to in writing, software
222
+ * distributed under the License is distributed on an "AS IS" BASIS,
223
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+ * See the License for the specific language governing permissions and
225
+ * limitations under the License.
226
+ */
227
+ //#endregion
228
+
229
+ /**
230
+ * Generated bundle index. Do not edit.
231
+ */
232
+
233
+ export { WattYearMonthField, YEARMONTH_FORMAT };
234
+ //# sourceMappingURL=energinet-watt-yearmonth-field.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"energinet-watt-yearmonth-field.mjs","sources":["../../../libs/watt/package/yearmonth-field/year-month.ts","../../../libs/watt/package/yearmonth-field/watt-yearmonth-field.component.ts","../../../libs/watt/package/yearmonth-field/index.ts","../../../libs/watt/package/yearmonth-field/energinet-watt-yearmonth-field.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 '@energinet/watt/core/date';\n\n/** Represents a year and month. */\nexport class YearMonth {\n static readonly VIEW_FORMAT = 'MMMM YYYY';\n static readonly MODEL_FORMAT = 'YYYY-MM';\n\n private constructor(private date: dayjs.Dayjs | null) {}\n\n /** Creates a `YearMonth` instance from a `Date` object. */\n static fromDate = (value: Date) => new YearMonth(dayjs(value));\n\n /** Creates a `YearMonth` instance from a `string` in the view format. */\n static fromView = (value: string) =>\n new YearMonth(value ? dayjs(value, YearMonth.VIEW_FORMAT, true) : null);\n\n /** Creates a `YearMonth` instance from a `string` in the model format. */\n static fromModel = (value: string | null | undefined) =>\n new YearMonth(value ? dayjs(value, YearMonth.MODEL_FORMAT, true) : null);\n\n /** Converts the `YearMonth` instance to a `Date` object. */\n toDate = () => this.date?.toDate() ?? null;\n\n /** Converts the `YearMonth` instance to a `string` in the view format. */\n toView = () => this.date?.format(YearMonth.VIEW_FORMAT) ?? '';\n\n /** Converts the `YearMonth` instance to a `string` in the model format. */\n toModel = () => this.date?.format(YearMonth.MODEL_FORMAT) ?? null;\n}\n\nexport const YEARMONTH_FORMAT = YearMonth.MODEL_FORMAT;\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n input,\n output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { outputFromObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { MatCalendar } from '@angular/material/datepicker';\nimport { map, share } from 'rxjs';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { YearMonth } from './year-month';\n\n/* eslint-disable @angular-eslint/component-class-suffix */\n@Component({\n selector: 'watt-yearmonth-field',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattYearMonthField),\n multi: true,\n },\n ],\n imports: [ReactiveFormsModule, MatCalendar, WattButtonComponent, WattFieldComponent],\n styles: [\n `\n watt-yearmonth-field {\n display: block;\n width: 100%;\n & input {\n text-transform: capitalize;\n }\n }\n\n .watt-yearmonth-field-picker {\n position: fixed;\n position-area: bottom span-right;\n position-try-fallbacks: flip-block;\n width: 296px;\n height: 354px;\n inset: unset;\n margin: unset;\n border: 0;\n }\n `,\n ],\n template: `\n <watt-field [label]=\"label()\" [control]=\"control\" [anchorName]=\"anchorName\">\n <input\n #field\n readonly\n [formControl]=\"control\"\n (focus)=\"handleFocus(picker)\"\n (blur)=\"handleBlur(picker, $event)\"\n />\n <watt-button icon=\"date\" variant=\"icon\" (click)=\"field.focus()\" />\n <div\n #picker\n class=\"watt-elevation watt-yearmonth-field-picker\"\n popover=\"manual\"\n tabindex=\"0\"\n [style.position-anchor]=\"anchorName\"\n >\n @if (isOpen()) {\n <mat-calendar\n startView=\"multi-year\"\n [startAt]=\"selected()\"\n [selected]=\"selected()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n (monthSelected)=\"handleSelectedChange(field, $event)\"\n />\n }\n </div>\n <ng-content />\n <ng-content select=\"watt-field-error\" ngProjectAs=\"watt-field-error\" />\n <ng-content select=\"watt-field-hint\" ngProjectAs=\"watt-field-hint\" />\n </watt-field>\n `,\n})\nexport class WattYearMonthField implements ControlValueAccessor {\n // Popovers exists on an entirely different layer, meaning that for anchor positioning they\n // look at the entire tree for the anchor name. This gives each field a unique anchor name.\n private static instance = 0;\n private instance = WattYearMonthField.instance++;\n protected anchorName = `--watt-yearmonth-field-popover-anchor-${this.instance}`;\n\n // The format of the inner FormControl is different from that of the outer FormControl\n protected control = new FormControl('', { nonNullable: true });\n\n // `registerOnChange` may subscribe to this component after it has been destroyed, thus\n // triggering an NG0911 from the `takeUntilDestroyed` operator. By sharing the observable,\n // the observable will already be closed and `subscribe` becomes a proper noop.\n private yearMonthChanges = this.control.valueChanges.pipe(map(YearMonth.fromView));\n private valueChanges = this.yearMonthChanges.pipe(\n map((yearMonth) => yearMonth.toModel()),\n takeUntilDestroyed(),\n share()\n );\n\n private yearMonth = toSignal(this.yearMonthChanges);\n protected selected = computed(() => this.yearMonth()?.toDate());\n\n // This is used to reset the MatCalendar component by destroying and then recreating it\n // whenever the picker is opened. There is no methods to do it programatically.\n protected isOpen = signal(false);\n\n /** Set the label text for `watt-field`. */\n label = input('');\n\n /** The minimum selectable date. */\n min = input<Date>();\n\n /** The maximum selectable date. */\n max = input<Date>();\n\n /** Emits when the selected month has changed. */\n monthChange = outputFromObservable(this.valueChanges);\n\n /** Emits when the field loses focus. */\n // eslint-disable-next-line @angular-eslint/no-output-native\n blur = output<FocusEvent>();\n\n protected handleFocus = (picker: HTMLElement) => {\n this.isOpen.set(true);\n picker.showPopover();\n };\n\n protected handleBlur = (picker: HTMLElement, event: FocusEvent) => {\n if (event.relatedTarget instanceof HTMLElement && picker.contains(event.relatedTarget)) {\n const target = event.target as HTMLInputElement; // safe type assertion\n setTimeout(() => target.focus()); // keep focus on input element while using the picker\n } else {\n picker.hidePopover();\n this.isOpen.set(false);\n this.blur.emit(event);\n }\n };\n\n protected handleSelectedChange = (field: HTMLInputElement, date: Date) => {\n field.value = YearMonth.fromDate(date).toView();\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.blur();\n };\n\n // Implementation for ControlValueAccessor\n writeValue = (value: string | null) => this.control.setValue(YearMonth.fromModel(value).toView());\n setDisabledState = (x: boolean) => (x ? this.control.disable() : this.control.enable());\n registerOnTouched = (fn: () => void) => this.blur.subscribe(fn);\n registerOnChange = (fn: (value: string | null) => void) => this.valueChanges.subscribe(fn);\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 { WattYearMonthField } from './watt-yearmonth-field.component';\nexport { YEARMONTH_FORMAT } from './year-month';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAGA;MACa,SAAS,CAAA;AAIQ,IAAA,IAAA;AAH5B,IAAA,OAAgB,WAAW,GAAG,WAAW;AACzC,IAAA,OAAgB,YAAY,GAAG,SAAS;AAExC,IAAA,WAAA,CAA4B,IAAwB,EAAA;QAAxB,IAAI,CAAA,IAAA,GAAJ,IAAI;;;AAGhC,IAAA,OAAO,QAAQ,GAAG,CAAC,KAAW,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;;AAG9D,IAAA,OAAO,QAAQ,GAAG,CAAC,KAAa,KAC9B,IAAI,SAAS,CAAC,KAAK,GAAG,KAAK,CA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A,EAAA,gBAAA,EAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,aAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,mBAAmB,8HAAE,kBAAkB,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,OAAA,EAAA,IAAA,EAAA,UAAA,EAAA,SAAA,EAAA,aAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAyDxE,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBApE9B,SAAS;+BACE,sBAAsB,EAAA,aAAA,EACjB,iBAAiB,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,EACpC,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,wBAAwB,CAAC;AACjD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA,CAAC,mBAAmB,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,EAuB1E,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,gRAAA,CAAA,EAAA;;;AC5GH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@energinet/watt",
4
- "version": "1.2.4",
4
+ "version": "1.5.0",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  ".": {
@@ -115,6 +115,10 @@
115
115
  "types": "./search/index.d.ts",
116
116
  "default": "./fesm2022/energinet-watt-search.mjs"
117
117
  },
118
+ "./segmented-buttons": {
119
+ "types": "./segmented-buttons/index.d.ts",
120
+ "default": "./fesm2022/energinet-watt-segmented-buttons.mjs"
121
+ },
118
122
  "./shell": {
119
123
  "types": "./shell/index.d.ts",
120
124
  "default": "./fesm2022/energinet-watt-shell.mjs"
@@ -171,6 +175,14 @@
171
175
  "types": "./vater/index.d.ts",
172
176
  "default": "./fesm2022/energinet-watt-vater.mjs"
173
177
  },
178
+ "./year-field": {
179
+ "types": "./year-field/index.d.ts",
180
+ "default": "./fesm2022/energinet-watt-year-field.mjs"
181
+ },
182
+ "./yearmonth-field": {
183
+ "types": "./yearmonth-field/index.d.ts",
184
+ "default": "./fesm2022/energinet-watt-yearmonth-field.mjs"
185
+ },
174
186
  "./core/breakpoints": {
175
187
  "types": "./core/breakpoints/index.d.ts",
176
188
  "default": "./fesm2022/energinet-watt-core-breakpoints.mjs"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';
18
+ export { WattSegmentedButtonComponent } from './watt-segmented-button.component';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { TemplateRef } from '@angular/core';
18
+ import * as i0 from "@angular/core";
19
+ export declare class WattSegmentedButtonComponent {
20
+ templateRef: import("@angular/core").Signal<TemplateRef<unknown>>;
21
+ value: import("@angular/core").InputSignal<string>;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<WattSegmentedButtonComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<WattSegmentedButtonComponent, "watt-segmented-button", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, ["*"], true, never>;
24
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ControlValueAccessor } from '@angular/forms';
18
+ import { WattSegmentedButtonComponent } from './watt-segmented-button.component';
19
+ import * as i0 from "@angular/core";
20
+ /**
21
+ * Segmented buttons.
22
+ */
23
+ export declare class WattSegmentedButtonsComponent implements ControlValueAccessor {
24
+ segmentedButtonElements: import("@angular/core").Signal<readonly WattSegmentedButtonComponent[]>;
25
+ selected: import("@angular/core").ModelSignal<string>;
26
+ disabled: import("@angular/core").WritableSignal<boolean>;
27
+ private element;
28
+ writeValue(selected: string): void;
29
+ registerOnChange(fn: (value: string) => void): void;
30
+ registerOnTouched(fn: (value: boolean) => void): void;
31
+ setDisabledState?(isDisabled: boolean): void;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<WattSegmentedButtonsComponent, never>;
33
+ static ɵcmp: i0.ɵɵComponentDeclaration<WattSegmentedButtonsComponent, "watt-segmented-buttons", never, { "selected": { "alias": "selected"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, ["segmentedButtonElements"], never, true, never>;
34
+ }
@@ -153,6 +153,10 @@ export declare class WattTableComponent<T> implements OnChanges, AfterViewInit {
153
153
  * when there is no data.
154
154
  */
155
155
  loading: boolean;
156
+ /**
157
+ * If true the footer will be sticky
158
+ */
159
+ stickyFooter: boolean;
156
160
  /**
157
161
  * Optional callback for determining header text for columns that
158
162
  * do not have a static header text set in the column definition.
@@ -262,7 +266,7 @@ export declare class WattTableComponent<T> implements OnChanges, AfterViewInit {
262
266
  /** @ignore */
263
267
  _onRowClick(row: T): void;
264
268
  static ɵfac: i0.ɵɵFactoryDeclaration<WattTableComponent<any>, never>;
265
- static ɵcmp: i0.ɵɵComponentDeclaration<WattTableComponent<any>, "watt-table", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "description": { "alias": "description"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "resolveHeader": { "alias": "resolveHeader"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "sortClear": { "alias": "sortClear"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "initialSelection": { "alias": "initialSelection"; "required": false; "isSignal": true; }; "suppressRowHoverHighlight": { "alias": "suppressRowHoverHighlight"; "required": false; }; "activeRow": { "alias": "activeRow"; "required": false; }; "activeRowComparator": { "alias": "activeRowComparator"; "required": false; }; "hideColumnHeaders": { "alias": "hideColumnHeaders"; "required": false; }; }, { "selectionChange": "selectionChange"; "rowClick": "rowClick"; "sortChange": "sortChange"; }, ["_toolbar", "_cells"], never, true, never>;
269
+ static ɵcmp: i0.ɵɵComponentDeclaration<WattTableComponent<any>, "watt-table", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "description": { "alias": "description"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "stickyFooter": { "alias": "stickyFooter"; "required": false; }; "resolveHeader": { "alias": "resolveHeader"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "sortClear": { "alias": "sortClear"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "initialSelection": { "alias": "initialSelection"; "required": false; "isSignal": true; }; "suppressRowHoverHighlight": { "alias": "suppressRowHoverHighlight"; "required": false; }; "activeRow": { "alias": "activeRow"; "required": false; }; "activeRowComparator": { "alias": "activeRowComparator"; "required": false; }; "hideColumnHeaders": { "alias": "hideColumnHeaders"; "required": false; }; }, { "selectionChange": "selectionChange"; "rowClick": "rowClick"; "sortChange": "sortChange"; }, ["_toolbar", "_cells"], never, true, never>;
266
270
  }
267
271
  export declare class WattTableToolbarSpacerComponent {
268
272
  static ɵfac: i0.ɵɵFactoryDeclaration<WattTableToolbarSpacerComponent, never>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { WattYearField, YEAR_FORMAT } from './watt-year-field.component';
@@ -0,0 +1,32 @@
1
+ import { FormControl, ControlValueAccessor } from '@angular/forms';
2
+ import * as i0 from "@angular/core";
3
+ export declare const YEAR_FORMAT = "YYYY";
4
+ export declare class WattYearField implements ControlValueAccessor {
5
+ private static instance;
6
+ private instance;
7
+ protected anchorName: string;
8
+ protected control: FormControl<string>;
9
+ private valueChanges;
10
+ private year;
11
+ protected selected: import("@angular/core").Signal<Date | undefined>;
12
+ protected isOpen: import("@angular/core").WritableSignal<boolean>;
13
+ /** Set the label text for `watt-field`. */
14
+ label: import("@angular/core").InputSignal<string>;
15
+ /** The minimum selectable date. */
16
+ min: import("@angular/core").InputSignal<Date | undefined>;
17
+ /** The maximum selectable date. */
18
+ max: import("@angular/core").InputSignal<Date | undefined>;
19
+ /** Emits when the selected year has changed. */
20
+ yearChange: import("@angular/core").OutputRef<string>;
21
+ /** Emits when the field loses focus. */
22
+ blur: import("@angular/core").OutputEmitterRef<FocusEvent>;
23
+ protected handleFocus: (picker: HTMLElement) => void;
24
+ protected handleBlur: (picker: HTMLElement, event: FocusEvent) => void;
25
+ protected handleSelectedChange: (field: HTMLInputElement, date: Date) => void;
26
+ writeValue: (value: string | null) => void;
27
+ setDisabledState: (x: boolean) => void;
28
+ registerOnTouched: (fn: () => void) => import("@angular/core").OutputRefSubscription;
29
+ registerOnChange: (fn: (value: string | null) => void) => import("rxjs").Subscription;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<WattYearField, never>;
31
+ static ɵcmp: i0.ɵɵComponentDeclaration<WattYearField, "watt-year-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; }, { "yearChange": "yearChange"; "blur": "blur"; }, never, ["*", "watt-field-error", "watt-field-hint"], true, never>;
32
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Energinet DataHub A/S
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License2");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { WattYearMonthField } from './watt-yearmonth-field.component';
18
+ export { YEARMONTH_FORMAT } from './year-month';
@@ -0,0 +1,32 @@
1
+ import { ControlValueAccessor, FormControl } from '@angular/forms';
2
+ import * as i0 from "@angular/core";
3
+ export declare class WattYearMonthField implements ControlValueAccessor {
4
+ private static instance;
5
+ private instance;
6
+ protected anchorName: string;
7
+ protected control: FormControl<string>;
8
+ private yearMonthChanges;
9
+ private valueChanges;
10
+ private yearMonth;
11
+ protected selected: import("@angular/core").Signal<Date | null | undefined>;
12
+ protected isOpen: import("@angular/core").WritableSignal<boolean>;
13
+ /** Set the label text for `watt-field`. */
14
+ label: import("@angular/core").InputSignal<string>;
15
+ /** The minimum selectable date. */
16
+ min: import("@angular/core").InputSignal<Date | undefined>;
17
+ /** The maximum selectable date. */
18
+ max: import("@angular/core").InputSignal<Date | undefined>;
19
+ /** Emits when the selected month has changed. */
20
+ monthChange: import("@angular/core").OutputRef<string | null>;
21
+ /** Emits when the field loses focus. */
22
+ blur: import("@angular/core").OutputEmitterRef<FocusEvent>;
23
+ protected handleFocus: (picker: HTMLElement) => void;
24
+ protected handleBlur: (picker: HTMLElement, event: FocusEvent) => void;
25
+ protected handleSelectedChange: (field: HTMLInputElement, date: Date) => void;
26
+ writeValue: (value: string | null) => void;
27
+ setDisabledState: (x: boolean) => void;
28
+ registerOnTouched: (fn: () => void) => import("@angular/core").OutputRefSubscription;
29
+ registerOnChange: (fn: (value: string | null) => void) => import("rxjs").Subscription;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<WattYearMonthField, never>;
31
+ static ɵcmp: i0.ɵɵComponentDeclaration<WattYearMonthField, "watt-yearmonth-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; }, { "monthChange": "monthChange"; "blur": "blur"; }, never, ["*", "watt-field-error", "watt-field-hint"], true, never>;
32
+ }
@@ -0,0 +1,20 @@
1
+ /** Represents a year and month. */
2
+ export declare class YearMonth {
3
+ private date;
4
+ static readonly VIEW_FORMAT = "MMMM YYYY";
5
+ static readonly MODEL_FORMAT = "YYYY-MM";
6
+ private constructor();
7
+ /** Creates a `YearMonth` instance from a `Date` object. */
8
+ static fromDate: (value: Date) => YearMonth;
9
+ /** Creates a `YearMonth` instance from a `string` in the view format. */
10
+ static fromView: (value: string) => YearMonth;
11
+ /** Creates a `YearMonth` instance from a `string` in the model format. */
12
+ static fromModel: (value: string | null | undefined) => YearMonth;
13
+ /** Converts the `YearMonth` instance to a `Date` object. */
14
+ toDate: () => Date | null;
15
+ /** Converts the `YearMonth` instance to a `string` in the view format. */
16
+ toView: () => string;
17
+ /** Converts the `YearMonth` instance to a `string` in the model format. */
18
+ toModel: () => string | null;
19
+ }
20
+ export declare const YEARMONTH_FORMAT = "YYYY-MM";