@energinet/watt 1.2.3 → 1.4.3
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/core/color/+storybook/storybook-colors-overview.component.scss +1 -1
- package/core/styles/_box-sizing.scss +2 -2
- package/fesm2022/energinet-watt-datetime-field.mjs +2 -2
- package/fesm2022/energinet-watt-datetime-field.mjs.map +1 -1
- package/fesm2022/energinet-watt-query-params.mjs +17 -0
- package/fesm2022/energinet-watt-query-params.mjs.map +1 -1
- package/fesm2022/energinet-watt-segmented-buttons.mjs +149 -0
- package/fesm2022/energinet-watt-segmented-buttons.mjs.map +1 -0
- package/fesm2022/energinet-watt-table.mjs +8 -2
- package/fesm2022/energinet-watt-table.mjs.map +1 -1
- package/fesm2022/energinet-watt-yearmonth-field.mjs +234 -0
- package/fesm2022/energinet-watt-yearmonth-field.mjs.map +1 -0
- package/package.json +9 -1
- package/segmented-buttons/index.d.ts +18 -0
- package/segmented-buttons/watt-segmented-button.component.d.ts +24 -0
- package/segmented-buttons/watt-segmented-buttons.component.d.ts +34 -0
- package/table/watt-table.component.d.ts +5 -1
- package/yearmonth-field/index.d.ts +18 -0
- package/yearmonth-field/watt-yearmonth-field.component.d.ts +32 -0
- package/yearmonth-field/year-month.d.ts +20 -0
|
@@ -41,7 +41,7 @@ class WattDateTimeField {
|
|
|
41
41
|
// look at the entire tree for the anchor name. This gives each field a unique anchor name.
|
|
42
42
|
static instance = 0;
|
|
43
43
|
instance = WattDateTimeField.instance++;
|
|
44
|
-
anchorName = `--watt-field-popover-anchor-${this.instance}`;
|
|
44
|
+
anchorName = `--watt-datetime-field-popover-anchor-${this.instance}`;
|
|
45
45
|
/** Converts date from outer FormControl to format of inner FormControl. */
|
|
46
46
|
modelToView = (value, format = DATETIME_FORMAT) => value ? dayjs(value).tz(DANISH_TIME_ZONE_IDENTIFIER).format(format) : '';
|
|
47
47
|
/** Converts value of inner FormControl to type of outer FormControl. */
|
|
@@ -85,7 +85,7 @@ class WattDateTimeField {
|
|
|
85
85
|
handleBlur = (picker, event) => {
|
|
86
86
|
if (event.relatedTarget instanceof HTMLElement && picker.contains(event.relatedTarget)) {
|
|
87
87
|
const target = event.target; // safe type assertion
|
|
88
|
-
setTimeout(() => target.focus());
|
|
88
|
+
setTimeout(() => target.focus()); // keep focus on input element while using the picker
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
91
|
picker.hidePopover();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-datetime-field.mjs","sources":["../../../libs/watt/package/datetime-field/watt-datetime-field.component.ts","../../../libs/watt/package/datetime-field/index.ts","../../../libs/watt/package/datetime-field/energinet-watt-datetime-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 {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { outputFromObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatCalendar } from '@angular/material/datepicker';\nimport { MaskitoDirective } from '@maskito/angular';\nimport { maskitoDateTimeOptionsGenerator } from '@maskito/kit';\nimport { map, share } from 'rxjs';\nimport { dayjs, WattLocaleService } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\nconst DA_FILLER = 'dd-mm-åååå, tt:mm';\nconst EN_FILLER = 'dd-mm-yyyy, hh:mm';\nconst DATETIME_FORMAT = 'DD-MM-YYYY, HH:mm';\nconst PARTIAL_DATETIME_FORMAT = 'DD-MM-YYYY, ';\nconst DANISH_TIME_ZONE_IDENTIFIER = 'Europe/Copenhagen';\n\n/* eslint-disable @angular-eslint/component-class-suffix */\n@Component({\n selector: 'watt-datetime-field',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDateTimeField),\n multi: true,\n },\n ],\n imports: [\n ReactiveFormsModule,\n MaskitoDirective,\n MatCalendar,\n WattButtonComponent,\n WattFieldComponent,\n ],\n styles: [\n `\n watt-datetime-field {\n display: block;\n width: 100%;\n }\n\n .watt-datetime-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\n [label]=\"label()\"\n [control]=\"control\"\n [placeholder]=\"placeholder()\"\n [anchorName]=\"anchorName\"\n >\n <input\n #field\n [formControl]=\"control\"\n [maskito]=\"mask()\"\n (focus)=\"picker.showPopover()\"\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-datetime-field-picker\"\n popover=\"manual\"\n tabindex=\"0\"\n [style.position-anchor]=\"anchorName\"\n >\n <mat-calendar\n [startAt]=\"selected()\"\n [selected]=\"selected()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n (selectedChange)=\"handleSelectedChange(field, picker, $event)\"\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 WattDateTimeField implements ControlValueAccessor {\n private locale = inject(WattLocaleService);\n\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 = WattDateTimeField.instance++;\n protected anchorName = `--watt-field-popover-anchor-${this.instance}`;\n\n /** Converts date from outer FormControl to format of inner FormControl. */\n protected modelToView = (value: Date | null, format = DATETIME_FORMAT) =>\n value ? dayjs(value).tz(DANISH_TIME_ZONE_IDENTIFIER).format(format) : '';\n\n /** Converts value of inner FormControl to type of outer FormControl. */\n protected viewToModel = (value: string) => {\n const date = dayjs(value, DATETIME_FORMAT, true);\n if (!date.isValid()) return null;\n return this.inclusive() ? date.endOf('m').toDate() : date.toDate();\n };\n\n // Must unfortunately be queried in order to update `activeDate`\n private calendar = viewChild.required<MatCalendar<Date>>(MatCalendar);\n\n // This inner FormControl is string only, but the outer FormControl is of type Date.\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 valueChanges = this.control.valueChanges.pipe(\n map(this.viewToModel),\n takeUntilDestroyed(),\n share()\n );\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 /** When true, seconds will be set to 59 and milliseconds to 999. Otherwise, both are 0. */\n inclusive = input(false);\n\n /** Emits when the selected date has changed. */\n dateChange = 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 selected = signal<Date | null>(null);\n protected placeholder = computed(() => (this.locale.isDanish() ? DA_FILLER : EN_FILLER));\n protected mask = computed(() =>\n maskitoDateTimeOptionsGenerator({\n min: this.min(),\n max: this.max(),\n dateMode: 'dd/mm/yyyy',\n timeMode: 'HH:MM',\n dateSeparator: '-',\n timeStep: 1,\n })\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());\n } else {\n picker.hidePopover();\n this.blur.emit(event);\n }\n };\n\n protected handleSelectedChange = (\n field: HTMLInputElement,\n picker: HTMLDivElement,\n date: Date\n ) => {\n const prev = this.viewToModel(this.control.value);\n\n // Only write the date part\n field.value = prev\n ? this.modelToView(dayjs(date).set('h', prev.getHours()).set('m', prev.getMinutes()).toDate())\n : this.modelToView(date, PARTIAL_DATETIME_FORMAT);\n\n field.dispatchEvent(new Event('input', { bubbles: true }));\n picker.hidePopover();\n };\n\n constructor() {\n this.valueChanges.subscribe((value) => {\n this.selected.set(value);\n this.calendar().activeDate = value ?? new Date();\n });\n }\n\n // Implementation for ControlValueAccessor\n writeValue = (value: Date | null) => this.control.setValue(this.modelToView(value));\n setDisabledState = (x: boolean) => (x ? this.control.disable() : this.control.enable());\n registerOnTouched = (fn: () => void) => this.blur.subscribe(fn);\n registerOnChange = (fn: (value: Date | 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 { WattDateTimeField } from './watt-datetime-field.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AA4BA,MAAM,SAAS,GAA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AA,WAAW,EAAE,UAAU,CAAC,uBAAuB,CAAC;AAChD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA;wBACP,mBAAmB;wBACnB,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,kBAAkB;qBACnB,EAoBS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yNAAA,CAAA,EAAA;;;AC3HH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-datetime-field.mjs","sources":["../../../libs/watt/package/datetime-field/watt-datetime-field.component.ts","../../../libs/watt/package/datetime-field/index.ts","../../../libs/watt/package/datetime-field/energinet-watt-datetime-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 {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { outputFromObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatCalendar } from '@angular/material/datepicker';\nimport { MaskitoDirective } from '@maskito/angular';\nimport { maskitoDateTimeOptionsGenerator } from '@maskito/kit';\nimport { map, share } from 'rxjs';\nimport { dayjs, WattLocaleService } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\nconst DA_FILLER = 'dd-mm-åååå, tt:mm';\nconst EN_FILLER = 'dd-mm-yyyy, hh:mm';\nconst DATETIME_FORMAT = 'DD-MM-YYYY, HH:mm';\nconst PARTIAL_DATETIME_FORMAT = 'DD-MM-YYYY, ';\nconst DANISH_TIME_ZONE_IDENTIFIER = 'Europe/Copenhagen';\n\n/* eslint-disable @angular-eslint/component-class-suffix */\n@Component({\n selector: 'watt-datetime-field',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDateTimeField),\n multi: true,\n },\n ],\n imports: [\n ReactiveFormsModule,\n MaskitoDirective,\n MatCalendar,\n WattButtonComponent,\n WattFieldComponent,\n ],\n styles: [\n `\n watt-datetime-field {\n display: block;\n width: 100%;\n }\n\n .watt-datetime-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\n [label]=\"label()\"\n [control]=\"control\"\n [placeholder]=\"placeholder()\"\n [anchorName]=\"anchorName\"\n >\n <input\n #field\n [formControl]=\"control\"\n [maskito]=\"mask()\"\n (focus)=\"picker.showPopover()\"\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-datetime-field-picker\"\n popover=\"manual\"\n tabindex=\"0\"\n [style.position-anchor]=\"anchorName\"\n >\n <mat-calendar\n [startAt]=\"selected()\"\n [selected]=\"selected()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n (selectedChange)=\"handleSelectedChange(field, picker, $event)\"\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 WattDateTimeField implements ControlValueAccessor {\n private locale = inject(WattLocaleService);\n\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 = WattDateTimeField.instance++;\n protected anchorName = `--watt-datetime-field-popover-anchor-${this.instance}`;\n\n /** Converts date from outer FormControl to format of inner FormControl. */\n protected modelToView = (value: Date | null, format = DATETIME_FORMAT) =>\n value ? dayjs(value).tz(DANISH_TIME_ZONE_IDENTIFIER).format(format) : '';\n\n /** Converts value of inner FormControl to type of outer FormControl. */\n protected viewToModel = (value: string) => {\n const date = dayjs(value, DATETIME_FORMAT, true);\n if (!date.isValid()) return null;\n return this.inclusive() ? date.endOf('m').toDate() : date.toDate();\n };\n\n // Must unfortunately be queried in order to update `activeDate`\n private calendar = viewChild.required<MatCalendar<Date>>(MatCalendar);\n\n // This inner FormControl is string only, but the outer FormControl is of type Date.\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 valueChanges = this.control.valueChanges.pipe(\n map(this.viewToModel),\n takeUntilDestroyed(),\n share()\n );\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 /** When true, seconds will be set to 59 and milliseconds to 999. Otherwise, both are 0. */\n inclusive = input(false);\n\n /** Emits when the selected date has changed. */\n dateChange = 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 selected = signal<Date | null>(null);\n protected placeholder = computed(() => (this.locale.isDanish() ? DA_FILLER : EN_FILLER));\n protected mask = computed(() =>\n maskitoDateTimeOptionsGenerator({\n min: this.min(),\n max: this.max(),\n dateMode: 'dd/mm/yyyy',\n timeMode: 'HH:MM',\n dateSeparator: '-',\n timeStep: 1,\n })\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.blur.emit(event);\n }\n };\n\n protected handleSelectedChange = (\n field: HTMLInputElement,\n picker: HTMLDivElement,\n date: Date\n ) => {\n const prev = this.viewToModel(this.control.value);\n\n // Only write the date part\n field.value = prev\n ? this.modelToView(dayjs(date).set('h', prev.getHours()).set('m', prev.getMinutes()).toDate())\n : this.modelToView(date, PARTIAL_DATETIME_FORMAT);\n\n field.dispatchEvent(new Event('input', { bubbles: true }));\n picker.hidePopover();\n };\n\n constructor() {\n this.valueChanges.subscribe((value) => {\n this.selected.set(value);\n this.calendar().activeDate = value ?? new Date();\n });\n }\n\n // Implementation for ControlValueAccessor\n writeValue = (value: Date | null) => this.control.setValue(this.modelToView(value));\n setDisabledState = (x: boolean) => (x ? this.control.disable() : this.control.enable());\n registerOnTouched = (fn: () => void) => this.blur.subscribe(fn);\n registerOnChange = (fn: (value: Date | 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 { WattDateTimeField } from './watt-datetime-field.component';\n","/**\n * Generated bundle index. Do not edit.\n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,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,EACpC,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,uBAAuB,CAAC;AAChD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA;wBACP,mBAAmB;wBACnB,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,kBAAkB;qBACnB,EAoBS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yNAAA,CAAA,EAAA;;;AC3HH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -54,6 +54,23 @@ class WattQueryParamsDirective {
|
|
|
54
54
|
// after which arrays are parsed as objects
|
|
55
55
|
// See https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays
|
|
56
56
|
arrayLimit: 200,
|
|
57
|
+
// https://github.com/ljharb/qs/issues/91#issuecomment-1833694874
|
|
58
|
+
decoder(str, defaultDecoder, charset, type) {
|
|
59
|
+
if (type === 'value' &&
|
|
60
|
+
/^(?:-(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))|(?:0|(?:[1-9](?:\d{0,2}(?:,\d{3})+|\d*))))(?:.\d+|)$/.test(str)) {
|
|
61
|
+
return parseFloat(str);
|
|
62
|
+
}
|
|
63
|
+
const keywords = {
|
|
64
|
+
true: true,
|
|
65
|
+
false: false,
|
|
66
|
+
null: null,
|
|
67
|
+
undefined: undefined,
|
|
68
|
+
};
|
|
69
|
+
if (type === 'value' && str in keywords) {
|
|
70
|
+
return keywords[str];
|
|
71
|
+
}
|
|
72
|
+
return defaultDecoder(str, defaultDecoder, charset);
|
|
73
|
+
},
|
|
57
74
|
});
|
|
58
75
|
this.formGroup.control.patchValue(value);
|
|
59
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-query-params.mjs","sources":["../../../libs/watt/package/query-params/watt-query-params.directive.ts","../../../libs/watt/package/query-params/index.ts","../../../libs/watt/package/query-params/energinet-watt-query-params.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { DestroyRef, Directive, OnInit, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroupDirective } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport qs from 'qs';\n\nconst filtersKey = 'filters';\n\n@Directive({\n selector: '[formGroup][wattQueryParams]',\n})\nexport class WattQueryParamsDirective implements OnInit {\n private formGroup = inject(FormGroupDirective);\n private destoryRef = inject(DestroyRef);\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n ngOnInit(): void {\n this.formGroup.valueChanges\n ?.pipe(takeUntilDestroyed(this.destoryRef))\n .subscribe((formValues) => {\n const formValuesClone = structuredClone(formValues);\n\n for (const key in formValuesClone) {\n if (formValuesClone[key] === null || formValuesClone[key] === undefined) {\n delete formValuesClone[key];\n }\n }\n\n const hasSetProperties = Object.keys(formValuesClone).length > 0;\n\n this.router.navigate([], {\n replaceUrl: true,\n relativeTo: this.route,\n queryParams: { [filtersKey]: hasSetProperties ? qs.stringify(formValuesClone) : null },\n queryParamsHandling: 'merge',\n });\n });\n\n if (Object.keys(this.route.snapshot.queryParams).length > 0) {\n const value = qs.parse(this.route.snapshot.queryParams[filtersKey] ?? '', {\n // Needed because `qs` library has a default value of 20 elements\n // after which arrays are parsed as objects\n // See https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays\n arrayLimit: 200,\n });\n\n this.formGroup.control.patchValue(value);\n }\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattQueryParamsDirective } from './watt-query-params.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAOA,MAAM,UAAU,GAAG,SAAS;MAKf,wBAAwB,CAAA;AAC3B,IAAA,SAAS,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACtC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;;IAGtC,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,CAAC;cACX,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;AACzC,aAAA,SAAS,CAAC,CAAC,UAAU,KAAI;AACxB,YAAA,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC;AAEnD,YAAA,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;AACjC,gBAAA,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;AACvE,oBAAA,OAAO,eAAe,CAAC,GAAG,CAAC;;;AAI/B,YAAA,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC;AAEhE,YAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE;AACvB,gBAAA,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,IAAI,CAAC,KAAK;gBACtB,WAAW,EAAE,EAAE,CAAC,UAAU,GAAG,gBAAgB,GAAG,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,IAAI,EAAE;AACtF,gBAAA,mBAAmB,EAAE,OAAO;AAC7B,aAAA,CAAC;AACJ,SAAC,CAAC;AAEJ,QAAA,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3D,YAAA,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE;;;;AAIxE,gBAAA,UAAU,EAAE,GAAG;AAChB,aAAA,CAAC;YAEF,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;;;
|
|
1
|
+
{"version":3,"file":"energinet-watt-query-params.mjs","sources":["../../../libs/watt/package/query-params/watt-query-params.directive.ts","../../../libs/watt/package/query-params/index.ts","../../../libs/watt/package/query-params/energinet-watt-query-params.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { DestroyRef, Directive, OnInit, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormGroupDirective } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport qs from 'qs';\n\nconst filtersKey = 'filters';\n\n@Directive({\n selector: '[formGroup][wattQueryParams]',\n})\nexport class WattQueryParamsDirective implements OnInit {\n private formGroup = inject(FormGroupDirective);\n private destoryRef = inject(DestroyRef);\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n ngOnInit(): void {\n this.formGroup.valueChanges\n ?.pipe(takeUntilDestroyed(this.destoryRef))\n .subscribe((formValues) => {\n const formValuesClone = structuredClone(formValues);\n\n for (const key in formValuesClone) {\n if (formValuesClone[key] === null || formValuesClone[key] === undefined) {\n delete formValuesClone[key];\n }\n }\n\n const hasSetProperties = Object.keys(formValuesClone).length > 0;\n\n this.router.navigate([], {\n replaceUrl: true,\n relativeTo: this.route,\n queryParams: { [filtersKey]: hasSetProperties ? qs.stringify(formValuesClone) : null },\n queryParamsHandling: 'merge',\n });\n });\n\n if (Object.keys(this.route.snapshot.queryParams).length > 0) {\n const value = qs.parse(this.route.snapshot.queryParams[filtersKey] ?? '', {\n // Needed because `qs` library has a default value of 20 elements\n // after which arrays are parsed as objects\n // See https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays\n arrayLimit: 200,\n // https://github.com/ljharb/qs/issues/91#issuecomment-1833694874\n decoder(\n str: string,\n defaultDecoder: qs.defaultDecoder,\n charset: string,\n type: 'key' | 'value'\n ) {\n if (\n type === 'value' &&\n /^(?:-(?:[1-9](?:\\d{0,2}(?:,\\d{3})+|\\d*))|(?:0|(?:[1-9](?:\\d{0,2}(?:,\\d{3})+|\\d*))))(?:.\\d+|)$/.test(\n str\n )\n ) {\n return parseFloat(str);\n }\n\n const keywords: Record<string, boolean | null | undefined> = {\n true: true,\n false: false,\n null: null,\n undefined: undefined,\n };\n if (type === 'value' && str in keywords) {\n return keywords[str];\n }\n\n return defaultDecoder(str, defaultDecoder, charset);\n },\n });\n\n this.formGroup.control.patchValue(value);\n }\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattQueryParamsDirective } from './watt-query-params.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAOA,MAAM,UAAU,GAAG,SAAS;MAKf,wBAAwB,CAAA;AAC3B,IAAA,SAAS,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACtC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;;IAGtC,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,CAAC;cACX,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;AACzC,aAAA,SAAS,CAAC,CAAC,UAAU,KAAI;AACxB,YAAA,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC;AAEnD,YAAA,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;AACjC,gBAAA,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;AACvE,oBAAA,OAAO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GAAG,EAAE,cAAc,EAAE,OAAO,CAAC;iBACpD;AACF,aAAA,CAAC;YAEF,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;;;uGAjEjC,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAxB,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,8BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,8BAA8B;AACzC,iBAAA;;;AC5BD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as i2 from '@angular/forms';
|
|
2
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { viewChild, TemplateRef, input, Component, contentChildren, model, signal, inject, ElementRef, forwardRef, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
|
5
|
+
import * as i1 from '@angular/material/button-toggle';
|
|
6
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
7
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
//#region License
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
13
|
+
*
|
|
14
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
15
|
+
* you may not use this file except in compliance with the License.
|
|
16
|
+
* You may obtain a copy of the License at
|
|
17
|
+
*
|
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
* See the License for the specific language governing permissions and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
//#endregion
|
|
27
|
+
class WattSegmentedButtonComponent {
|
|
28
|
+
templateRef = viewChild.required(TemplateRef);
|
|
29
|
+
value = input.required();
|
|
30
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattSegmentedButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.1", type: WattSegmentedButtonComponent, isStandalone: true, selector: "watt-segmented-button", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: ` <ng-template>
|
|
32
|
+
<ng-content />
|
|
33
|
+
</ng-template>`, isInline: true });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattSegmentedButtonComponent, decorators: [{
|
|
36
|
+
type: Component,
|
|
37
|
+
args: [{
|
|
38
|
+
selector: 'watt-segmented-button',
|
|
39
|
+
template: ` <ng-template>
|
|
40
|
+
<ng-content />
|
|
41
|
+
</ng-template>`,
|
|
42
|
+
}]
|
|
43
|
+
}] });
|
|
44
|
+
|
|
45
|
+
//#region License
|
|
46
|
+
/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
49
|
+
*
|
|
50
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
51
|
+
* you may not use this file except in compliance with the License.
|
|
52
|
+
* You may obtain a copy of the License at
|
|
53
|
+
*
|
|
54
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
+
*
|
|
56
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
58
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
+
* See the License for the specific language governing permissions and
|
|
60
|
+
* limitations under the License.
|
|
61
|
+
*/
|
|
62
|
+
//#endregion
|
|
63
|
+
/**
|
|
64
|
+
* Segmented buttons.
|
|
65
|
+
*/
|
|
66
|
+
class WattSegmentedButtonsComponent {
|
|
67
|
+
segmentedButtonElements = contentChildren(WattSegmentedButtonComponent);
|
|
68
|
+
selected = model('');
|
|
69
|
+
disabled = signal(false);
|
|
70
|
+
element = inject(ElementRef);
|
|
71
|
+
writeValue(selected) {
|
|
72
|
+
this.selected.set(selected);
|
|
73
|
+
}
|
|
74
|
+
registerOnChange(fn) {
|
|
75
|
+
this.selected.subscribe(fn);
|
|
76
|
+
}
|
|
77
|
+
registerOnTouched(fn) {
|
|
78
|
+
this.element.nativeElement.addEventListener('focusout', fn);
|
|
79
|
+
}
|
|
80
|
+
setDisabledState(isDisabled) {
|
|
81
|
+
this.disabled.set(isDisabled);
|
|
82
|
+
}
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattSegmentedButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
84
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattSegmentedButtonsComponent, isStandalone: true, selector: "watt-segmented-buttons", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, providers: [
|
|
85
|
+
{
|
|
86
|
+
provide: NG_VALUE_ACCESSOR,
|
|
87
|
+
useExisting: forwardRef(() => WattSegmentedButtonsComponent),
|
|
88
|
+
multi: true,
|
|
89
|
+
},
|
|
90
|
+
], queries: [{ propertyName: "segmentedButtonElements", predicate: WattSegmentedButtonComponent, isSignal: true }], ngImport: i0, template: ` <mat-button-toggle-group
|
|
91
|
+
[(ngModel)]="selected"
|
|
92
|
+
[multiple]="false"
|
|
93
|
+
[hideSingleSelectionIndicator]="true"
|
|
94
|
+
[disabled]="disabled()"
|
|
95
|
+
>
|
|
96
|
+
@for (segmentedButton of segmentedButtonElements(); track segmentedButton) {
|
|
97
|
+
<mat-button-toggle [disableRipple]="true" [value]="segmentedButton.value()">
|
|
98
|
+
<ng-container *ngTemplateOutlet="segmentedButton.templateRef()" />
|
|
99
|
+
</mat-button-toggle>
|
|
100
|
+
}
|
|
101
|
+
</mat-button-toggle-group>`, isInline: true, styles: [":root{--mat-standard-button-toggle-selected-state-text-color: white}:root{--mat-standard-button-toggle-selected-state-background-color: var(--watt-color-primary)}:root{--mat-standard-button-toggle-height: 2.5rem}:root mat-button-toggle-group{border-color:var(--watt-color-neutral-grey-700)}:root mat-button-toggle-group mat-button-toggle{border-color:var(--watt-color-neutral-grey-700)!important}:root mat-button-toggle-group mat-button-toggle button{width:6.5rem}:root mat-button-toggle-group mat-button-toggle button span{font-size:.875rem;font-weight:600}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattSegmentedButtonsComponent, decorators: [{
|
|
104
|
+
type: Component,
|
|
105
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [MatButtonToggleModule, FormsModule, NgTemplateOutlet], providers: [
|
|
106
|
+
{
|
|
107
|
+
provide: NG_VALUE_ACCESSOR,
|
|
108
|
+
useExisting: forwardRef(() => WattSegmentedButtonsComponent),
|
|
109
|
+
multi: true,
|
|
110
|
+
},
|
|
111
|
+
], selector: 'watt-segmented-buttons', template: ` <mat-button-toggle-group
|
|
112
|
+
[(ngModel)]="selected"
|
|
113
|
+
[multiple]="false"
|
|
114
|
+
[hideSingleSelectionIndicator]="true"
|
|
115
|
+
[disabled]="disabled()"
|
|
116
|
+
>
|
|
117
|
+
@for (segmentedButton of segmentedButtonElements(); track segmentedButton) {
|
|
118
|
+
<mat-button-toggle [disableRipple]="true" [value]="segmentedButton.value()">
|
|
119
|
+
<ng-container *ngTemplateOutlet="segmentedButton.templateRef()" />
|
|
120
|
+
</mat-button-toggle>
|
|
121
|
+
}
|
|
122
|
+
</mat-button-toggle-group>`, styles: [":root{--mat-standard-button-toggle-selected-state-text-color: white}:root{--mat-standard-button-toggle-selected-state-background-color: var(--watt-color-primary)}:root{--mat-standard-button-toggle-height: 2.5rem}:root mat-button-toggle-group{border-color:var(--watt-color-neutral-grey-700)}:root mat-button-toggle-group mat-button-toggle{border-color:var(--watt-color-neutral-grey-700)!important}:root mat-button-toggle-group mat-button-toggle button{width:6.5rem}:root mat-button-toggle-group mat-button-toggle button span{font-size:.875rem;font-weight:600}\n"] }]
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
//#region License
|
|
126
|
+
/**
|
|
127
|
+
* @license
|
|
128
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
129
|
+
*
|
|
130
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
131
|
+
* you may not use this file except in compliance with the License.
|
|
132
|
+
* You may obtain a copy of the License at
|
|
133
|
+
*
|
|
134
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
135
|
+
*
|
|
136
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
139
|
+
* See the License for the specific language governing permissions and
|
|
140
|
+
* limitations under the License.
|
|
141
|
+
*/
|
|
142
|
+
//#endregion
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Generated bundle index. Do not edit.
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
export { WattSegmentedButtonComponent, WattSegmentedButtonsComponent };
|
|
149
|
+
//# sourceMappingURL=energinet-watt-segmented-buttons.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"energinet-watt-segmented-buttons.mjs","sources":["../../../libs/watt/package/segmented-buttons/watt-segmented-button.component.ts","../../../libs/watt/package/segmented-buttons/watt-segmented-buttons.component.ts","../../../libs/watt/package/segmented-buttons/index.ts","../../../libs/watt/package/segmented-buttons/energinet-watt-segmented-buttons.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, input, TemplateRef, viewChild } from '@angular/core';\n\n@Component({\n selector: 'watt-segmented-button',\n template: ` <ng-template>\n <ng-content />\n </ng-template>`,\n})\nexport class WattSegmentedButtonComponent {\n templateRef = viewChild.required<TemplateRef<unknown>>(TemplateRef);\n value = input.required<string>();\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n ChangeDetectionStrategy,\n Component,\n contentChildren,\n ElementRef,\n forwardRef,\n inject,\n model,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n\n/**\n * Segmented buttons.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [MatButtonToggleModule, FormsModule, NgTemplateOutlet],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattSegmentedButtonsComponent),\n multi: true,\n },\n ],\n selector: 'watt-segmented-buttons',\n styleUrls: ['./watt-segmented-buttons.component.scss'],\n template: ` <mat-button-toggle-group\n [(ngModel)]=\"selected\"\n [multiple]=\"false\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"disabled()\"\n >\n @for (segmentedButton of segmentedButtonElements(); track segmentedButton) {\n <mat-button-toggle [disableRipple]=\"true\" [value]=\"segmentedButton.value()\">\n <ng-container *ngTemplateOutlet=\"segmentedButton.templateRef()\" />\n </mat-button-toggle>\n }\n </mat-button-toggle-group>`,\n})\nexport class WattSegmentedButtonsComponent implements ControlValueAccessor {\n segmentedButtonElements = contentChildren(WattSegmentedButtonComponent);\n selected = model<string>('');\n disabled = signal(false);\n private element = inject(ElementRef);\n\n writeValue(selected: string): void {\n this.selected.set(selected);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.selected.subscribe(fn);\n }\n\n registerOnTouched(fn: (value: boolean) => void): void {\n this.element.nativeElement.addEventListener('focusout', fn);\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';\nexport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MASa,4BAA4B,CAAA;AACvC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAuB,WAAW,CAAC;AACnE,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;uGAFrB,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAA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AA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAuBnD,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBA1BzC,SAAS;AACS,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAChC,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,qBAAqB,EAAE,WAAW,EAAE,gBAAgB,CAAC,EACpD,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,mCAAmC,CAAC;AAC5D,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EACS,wBAAwB,EAExB,QAAA,EAAA,CAAA;;;;;;;;;;;AAWiB,4BAAA,CAAA,EAAA,MAAA,EAAA,CAAA,kjBAAA,CAAA,EAAA;;;AC7D7B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -119,6 +119,10 @@ class WattTableComponent {
|
|
|
119
119
|
* when there is no data.
|
|
120
120
|
*/
|
|
121
121
|
loading = false;
|
|
122
|
+
/**
|
|
123
|
+
* If true the footer will be sticky
|
|
124
|
+
*/
|
|
125
|
+
stickyFooter = false;
|
|
122
126
|
/**
|
|
123
127
|
* Optional callback for determining header text for columns that
|
|
124
128
|
* do not have a static header text set in the column definition.
|
|
@@ -329,7 +333,7 @@ class WattTableComponent {
|
|
|
329
333
|
this.rowClick.emit(row);
|
|
330
334
|
}
|
|
331
335
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
332
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattTableComponent, isStandalone: true, selector: "watt-table", inputs: { dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: false, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: false, isRequired: false, transformFunction: null }, displayedColumns: { classPropertyName: "displayedColumns", publicName: "displayedColumns", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: false, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: false, isRequired: false, transformFunction: null }, resolveHeader: { classPropertyName: "resolveHeader", publicName: "resolveHeader", isSignal: false, isRequired: false, transformFunction: null }, sortBy: { classPropertyName: "sortBy", publicName: "sortBy", isSignal: false, isRequired: false, transformFunction: null }, sortDirection: { classPropertyName: "sortDirection", publicName: "sortDirection", isSignal: false, isRequired: false, transformFunction: null }, sortClear: { classPropertyName: "sortClear", publicName: "sortClear", isSignal: false, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: false, isRequired: false, transformFunction: null }, initialSelection: { classPropertyName: "initialSelection", publicName: "initialSelection", isSignal: true, isRequired: false, transformFunction: null }, suppressRowHoverHighlight: { classPropertyName: "suppressRowHoverHighlight", publicName: "suppressRowHoverHighlight", isSignal: false, isRequired: false, transformFunction: null }, activeRow: { classPropertyName: "activeRow", publicName: "activeRow", isSignal: false, isRequired: false, transformFunction: null }, activeRowComparator: { classPropertyName: "activeRowComparator", publicName: "activeRowComparator", isSignal: false, isRequired: false, transformFunction: null }, hideColumnHeaders: { classPropertyName: "hideColumnHeaders", publicName: "hideColumnHeaders", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", rowClick: "rowClick", sortChange: "sortChange" }, providers: [WattDatePipe], queries: [{ propertyName: "_toolbar", first: true, predicate: WattTableToolbarDirective, descendants: true }, { propertyName: "_cells", predicate: WattTableCellDirective }], viewQueries: [{ propertyName: "_sort", first: true, predicate: MatSort, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\n}\n", styles: ["watt-table{--mat-table-row-item-label-text-font: $primary-font-family;--mat-table-row-item-outline-color: var(--watt-color-neutral-grey-300);--mat-table-header-headline-font: $primary-font-family}watt-table,watt-table .mat-mdc-table{display:grid;position:relative;overflow:auto;min-height:44px}watt-table .mat-mdc-table{grid-template-columns:var(--watt-table-grid-template-columns);grid-auto-rows:max-content;max-height:100%;z-index:1}watt-table .mat-mdc-table thead,watt-table .mat-mdc-table tbody,watt-table .mat-mdc-table tfoot,watt-table .mat-mdc-table tr.mat-mdc-row,watt-table .mat-mdc-table tr.mat-mdc-header-row,watt-table .mat-mdc-table tr.mat-mdc-footer-row{display:contents}watt-table .mat-mdc-table tr.mat-mdc-header-row{flex:0 0 auto}watt-table .mat-mdc-table th.mat-mdc-header-cell{color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:uppercase;box-sizing:border-box;display:flex;position:sticky;top:0;padding:0 var(--watt-space-s);height:auto;background:var(--watt-color-primary-ultralight);box-shadow:0 -1px #0000001f inset;border:0;z-index:2!important;white-space:nowrap;-webkit-user-select:none;user-select:none}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table td.mat-mdc-cell{display:flex;align-items:center;min-height:56px;padding:var(--watt-space-s) var(--watt-space-m)}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:1px solid var(--watt-color-neutral-grey-300)}watt-table .mat-mdc-table td.mat-mdc-footer-cell{font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:none;letter-spacing:0;border-top:2px solid var(--watt-color-neutral-grey-300);background-color:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-no-end-divider:last-child .mat-mdc-cell{border-bottom:0px solid var(--watt-color-neutral-grey-300)!important}watt-table .mat-mdc-table .watt-table-clickable-row td{cursor:pointer;-webkit-user-select:text;user-select:text}watt-table .mat-mdc-table .watt-table-highlight-row:hover:not(.watt-table-active-row) td{background:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-active-row td{background:var(--watt-color-secondary-ultralight)}watt-table .mat-mdc-table .mat-sort-header-arrow{margin:0}watt-table .mat-mdc-table .mat-sort-header-arrow{margin-left:var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-header-cell{padding:.75rem var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-checkbox-cell{justify-content:center}watt-table .mat-mdc-table th.watt-table-checkbox-cell{display:flex;align-items:center}watt-table .mat-mdc-table .watt-table-align-center,watt-table .mat-mdc-table .watt-table-align-center .mat-sort-header-container{justify-content:center}watt-table .mat-mdc-table .watt-table-align-right,watt-table .mat-mdc-table .watt-table-align-right .mat-sort-header-container{justify-content:right}.watt-table-footer-spacer{display:none;height:76px;border:0}.watt-table-has-selection .watt-table-footer-spacer{display:block}.watt-table-has-selection+.watt-table-toolbar{opacity:1;visibility:visible;transition:opacity .3s cubic-bezier(0,0,.2,1),visibility .5s}.watt-table-toolbar{position:absolute;bottom:var(--watt-space-m);left:50%;transform:translate(-50%);display:flex;align-items:center;padding:0 var(--watt-space-m);min-height:44px;border-radius:22px;color:var(--watt-color-primary-contrast);background-color:var(--watt-color-primary);z-index:1;opacity:0;visibility:hidden;transition:none}.watt-table-toolbar .watt-button--disabled{opacity:.4;--watt-button-primary-disabled-color: #fff}.watt-table-loading-cell:before{content:\"\";flex:1;display:block;max-width:200px;height:var(--watt-space-m);border-radius:var(--watt-space-m);opacity:.75;animation:shine 2s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:300px;background-position:-100px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}@keyframes shine{40%,to{background-position:200px}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i2.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i2.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i3.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i3.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i3.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i3.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i3.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "component", type: WattCheckboxComponent, selector: "watt-checkbox", inputs: ["required"] }, { kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
336
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattTableComponent, isStandalone: true, selector: "watt-table", inputs: { dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: false, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: false, isRequired: false, transformFunction: null }, displayedColumns: { classPropertyName: "displayedColumns", publicName: "displayedColumns", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: false, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: false, isRequired: false, transformFunction: null }, stickyFooter: { classPropertyName: "stickyFooter", publicName: "stickyFooter", isSignal: false, isRequired: false, transformFunction: null }, resolveHeader: { classPropertyName: "resolveHeader", publicName: "resolveHeader", isSignal: false, isRequired: false, transformFunction: null }, sortBy: { classPropertyName: "sortBy", publicName: "sortBy", isSignal: false, isRequired: false, transformFunction: null }, sortDirection: { classPropertyName: "sortDirection", publicName: "sortDirection", isSignal: false, isRequired: false, transformFunction: null }, sortClear: { classPropertyName: "sortClear", publicName: "sortClear", isSignal: false, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: false, isRequired: false, transformFunction: null }, initialSelection: { classPropertyName: "initialSelection", publicName: "initialSelection", isSignal: true, isRequired: false, transformFunction: null }, suppressRowHoverHighlight: { classPropertyName: "suppressRowHoverHighlight", publicName: "suppressRowHoverHighlight", isSignal: false, isRequired: false, transformFunction: null }, activeRow: { classPropertyName: "activeRow", publicName: "activeRow", isSignal: false, isRequired: false, transformFunction: null }, activeRowComparator: { classPropertyName: "activeRowComparator", publicName: "activeRowComparator", isSignal: false, isRequired: false, transformFunction: null }, hideColumnHeaders: { classPropertyName: "hideColumnHeaders", publicName: "hideColumnHeaders", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange", rowClick: "rowClick", sortChange: "sortChange" }, providers: [WattDatePipe], queries: [{ propertyName: "_toolbar", first: true, predicate: WattTableToolbarDirective, descendants: true }, { propertyName: "_cells", predicate: WattTableCellDirective }], viewQueries: [{ propertyName: "_sort", first: true, predicate: MatSort, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter && !stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n @if (_hasFooter && stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns(); sticky: true\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\n}\n", styles: ["watt-table{--mat-table-row-item-label-text-font: $primary-font-family;--mat-table-row-item-outline-color: var(--watt-color-neutral-grey-300);--mat-table-header-headline-font: $primary-font-family}watt-table,watt-table .mat-mdc-table{display:grid;position:relative;overflow:auto;min-height:44px}watt-table .mat-mdc-table{grid-template-columns:var(--watt-table-grid-template-columns);grid-auto-rows:max-content;max-height:100%;z-index:1}watt-table .mat-mdc-table thead,watt-table .mat-mdc-table tbody,watt-table .mat-mdc-table tfoot,watt-table .mat-mdc-table tr.mat-mdc-row,watt-table .mat-mdc-table tr.mat-mdc-header-row,watt-table .mat-mdc-table tr.mat-mdc-footer-row{display:contents}watt-table .mat-mdc-table tr.mat-mdc-header-row{flex:0 0 auto}watt-table .mat-mdc-table th.mat-mdc-header-cell{color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:uppercase;box-sizing:border-box;display:flex;position:sticky;top:0;padding:0 var(--watt-space-s);height:auto;background:var(--watt-color-primary-ultralight);box-shadow:0 -1px #0000001f inset;border:0;z-index:2!important;white-space:nowrap;-webkit-user-select:none;user-select:none}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table td.mat-mdc-cell{display:flex;align-items:center;min-height:56px;padding:var(--watt-space-s) var(--watt-space-m)}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:1px solid var(--watt-color-neutral-grey-300)}watt-table .mat-mdc-table td.mat-mdc-footer-cell{font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:none;letter-spacing:0;border-top:2px solid var(--watt-color-neutral-grey-300);background-color:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-no-end-divider:last-child .mat-mdc-cell{border-bottom:0px solid var(--watt-color-neutral-grey-300)!important}watt-table .mat-mdc-table .watt-table-clickable-row td{cursor:pointer;-webkit-user-select:text;user-select:text}watt-table .mat-mdc-table .watt-table-highlight-row:hover:not(.watt-table-active-row) td{background:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-active-row td{background:var(--watt-color-secondary-ultralight)}watt-table .mat-mdc-table .mat-sort-header-arrow{margin:0}watt-table .mat-mdc-table .mat-sort-header-arrow{margin-left:var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-header-cell{padding:.75rem var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-checkbox-cell{justify-content:center}watt-table .mat-mdc-table th.watt-table-checkbox-cell{display:flex;align-items:center}watt-table .mat-mdc-table .watt-table-align-center,watt-table .mat-mdc-table .watt-table-align-center .mat-sort-header-container{justify-content:center}watt-table .mat-mdc-table .watt-table-align-right,watt-table .mat-mdc-table .watt-table-align-right .mat-sort-header-container{justify-content:right}.watt-table-footer-spacer{display:none;height:76px;border:0}.watt-table-has-selection .watt-table-footer-spacer{display:block}.watt-table-has-selection+.watt-table-toolbar{opacity:1;visibility:visible;transition:opacity .3s cubic-bezier(0,0,.2,1),visibility .5s}.watt-table-toolbar{position:absolute;bottom:var(--watt-space-m);left:50%;transform:translate(-50%);display:flex;align-items:center;padding:0 var(--watt-space-m);min-height:44px;border-radius:22px;color:var(--watt-color-primary-contrast);background-color:var(--watt-color-primary);z-index:1;opacity:0;visibility:hidden;transition:none}.watt-table-toolbar .watt-button--disabled{opacity:.4;--watt-button-primary-disabled-color: #fff}.watt-table-loading-cell:before{content:\"\";flex:1;display:block;max-width:200px;height:var(--watt-space-m);border-radius:var(--watt-space-m);opacity:.75;animation:shine 2s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:300px;background-position:-100px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}@keyframes shine{40%,to{background-position:200px}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i2.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i2.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i3.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i3.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i3.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i3.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i3.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "component", type: WattCheckboxComponent, selector: "watt-checkbox", inputs: ["required"] }, { kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
333
337
|
}
|
|
334
338
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattTableComponent, decorators: [{
|
|
335
339
|
type: Component,
|
|
@@ -342,7 +346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
342
346
|
MatTableModule,
|
|
343
347
|
WattCheckboxComponent,
|
|
344
348
|
WattIconComponent,
|
|
345
|
-
], providers: [WattDatePipe], encapsulation: ViewEncapsulation.None, selector: 'watt-table', template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\n}\n", styles: ["watt-table{--mat-table-row-item-label-text-font: $primary-font-family;--mat-table-row-item-outline-color: var(--watt-color-neutral-grey-300);--mat-table-header-headline-font: $primary-font-family}watt-table,watt-table .mat-mdc-table{display:grid;position:relative;overflow:auto;min-height:44px}watt-table .mat-mdc-table{grid-template-columns:var(--watt-table-grid-template-columns);grid-auto-rows:max-content;max-height:100%;z-index:1}watt-table .mat-mdc-table thead,watt-table .mat-mdc-table tbody,watt-table .mat-mdc-table tfoot,watt-table .mat-mdc-table tr.mat-mdc-row,watt-table .mat-mdc-table tr.mat-mdc-header-row,watt-table .mat-mdc-table tr.mat-mdc-footer-row{display:contents}watt-table .mat-mdc-table tr.mat-mdc-header-row{flex:0 0 auto}watt-table .mat-mdc-table th.mat-mdc-header-cell{color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:uppercase;box-sizing:border-box;display:flex;position:sticky;top:0;padding:0 var(--watt-space-s);height:auto;background:var(--watt-color-primary-ultralight);box-shadow:0 -1px #0000001f inset;border:0;z-index:2!important;white-space:nowrap;-webkit-user-select:none;user-select:none}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table td.mat-mdc-cell{display:flex;align-items:center;min-height:56px;padding:var(--watt-space-s) var(--watt-space-m)}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:1px solid var(--watt-color-neutral-grey-300)}watt-table .mat-mdc-table td.mat-mdc-footer-cell{font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:none;letter-spacing:0;border-top:2px solid var(--watt-color-neutral-grey-300);background-color:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-no-end-divider:last-child .mat-mdc-cell{border-bottom:0px solid var(--watt-color-neutral-grey-300)!important}watt-table .mat-mdc-table .watt-table-clickable-row td{cursor:pointer;-webkit-user-select:text;user-select:text}watt-table .mat-mdc-table .watt-table-highlight-row:hover:not(.watt-table-active-row) td{background:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-active-row td{background:var(--watt-color-secondary-ultralight)}watt-table .mat-mdc-table .mat-sort-header-arrow{margin:0}watt-table .mat-mdc-table .mat-sort-header-arrow{margin-left:var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-header-cell{padding:.75rem var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-checkbox-cell{justify-content:center}watt-table .mat-mdc-table th.watt-table-checkbox-cell{display:flex;align-items:center}watt-table .mat-mdc-table .watt-table-align-center,watt-table .mat-mdc-table .watt-table-align-center .mat-sort-header-container{justify-content:center}watt-table .mat-mdc-table .watt-table-align-right,watt-table .mat-mdc-table .watt-table-align-right .mat-sort-header-container{justify-content:right}.watt-table-footer-spacer{display:none;height:76px;border:0}.watt-table-has-selection .watt-table-footer-spacer{display:block}.watt-table-has-selection+.watt-table-toolbar{opacity:1;visibility:visible;transition:opacity .3s cubic-bezier(0,0,.2,1),visibility .5s}.watt-table-toolbar{position:absolute;bottom:var(--watt-space-m);left:50%;transform:translate(-50%);display:flex;align-items:center;padding:0 var(--watt-space-m);min-height:44px;border-radius:22px;color:var(--watt-color-primary-contrast);background-color:var(--watt-color-primary);z-index:1;opacity:0;visibility:hidden;transition:none}.watt-table-toolbar .watt-button--disabled{opacity:.4;--watt-button-primary-disabled-color: #fff}.watt-table-loading-cell:before{content:\"\";flex:1;display:block;max-width:200px;height:var(--watt-space-m);border-radius:var(--watt-space-m);opacity:.75;animation:shine 2s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:300px;background-position:-100px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}@keyframes shine{40%,to{background-position:200px}}\n"] }]
|
|
349
|
+
], providers: [WattDatePipe], encapsulation: ViewEncapsulation.None, selector: 'watt-table', template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter && !stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n @if (_hasFooter && stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns(); sticky: true\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\n}\n", styles: ["watt-table{--mat-table-row-item-label-text-font: $primary-font-family;--mat-table-row-item-outline-color: var(--watt-color-neutral-grey-300);--mat-table-header-headline-font: $primary-font-family}watt-table,watt-table .mat-mdc-table{display:grid;position:relative;overflow:auto;min-height:44px}watt-table .mat-mdc-table{grid-template-columns:var(--watt-table-grid-template-columns);grid-auto-rows:max-content;max-height:100%;z-index:1}watt-table .mat-mdc-table thead,watt-table .mat-mdc-table tbody,watt-table .mat-mdc-table tfoot,watt-table .mat-mdc-table tr.mat-mdc-row,watt-table .mat-mdc-table tr.mat-mdc-header-row,watt-table .mat-mdc-table tr.mat-mdc-footer-row{display:contents}watt-table .mat-mdc-table tr.mat-mdc-header-row{flex:0 0 auto}watt-table .mat-mdc-table th.mat-mdc-header-cell{color:var(--watt-typography-label-color);font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:uppercase;box-sizing:border-box;display:flex;position:sticky;top:0;padding:0 var(--watt-space-s);height:auto;background:var(--watt-color-primary-ultralight);box-shadow:0 -1px #0000001f inset;border:0;z-index:2!important;white-space:nowrap;-webkit-user-select:none;user-select:none}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table td.mat-mdc-cell{display:flex;align-items:center;min-height:56px;padding:var(--watt-space-s) var(--watt-space-m)}watt-table .mat-mdc-table td.mat-mdc-footer-cell,watt-table .mat-mdc-table tr.mdc-data-table__row:last-child .mat-mdc-cell{border-bottom:1px solid var(--watt-color-neutral-grey-300)}watt-table .mat-mdc-table td.mat-mdc-footer-cell{font-size:.875rem;line-height:1.25rem;font-weight:600;text-transform:none;letter-spacing:0;border-top:2px solid var(--watt-color-neutral-grey-300);background-color:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-no-end-divider:last-child .mat-mdc-cell{border-bottom:0px solid var(--watt-color-neutral-grey-300)!important}watt-table .mat-mdc-table .watt-table-clickable-row td{cursor:pointer;-webkit-user-select:text;user-select:text}watt-table .mat-mdc-table .watt-table-highlight-row:hover:not(.watt-table-active-row) td{background:var(--watt-color-neutral-grey-100)}watt-table .mat-mdc-table .watt-table-active-row td{background:var(--watt-color-secondary-ultralight)}watt-table .mat-mdc-table .mat-sort-header-arrow{margin:0}watt-table .mat-mdc-table .mat-sort-header-arrow{margin-left:var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-header-cell{padding:.75rem var(--watt-space-s)}watt-table .mat-mdc-table .watt-table-checkbox-cell{justify-content:center}watt-table .mat-mdc-table th.watt-table-checkbox-cell{display:flex;align-items:center}watt-table .mat-mdc-table .watt-table-align-center,watt-table .mat-mdc-table .watt-table-align-center .mat-sort-header-container{justify-content:center}watt-table .mat-mdc-table .watt-table-align-right,watt-table .mat-mdc-table .watt-table-align-right .mat-sort-header-container{justify-content:right}.watt-table-footer-spacer{display:none;height:76px;border:0}.watt-table-has-selection .watt-table-footer-spacer{display:block}.watt-table-has-selection+.watt-table-toolbar{opacity:1;visibility:visible;transition:opacity .3s cubic-bezier(0,0,.2,1),visibility .5s}.watt-table-toolbar{position:absolute;bottom:var(--watt-space-m);left:50%;transform:translate(-50%);display:flex;align-items:center;padding:0 var(--watt-space-m);min-height:44px;border-radius:22px;color:var(--watt-color-primary-contrast);background-color:var(--watt-color-primary);z-index:1;opacity:0;visibility:hidden;transition:none}.watt-table-toolbar .watt-button--disabled{opacity:.4;--watt-button-primary-disabled-color: #fff}.watt-table-loading-cell:before{content:\"\";flex:1;display:block;max-width:200px;height:var(--watt-space-m);border-radius:var(--watt-space-m);opacity:.75;animation:shine 2s infinite linear;background-color:var(--watt-color-neutral-grey-200);background-size:300px;background-position:-100px;background-image:linear-gradient(90deg,var(--watt-color-neutral-grey-300) 0px,var(--watt-color-neutral-grey-200) 40px,var(--watt-color-neutral-grey-300) 80px)}@keyframes shine{40%,to{background-position:200px}}\n"] }]
|
|
346
350
|
}], ctorParameters: () => [], propDecorators: { dataSource: [{
|
|
347
351
|
type: Input
|
|
348
352
|
}], columns: [{
|
|
@@ -355,6 +359,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
355
359
|
type: Input
|
|
356
360
|
}], loading: [{
|
|
357
361
|
type: Input
|
|
362
|
+
}], stickyFooter: [{
|
|
363
|
+
type: Input
|
|
358
364
|
}], resolveHeader: [{
|
|
359
365
|
type: Input
|
|
360
366
|
}], sortBy: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-table.mjs","sources":["../../../libs/watt/package/table/watt-table-data-source.ts","../../../libs/watt/package/table/watt-table.component.ts","../../../libs/watt/package/table/watt-table.component.html","../../../libs/watt/package/table/index.ts","../../../libs/watt/package/table/energinet-watt-table.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 { DataSource } from '@angular/cdk/collections';\nimport { MatPaginator } from '@angular/material/paginator';\nimport { MatSort } from '@angular/material/sort';\nimport { MatTableDataSource } from '@angular/material/table';\n\nexport interface IWattTableDataSource<T> extends DataSource<T> {\n data: T[];\n filter: string;\n filteredData: T[];\n paginator: MatPaginator | null;\n sort: MatSort | null;\n totalCount: number;\n}\n\n/**\n * @see https://material.angular.io/components/table/api#MatTableDataSource\n */\nexport class WattTableDataSource<T>\n extends MatTableDataSource<T>\n implements IWattTableDataSource<T>\n{\n constructor(\n initialData?: T[],\n config: { disableClientSideSort: boolean } = { disableClientSideSort: false }\n ) {\n super(initialData);\n\n if (config.disableClientSideSort)\n this.sortData = (data: T[]): T[] => {\n return data;\n };\n }\n\n get totalCount() {\n return this.data.length;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { SelectionModel } from '@angular/cdk/collections';\nimport { KeyValue, KeyValuePipe, NgClass, NgTemplateOutlet } from '@angular/common';\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ContentChildren,\n Directive,\n effect,\n ElementRef,\n EventEmitter,\n inject,\n input,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { QueryList, Signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { MatSort, MatSortModule, Sort, SortDirection } from '@angular/material/sort';\nimport { MatTableModule } from '@angular/material/table';\nimport { map } from 'rxjs';\n\nimport { WattCheckboxComponent } from '@energinet/watt/checkbox';\nimport { WattDatePipe } from '@energinet/watt/core/date';\nimport { WattIconComponent } from '@energinet/watt/icon';\n\nimport { IWattTableDataSource, WattTableDataSource } from './watt-table-data-source';\n\nexport interface WattTableColumn<T> {\n /**\n * The data that this column should be bound to, either as a property of `T`\n * or derived from each row of `T` using an accessor function. Use `null`\n * for columns that should not be associated with data, but note that this\n * will disable sorting and automatic cell population.\n */\n accessor: keyof T | ((row: T) => unknown) | null;\n\n /**\n * Resolve the header text to a static display value. This will prevent\n * the `resolveHeader` input function from being called for this column.\n */\n header?: string;\n\n /**\n * Callback for determining cell content when not using template. By default,\n * cell content is found using the `accessor` (unless it is `null`).\n */\n cell?: (row: T) => string;\n\n /**\n * Enable or disable sorting for this column. Defaults to `true`\n * unless `accessor` is `null`.\n */\n sort?: boolean;\n\n /**\n * Set the column size using grid sizing values. Defaults to `\"auto\"`.\n *\n * @remarks\n * Accepts all of the CSS grid track size keywords (such as `min-content`,\n * `max-content`, `minmax()`) as well as fractional (`fr`), percentage (`%`)\n * and length (`px`, `em`, etc) units.\n *\n * @see https://drafts.csswg.org/css-grid/#track-sizes\n */\n size?: string;\n\n /**\n * Horizontally align the contents of the column. Defaults to `\"left\"`.\n */\n align?: 'left' | 'right' | 'center';\n\n /**\n * Helper icon will be shown in the header cell, with an click event.\n */\n helperAction?: () => void;\n\n /**\n * CSS class to apply to the header cell element.\n */\n headerCellClass?: string;\n\n /**\n * CSS class to apply to the data cell element.\n */\n dataCellClass?: string;\n\n /**\n * Footer configuration for the column.\n */\n footer?: WattTableColumnFooter;\n\n /**\n * When set to `true`, the column remains visible when horizontally scrolling.\n */\n stickyEnd?: Signal<boolean>;\n}\n\n/**\n * Configuration for the footer cell of a column.\n */\nexport interface WattTableColumnFooter {\n /**\n * The value that will be displayed in the footer cell.\n */\n value?: Signal<string | number>;\n\n /**\n * CSS class to apply to the footer cell.\n */\n class?: string;\n}\n\n/**\n * Record for defining columns with keys used as column identifiers.\n */\nexport type WattTableColumnDef<T> = Record<string, WattTableColumn<T>>;\n\n// Used for strongly typing the structural directive\ninterface WattTableCellContext<T> {\n $implicit: T;\n}\n\ninterface WattTableToolbarContext<T> {\n $implicit: T;\n}\n\n@Directive({\n selector: '[wattTableCell]',\n})\nexport class WattTableCellDirective<T> {\n /** The WattTableColumn this template applies to. */\n @Input('wattTableCell') column!: WattTableColumn<T>;\n @Input('wattTableCellHeader') header?: string;\n templateRef = inject(TemplateRef<WattTableCellContext<T>>);\n static ngTemplateContextGuard<T>(\n _directive: WattTableCellDirective<T>,\n context: unknown\n ): context is WattTableCellContext<T> {\n return true;\n }\n}\n\n@Directive({\n selector: '[wattTableToolbar]',\n})\nexport class WattTableToolbarDirective<T> {\n templateRef = inject(TemplateRef<WattTableToolbarContext<T[]>>);\n static ngTemplateContextGuard<T>(\n _directive: WattTableToolbarDirective<T>,\n context: unknown\n ): context is WattTableToolbarContext<T[]> {\n return true;\n }\n}\n\n/**\n * Usage:\n * `import { WATT_TABLE } from '@energinet-datahub/watt/table';`\n */\n@Component({\n imports: [\n NgClass,\n NgTemplateOutlet,\n KeyValuePipe,\n FormsModule,\n MatSortModule,\n MatTableModule,\n WattCheckboxComponent,\n WattIconComponent,\n ],\n providers: [WattDatePipe],\n encapsulation: ViewEncapsulation.None,\n selector: 'watt-table',\n styleUrls: ['./watt-table.component.scss'],\n templateUrl: './watt-table.component.html',\n})\nexport class WattTableComponent<T> implements OnChanges, AfterViewInit {\n /**\n * The table's source of data. Property should not be changed after\n * initialization, instead update the data on the instance itself.\n */\n @Input() dataSource!: IWattTableDataSource<T>;\n\n /**\n * Column definition record with keys representing the column identifiers\n * and values being the column configuration. The order of the columns\n * is determined by the property order, but can be overruled by the\n * `displayedColumns` input.\n */\n @Input() columns: WattTableColumnDef<T> = {};\n\n /**\n * Used for hiding or reordering columns defined in the `columns` input.\n */\n @Input() displayedColumns?: string[];\n\n /**\n * Used for disabling the table. This will disable all user interaction\n */\n @Input() disabled = false;\n\n /**\n * Provide a description of the table for visually impaired users.\n */\n @Input() description = '';\n\n /**\n * If set to `true`, the table will show a loading indicator\n * when there is no data.\n */\n @Input() loading = false;\n\n /**\n * Optional callback for determining header text for columns that\n * do not have a static header text set in the column definition.\n * Useful for providing translations of column headers.\n */\n @Input()\n resolveHeader?: (key: string) => string;\n\n /**\n * Identifier for column that should be sorted initially.\n */\n @Input()\n sortBy = '';\n\n /**\n * The sort direction of the initially sorted column.\n */\n @Input()\n sortDirection: SortDirection = '';\n\n /**\n * Whether to allow the user to clear the sort. Defaults to `true`.\n */\n @Input()\n sortClear = true;\n\n /**\n * Whether the table should include a checkbox column for row selection.\n */\n @Input()\n selectable = false;\n\n /**\n * Sets the initially selected rows. Only works when selectable is `true`.\n */\n\n initialSelection = input<T[]>([]);\n\n /**\n * Set to true to disable row hover highlight.\n */\n @Input()\n suppressRowHoverHighlight = false;\n\n /**\n * Highlights the currently active row.\n */\n @Input()\n activeRow?: T;\n\n /**\n * Custom comparator function to determine if two rows are equal.\n *\n * @remarks\n * The default behavior for determining the active row is to compare\n * the two row objects using strict equality check. This is sufficient\n * as long as the instances remain the same, which may not be the case\n * if row data is recreated or rebuilt from serialization.\n */\n @Input()\n activeRowComparator?: (currentRow: T, activeRow: T) => boolean;\n\n /**\n * If set to `true`, the column headers will not be shown. Default is `false`.\n */\n @Input()\n hideColumnHeaders = false;\n\n /**\n * Emits whenever the selection updates. Only works when selectable is `true`.\n */\n @Output()\n selectionChange = new EventEmitter<T[]>();\n\n /**\n * Emits whenever a row is clicked.\n */\n @Output()\n rowClick = new EventEmitter<T>();\n\n /**\n * Event emitted when the user changes the active sort or sort direction.\n */\n @Output()\n sortChange = new EventEmitter<Sort>();\n\n /** @ignore */\n @ContentChildren(WattTableCellDirective)\n _cells!: QueryList<WattTableCellDirective<T>>;\n\n /** @ignore */\n @ContentChild(WattTableToolbarDirective)\n _toolbar?: WattTableToolbarDirective<T>;\n\n /** @ignore */\n @ViewChild(MatSort)\n _sort!: MatSort;\n\n /** @ignore */\n _selectionModel = new SelectionModel<T>(true, []);\n\n /** @ignore */\n _checkboxColumn = '__checkboxColumn__';\n\n /** @ignore */\n _element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @ignore */\n _datePipe = inject(WattDatePipe);\n\n /** @ignore */\n _hasFooter = false;\n\n /** @ignore */\n private formatCellData(cell: unknown) {\n if (!cell) return '—';\n if (cell instanceof Date) return this._datePipe.transform(cell);\n return cell;\n }\n\n /** @ignore */\n private getCellData(row: T, column?: WattTableColumn<T>) {\n if (!column?.accessor) return null;\n const { accessor } = column;\n const cell = typeof accessor === 'function' ? accessor(row) : row[accessor];\n return this.formatCellData(cell);\n }\n\n /** @ignore */\n private checkHasFooter(): void {\n this._hasFooter = Object.values(this.columns).some((column) => !!column.footer);\n }\n\n constructor() {\n effect(() => {\n this._selectionModel.setSelection(...(this.initialSelection() ?? []));\n });\n this._selectionModel.changed\n .pipe(\n map(() => this._selectionModel.selected),\n takeUntilDestroyed()\n )\n .subscribe((selection) => this.selectionChange.emit(selection));\n }\n\n ngAfterViewInit() {\n if (this.dataSource === undefined) return;\n\n this.checkHasFooter();\n this.dataSource.sort = this._sort;\n if (this.dataSource instanceof WattTableDataSource === false) return;\n this.dataSource.sortingDataAccessor = (row: T, sortHeaderId: string) => {\n const sortColumn = this.columns[sortHeaderId];\n if (!sortColumn?.accessor) return '';\n\n // Access raw value for sorting, instead of applying default formatting.\n const { accessor } = sortColumn;\n const cell = typeof accessor === 'function' ? accessor(row) : row[accessor];\n\n // Make sorting by text case insensitive.\n if (typeof cell === 'string') return cell.toLowerCase();\n if (cell instanceof Date) return cell.getTime();\n return cell as number;\n };\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['columns'] || changes['displayedColumns'] || changes['selectable']) {\n const { displayedColumns } = this;\n\n if (this.columns === undefined) return;\n\n const sizing = Object.keys(this.columns)\n .filter((key) => !displayedColumns || displayedColumns.includes(key))\n .map((key) => this.columns[key].size)\n .map((size) => size ?? 'auto');\n\n if (this.selectable) {\n // Add space for extra checkbox column\n sizing.unshift('var(--watt-space-xl)');\n }\n\n this._element.nativeElement.style.setProperty(\n '--watt-table-grid-template-columns',\n sizing.join(' ')\n );\n\n this.checkHasFooter();\n }\n }\n\n /**\n * Clears the selection. Only works when selectable is `true`.\n */\n clearSelection() {\n if (this.selectable) {\n this._selectionModel.clear();\n }\n }\n\n /** @ignore */\n get _columnSelection() {\n if (this.dataSource.filteredData.length === 0) return false;\n return this.dataSource.filteredData.every((row) => this._selectionModel.isSelected(row));\n }\n\n /** @ignore */\n set _columnSelection(value) {\n if (value) {\n this._selectionModel.setSelection(...this.dataSource.filteredData);\n } else {\n this.clearSelection();\n }\n }\n\n get _filteredSelection() {\n return this._selectionModel.selected.filter((row) =>\n this.dataSource.filteredData.includes(row)\n );\n }\n\n /** @ignore */\n _getColumns() {\n if (this.columns === undefined) return [];\n const columns = this.displayedColumns ?? Object.keys(this.columns);\n return this.selectable ? [this._checkboxColumn, ...columns] : columns;\n }\n\n /** @ignore */\n _getColumnTemplate(column: WattTableColumn<T>) {\n return this._cells.find((item) => item.column === column)?.templateRef;\n }\n\n /** @ignore */\n _getColumnHeader(column: KeyValue<string, WattTableColumn<T>>) {\n if (typeof column.value.header === 'string') return column.value.header;\n const cell = this._cells.find((item) => item.column === column.value);\n return cell?.header ?? this.resolveHeader?.(column.key) ?? column.key;\n }\n\n /** @ignore */\n _getColumnHelperAction(column: KeyValue<string, WattTableColumn<T>>) {\n return column.value.helperAction;\n }\n\n /** @ignore */\n _getColumnCell(column: KeyValue<string, WattTableColumn<T>>, row: T) {\n return column.value.cell?.(row) ?? this.getCellData(row, column.value);\n }\n\n /** @ignore */\n _isActiveRow(row: T) {\n if (!this.activeRow) return false;\n return this.activeRowComparator\n ? this.activeRowComparator(row, this.activeRow)\n : row === this.activeRow;\n }\n\n /** @ignore */\n _onRowClick(row: T) {\n if (this.disabled || window.getSelection()?.toString() !== '') return;\n this.rowClick.emit(row);\n }\n}\n\n@Component({\n selector: 'watt-table-toolbar-spacer',\n template: '',\n styles: [\n `\n :host {\n width: var(--watt-space-xl);\n }\n `,\n ],\n})\nexport class WattTableToolbarSpacerComponent {}\n\nexport const WATT_TABLE = [\n WattTableComponent,\n WattTableCellDirective,\n WattTableToolbarDirective,\n WattTableToolbarSpacerComponent,\n];\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\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 { IWattTableDataSource, WattTableDataSource } from './watt-table-data-source';\nexport {\n type WattTableColumn,\n type WattTableColumnDef,\n WattTableComponent,\n WattTableCellDirective,\n WattTableToolbarDirective,\n WattTableToolbarSpacerComponent,\n WATT_TABLE,\n} from './watt-table.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA;;AAEG;AACG,MAAO,mBACX,SAAQ,kBAAqB,CAAA;AAG7B,IAAA,WAAA,CACE,WAAiB,EACjB,MAAA,GAA6C,EAAE,qBAAqB,EAAE,KAAK,EAAE,EAAA;QAE7E,KAAK,CAAC,WAAW,CAAC;QAElB,IAAI,MAAM,CAAC,qBAAqB;AAC9B,YAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAS,KAAS;AACjC,gBAAA,OAAO,IAAI;AACb,aAAC;;AAGL,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM;;AAE1B;;ACtDD;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAyIa,sBAAsB,CAAA;;AAET,IAAA,MAAM;AACA,IAAA,MAAM;AACpC,IAAA,WAAW,GAAG,MAAM,EAAC,WAAoC,EAAC;AAC1D,I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AA,CAAA;sBADR;gBAaD,mBAAmB,EAAA,CAAA;sBADlB;gBAOD,iBAAiB,EAAA,CAAA;sBADhB;gBAOD,eAAe,EAAA,CAAA;sBADd;gBAOD,QAAQ,EAAA,CAAA;sBADP;gBAOD,UAAU,EAAA,CAAA;sBADT;gBAKD,MAAM,EAAA,CAAA;sBADL,eAAe;uBAAC,sBAAsB;gBAKvC,QAAQ,EAAA,CAAA;sBADP,YAAY;uBAAC,yBAAyB;gBAKvC,KAAK,EAAA,CAAA;sBADJ,SAAS;uBAAC,OAAO;;MAqLP,+BAA+B,CAAA;uGAA/B,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA/B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,+BAA+B,qFAThC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,qCAAA,CAAA,EAAA,CAAA;;2FASD,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAX3C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,2BAA2B,YAC3B,EAAE,EAAA,MAAA,EAAA,CAAA,qCAAA,CAAA,EAAA;;AAWD,MAAA,UAAU,GAAG;IACxB,kBAAkB;IAClB,sBAAsB;IACtB,yBAAyB;IACzB,+BAA+B;;;AEvgBjC;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-table.mjs","sources":["../../../libs/watt/package/table/watt-table-data-source.ts","../../../libs/watt/package/table/watt-table.component.ts","../../../libs/watt/package/table/watt-table.component.html","../../../libs/watt/package/table/index.ts","../../../libs/watt/package/table/energinet-watt-table.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 { DataSource } from '@angular/cdk/collections';\nimport { MatPaginator } from '@angular/material/paginator';\nimport { MatSort } from '@angular/material/sort';\nimport { MatTableDataSource } from '@angular/material/table';\n\nexport interface IWattTableDataSource<T> extends DataSource<T> {\n data: T[];\n filter: string;\n filteredData: T[];\n paginator: MatPaginator | null;\n sort: MatSort | null;\n totalCount: number;\n}\n\n/**\n * @see https://material.angular.io/components/table/api#MatTableDataSource\n */\nexport class WattTableDataSource<T>\n extends MatTableDataSource<T>\n implements IWattTableDataSource<T>\n{\n constructor(\n initialData?: T[],\n config: { disableClientSideSort: boolean } = { disableClientSideSort: false }\n ) {\n super(initialData);\n\n if (config.disableClientSideSort)\n this.sortData = (data: T[]): T[] => {\n return data;\n };\n }\n\n get totalCount() {\n return this.data.length;\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { SelectionModel } from '@angular/cdk/collections';\nimport { KeyValue, KeyValuePipe, NgClass, NgTemplateOutlet } from '@angular/common';\nimport {\n AfterViewInit,\n Component,\n ContentChild,\n ContentChildren,\n Directive,\n effect,\n ElementRef,\n EventEmitter,\n inject,\n input,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { QueryList, Signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { MatSort, MatSortModule, Sort, SortDirection } from '@angular/material/sort';\nimport { MatTableModule } from '@angular/material/table';\nimport { map } from 'rxjs';\n\nimport { WattCheckboxComponent } from '@energinet/watt/checkbox';\nimport { WattDatePipe } from '@energinet/watt/core/date';\nimport { WattIconComponent } from '@energinet/watt/icon';\n\nimport { IWattTableDataSource, WattTableDataSource } from './watt-table-data-source';\n\nexport interface WattTableColumn<T> {\n /**\n * The data that this column should be bound to, either as a property of `T`\n * or derived from each row of `T` using an accessor function. Use `null`\n * for columns that should not be associated with data, but note that this\n * will disable sorting and automatic cell population.\n */\n accessor: keyof T | ((row: T) => unknown) | null;\n\n /**\n * Resolve the header text to a static display value. This will prevent\n * the `resolveHeader` input function from being called for this column.\n */\n header?: string;\n\n /**\n * Callback for determining cell content when not using template. By default,\n * cell content is found using the `accessor` (unless it is `null`).\n */\n cell?: (row: T) => string;\n\n /**\n * Enable or disable sorting for this column. Defaults to `true`\n * unless `accessor` is `null`.\n */\n sort?: boolean;\n\n /**\n * Set the column size using grid sizing values. Defaults to `\"auto\"`.\n *\n * @remarks\n * Accepts all of the CSS grid track size keywords (such as `min-content`,\n * `max-content`, `minmax()`) as well as fractional (`fr`), percentage (`%`)\n * and length (`px`, `em`, etc) units.\n *\n * @see https://drafts.csswg.org/css-grid/#track-sizes\n */\n size?: string;\n\n /**\n * Horizontally align the contents of the column. Defaults to `\"left\"`.\n */\n align?: 'left' | 'right' | 'center';\n\n /**\n * Helper icon will be shown in the header cell, with an click event.\n */\n helperAction?: () => void;\n\n /**\n * CSS class to apply to the header cell element.\n */\n headerCellClass?: string;\n\n /**\n * CSS class to apply to the data cell element.\n */\n dataCellClass?: string;\n\n /**\n * Footer configuration for the column.\n */\n footer?: WattTableColumnFooter;\n\n /**\n * When set to `true`, the column remains visible when horizontally scrolling.\n */\n stickyEnd?: Signal<boolean>;\n}\n\n/**\n * Configuration for the footer cell of a column.\n */\nexport interface WattTableColumnFooter {\n /**\n * The value that will be displayed in the footer cell.\n */\n value?: Signal<string | number>;\n\n /**\n * CSS class to apply to the footer cell.\n */\n class?: string;\n}\n\n/**\n * Record for defining columns with keys used as column identifiers.\n */\nexport type WattTableColumnDef<T> = Record<string, WattTableColumn<T>>;\n\n// Used for strongly typing the structural directive\ninterface WattTableCellContext<T> {\n $implicit: T;\n}\n\ninterface WattTableToolbarContext<T> {\n $implicit: T;\n}\n\n@Directive({\n selector: '[wattTableCell]',\n})\nexport class WattTableCellDirective<T> {\n /** The WattTableColumn this template applies to. */\n @Input('wattTableCell') column!: WattTableColumn<T>;\n @Input('wattTableCellHeader') header?: string;\n templateRef = inject(TemplateRef<WattTableCellContext<T>>);\n static ngTemplateContextGuard<T>(\n _directive: WattTableCellDirective<T>,\n context: unknown\n ): context is WattTableCellContext<T> {\n return true;\n }\n}\n\n@Directive({\n selector: '[wattTableToolbar]',\n})\nexport class WattTableToolbarDirective<T> {\n templateRef = inject(TemplateRef<WattTableToolbarContext<T[]>>);\n static ngTemplateContextGuard<T>(\n _directive: WattTableToolbarDirective<T>,\n context: unknown\n ): context is WattTableToolbarContext<T[]> {\n return true;\n }\n}\n\n/**\n * Usage:\n * `import { WATT_TABLE } from '@energinet-datahub/watt/table';`\n */\n@Component({\n imports: [\n NgClass,\n NgTemplateOutlet,\n KeyValuePipe,\n FormsModule,\n MatSortModule,\n MatTableModule,\n WattCheckboxComponent,\n WattIconComponent,\n ],\n providers: [WattDatePipe],\n encapsulation: ViewEncapsulation.None,\n selector: 'watt-table',\n styleUrls: ['./watt-table.component.scss'],\n templateUrl: './watt-table.component.html',\n})\nexport class WattTableComponent<T> implements OnChanges, AfterViewInit {\n /**\n * The table's source of data. Property should not be changed after\n * initialization, instead update the data on the instance itself.\n */\n @Input() dataSource!: IWattTableDataSource<T>;\n\n /**\n * Column definition record with keys representing the column identifiers\n * and values being the column configuration. The order of the columns\n * is determined by the property order, but can be overruled by the\n * `displayedColumns` input.\n */\n @Input() columns: WattTableColumnDef<T> = {};\n\n /**\n * Used for hiding or reordering columns defined in the `columns` input.\n */\n @Input() displayedColumns?: string[];\n\n /**\n * Used for disabling the table. This will disable all user interaction\n */\n @Input() disabled = false;\n\n /**\n * Provide a description of the table for visually impaired users.\n */\n @Input() description = '';\n\n /**\n * If set to `true`, the table will show a loading indicator\n * when there is no data.\n */\n @Input() loading = false;\n\n /**\n * If true the footer will be sticky\n */\n @Input() stickyFooter = false;\n\n /**\n * Optional callback for determining header text for columns that\n * do not have a static header text set in the column definition.\n * Useful for providing translations of column headers.\n */\n @Input()\n resolveHeader?: (key: string) => string;\n\n /**\n * Identifier for column that should be sorted initially.\n */\n @Input()\n sortBy = '';\n\n /**\n * The sort direction of the initially sorted column.\n */\n @Input()\n sortDirection: SortDirection = '';\n\n /**\n * Whether to allow the user to clear the sort. Defaults to `true`.\n */\n @Input()\n sortClear = true;\n\n /**\n * Whether the table should include a checkbox column for row selection.\n */\n @Input()\n selectable = false;\n\n /**\n * Sets the initially selected rows. Only works when selectable is `true`.\n */\n\n initialSelection = input<T[]>([]);\n\n /**\n * Set to true to disable row hover highlight.\n */\n @Input()\n suppressRowHoverHighlight = false;\n\n /**\n * Highlights the currently active row.\n */\n @Input()\n activeRow?: T;\n\n /**\n * Custom comparator function to determine if two rows are equal.\n *\n * @remarks\n * The default behavior for determining the active row is to compare\n * the two row objects using strict equality check. This is sufficient\n * as long as the instances remain the same, which may not be the case\n * if row data is recreated or rebuilt from serialization.\n */\n @Input()\n activeRowComparator?: (currentRow: T, activeRow: T) => boolean;\n\n /**\n * If set to `true`, the column headers will not be shown. Default is `false`.\n */\n @Input()\n hideColumnHeaders = false;\n\n /**\n * Emits whenever the selection updates. Only works when selectable is `true`.\n */\n @Output()\n selectionChange = new EventEmitter<T[]>();\n\n /**\n * Emits whenever a row is clicked.\n */\n @Output()\n rowClick = new EventEmitter<T>();\n\n /**\n * Event emitted when the user changes the active sort or sort direction.\n */\n @Output()\n sortChange = new EventEmitter<Sort>();\n\n /** @ignore */\n @ContentChildren(WattTableCellDirective)\n _cells!: QueryList<WattTableCellDirective<T>>;\n\n /** @ignore */\n @ContentChild(WattTableToolbarDirective)\n _toolbar?: WattTableToolbarDirective<T>;\n\n /** @ignore */\n @ViewChild(MatSort)\n _sort!: MatSort;\n\n /** @ignore */\n _selectionModel = new SelectionModel<T>(true, []);\n\n /** @ignore */\n _checkboxColumn = '__checkboxColumn__';\n\n /** @ignore */\n _element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @ignore */\n _datePipe = inject(WattDatePipe);\n\n /** @ignore */\n _hasFooter = false;\n\n /** @ignore */\n private formatCellData(cell: unknown) {\n if (!cell) return '—';\n if (cell instanceof Date) return this._datePipe.transform(cell);\n return cell;\n }\n\n /** @ignore */\n private getCellData(row: T, column?: WattTableColumn<T>) {\n if (!column?.accessor) return null;\n const { accessor } = column;\n const cell = typeof accessor === 'function' ? accessor(row) : row[accessor];\n return this.formatCellData(cell);\n }\n\n /** @ignore */\n private checkHasFooter(): void {\n this._hasFooter = Object.values(this.columns).some((column) => !!column.footer);\n }\n\n constructor() {\n effect(() => {\n this._selectionModel.setSelection(...(this.initialSelection() ?? []));\n });\n this._selectionModel.changed\n .pipe(\n map(() => this._selectionModel.selected),\n takeUntilDestroyed()\n )\n .subscribe((selection) => this.selectionChange.emit(selection));\n }\n\n ngAfterViewInit() {\n if (this.dataSource === undefined) return;\n\n this.checkHasFooter();\n this.dataSource.sort = this._sort;\n if (this.dataSource instanceof WattTableDataSource === false) return;\n this.dataSource.sortingDataAccessor = (row: T, sortHeaderId: string) => {\n const sortColumn = this.columns[sortHeaderId];\n if (!sortColumn?.accessor) return '';\n\n // Access raw value for sorting, instead of applying default formatting.\n const { accessor } = sortColumn;\n const cell = typeof accessor === 'function' ? accessor(row) : row[accessor];\n\n // Make sorting by text case insensitive.\n if (typeof cell === 'string') return cell.toLowerCase();\n if (cell instanceof Date) return cell.getTime();\n return cell as number;\n };\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['columns'] || changes['displayedColumns'] || changes['selectable']) {\n const { displayedColumns } = this;\n\n if (this.columns === undefined) return;\n\n const sizing = Object.keys(this.columns)\n .filter((key) => !displayedColumns || displayedColumns.includes(key))\n .map((key) => this.columns[key].size)\n .map((size) => size ?? 'auto');\n\n if (this.selectable) {\n // Add space for extra checkbox column\n sizing.unshift('var(--watt-space-xl)');\n }\n\n this._element.nativeElement.style.setProperty(\n '--watt-table-grid-template-columns',\n sizing.join(' ')\n );\n\n this.checkHasFooter();\n }\n }\n\n /**\n * Clears the selection. Only works when selectable is `true`.\n */\n clearSelection() {\n if (this.selectable) {\n this._selectionModel.clear();\n }\n }\n\n /** @ignore */\n get _columnSelection() {\n if (this.dataSource.filteredData.length === 0) return false;\n return this.dataSource.filteredData.every((row) => this._selectionModel.isSelected(row));\n }\n\n /** @ignore */\n set _columnSelection(value) {\n if (value) {\n this._selectionModel.setSelection(...this.dataSource.filteredData);\n } else {\n this.clearSelection();\n }\n }\n\n get _filteredSelection() {\n return this._selectionModel.selected.filter((row) =>\n this.dataSource.filteredData.includes(row)\n );\n }\n\n /** @ignore */\n _getColumns() {\n if (this.columns === undefined) return [];\n const columns = this.displayedColumns ?? Object.keys(this.columns);\n return this.selectable ? [this._checkboxColumn, ...columns] : columns;\n }\n\n /** @ignore */\n _getColumnTemplate(column: WattTableColumn<T>) {\n return this._cells.find((item) => item.column === column)?.templateRef;\n }\n\n /** @ignore */\n _getColumnHeader(column: KeyValue<string, WattTableColumn<T>>) {\n if (typeof column.value.header === 'string') return column.value.header;\n const cell = this._cells.find((item) => item.column === column.value);\n return cell?.header ?? this.resolveHeader?.(column.key) ?? column.key;\n }\n\n /** @ignore */\n _getColumnHelperAction(column: KeyValue<string, WattTableColumn<T>>) {\n return column.value.helperAction;\n }\n\n /** @ignore */\n _getColumnCell(column: KeyValue<string, WattTableColumn<T>>, row: T) {\n return column.value.cell?.(row) ?? this.getCellData(row, column.value);\n }\n\n /** @ignore */\n _isActiveRow(row: T) {\n if (!this.activeRow) return false;\n return this.activeRowComparator\n ? this.activeRowComparator(row, this.activeRow)\n : row === this.activeRow;\n }\n\n /** @ignore */\n _onRowClick(row: T) {\n if (this.disabled || window.getSelection()?.toString() !== '') return;\n this.rowClick.emit(row);\n }\n}\n\n@Component({\n selector: 'watt-table-toolbar-spacer',\n template: '',\n styles: [\n `\n :host {\n width: var(--watt-space-xl);\n }\n `,\n ],\n})\nexport class WattTableToolbarSpacerComponent {}\n\nexport const WATT_TABLE = [\n WattTableComponent,\n WattTableCellDirective,\n WattTableToolbarDirective,\n WattTableToolbarSpacerComponent,\n];\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<table\n mat-table\n matSort\n role=\"treegrid\"\n [ngClass]=\"{ 'watt-table-has-selection': _filteredSelection.length > 0 }\"\n [matSortActive]=\"sortBy\"\n [matSortDirection]=\"sortDirection\"\n [matSortDisableClear]=\"!sortClear\"\n [dataSource]=\"dataSource\"\n [attr.aria-label]=\"description\"\n (matSortChange)=\"sortChange.emit($event)\"\n>\n @if (selectable) {\n <ng-container [matColumnDef]=\"_checkboxColumn\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"watt-table-checkbox-cell\">\n <watt-checkbox [(ngModel)]=\"_columnSelection\" />\n </th>\n <td mat-cell *matCellDef=\"let row\" class=\"watt-table-checkbox-cell\">\n <watt-checkbox\n [ngModel]=\"_selectionModel.isSelected(row)\"\n (ngModelChange)=\"_selectionModel.toggle(row)\"\n (click)=\"$event.stopPropagation()\"\n />\n </td>\n </ng-container>\n }\n\n @for (column of columns | keyvalue; track column.key) {\n <ng-container [matColumnDef]=\"column.key\" [stickyEnd]=\"column.value.stickyEnd?.()\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{\n column.value.headerCellClass\n }}\"\n >\n @if (_getColumnHelperAction(column); as action) {\n <watt-icon name=\"help\" (click)=\"action()\" />\n }\n\n <div\n class=\"watt-table-header-cell\"\n mat-sort-header\n [arrowPosition]=\"column.value.align === 'right' ? 'before' : 'after'\"\n [disabled]=\"!column.value.accessor || column.value.sort === false\"\n >\n {{ _getColumnHeader(column) }}\n </div>\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"watt-table-align-{{ column.value.align ?? 'left' }} {{ column.value.dataCellClass }}\"\n >\n @if (_getColumnTemplate(column.value); as template) {\n <div>\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row }\" />\n </div>\n } @else {\n {{ _getColumnCell(column, row) }}\n }\n </td>\n\n @if (_hasFooter) {\n <td\n mat-footer-cell\n *matFooterCellDef\n class=\"{{ column.value.footer?.class }} watt-table-align-{{\n column.value.align ?? 'left'\n }}\"\n >\n {{ column.value.footer?.value?.() }}\n </td>\n }\n </ng-container>\n }\n\n <ng-container matColumnDef=\"spacer\">\n <td class=\"watt-table-footer-spacer\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n @if (!hideColumnHeaders) {\n <tr mat-header-row *matHeaderRowDef=\"_getColumns()\"></tr>\n }\n <tr\n mat-row\n *matRowDef=\"let row; columns: _getColumns()\"\n [attr.aria-selected]=\"row === activeRow\"\n (click)=\"_onRowClick(row)\"\n [ngClass]=\"{\n 'watt-table-highlight-row': !disabled && !suppressRowHoverHighlight,\n 'watt-table-clickable-row': !disabled && rowClick.observed,\n 'watt-table-active-row': _isActiveRow(row),\n 'watt-table-no-end-divider': hideColumnHeaders,\n }\"\n ></tr>\n\n @if (_toolbar) {\n <tr mat-footer-row *matFooterRowDef=\"['spacer']\"></tr>\n }\n\n @if (_hasFooter && !stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns()\"></tr>\n }\n\n @if (_hasFooter && stickyFooter) {\n <tr mat-footer-row *matFooterRowDef=\"_getColumns(); sticky: true\"></tr>\n }\n\n <ng-container *matNoDataRow>\n @if (loading) {\n @for (i of [1, 2, 3]; track i) {\n <tr class=\"mat-mdc-row\">\n @for (_ of _getColumns(); track _; let i = $index) {\n <td class=\"mat-mdc-cell\" [class.watt-table-loading-cell]=\"i > 0 || !selectable\"></td>\n }\n </tr>\n }\n }\n </ng-container>\n</table>\n\n@if (_toolbar) {\n <div class=\"watt-table-toolbar\" role=\"toolbar\">\n <ng-container\n *ngTemplateOutlet=\"_toolbar.templateRef; context: { $implicit: _filteredSelection }\"\n />\n </div>\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 { IWattTableDataSource, WattTableDataSource } from './watt-table-data-source';\nexport {\n type WattTableColumn,\n type WattTableColumnDef,\n WattTableComponent,\n WattTableCellDirective,\n WattTableToolbarDirective,\n WattTableToolbarSpacerComponent,\n WATT_TABLE,\n} from './watt-table.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgCA;;AAEG;AACG,MAAO,m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A,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,+BAA+B,qFAThC,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,qCAAA,CAAA,EAAA,CAAA;;2FASD,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAX3C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,2BAA2B,YAC3B,EAAE,EAAA,MAAA,EAAA,CAAA,qCAAA,CAAA,EAAA;;AAWD,MAAA,UAAU,GAAG;IACxB,kBAAkB;IAClB,sBAAsB;IACtB,yBAAyB;IACzB,+BAA+B;;;AE5gBjC;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -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,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;;AAGzE,IAAA,OAAO,SAAS,GAAG,CAAC,KAAgC,KAClD,IAAI,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;;AAG1E,IAAA,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI;;AAG1C,IAAA,MAAM,GAAG,MAAM,IAAI,CAAC,I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AA,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.
|
|
4
|
+
"version": "1.4.3",
|
|
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,10 @@
|
|
|
171
175
|
"types": "./vater/index.d.ts",
|
|
172
176
|
"default": "./fesm2022/energinet-watt-vater.mjs"
|
|
173
177
|
},
|
|
178
|
+
"./yearmonth-field": {
|
|
179
|
+
"types": "./yearmonth-field/index.d.ts",
|
|
180
|
+
"default": "./fesm2022/energinet-watt-yearmonth-field.mjs"
|
|
181
|
+
},
|
|
174
182
|
"./core/breakpoints": {
|
|
175
183
|
"types": "./core/breakpoints/index.d.ts",
|
|
176
184
|
"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,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";
|