@energinet/watt 2.0.6 → 2.0.8

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.
@@ -71,7 +71,7 @@ class WattCodeComponent {
71
71
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattCodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
72
72
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattCodeComponent, isStandalone: true, selector: "watt-code", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
73
73
  @if (loading()) {
74
- <vater-stack [fill]="'horizontal'" [align]="'center'"><watt-spinner /></vater-stack>
74
+ <vater-stack fill="horizontal" alignment="center"><watt-spinner /></vater-stack>
75
75
  } @else {
76
76
  <pre>
77
77
  <code class="watt-code-content" [innerHTML]="formattedCode()"></code>
@@ -83,7 +83,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
83
83
  type: Component,
84
84
  args: [{ selector: 'watt-code', template: `
85
85
  @if (loading()) {
86
- <vater-stack [fill]="'horizontal'" [align]="'center'"><watt-spinner /></vater-stack>
86
+ <vater-stack fill="horizontal" alignment="center"><watt-spinner /></vater-stack>
87
87
  } @else {
88
88
  <pre>
89
89
  <code class="watt-code-content" [innerHTML]="formattedCode()"></code>
@@ -1 +1 @@
1
- {"version":3,"file":"energinet-watt-code.mjs","sources":["../../../libs/watt/package/code/watt-code.worker.token.ts","../../../libs/watt/package/code/watt-code.component.ts","../../../libs/watt/package/code/index.ts","../../../libs/watt/package/code/energinet-watt-code.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 { InjectionToken } from '@angular/core';\n\nexport const WATT_CODE_HIGHLIGHT_WORKER_FACTORY = new InjectionToken<(() => Worker) | null>(\n 'WattCodeHighlightWorkerFactory',\n { factory: () => null }\n);\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n Component,\n ChangeDetectionStrategy,\n ViewEncapsulation,\n signal,\n input,\n OnDestroy,\n inject,\n effect,\n linkedSignal,\n} from '@angular/core';\n\nimport { WattSpinnerComponent } from '@energinet/watt/spinner';\nimport { VaterStackComponent } from '@energinet/watt/vater';\n\nimport { WATT_CODE_HIGHLIGHT_WORKER_FACTORY } from './watt-code.worker.token';\n\n@Component({\n selector: 'watt-code',\n template: `\n @if (loading()) {\n <vater-stack [fill]=\"'horizontal'\" [align]=\"'center'\"><watt-spinner /></vater-stack>\n } @else {\n <pre>\n <code class=\"watt-code-content\" [innerHTML]=\"formattedCode()\"></code>\n </pre>\n }\n `,\n styleUrls: ['./watt-code.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WattSpinnerComponent, VaterStackComponent],\n})\nexport class WattCodeComponent implements OnDestroy {\n private highlightWorkerFactory = inject(WATT_CODE_HIGHLIGHT_WORKER_FACTORY);\n private worker = this.highlightWorkerFactory?.();\n\n code = input.required<string | null | undefined>();\n\n /** @ignore */\n formattedCode = linkedSignal(() => this.code() ?? '');\n\n /** @ignore */\n loading = signal(false);\n\n /** @ignore */\n ngOnDestroy(): void {\n this.worker?.terminate();\n }\n\n constructor() {\n effect(() => {\n const code = this.code();\n if (!code) return;\n if (!this.worker) return;\n this.loading.set(true);\n this.worker.onmessage = (event) => {\n this.formattedCode.set(event.data);\n this.loading.set(false);\n };\n this.worker.postMessage(code);\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 { WattCodeComponent } from './watt-code.component';\nexport { WATT_CODE_HIGHLIGHT_WORKER_FACTORY } from './watt-code.worker.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAGa,MAAA,kCAAkC,GAAG,IAAI,cAAc,CAClE,gCAAgC,EAChC,EAAE,OAAO,EAAE,MAAM,IAAI,EAAE;;ACtBzB;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAkCa,iBAAiB,CAAA;AACpB,IAAA,sBAAsB,GAAG,MAAM,CAAC,kCAAkC,CAAC;AACnE,IAAA,MAAM,GAAG,IAAI,CAAC,sBAAsB,IAAI;AAEhD,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,EAA6B;;AAGlD,IAAA,aAAa,GAAG,YAAY,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;;AAGrD,IAAA,OAAO,G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AAA,EAAA,IAAA,EAAA,oBAAoB,8FAAE,mBAAmB,EAAA,QAAA,EAAA,4BAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAExC,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAhB7B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EACX,QAAA,EAAA;;;;;;;;AAQT,EAAA,CAAA,EAAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,EAAA,MAAA,EAAA,CAAA,+RAAA,CAAA,EAAA;;;ACjDtD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"energinet-watt-code.mjs","sources":["../../../libs/watt/package/code/watt-code.worker.token.ts","../../../libs/watt/package/code/watt-code.component.ts","../../../libs/watt/package/code/index.ts","../../../libs/watt/package/code/energinet-watt-code.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 { InjectionToken } from '@angular/core';\n\nexport const WATT_CODE_HIGHLIGHT_WORKER_FACTORY = new InjectionToken<(() => Worker) | null>(\n 'WattCodeHighlightWorkerFactory',\n { factory: () => null }\n);\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n Component,\n ChangeDetectionStrategy,\n ViewEncapsulation,\n signal,\n input,\n OnDestroy,\n inject,\n effect,\n linkedSignal,\n} from '@angular/core';\n\nimport { WattSpinnerComponent } from '@energinet/watt/spinner';\nimport { VaterStackComponent } from '@energinet/watt/vater';\n\nimport { WATT_CODE_HIGHLIGHT_WORKER_FACTORY } from './watt-code.worker.token';\n\n@Component({\n selector: 'watt-code',\n template: `\n @if (loading()) {\n <vater-stack fill=\"horizontal\" alignment=\"center\"><watt-spinner /></vater-stack>\n } @else {\n <pre>\n <code class=\"watt-code-content\" [innerHTML]=\"formattedCode()\"></code>\n </pre>\n }\n `,\n styleUrls: ['./watt-code.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WattSpinnerComponent, VaterStackComponent],\n})\nexport class WattCodeComponent implements OnDestroy {\n private highlightWorkerFactory = inject(WATT_CODE_HIGHLIGHT_WORKER_FACTORY);\n private worker = this.highlightWorkerFactory?.();\n\n code = input.required<string | null | undefined>();\n\n /** @ignore */\n formattedCode = linkedSignal(() => this.code() ?? '');\n\n /** @ignore */\n loading = signal(false);\n\n /** @ignore */\n ngOnDestroy(): void {\n this.worker?.terminate();\n }\n\n constructor() {\n effect(() => {\n const code = this.code();\n if (!code) return;\n if (!this.worker) return;\n this.loading.set(true);\n this.worker.onmessage = (event) => {\n this.formattedCode.set(event.data);\n this.loading.set(false);\n };\n this.worker.postMessage(code);\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 { WattCodeComponent } from './watt-code.component';\nexport { WATT_CODE_HIGHLIGHT_WORKER_FACTORY } from './watt-code.worker.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAGa,MAAA,kCAAkC,GAAG,IAAI,cAAc,CAClE,gCAAgC,EAChC,EAAE,OAAO,EAAE,MAAM,IAAI,EAAE;;ACtBzB;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAkCa,iBAAiB,CAAA;AACpB,IAAA,sBAAsB,GAAG,MAAM,CAAC,kCAAkC,CAAC;AACnE,IAAA,MAAM,GAAG,IAAI,CAAC,sBAAsB,IAAI;AAEhD,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,EAA6B;;AAGlD,IAAA,aAAa,GAAG,YAAY,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;;AAGrD,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;;IAGvB,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE;;AAG1B,IAAA,WAAA,GAAA;QACE,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE;AACxB,YAAA,IAAI,CAAC,IAAI;gBAAE;YACX,IAAI,CAAC,IAAI,CAAC,MAAM;gBAAE;AAClB,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACtB,IAAI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AAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,EAAA,MAAA,EAAA,CAAA,+RAAA,CAAA,EAAA;;;ACjDtD;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
@@ -187,7 +187,7 @@ class WattDropZone {
187
187
  (dragleave)="dragOver.set(false)"
188
188
  >
189
189
  @if (progress() < 100) {
190
- <vater-stack center gap="s" fill="horizontal" align="start">
190
+ <vater-stack center gap="s" fill="horizontal" alignment="start">
191
191
  <span>{{ intl.loadingMessage }} ( {{ progress() + '%' }} )</span>
192
192
  <mat-progress-bar mode="determinate" [value]="progress()" />
193
193
  </vater-stack>
@@ -244,7 +244,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
244
244
  (dragleave)="dragOver.set(false)"
245
245
  >
246
246
  @if (progress() < 100) {
247
- <vater-stack center gap="s" fill="horizontal" align="start">
247
+ <vater-stack center gap="s" fill="horizontal" alignment="start">
248
248
  <span>{{ intl.loadingMessage }} ( {{ progress() + '%' }} )</span>
249
249
  <mat-progress-bar mode="determinate" [value]="progress()" />
250
250
  </vater-stack>
@@ -1 +1 @@
1
- {"version":3,"file":"energinet-watt-dropzone.mjs","sources":["../../../libs/watt/package/dropzone/watt-dropzone-intl.ts","../../../libs/watt/package/dropzone/watt-dropzone-validators.ts","../../../libs/watt/package/dropzone/watt-dropzone.ts","../../../libs/watt/package/dropzone/index.ts","../../../libs/watt/package/dropzone/energinet-watt-dropzone.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 { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class WattDropZoneIntlService {\n prompt = 'Drop file here';\n promptMultiple = 'Drop files here';\n separator = 'or';\n button = 'Choose file';\n buttonMultiple = 'Choose files';\n loadingMessage = 'Loading';\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 { Directive, inject } from '@angular/core';\nimport { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator } from '@angular/forms';\nimport { WattDropZone, MimeType } from './watt-dropzone';\n\n/**\n * Directive that validates the file type of provided files. This is automatically\n * applied to the `WattDropZone` component via `hostDirectives`.\n */\n@Directive({\n providers: [{ provide: NG_VALIDATORS, useExisting: FileTypeValidator, multi: true }],\n})\nexport class FileTypeValidator implements Validator {\n component = inject(WattDropZone, { host: true, self: true });\n validate(control: AbstractControl<File[] | null>): ValidationErrors | null {\n const accept = this.component.accept();\n return accept.length > 0 && control.value?.some((i) => !accept.includes(i.type as MimeType))\n ? { type: true }\n : null;\n }\n}\n\n/**\n * Directive validating that a single file is selected when `multiple` is false.\n * This is automatically applied to the `WattDropZone` component via `hostDirectives`.\n */\n@Directive({\n providers: [{ provide: NG_VALIDATORS, useExisting: MultipleFilesValidator, multi: true }],\n})\nexport class MultipleFilesValidator implements Validator {\n component = inject(WattDropZone, { host: true, self: true });\n validate(control: AbstractControl<File[] | null>): ValidationErrors | null {\n const multiple = this.component.multiple();\n return !multiple && control.value?.length !== 1 ? { multiple: true } : null;\n }\n}\n\n/** Validates that the file size is less than or equal to the specified maximum size. */\nexport const limitFiles =\n (limit: number) =>\n (control: AbstractControl<File[] | null>): ValidationErrors | null =>\n control.value?.length && control.value.length > limit ? { limit } : null;\n\n/** Validates that the file size is less than or equal to the specified maximum size. */\nexport const maxFileSize =\n (size: number) =>\n (control: AbstractControl<File[] | null>): ValidationErrors | null =>\n control.value?.some((file) => file.size > size) ? { size } : null;\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n Component,\n booleanAttribute,\n forwardRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { VaterStackComponent, VaterUtilityDirective } from '@energinet/watt/vater';\nimport { WattDropZoneIntlService } from './watt-dropzone-intl';\nimport { FileTypeValidator, MultipleFilesValidator } from './watt-dropzone-validators';\n\n// Slightly better typing than just raw string\nexport type MimeType = `${string}/${string}`;\n\n@Component({\n imports: [\n ReactiveFormsModule,\n VaterStackComponent,\n VaterUtilityDirective,\n WattButtonComponent,\n WattFieldComponent,\n MatProgressBarModule,\n ],\n selector: 'watt-dropzone',\n hostDirectives: [FileTypeValidator, MultipleFilesValidator],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDropZone),\n multi: true,\n },\n ],\n styles: `\n .wrapper {\n display: block;\n min-height: 184px; /* Magic UX number */\n }\n\n .dropzone {\n padding: var(--watt-space-l);\n background: var(--watt-color-neutral-grey-200);\n }\n\n .dragOver {\n background: var(--watt-color-state-info-light);\n }\n\n .mat-mdc-progress-bar {\n --mdc-linear-progress-active-indicator-color: var(--watt-color-primary);\n --mdc-linear-progress-track-color: var(--watt-color-primary-light);\n }\n `,\n template: `\n <watt-field [label]=\"label()\">\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 <span class=\"wrapper\">\n <vater-stack\n inset=\"0\"\n class=\"dropzone\"\n [class.dragOver]=\"dragOver()\"\n (dragover)=\"handleDragOver($event)\"\n (drop)=\"handleDrop($event)\"\n (drop)=\"dragOver.set(false)\"\n (dragleave)=\"dragOver.set(false)\"\n >\n @if (progress() < 100) {\n <vater-stack center gap=\"s\" fill=\"horizontal\" align=\"start\">\n <span>{{ intl.loadingMessage }} ( {{ progress() + '%' }} )</span>\n <mat-progress-bar mode=\"determinate\" [value]=\"progress()\" />\n </vater-stack>\n } @else {\n <vater-stack center gap=\"xs\">\n <input\n #input\n hidden\n type=\"file\"\n [multiple]=\"multiple()\"\n [accept]=\"accept().join(',')\"\n (change)=\"handleFiles(input.files)\"\n />\n <span>{{ multiple() ? intl.promptMultiple : intl.prompt }}</span>\n <span class=\"watt-on-light--medium-emphasis\">{{ intl.separator }}</span>\n <watt-button size=\"small\" variant=\"secondary\" (click)=\"input.click()\">\n {{ multiple() ? intl.buttonMultiple : intl.button }}\n </watt-button>\n </vater-stack>\n }\n </vater-stack>\n </span>\n </watt-field>\n `,\n})\n// eslint-disable-next-line @angular-eslint/component-class-suffix\nexport class WattDropZone implements ControlValueAccessor {\n intl = inject(WattDropZoneIntlService);\n\n /** Whether the dropzone should accept multiple files. */\n multiple = input(false, { transform: booleanAttribute });\n\n /** Label for the dropzone. */\n label = input<string>();\n\n /** Comma-separated list of MIME types that the dropzone accepts. */\n accept = input([], { transform: (value: MimeType) => value.split(',') as MimeType[] });\n\n /** Emits when one or more files are selected. */\n selected = output<File[]>();\n\n // Tracks (valid) drag over state\n dragOver = signal(false);\n\n // Progress\n progress = input<number>(100);\n\n handleFiles(files: FileList | null) {\n if (!files) return;\n this.selected.emit(Array.from(files));\n }\n\n handleDrop(event: DragEvent) {\n if (!event.dataTransfer) return;\n if (!this.dragOver()) return;\n\n // Prevent opening the file in the browser\n event.preventDefault();\n\n this.handleFiles(event.dataTransfer.files);\n }\n\n handleDragOver(event: DragEvent) {\n if (!event.dataTransfer) return;\n\n // Ignore non-file items such as strings\n if (Array.from(event.dataTransfer.items).some((i) => i.kind !== 'file')) return;\n\n // Prevent opening the file in the browser\n event.preventDefault();\n\n this.dragOver.set(true);\n }\n\n // Implementation for ControlValueAccessor\n writeValue = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n registerOnTouched = (fn: () => void) => this.selected.subscribe(fn);\n registerOnChange = (fn: (value: File[]) => void) => this.selected.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 { WattDropZone } from './watt-dropzone';\nexport { WattDropZoneIntlService } from './watt-dropzone-intl';\nexport {\n FileTypeValidator,\n MultipleFilesValidator,\n maxFileSize,\n limitFiles,\n} from './watt-dropzone-validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":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AAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,QAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,kBAAkB,8IAClB,oBAAoB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,cAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,aAAA,EAAA,MAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FA0EX,YAAY,EAAA,UAAA,EAAA,CAAA;kBAjFxB,SAAS;AACC,YAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EAAA;wBACP,mBAAmB;wBACnB,mBAAmB;wBACnB,qBAAqB;wBACrB,mBAAmB;wBACnB,kBAAkB;wBAClB,oBAAoB;AACrB,qBAAA,EAAA,QAAA,EACS,eAAe,EACT,cAAA,EAAA,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,EAChD,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC;AAC3C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAqBS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA;;;ACrHH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"energinet-watt-dropzone.mjs","sources":["../../../libs/watt/package/dropzone/watt-dropzone-intl.ts","../../../libs/watt/package/dropzone/watt-dropzone-validators.ts","../../../libs/watt/package/dropzone/watt-dropzone.ts","../../../libs/watt/package/dropzone/index.ts","../../../libs/watt/package/dropzone/energinet-watt-dropzone.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 { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class WattDropZoneIntlService {\n prompt = 'Drop file here';\n promptMultiple = 'Drop files here';\n separator = 'or';\n button = 'Choose file';\n buttonMultiple = 'Choose files';\n loadingMessage = 'Loading';\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 { Directive, inject } from '@angular/core';\nimport { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator } from '@angular/forms';\nimport { WattDropZone, MimeType } from './watt-dropzone';\n\n/**\n * Directive that validates the file type of provided files. This is automatically\n * applied to the `WattDropZone` component via `hostDirectives`.\n */\n@Directive({\n providers: [{ provide: NG_VALIDATORS, useExisting: FileTypeValidator, multi: true }],\n})\nexport class FileTypeValidator implements Validator {\n component = inject(WattDropZone, { host: true, self: true });\n validate(control: AbstractControl<File[] | null>): ValidationErrors | null {\n const accept = this.component.accept();\n return accept.length > 0 && control.value?.some((i) => !accept.includes(i.type as MimeType))\n ? { type: true }\n : null;\n }\n}\n\n/**\n * Directive validating that a single file is selected when `multiple` is false.\n * This is automatically applied to the `WattDropZone` component via `hostDirectives`.\n */\n@Directive({\n providers: [{ provide: NG_VALIDATORS, useExisting: MultipleFilesValidator, multi: true }],\n})\nexport class MultipleFilesValidator implements Validator {\n component = inject(WattDropZone, { host: true, self: true });\n validate(control: AbstractControl<File[] | null>): ValidationErrors | null {\n const multiple = this.component.multiple();\n return !multiple && control.value?.length !== 1 ? { multiple: true } : null;\n }\n}\n\n/** Validates that the file size is less than or equal to the specified maximum size. */\nexport const limitFiles =\n (limit: number) =>\n (control: AbstractControl<File[] | null>): ValidationErrors | null =>\n control.value?.length && control.value.length > limit ? { limit } : null;\n\n/** Validates that the file size is less than or equal to the specified maximum size. */\nexport const maxFileSize =\n (size: number) =>\n (control: AbstractControl<File[] | null>): ValidationErrors | null =>\n control.value?.some((file) => file.size > size) ? { size } : null;\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n Component,\n booleanAttribute,\n forwardRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { VaterStackComponent, VaterUtilityDirective } from '@energinet/watt/vater';\nimport { WattDropZoneIntlService } from './watt-dropzone-intl';\nimport { FileTypeValidator, MultipleFilesValidator } from './watt-dropzone-validators';\n\n// Slightly better typing than just raw string\nexport type MimeType = `${string}/${string}`;\n\n@Component({\n imports: [\n ReactiveFormsModule,\n VaterStackComponent,\n VaterUtilityDirective,\n WattButtonComponent,\n WattFieldComponent,\n MatProgressBarModule,\n ],\n selector: 'watt-dropzone',\n hostDirectives: [FileTypeValidator, MultipleFilesValidator],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDropZone),\n multi: true,\n },\n ],\n styles: `\n .wrapper {\n display: block;\n min-height: 184px; /* Magic UX number */\n }\n\n .dropzone {\n padding: var(--watt-space-l);\n background: var(--watt-color-neutral-grey-200);\n }\n\n .dragOver {\n background: var(--watt-color-state-info-light);\n }\n\n .mat-mdc-progress-bar {\n --mdc-linear-progress-active-indicator-color: var(--watt-color-primary);\n --mdc-linear-progress-track-color: var(--watt-color-primary-light);\n }\n `,\n template: `\n <watt-field [label]=\"label()\">\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 <span class=\"wrapper\">\n <vater-stack\n inset=\"0\"\n class=\"dropzone\"\n [class.dragOver]=\"dragOver()\"\n (dragover)=\"handleDragOver($event)\"\n (drop)=\"handleDrop($event)\"\n (drop)=\"dragOver.set(false)\"\n (dragleave)=\"dragOver.set(false)\"\n >\n @if (progress() < 100) {\n <vater-stack center gap=\"s\" fill=\"horizontal\" alignment=\"start\">\n <span>{{ intl.loadingMessage }} ( {{ progress() + '%' }} )</span>\n <mat-progress-bar mode=\"determinate\" [value]=\"progress()\" />\n </vater-stack>\n } @else {\n <vater-stack center gap=\"xs\">\n <input\n #input\n hidden\n type=\"file\"\n [multiple]=\"multiple()\"\n [accept]=\"accept().join(',')\"\n (change)=\"handleFiles(input.files)\"\n />\n <span>{{ multiple() ? intl.promptMultiple : intl.prompt }}</span>\n <span class=\"watt-on-light--medium-emphasis\">{{ intl.separator }}</span>\n <watt-button size=\"small\" variant=\"secondary\" (click)=\"input.click()\">\n {{ multiple() ? intl.buttonMultiple : intl.button }}\n </watt-button>\n </vater-stack>\n }\n </vater-stack>\n </span>\n </watt-field>\n `,\n})\n// eslint-disable-next-line @angular-eslint/component-class-suffix\nexport class WattDropZone implements ControlValueAccessor {\n intl = inject(WattDropZoneIntlService);\n\n /** Whether the dropzone should accept multiple files. */\n multiple = input(false, { transform: booleanAttribute });\n\n /** Label for the dropzone. */\n label = input<string>();\n\n /** Comma-separated list of MIME types that the dropzone accepts. */\n accept = input([], { transform: (value: MimeType) => value.split(',') as MimeType[] });\n\n /** Emits when one or more files are selected. */\n selected = output<File[]>();\n\n // Tracks (valid) drag over state\n dragOver = signal(false);\n\n // Progress\n progress = input<number>(100);\n\n handleFiles(files: FileList | null) {\n if (!files) return;\n this.selected.emit(Array.from(files));\n }\n\n handleDrop(event: DragEvent) {\n if (!event.dataTransfer) return;\n if (!this.dragOver()) return;\n\n // Prevent opening the file in the browser\n event.preventDefault();\n\n this.handleFiles(event.dataTransfer.files);\n }\n\n handleDragOver(event: DragEvent) {\n if (!event.dataTransfer) return;\n\n // Ignore non-file items such as strings\n if (Array.from(event.dataTransfer.items).some((i) => i.kind !== 'file')) return;\n\n // Prevent opening the file in the browser\n event.preventDefault();\n\n this.dragOver.set(true);\n }\n\n // Implementation for ControlValueAccessor\n writeValue = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function\n registerOnTouched = (fn: () => void) => this.selected.subscribe(fn);\n registerOnChange = (fn: (value: File[]) => void) => this.selected.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 { WattDropZone } from './watt-dropzone';\nexport { WattDropZoneIntlService } from './watt-dropzone-intl';\nexport {\n FileTypeValidator,\n MultipleFilesValidator,\n maxFileSize,\n limitFiles,\n} from './watt-dropzone-validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.FileTypeValidator","i1.MultipleFilesValidator"],"mappings":";;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAIa,uBAAuB,CAAA;IAClC,MAAM,GAAG,gBAAgB;IACzB,cAAc,GAAG,iBAAiB;IAClC,SAAS,GAAG,IAAI;IAChB,MAAM,GAAG,aAAa;IACtB,cAAc,GAAG,cAAc;IAC/B,cAAc,GAAG,SAAS;uGANf,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACpBlC;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAKA;;;AAGG;MAIU,iBAAiB,CAAA;AAC5B,IAAA,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,QAAQ,CAAC,OAAuC,EAAA;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;QACtC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,E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AAA,CAAA,EAAA;;;ACrHH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
@@ -138,7 +138,7 @@ class WattFieldComponent {
138
138
  }
139
139
  </span>
140
140
  }
141
- <vater-flex direction="row" gap="s" align="center">
141
+ <vater-flex direction="row" gap="s" alignment="center">
142
142
  <div
143
143
  vater
144
144
  fill="horizontal"
@@ -195,7 +195,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
195
195
  }
196
196
  </span>
197
197
  }
198
- <vater-flex direction="row" gap="s" align="center">
198
+ <vater-flex direction="row" gap="s" alignment="center">
199
199
  <div
200
200
  vater
201
201
  fill="horizontal"
@@ -1 +1 @@
1
- {"version":3,"file":"energinet-watt-field.mjs","sources":["../../../libs/watt/package/field/watt-field-intl.service.ts","../../../libs/watt/package/field/watt-field-error.component.ts","../../../libs/watt/package/field/watt-field.component.ts","../../../libs/watt/package/field/watt-field-hint.component.ts","../../../libs/watt/package/field/index.ts","../../../libs/watt/package/field/energinet-watt-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 { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class WattFieldIntlService {\n readonly changes: Subject<void> = new Subject<void>();\n required = 'Field is required';\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 { Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'watt-field-error',\n template: `<ng-content />`,\n encapsulation: ViewEncapsulation.None,\n styles: [\n `\n watt-field-error {\n color: var(--watt-color-state-danger);\n }\n `,\n ],\n})\nexport class WattFieldErrorComponent {}\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 ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { FormControl, ValidationErrors, Validators } from '@angular/forms';\nimport { filter, map, startWith, switchMap, tap } from 'rxjs/operators';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\n\nimport { WattIconComponent } from '@energinet/watt/icon';\nimport { WattTooltipDirective } from '@energinet/watt/tooltip';\nimport { VaterFlexComponent, VaterUtilityDirective } from '@energinet/watt/vater';\nimport { WattRangeValidators } from '@energinet/watt/validators';\n\nimport { WattFieldIntlService } from './watt-field-intl.service';\nimport { WattFieldErrorComponent } from './watt-field-error.component';\nimport { NgTemplateOutlet } from '@angular/common';\n\n@Component({\n selector: 'watt-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n NgTemplateOutlet,\n WattIconComponent,\n WattTooltipDirective,\n WattFieldErrorComponent,\n VaterFlexComponent,\n VaterUtilityDirective,\n ],\n styleUrls: ['./watt-field.component.scss'],\n template: `\n @if (chipMode()) {\n <span class=\"watt-label\">\n <ng-container *ngTemplateOutlet=\"template\" />\n </span>\n } @else {\n <label [attr.for]=\"id()\">\n <ng-container *ngTemplateOutlet=\"template\" />\n </label>\n }\n\n <ng-template #template>\n @if (label()) {\n <span class=\"label\" [class.required]=\"isRequired()\">\n {{ label() }}\n @if (tooltip(); as tooltip) {\n <watt-icon name=\"info\" wattTooltipPosition=\"top\" [wattTooltip]=\"tooltip\" />\n }\n </span>\n }\n <vater-flex direction=\"row\" gap=\"s\" align=\"center\">\n <div\n vater\n fill=\"horizontal\"\n #wrapper\n class=\"watt-field-wrapper\"\n [class.watt-field--has-placeholder]=\"!!placeholder()\"\n [style.anchor-name]=\"anchorName()\"\n >\n @if (placeholder()) {\n <div class=\"watt-field-placeholder\" aria-hidden=\"true\">\n <span class=\"watt-field-ghost\">{{ ghost() }}</span>\n <span class=\"watt-field-filler\">{{ filler() }}</span>\n </div>\n }\n <ng-content />\n </div>\n <ng-content select=\"watt-field-descriptor\" />\n </vater-flex>\n <ng-content select=\"[popover]\" />\n <ng-content select=\"watt-field-hint\" />\n <ng-content select=\"watt-field-error\" />\n @if (isEmpty()) {\n <watt-field-error>{{ intl.required }}</watt-field-error>\n }\n </ng-template>\n `,\n host: {\n '[class.watt-field--chip]': 'chipMode()',\n '[class.watt-field--unlabelled]': 'unlabelled()',\n '[class.watt-field--disabled]': 'control()?.disabled',\n },\n})\nexport class WattFieldComponent {\n intl = inject(WattFieldIntlService);\n elementRef = inject<ElementRef>(ElementRef);\n\n control = input<FormControl | null>(null);\n label = input<string>();\n id = input<string>();\n chipMode = input(false);\n tooltip = input<string>();\n placeholder = input('');\n anchorName = input<string>();\n\n value = signal('');\n filler = computed(() => this.placeholder().slice(this.value().length));\n ghost = computed(() => this.value().slice(0, this.placeholder().length));\n\n unlabelled = computed(() => !this.label());\n\n errors = signal<ValidationErrors | null>(null);\n isRequired = signal(false);\n isEmpty = computed(() => this.errors()?.['required'] || this.errors()?.['rangeRequired']);\n\n // Used for text fields with autocomplete\n wrapper = viewChild<ElementRef>('wrapper');\n\n constructor() {\n const control$ = toObservable(this.control).pipe(filter((control) => control !== null));\n\n // Track value in order to update ghost and filler\n const value$ = control$.pipe(\n switchMap((control) =>\n control.valueChanges.pipe(\n startWith(control.value),\n map((value) => (value === null || value === undefined ? '' : value.toString())),\n tap((value) => this.value.set(value))\n )\n ),\n takeUntilDestroyed()\n );\n\n // Track status in order to update required state and show errors\n const status$ = control$.pipe(\n switchMap((control) =>\n control.statusChanges.pipe(\n startWith(control.status),\n tap(() => this.isRequired.set(this.isRequiredControl(control))),\n tap(() => this.errors.set(control.errors))\n )\n ),\n takeUntilDestroyed()\n );\n\n // Subscribe for side effects\n value$.subscribe();\n status$.subscribe();\n }\n\n isRequiredControl(control: FormControl) {\n const validators = [Validators.required, WattRangeValidators.required];\n return validators.some((validator) => control.hasValidator(validator));\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 { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-field-hint',\n styles: [\n `\n :host {\n color: var(--watt-color-neutral-grey-700);\n }\n `,\n ],\n template: `<ng-content />`,\n})\nexport class WattFieldHintComponent {}\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 { WattFieldComponent } from './watt-field.component';\nexport { WattFieldErrorComponent } from './watt-field-error.component';\nexport { WattFieldHintComponent } from './watt-field-hint.component';\nexport { WattFieldIntlService } from './watt-field-intl.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAKa,oBAAoB,CAAA;AACtB,IAAA,OAAO,GAAkB,IAAI,OAAO,EAAQ;IACrD,QAAQ,GAAG,mBAAmB;uGAFnB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACrBlC;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAea,uBAAuB,CAAA;uGAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB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AA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,2EAFvB,CAAgB,cAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,mDAAA,CAAA,EAAA,CAAA;;2FAEf,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAXlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,YAQjB,CAAgB,cAAA,CAAA,EAAA,MAAA,EAAA,CAAA,mDAAA,CAAA,EAAA;;;AC7B5B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"energinet-watt-field.mjs","sources":["../../../libs/watt/package/field/watt-field-intl.service.ts","../../../libs/watt/package/field/watt-field-error.component.ts","../../../libs/watt/package/field/watt-field.component.ts","../../../libs/watt/package/field/watt-field-hint.component.ts","../../../libs/watt/package/field/index.ts","../../../libs/watt/package/field/energinet-watt-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 { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class WattFieldIntlService {\n readonly changes: Subject<void> = new Subject<void>();\n required = 'Field is required';\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 { Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'watt-field-error',\n template: `<ng-content />`,\n encapsulation: ViewEncapsulation.None,\n styles: [\n `\n watt-field-error {\n color: var(--watt-color-state-danger);\n }\n `,\n ],\n})\nexport class WattFieldErrorComponent {}\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 ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { FormControl, ValidationErrors, Validators } from '@angular/forms';\nimport { filter, map, startWith, switchMap, tap } from 'rxjs/operators';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\n\nimport { WattIconComponent } from '@energinet/watt/icon';\nimport { WattTooltipDirective } from '@energinet/watt/tooltip';\nimport { VaterFlexComponent, VaterUtilityDirective } from '@energinet/watt/vater';\nimport { WattRangeValidators } from '@energinet/watt/validators';\n\nimport { WattFieldIntlService } from './watt-field-intl.service';\nimport { WattFieldErrorComponent } from './watt-field-error.component';\nimport { NgTemplateOutlet } from '@angular/common';\n\n@Component({\n selector: 'watt-field',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n NgTemplateOutlet,\n WattIconComponent,\n WattTooltipDirective,\n WattFieldErrorComponent,\n VaterFlexComponent,\n VaterUtilityDirective,\n ],\n styleUrls: ['./watt-field.component.scss'],\n template: `\n @if (chipMode()) {\n <span class=\"watt-label\">\n <ng-container *ngTemplateOutlet=\"template\" />\n </span>\n } @else {\n <label [attr.for]=\"id()\">\n <ng-container *ngTemplateOutlet=\"template\" />\n </label>\n }\n\n <ng-template #template>\n @if (label()) {\n <span class=\"label\" [class.required]=\"isRequired()\">\n {{ label() }}\n @if (tooltip(); as tooltip) {\n <watt-icon name=\"info\" wattTooltipPosition=\"top\" [wattTooltip]=\"tooltip\" />\n }\n </span>\n }\n <vater-flex direction=\"row\" gap=\"s\" alignment=\"center\">\n <div\n vater\n fill=\"horizontal\"\n #wrapper\n class=\"watt-field-wrapper\"\n [class.watt-field--has-placeholder]=\"!!placeholder()\"\n [style.anchor-name]=\"anchorName()\"\n >\n @if (placeholder()) {\n <div class=\"watt-field-placeholder\" aria-hidden=\"true\">\n <span class=\"watt-field-ghost\">{{ ghost() }}</span>\n <span class=\"watt-field-filler\">{{ filler() }}</span>\n </div>\n }\n <ng-content />\n </div>\n <ng-content select=\"watt-field-descriptor\" />\n </vater-flex>\n <ng-content select=\"[popover]\" />\n <ng-content select=\"watt-field-hint\" />\n <ng-content select=\"watt-field-error\" />\n @if (isEmpty()) {\n <watt-field-error>{{ intl.required }}</watt-field-error>\n }\n </ng-template>\n `,\n host: {\n '[class.watt-field--chip]': 'chipMode()',\n '[class.watt-field--unlabelled]': 'unlabelled()',\n '[class.watt-field--disabled]': 'control()?.disabled',\n },\n})\nexport class WattFieldComponent {\n intl = inject(WattFieldIntlService);\n elementRef = inject<ElementRef>(ElementRef);\n\n control = input<FormControl | null>(null);\n label = input<string>();\n id = input<string>();\n chipMode = input(false);\n tooltip = input<string>();\n placeholder = input('');\n anchorName = input<string>();\n\n value = signal('');\n filler = computed(() => this.placeholder().slice(this.value().length));\n ghost = computed(() => this.value().slice(0, this.placeholder().length));\n\n unlabelled = computed(() => !this.label());\n\n errors = signal<ValidationErrors | null>(null);\n isRequired = signal(false);\n isEmpty = computed(() => this.errors()?.['required'] || this.errors()?.['rangeRequired']);\n\n // Used for text fields with autocomplete\n wrapper = viewChild<ElementRef>('wrapper');\n\n constructor() {\n const control$ = toObservable(this.control).pipe(filter((control) => control !== null));\n\n // Track value in order to update ghost and filler\n const value$ = control$.pipe(\n switchMap((control) =>\n control.valueChanges.pipe(\n startWith(control.value),\n map((value) => (value === null || value === undefined ? '' : value.toString())),\n tap((value) => this.value.set(value))\n )\n ),\n takeUntilDestroyed()\n );\n\n // Track status in order to update required state and show errors\n const status$ = control$.pipe(\n switchMap((control) =>\n control.statusChanges.pipe(\n startWith(control.status),\n tap(() => this.isRequired.set(this.isRequiredControl(control))),\n tap(() => this.errors.set(control.errors))\n )\n ),\n takeUntilDestroyed()\n );\n\n // Subscribe for side effects\n value$.subscribe();\n status$.subscribe();\n }\n\n isRequiredControl(control: FormControl) {\n const validators = [Validators.required, WattRangeValidators.required];\n return validators.some((validator) => control.hasValidator(validator));\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 { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-field-hint',\n styles: [\n `\n :host {\n color: var(--watt-color-neutral-grey-700);\n }\n `,\n ],\n template: `<ng-content />`,\n})\nexport class WattFieldHintComponent {}\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 { WattFieldComponent } from './watt-field.component';\nexport { WattFieldErrorComponent } from './watt-field-error.component';\nexport { WattFieldHintComponent } from './watt-field-hint.component';\nexport { WattFieldIntlService } from './watt-field-intl.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAKa,oBAAoB,CAAA;AACtB,IAAA,OAAO,GAAkB,IAAI,OAAO,EAAQ;IACrD,QAAQ,GAAG,mBAAmB;uGAFnB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACrBlC;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAea,uBAAuB,CAAA;uGAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,4EAVxB,CAAgB,cAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAA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,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,mDAAA,CAAA,EAAA,CAAA;;2FAEf,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAXlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,YAQjB,CAAgB,cAAA,CAAA,EAAA,MAAA,EAAA,CAAA,mDAAA,CAAA,EAAA;;;AC7B5B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
@@ -11,6 +11,15 @@ class WattRangeValidators {
11
11
  // this condition checks for `maxDays` - 1 (as the diff is in whole days only).
12
12
  return dayjs(value.end).diff(value.start, 'days') > maxDays - 1 ? { maxDays: true } : null;
13
13
  };
14
+ static maxMonths = (maxMonths) => ({ value }) => {
15
+ if (!value?.end || !value?.start)
16
+ return null;
17
+ // Since the date range does not include the last millisecond (ends at 23:59:59.999),
18
+ // this condition checks for `maxMonths` - 1 (as the diff is in whole months only).
19
+ return dayjs(value.end).diff(value.start, 'months') > maxMonths - 1
20
+ ? { maxMonths: true }
21
+ : null;
22
+ };
14
23
  }
15
24
 
16
25
  //#region License
@@ -1 +1 @@
1
- {"version":3,"file":"energinet-watt-validators.mjs","sources":["../../../libs/watt/package/validators/watt-range.validators.ts","../../../libs/watt/package/validators/index.ts","../../../libs/watt/package/validators/energinet-watt-validators.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 { AbstractControl, ValidatorFn } from '@angular/forms';\nimport { dayjs, WattDateRange } from '@energinet/watt/core/date';\n\nexport class WattRangeValidators {\n static required: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.start && control.value?.end ? null : { rangeRequired: true };\n\n static startRequired: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.start ? null : { startOfRangeRequired: true };\n\n static endRequired: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.end ? null : { endOfRangeRequired: true };\n\n static maxDays =\n (maxDays: number): ValidatorFn =>\n ({ value }: AbstractControl<WattDateRange | null>) => {\n if (!value?.end || !value?.start) return null;\n // Since the date range does not include the last millisecond (ends at 23:59:59.999),\n // this condition checks for `maxDays` - 1 (as the diff is in whole days only).\n return dayjs(value.end).diff(value.start, 'days') > maxDays - 1 ? { maxDays: true } : null;\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 * from './watt-range.validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAqBa,mBAAmB,CAAA;AAC9B,IAAA,OAAO,QAAQ,GAAgB,CAAC,OAA8C,KAC5E,OAAO,CAAC,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;IAE7E,OAAO,aAAa,GAAgB,CAAC,OAA8C,KACjF,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE;IAE9D,OAAO,WAAW,GAAgB,CAAC,OAA8C,KAC/E,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE;AAE1D,IAAA,OAAO,OAAO,GACZ,CAAC,OAAe,KAChB,CAAC,EAAE,KAAK,EAAyC,KAAI;QACnD,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK;AAAE,YAAA,OAAO,IAAI;;;AAG7C,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI;AAC5F,KAAC;;;ACtCL;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"energinet-watt-validators.mjs","sources":["../../../libs/watt/package/validators/watt-range.validators.ts","../../../libs/watt/package/validators/index.ts","../../../libs/watt/package/validators/energinet-watt-validators.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 { AbstractControl, ValidatorFn } from '@angular/forms';\nimport { dayjs, WattDateRange } from '@energinet/watt/core/date';\n\nexport class WattRangeValidators {\n static required: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.start && control.value?.end ? null : { rangeRequired: true };\n\n static startRequired: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.start ? null : { startOfRangeRequired: true };\n\n static endRequired: ValidatorFn = (control: AbstractControl<WattDateRange | null>) =>\n control.value?.end ? null : { endOfRangeRequired: true };\n\n static maxDays =\n (maxDays: number): ValidatorFn =>\n ({ value }: AbstractControl<WattDateRange | null>) => {\n if (!value?.end || !value?.start) return null;\n // Since the date range does not include the last millisecond (ends at 23:59:59.999),\n // this condition checks for `maxDays` - 1 (as the diff is in whole days only).\n return dayjs(value.end).diff(value.start, 'days') > maxDays - 1 ? { maxDays: true } : null;\n };\n\n static maxMonths =\n (maxMonths: number): ValidatorFn =>\n ({ value }: AbstractControl<WattDateRange | null>) => {\n if (!value?.end || !value?.start) return null;\n // Since the date range does not include the last millisecond (ends at 23:59:59.999),\n // this condition checks for `maxMonths` - 1 (as the diff is in whole months only).\n return dayjs(value.end).diff(value.start, 'months') > maxMonths - 1\n ? { maxMonths: true }\n : null;\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 * from './watt-range.validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAqBa,mBAAmB,CAAA;AAC9B,IAAA,OAAO,QAAQ,GAAgB,CAAC,OAA8C,KAC5E,OAAO,CAAC,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;IAE7E,OAAO,aAAa,GAAgB,CAAC,OAA8C,KACjF,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE;IAE9D,OAAO,WAAW,GAAgB,CAAC,OAA8C,KAC/E,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE;AAE1D,IAAA,OAAO,OAAO,GACZ,CAAC,OAAe,KAChB,CAAC,EAAE,KAAK,EAAyC,KAAI;QACnD,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK;AAAE,YAAA,OAAO,IAAI;;;AAG7C,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI;AAC5F,KAAC;AAEH,IAAA,OAAO,SAAS,GACd,CAAC,SAAiB,KAClB,CAAC,EAAE,KAAK,EAAyC,KAAI;QACnD,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK;AAAE,YAAA,OAAO,IAAI;;;AAG7C,QAAA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG;AAChE,cAAE,EAAE,SAAS,EAAE,IAAI;cACjB,IAAI;AACV,KAAC;;;ACjDL;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
@@ -68,7 +68,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
68
68
  //#endregion
69
69
  class VaterLayoutDirective {
70
70
  /** Cross axis alignment of the flex items. */
71
- align = input();
71
+ // eslint-disable-next-line @angular-eslint/no-input-rename
72
+ align = input(undefined, { alias: 'alignment' });
72
73
  /** Direction of the flex items. Defaults to `column`. */
73
74
  direction = input('column');
74
75
  /** Spacing between the flex items. */
@@ -93,7 +94,7 @@ class VaterLayoutDirective {
93
94
  this.offsetClass(),
94
95
  ].filter(Boolean));
95
96
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterLayoutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
96
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: VaterLayoutDirective, isStandalone: true, inputs: { align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, justify: { classPropertyName: "justify", publicName: "justify", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "class()", "class.vater-wrap": "wrap()" } }, ngImport: i0 });
97
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: VaterLayoutDirective, isStandalone: true, inputs: { align: { classPropertyName: "align", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, justify: { classPropertyName: "justify", publicName: "justify", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "class()", "class.vater-wrap": "wrap()" } }, ngImport: i0 });
97
98
  }
98
99
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterLayoutDirective, decorators: [{
99
100
  type: Directive,
@@ -132,14 +133,14 @@ class VaterFlexComponent {
132
133
  */
133
134
  autoSize = input(false, { transform: booleanAttribute });
134
135
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterFlexComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
135
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: VaterFlexComponent, isStandalone: true, selector: "vater-flex, [vater-flex]", inputs: { autoSize: { classPropertyName: "autoSize", publicName: "autoSize", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.vater-flex-auto": "autoSize()" } }, hostDirectives: [{ directive: VaterLayoutDirective, inputs: ["align", "align", "direction", "direction", "justify", "justify", "wrap", "wrap", "gap", "gap", "offset", "offset"] }, { directive: VaterUtilityDirective, inputs: ["center", "center", "fill", "fill", "inset", "inset", "scrollable", "scrollable"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["vater-flex,[vater-flex]{display:flex;line-height:normal}\n"], encapsulation: i0.ViewEncapsulation.None });
136
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: VaterFlexComponent, isStandalone: true, selector: "vater-flex, [vater-flex]", inputs: { autoSize: { classPropertyName: "autoSize", publicName: "autoSize", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.vater-flex-auto": "autoSize()" } }, hostDirectives: [{ directive: VaterLayoutDirective, inputs: ["alignment", "alignment", "direction", "direction", "justify", "justify", "wrap", "wrap", "gap", "gap", "offset", "offset"] }, { directive: VaterUtilityDirective, inputs: ["center", "center", "fill", "fill", "inset", "inset", "scrollable", "scrollable"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["vater-flex,[vater-flex]{display:flex;line-height:normal}\n"], encapsulation: i0.ViewEncapsulation.None });
136
137
  }
137
138
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterFlexComponent, decorators: [{
138
139
  type: Component,
139
140
  args: [{ selector: 'vater-flex, [vater-flex]', encapsulation: ViewEncapsulation.None, hostDirectives: [
140
141
  {
141
142
  directive: VaterLayoutDirective,
142
- inputs: ['align', 'direction', 'justify', 'wrap', 'gap', 'offset'],
143
+ inputs: ['alignment', 'direction', 'justify', 'wrap', 'gap', 'offset'],
143
144
  },
144
145
  {
145
146
  directive: VaterUtilityDirective,
@@ -195,14 +196,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
195
196
  //#endregion
196
197
  class VaterStackComponent {
197
198
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterStackComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
198
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VaterStackComponent, isStandalone: true, selector: "vater-stack, [vater-stack]", hostDirectives: [{ directive: VaterLayoutDirective, inputs: ["align", "align", "direction", "direction", "justify", "justify", "wrap", "wrap", "gap", "gap", "offset", "offset"] }, { directive: VaterUtilityDirective, inputs: ["center", "center", "fill", "fill", "inset", "inset", "scrollable", "scrollable"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["vater-stack,[vater-stack]{display:flex;line-height:normal}\n"], encapsulation: i0.ViewEncapsulation.None });
199
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: VaterStackComponent, isStandalone: true, selector: "vater-stack, [vater-stack]", hostDirectives: [{ directive: VaterLayoutDirective, inputs: ["alignment", "alignment", "direction", "direction", "justify", "justify", "wrap", "wrap", "gap", "gap", "offset", "offset"] }, { directive: VaterUtilityDirective, inputs: ["center", "center", "fill", "fill", "inset", "inset", "scrollable", "scrollable"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["vater-stack,[vater-stack]{display:flex;line-height:normal}\n"], encapsulation: i0.ViewEncapsulation.None });
199
200
  }
200
201
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: VaterStackComponent, decorators: [{
201
202
  type: Component,
202
203
  args: [{ selector: 'vater-stack, [vater-stack]', encapsulation: ViewEncapsulation.None, hostDirectives: [
203
204
  {
204
205
  directive: VaterLayoutDirective,
205
- inputs: ['align', 'direction', 'justify', 'wrap', 'gap', 'offset'],
206
+ inputs: ['alignment', 'direction', 'justify', 'wrap', 'gap', 'offset'],
206
207
  },
207
208
  {
208
209
  directive: VaterUtilityDirective,
@@ -1 +1 @@
1
- {"version":3,"file":"energinet-watt-vater.mjs","sources":["../../../libs/watt/package/vater/vater-utility.directive.ts","../../../libs/watt/package/vater/vater-layout.directive.ts","../../../libs/watt/package/vater/vater-flex.component.ts","../../../libs/watt/package/vater/vater-spacer.component.ts","../../../libs/watt/package/vater/vater-stack.component.ts","../../../libs/watt/package/vater/index.ts","../../../libs/watt/package/vater/energinet-watt-vater.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 { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { Fill, Inset } from './types';\n\n/* eslint-disable @angular-eslint/no-input-rename */\n@Directive({\n selector: '[vater]',\n host: {\n '[class]': 'class()',\n '[class.vater-center]': 'center()',\n '[class.vater-scrollable]': 'scrollable()',\n },\n})\nexport class VaterUtilityDirective {\n /** Center the element horizontally and vertically. */\n center = input(false, { transform: booleanAttribute });\n\n /** Stretch the element to fill the available space in one or both directions. */\n fill = input<Fill>();\n\n /** Position the element absolute with the provided inset value. */\n inset = input<Inset>();\n\n /** Make the element scrollable. */\n scrollable = input(false, { transform: booleanAttribute });\n\n // Computed class names\n protected fillClass = computed(() => this.fill() && `vater-fill-${this.fill()}`);\n protected insetClass = computed(() => this.inset() && `vater-inset-${this.inset()}`);\n protected class = computed(() => [this.fillClass(), this.insetClass()].filter(Boolean));\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 { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { Align, Direction, Justify, Spacing } from './types';\n\n@Directive({\n host: {\n '[class]': 'class()',\n '[class.vater-wrap]': 'wrap()',\n },\n})\nexport class VaterLayoutDirective {\n /** Cross axis alignment of the flex items. */\n align = input<Align>();\n\n /** Direction of the flex items. Defaults to `column`. */\n direction = input<Direction>('column');\n\n /** Spacing between the flex items. */\n gap = input<Spacing>();\n\n /** Main axis alignment of the flex items. */\n justify = input<Justify>();\n\n /** Offset to apply along the main axis. */\n offset = input<Spacing>();\n\n /** Whether the flex items should wrap. */\n wrap = input(false, { transform: booleanAttribute });\n\n // Computed class names\n protected alignClass = computed(() => this.align() && `vater-align-${this.align()}`);\n protected directionClass = computed(() => this.direction() && `vater-${this.direction()}`);\n protected gapClass = computed(() => this.gap() && `vater-gap-${this.gap()}`);\n protected justifyClass = computed(() => this.justify() && `vater-justify-${this.justify()}`);\n protected offsetClass = computed(() => this.offset() && `vater-offset-${this.offset()}`);\n protected class = computed(() =>\n [\n this.alignClass(),\n this.directionClass(),\n this.gapClass(),\n this.justifyClass(),\n this.offsetClass(),\n ].filter(Boolean)\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 { booleanAttribute, Component, input, ViewEncapsulation } from '@angular/core';\nimport { VaterUtilityDirective } from './vater-utility.directive';\nimport { VaterLayoutDirective } from './vater-layout.directive';\n\n@Component({\n selector: 'vater-flex, [vater-flex]',\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [\n {\n directive: VaterLayoutDirective,\n inputs: ['align', 'direction', 'justify', 'wrap', 'gap', 'offset'],\n },\n {\n directive: VaterUtilityDirective,\n inputs: ['center', 'fill', 'inset', 'scrollable'],\n },\n ],\n host: { '[class.vater-flex-auto]': 'autoSize()' },\n styles: `\n vater-flex,\n [vater-flex] {\n display: flex;\n line-height: normal;\n }\n `,\n template: `<ng-content />`,\n})\nexport class VaterFlexComponent {\n /**\n * When set, sizes the flex items according to their width or height properties.\n * @see https://drafts.csswg.org/css-flexbox-1/#flex-common\n * @remarks\n * Prefer setting `fill` on flex items over using `autoSize`.\n */\n autoSize = input(false, { transform: booleanAttribute });\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 { Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'vater-spacer, [vater-spacer]',\n encapsulation: ViewEncapsulation.None,\n styles: `\n vater-spacer,\n [vater-spacer] {\n flex: 1;\n align-self: stretch;\n }\n `,\n template: '<ng-content />',\n})\nexport class VaterSpacerComponent {}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, ViewEncapsulation } from '@angular/core';\nimport { VaterUtilityDirective } from './vater-utility.directive';\nimport { VaterLayoutDirective } from './vater-layout.directive';\n\n@Component({\n selector: 'vater-stack, [vater-stack]',\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [\n {\n directive: VaterLayoutDirective,\n inputs: ['align', 'direction', 'justify', 'wrap', 'gap', 'offset'],\n },\n {\n directive: VaterUtilityDirective,\n inputs: ['center', 'fill', 'inset', 'scrollable'],\n },\n ],\n styles: `\n vater-stack,\n [vater-stack] {\n display: flex;\n line-height: normal;\n }\n `,\n template: `<ng-content />`,\n})\nexport class VaterStackComponent {}\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 { VaterFlexComponent } from './vater-flex.component';\nexport { VaterSpacerComponent } from './vater-spacer.component';\nexport { VaterStackComponent } from './vater-stack.component';\nexport { VaterLayoutDirective } from './vater-layout.directive';\nexport { VaterUtilityDirective } from './vater-utility.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAIA;MASa,qBAAqB,CAAA;;IAEhC,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;IAGtD,IAAI,GAAG,KAAK,EAAQ;;IAGpB,KAAK,GAAG,KAAK,EAAS;;IAGtB,UAAU,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;AAGhD,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,cAAc,IAAI,CAAC,IAAI,EAAE,CAAA,CAAE,CAAC;AACtE,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,IAAI,eAAe,IAAI,CAAC,KAAK,EAAE,CAAA,CAAE,CAAC;IAC1E,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;uGAhB5E,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EA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A,EAAA,QAAA,EAQS,CAAgB,cAAA,CAAA,EAAA,MAAA,EAAA,CAAA,8DAAA,CAAA,EAAA;;;AC1C5B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"energinet-watt-vater.mjs","sources":["../../../libs/watt/package/vater/vater-utility.directive.ts","../../../libs/watt/package/vater/vater-layout.directive.ts","../../../libs/watt/package/vater/vater-flex.component.ts","../../../libs/watt/package/vater/vater-spacer.component.ts","../../../libs/watt/package/vater/vater-stack.component.ts","../../../libs/watt/package/vater/index.ts","../../../libs/watt/package/vater/energinet-watt-vater.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 { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { Fill, Inset } from './types';\n\n/* eslint-disable @angular-eslint/no-input-rename */\n@Directive({\n selector: '[vater]',\n host: {\n '[class]': 'class()',\n '[class.vater-center]': 'center()',\n '[class.vater-scrollable]': 'scrollable()',\n },\n})\nexport class VaterUtilityDirective {\n /** Center the element horizontally and vertically. */\n center = input(false, { transform: booleanAttribute });\n\n /** Stretch the element to fill the available space in one or both directions. */\n fill = input<Fill>();\n\n /** Position the element absolute with the provided inset value. */\n inset = input<Inset>();\n\n /** Make the element scrollable. */\n scrollable = input(false, { transform: booleanAttribute });\n\n // Computed class names\n protected fillClass = computed(() => this.fill() && `vater-fill-${this.fill()}`);\n protected insetClass = computed(() => this.inset() && `vater-inset-${this.inset()}`);\n protected class = computed(() => [this.fillClass(), this.insetClass()].filter(Boolean));\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 { booleanAttribute, computed, Directive, input } from '@angular/core';\nimport { Align, Direction, Justify, Spacing } from './types';\n\n@Directive({\n host: {\n '[class]': 'class()',\n '[class.vater-wrap]': 'wrap()',\n },\n})\nexport class VaterLayoutDirective {\n /** Cross axis alignment of the flex items. */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n align = input<Align>(undefined, { alias: 'alignment' });\n\n /** Direction of the flex items. Defaults to `column`. */\n direction = input<Direction>('column');\n\n /** Spacing between the flex items. */\n gap = input<Spacing>();\n\n /** Main axis alignment of the flex items. */\n justify = input<Justify>();\n\n /** Offset to apply along the main axis. */\n offset = input<Spacing>();\n\n /** Whether the flex items should wrap. */\n wrap = input(false, { transform: booleanAttribute });\n\n // Computed class names\n protected alignClass = computed(() => this.align() && `vater-align-${this.align()}`);\n protected directionClass = computed(() => this.direction() && `vater-${this.direction()}`);\n protected gapClass = computed(() => this.gap() && `vater-gap-${this.gap()}`);\n protected justifyClass = computed(() => this.justify() && `vater-justify-${this.justify()}`);\n protected offsetClass = computed(() => this.offset() && `vater-offset-${this.offset()}`);\n protected class = computed(() =>\n [\n this.alignClass(),\n this.directionClass(),\n this.gapClass(),\n this.justifyClass(),\n this.offsetClass(),\n ].filter(Boolean)\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 { booleanAttribute, Component, input, ViewEncapsulation } from '@angular/core';\nimport { VaterUtilityDirective } from './vater-utility.directive';\nimport { VaterLayoutDirective } from './vater-layout.directive';\n\n@Component({\n selector: 'vater-flex, [vater-flex]',\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [\n {\n directive: VaterLayoutDirective,\n inputs: ['alignment', 'direction', 'justify', 'wrap', 'gap', 'offset'],\n },\n {\n directive: VaterUtilityDirective,\n inputs: ['center', 'fill', 'inset', 'scrollable'],\n },\n ],\n host: { '[class.vater-flex-auto]': 'autoSize()' },\n styles: `\n vater-flex,\n [vater-flex] {\n display: flex;\n line-height: normal;\n }\n `,\n template: `<ng-content />`,\n})\nexport class VaterFlexComponent {\n /**\n * When set, sizes the flex items according to their width or height properties.\n * @see https://drafts.csswg.org/css-flexbox-1/#flex-common\n * @remarks\n * Prefer setting `fill` on flex items over using `autoSize`.\n */\n autoSize = input(false, { transform: booleanAttribute });\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 { Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'vater-spacer, [vater-spacer]',\n encapsulation: ViewEncapsulation.None,\n styles: `\n vater-spacer,\n [vater-spacer] {\n flex: 1;\n align-self: stretch;\n }\n `,\n template: '<ng-content />',\n})\nexport class VaterSpacerComponent {}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, ViewEncapsulation } from '@angular/core';\nimport { VaterUtilityDirective } from './vater-utility.directive';\nimport { VaterLayoutDirective } from './vater-layout.directive';\n\n@Component({\n selector: 'vater-stack, [vater-stack]',\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [\n {\n directive: VaterLayoutDirective,\n inputs: ['alignment', 'direction', 'justify', 'wrap', 'gap', 'offset'],\n },\n {\n directive: VaterUtilityDirective,\n inputs: ['center', 'fill', 'inset', 'scrollable'],\n },\n ],\n styles: `\n vater-stack,\n [vater-stack] {\n display: flex;\n line-height: normal;\n }\n `,\n template: `<ng-content />`,\n})\nexport class VaterStackComponent {}\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 { VaterFlexComponent } from './vater-flex.component';\nexport { VaterSpacerComponent } from './vater-spacer.component';\nexport { VaterStackComponent } from './vater-stack.component';\nexport { VaterLayoutDirective } from './vater-layout.directive';\nexport { VaterUtilityDirective } from './vater-utility.directive';\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ACH;;ACjBA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@energinet/watt",
4
- "version": "2.0.6",
4
+ "version": "2.0.8",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  ".": {
@@ -20,4 +20,5 @@ export declare class WattRangeValidators {
20
20
  static startRequired: ValidatorFn;
21
21
  static endRequired: ValidatorFn;
22
22
  static maxDays: (maxDays: number) => ValidatorFn;
23
+ static maxMonths: (maxMonths: number) => ValidatorFn;
23
24
  }
@@ -10,5 +10,5 @@ export declare class VaterFlexComponent {
10
10
  */
11
11
  autoSize: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
12
12
  static ɵfac: i0.ɵɵFactoryDeclaration<VaterFlexComponent, never>;
13
- static ɵcmp: i0.ɵɵComponentDeclaration<VaterFlexComponent, "vater-flex, [vater-flex]", never, { "autoSize": { "alias": "autoSize"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof i1.VaterLayoutDirective; inputs: { "align": "align"; "direction": "direction"; "justify": "justify"; "wrap": "wrap"; "gap": "gap"; "offset": "offset"; }; outputs: {}; }, { directive: typeof i2.VaterUtilityDirective; inputs: { "center": "center"; "fill": "fill"; "inset": "inset"; "scrollable": "scrollable"; }; outputs: {}; }]>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<VaterFlexComponent, "vater-flex, [vater-flex]", never, { "autoSize": { "alias": "autoSize"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, [{ directive: typeof i1.VaterLayoutDirective; inputs: { "alignment": "alignment"; "direction": "direction"; "justify": "justify"; "wrap": "wrap"; "gap": "gap"; "offset": "offset"; }; outputs: {}; }, { directive: typeof i2.VaterUtilityDirective; inputs: { "center": "center"; "fill": "fill"; "inset": "inset"; "scrollable": "scrollable"; }; outputs: {}; }]>;
14
14
  }
@@ -20,5 +20,5 @@ export declare class VaterLayoutDirective {
20
20
  protected offsetClass: import("@angular/core").Signal<string | undefined>;
21
21
  protected class: import("@angular/core").Signal<(string | undefined)[]>;
22
22
  static ɵfac: i0.ɵɵFactoryDeclaration<VaterLayoutDirective, never>;
23
- static ɵdir: i0.ɵɵDirectiveDeclaration<VaterLayoutDirective, never, never, { "align": { "alias": "align"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "justify": { "alias": "justify"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
23
+ static ɵdir: i0.ɵɵDirectiveDeclaration<VaterLayoutDirective, never, never, { "align": { "alias": "alignment"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "justify": { "alias": "justify"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
24
24
  }
@@ -3,5 +3,5 @@ import * as i1 from "./vater-layout.directive";
3
3
  import * as i2 from "./vater-utility.directive";
4
4
  export declare class VaterStackComponent {
5
5
  static ɵfac: i0.ɵɵFactoryDeclaration<VaterStackComponent, never>;
6
- static ɵcmp: i0.ɵɵComponentDeclaration<VaterStackComponent, "vater-stack, [vater-stack]", never, {}, {}, never, ["*"], true, [{ directive: typeof i1.VaterLayoutDirective; inputs: { "align": "align"; "direction": "direction"; "justify": "justify"; "wrap": "wrap"; "gap": "gap"; "offset": "offset"; }; outputs: {}; }, { directive: typeof i2.VaterUtilityDirective; inputs: { "center": "center"; "fill": "fill"; "inset": "inset"; "scrollable": "scrollable"; }; outputs: {}; }]>;
6
+ static ɵcmp: i0.ɵɵComponentDeclaration<VaterStackComponent, "vater-stack, [vater-stack]", never, {}, {}, never, ["*"], true, [{ directive: typeof i1.VaterLayoutDirective; inputs: { "alignment": "alignment"; "direction": "direction"; "justify": "justify"; "wrap": "wrap"; "gap": "gap"; "offset": "offset"; }; outputs: {}; }, { directive: typeof i2.VaterUtilityDirective; inputs: { "center": "center"; "fill": "fill"; "inset": "inset"; "scrollable": "scrollable"; }; outputs: {}; }]>;
7
7
  }