@energinet/watt 1.6.2 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/watt-button.component.d.ts +4 -2
- package/dropzone/index.d.ts +19 -0
- package/dropzone/watt-dropzone-intl.d.ts +10 -0
- package/dropzone/watt-dropzone-validators.d.ts +27 -0
- package/dropzone/watt-dropzone.d.ts +25 -0
- package/fesm2022/energinet-watt-button.mjs +6 -5
- package/fesm2022/energinet-watt-button.mjs.map +1 -1
- package/fesm2022/energinet-watt-chip.mjs +1 -1
- package/fesm2022/energinet-watt-chip.mjs.map +1 -1
- package/fesm2022/energinet-watt-data.mjs +1 -1
- package/fesm2022/energinet-watt-data.mjs.map +1 -1
- package/fesm2022/energinet-watt-datetime-field.mjs +1 -1
- package/fesm2022/energinet-watt-datetime-field.mjs.map +1 -1
- package/fesm2022/energinet-watt-drawer.mjs +1 -1
- package/fesm2022/energinet-watt-drawer.mjs.map +1 -1
- package/fesm2022/energinet-watt-dropzone.mjs +278 -0
- package/fesm2022/energinet-watt-dropzone.mjs.map +1 -0
- package/fesm2022/energinet-watt-expansion.mjs +1 -1
- package/fesm2022/energinet-watt-expansion.mjs.map +1 -1
- package/fesm2022/energinet-watt-modal.mjs +1 -1
- package/fesm2022/energinet-watt-modal.mjs.map +1 -1
- package/fesm2022/energinet-watt-picker-datepicker.mjs +1 -1
- package/fesm2022/energinet-watt-picker-datepicker.mjs.map +1 -1
- package/fesm2022/energinet-watt-picker-timepicker.mjs +1 -1
- package/fesm2022/energinet-watt-picker-timepicker.mjs.map +1 -1
- package/fesm2022/energinet-watt-shell.mjs +1 -1
- package/fesm2022/energinet-watt-shell.mjs.map +1 -1
- package/fesm2022/energinet-watt-stepper.mjs +1 -1
- package/fesm2022/energinet-watt-stepper.mjs.map +1 -1
- package/fesm2022/energinet-watt-toast.mjs +1 -1
- package/fesm2022/energinet-watt-toast.mjs.map +1 -1
- package/fesm2022/energinet-watt-vater.mjs +4 -4
- package/fesm2022/energinet-watt-vater.mjs.map +1 -1
- package/fesm2022/energinet-watt-year-field.mjs +1 -1
- package/fesm2022/energinet-watt-year-field.mjs.map +1 -1
- package/fesm2022/energinet-watt-yearmonth-field.mjs +1 -1
- package/fesm2022/energinet-watt-yearmonth-field.mjs.map +1 -1
- package/package.json +5 -1
- package/vater/vater-flex.component.d.ts +1 -1
- package/vater/vater-stack.component.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-datetime-field.mjs","sources":["../../../libs/watt/package/datetime-field/watt-datetime-field.component.ts","../../../libs/watt/package/datetime-field/index.ts","../../../libs/watt/package/datetime-field/energinet-watt-datetime-field.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { outputFromObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatCalendar } from '@angular/material/datepicker';\nimport { MaskitoDirective } from '@maskito/angular';\nimport { maskitoDateTimeOptionsGenerator } from '@maskito/kit';\nimport { map, share } from 'rxjs';\nimport { dayjs, WattLocaleService } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\nconst DA_FILLER = 'dd-mm-åååå, tt:mm';\nconst EN_FILLER = 'dd-mm-yyyy, hh:mm';\nconst DATETIME_FORMAT = 'DD-MM-YYYY, HH:mm';\nconst PARTIAL_DATETIME_FORMAT = 'DD-MM-YYYY, ';\nconst DANISH_TIME_ZONE_IDENTIFIER = 'Europe/Copenhagen';\n\n/* eslint-disable @angular-eslint/component-class-suffix */\n@Component({\n selector: 'watt-datetime-field',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDateTimeField),\n multi: true,\n },\n ],\n imports: [\n ReactiveFormsModule,\n MaskitoDirective,\n MatCalendar,\n WattButtonComponent,\n WattFieldComponent,\n ],\n styles: [\n `\n watt-datetime-field {\n display: block;\n width: 100%;\n }\n\n .watt-datetime-field-picker {\n position: fixed;\n position-area: bottom span-right;\n position-try-fallbacks: flip-block;\n width: 296px;\n height: 354px;\n inset: unset;\n margin: unset;\n border: 0;\n }\n `,\n ],\n template: `\n <watt-field\n [label]=\"label()\"\n [control]=\"control\"\n [placeholder]=\"placeholder()\"\n [anchorName]=\"anchorName\"\n >\n <input\n #field\n [formControl]=\"control\"\n [maskito]=\"mask()\"\n (focus)=\"picker.showPopover()\"\n (blur)=\"handleBlur(picker, $event)\"\n />\n <watt-button icon=\"date\" variant=\"icon\" (click)=\"field.focus()\" />\n <div\n #picker\n class=\"watt-elevation watt-datetime-field-picker\"\n popover=\"manual\"\n tabindex=\"0\"\n [style.position-anchor]=\"anchorName\"\n >\n <mat-calendar\n [startAt]=\"selected()\"\n [selected]=\"selected()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n (selectedChange)=\"handleSelectedChange(field, picker, $event)\"\n />\n </div>\n <ng-content />\n <ng-content select=\"watt-field-error\" ngProjectAs=\"watt-field-error\" />\n <ng-content select=\"watt-field-hint\" ngProjectAs=\"watt-field-hint\" />\n </watt-field>\n `,\n})\nexport class WattDateTimeField implements ControlValueAccessor {\n private locale = inject(WattLocaleService);\n\n // Popovers exists on an entirely different layer, meaning that for anchor positioning they\n // look at the entire tree for the anchor name. This gives each field a unique anchor name.\n private static instance = 0;\n private instance = WattDateTimeField.instance++;\n protected anchorName = `--watt-datetime-field-popover-anchor-${this.instance}`;\n\n /** Converts date from outer FormControl to format of inner FormControl. */\n protected modelToView = (value: Date | null, format = DATETIME_FORMAT) =>\n value ? dayjs(value).tz(DANISH_TIME_ZONE_IDENTIFIER).format(format) : '';\n\n /** Converts value of inner FormControl to type of outer FormControl. */\n protected viewToModel = (value: string) => {\n const date = dayjs(value, DATETIME_FORMAT, true);\n if (!date.isValid()) return null;\n return this.inclusive() ? date.endOf('m').toDate() : date.toDate();\n };\n\n // Must unfortunately be queried in order to update `activeDate`\n private calendar = viewChild.required<MatCalendar<Date>>(MatCalendar);\n\n // This inner FormControl is string only, but the outer FormControl is of type Date.\n protected control = new FormControl('', { nonNullable: true });\n\n // `registerOnChange` may subscribe to this component after it has been destroyed, thus\n // triggering an NG0911 from the `takeUntilDestroyed` operator. By sharing the observable,\n // the observable will already be closed and `subscribe` becomes a proper noop.\n private valueChanges = this.control.valueChanges.pipe(\n map(this.viewToModel),\n takeUntilDestroyed(),\n share()\n );\n\n /** Set the label text for `watt-field`. */\n label = input('');\n\n /** The minimum selectable date. */\n min = input<Date>();\n\n /** The maximum selectable date. */\n max = input<Date>();\n\n /** When true, seconds will be set to 59 and milliseconds to 999. Otherwise, both are 0. */\n inclusive = input(false);\n\n /** Emits when the selected date has changed. */\n dateChange = outputFromObservable(this.valueChanges);\n\n /** Emits when the field loses focus. */\n // eslint-disable-next-line @angular-eslint/no-output-native\n blur = output<FocusEvent>();\n\n protected selected = signal<Date | null>(null);\n protected placeholder = computed(() => (this.locale.isDanish() ? DA_FILLER : EN_FILLER));\n protected mask = computed(() =>\n maskitoDateTimeOptionsGenerator({\n min: this.min(),\n max: this.max(),\n dateMode: 'dd/mm/yyyy',\n timeMode: 'HH:MM',\n dateSeparator: '-',\n timeStep: 1,\n })\n );\n\n protected handleBlur = (picker: HTMLElement, event: FocusEvent) => {\n if (event.relatedTarget instanceof HTMLElement && picker.contains(event.relatedTarget)) {\n const target = event.target as HTMLInputElement; // safe type assertion\n setTimeout(() => target.focus()); // keep focus on input element while using the picker\n } else {\n picker.hidePopover();\n this.blur.emit(event);\n }\n };\n\n protected handleSelectedChange = (\n field: HTMLInputElement,\n picker: HTMLDivElement,\n date: Date\n ) => {\n const prev = this.viewToModel(this.control.value);\n\n // Only write the date part\n field.value = prev\n ? this.modelToView(dayjs(date).set('h', prev.getHours()).set('m', prev.getMinutes()).toDate())\n : this.modelToView(date, PARTIAL_DATETIME_FORMAT);\n\n field.dispatchEvent(new Event('input', { bubbles: true }));\n picker.hidePopover();\n };\n\n constructor() {\n this.valueChanges.subscribe((value) => {\n this.selected.set(value);\n this.calendar().activeDate = value ?? new Date();\n });\n }\n\n // Implementation for ControlValueAccessor\n writeValue = (value: Date | null) => this.control.setValue(this.modelToView(value));\n setDisabledState = (x: boolean) => (x ? this.control.disable() : this.control.enable());\n registerOnTouched = (fn: () => void) => this.blur.subscribe(fn);\n registerOnChange = (fn: (value: Date | null) => void) => this.valueChanges.subscribe(fn);\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattDateTimeField } from './watt-datetime-field.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AA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,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,uBAAuB,CAAC;AAChD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA;wBACP,mBAAmB;wBACnB,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,kBAAkB;qBACnB,EAoBS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yNAAA,CAAA,EAAA;;;AC3HH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-datetime-field.mjs","sources":["../../../libs/watt/package/datetime-field/watt-datetime-field.component.ts","../../../libs/watt/package/datetime-field/index.ts","../../../libs/watt/package/datetime-field/energinet-watt-datetime-field.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n NG_VALUE_ACCESSOR,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { outputFromObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatCalendar } from '@angular/material/datepicker';\nimport { MaskitoDirective } from '@maskito/angular';\nimport { maskitoDateTimeOptionsGenerator } from '@maskito/kit';\nimport { map, share } from 'rxjs';\nimport { dayjs, WattLocaleService } from '@energinet/watt/core/date';\nimport { WattFieldComponent } from '@energinet/watt/field';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\nconst DA_FILLER = 'dd-mm-åååå, tt:mm';\nconst EN_FILLER = 'dd-mm-yyyy, hh:mm';\nconst DATETIME_FORMAT = 'DD-MM-YYYY, HH:mm';\nconst PARTIAL_DATETIME_FORMAT = 'DD-MM-YYYY, ';\nconst DANISH_TIME_ZONE_IDENTIFIER = 'Europe/Copenhagen';\n\n/* eslint-disable @angular-eslint/component-class-suffix */\n@Component({\n selector: 'watt-datetime-field',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattDateTimeField),\n multi: true,\n },\n ],\n imports: [\n ReactiveFormsModule,\n MaskitoDirective,\n MatCalendar,\n WattButtonComponent,\n WattFieldComponent,\n ],\n styles: [\n `\n watt-datetime-field {\n display: block;\n width: 100%;\n }\n\n .watt-datetime-field-picker {\n position: fixed;\n position-area: bottom span-right;\n position-try-fallbacks: flip-block;\n width: 296px;\n height: 354px;\n inset: unset;\n margin: unset;\n border: 0;\n }\n `,\n ],\n template: `\n <watt-field\n [label]=\"label()\"\n [control]=\"control\"\n [placeholder]=\"placeholder()\"\n [anchorName]=\"anchorName\"\n >\n <input\n #field\n [formControl]=\"control\"\n [maskito]=\"mask()\"\n (focus)=\"picker.showPopover()\"\n (blur)=\"handleBlur(picker, $event)\"\n />\n <watt-button icon=\"date\" variant=\"icon\" (click)=\"field.focus()\" />\n <div\n #picker\n class=\"watt-elevation watt-datetime-field-picker\"\n popover=\"manual\"\n tabindex=\"0\"\n [style.position-anchor]=\"anchorName\"\n >\n <mat-calendar\n [startAt]=\"selected()\"\n [selected]=\"selected()\"\n [minDate]=\"min()\"\n [maxDate]=\"max()\"\n (selectedChange)=\"handleSelectedChange(field, picker, $event)\"\n />\n </div>\n <ng-content />\n <ng-content select=\"watt-field-error\" ngProjectAs=\"watt-field-error\" />\n <ng-content select=\"watt-field-hint\" ngProjectAs=\"watt-field-hint\" />\n </watt-field>\n `,\n})\nexport class WattDateTimeField implements ControlValueAccessor {\n private locale = inject(WattLocaleService);\n\n // Popovers exists on an entirely different layer, meaning that for anchor positioning they\n // look at the entire tree for the anchor name. This gives each field a unique anchor name.\n private static instance = 0;\n private instance = WattDateTimeField.instance++;\n protected anchorName = `--watt-datetime-field-popover-anchor-${this.instance}`;\n\n /** Converts date from outer FormControl to format of inner FormControl. */\n protected modelToView = (value: Date | null, format = DATETIME_FORMAT) =>\n value ? dayjs(value).tz(DANISH_TIME_ZONE_IDENTIFIER).format(format) : '';\n\n /** Converts value of inner FormControl to type of outer FormControl. */\n protected viewToModel = (value: string) => {\n const date = dayjs(value, DATETIME_FORMAT, true);\n if (!date.isValid()) return null;\n return this.inclusive() ? date.endOf('m').toDate() : date.toDate();\n };\n\n // Must unfortunately be queried in order to update `activeDate`\n private calendar = viewChild.required<MatCalendar<Date>>(MatCalendar);\n\n // This inner FormControl is string only, but the outer FormControl is of type Date.\n protected control = new FormControl('', { nonNullable: true });\n\n // `registerOnChange` may subscribe to this component after it has been destroyed, thus\n // triggering an NG0911 from the `takeUntilDestroyed` operator. By sharing the observable,\n // the observable will already be closed and `subscribe` becomes a proper noop.\n private valueChanges = this.control.valueChanges.pipe(\n map(this.viewToModel),\n takeUntilDestroyed(),\n share()\n );\n\n /** Set the label text for `watt-field`. */\n label = input('');\n\n /** The minimum selectable date. */\n min = input<Date>();\n\n /** The maximum selectable date. */\n max = input<Date>();\n\n /** When true, seconds will be set to 59 and milliseconds to 999. Otherwise, both are 0. */\n inclusive = input(false);\n\n /** Emits when the selected date has changed. */\n dateChange = outputFromObservable(this.valueChanges);\n\n /** Emits when the field loses focus. */\n // eslint-disable-next-line @angular-eslint/no-output-native\n blur = output<FocusEvent>();\n\n protected selected = signal<Date | null>(null);\n protected placeholder = computed(() => (this.locale.isDanish() ? DA_FILLER : EN_FILLER));\n protected mask = computed(() =>\n maskitoDateTimeOptionsGenerator({\n min: this.min(),\n max: this.max(),\n dateMode: 'dd/mm/yyyy',\n timeMode: 'HH:MM',\n dateSeparator: '-',\n timeStep: 1,\n })\n );\n\n protected handleBlur = (picker: HTMLElement, event: FocusEvent) => {\n if (event.relatedTarget instanceof HTMLElement && picker.contains(event.relatedTarget)) {\n const target = event.target as HTMLInputElement; // safe type assertion\n setTimeout(() => target.focus()); // keep focus on input element while using the picker\n } else {\n picker.hidePopover();\n this.blur.emit(event);\n }\n };\n\n protected handleSelectedChange = (\n field: HTMLInputElement,\n picker: HTMLDivElement,\n date: Date\n ) => {\n const prev = this.viewToModel(this.control.value);\n\n // Only write the date part\n field.value = prev\n ? this.modelToView(dayjs(date).set('h', prev.getHours()).set('m', prev.getMinutes()).toDate())\n : this.modelToView(date, PARTIAL_DATETIME_FORMAT);\n\n field.dispatchEvent(new Event('input', { bubbles: true }));\n picker.hidePopover();\n };\n\n constructor() {\n this.valueChanges.subscribe((value) => {\n this.selected.set(value);\n this.calendar().activeDate = value ?? new Date();\n });\n }\n\n // Implementation for ControlValueAccessor\n writeValue = (value: Date | null) => this.control.setValue(this.modelToView(value));\n setDisabledState = (x: boolean) => (x ? this.control.disable() : this.control.enable());\n registerOnTouched = (fn: () => void) => this.blur.subscribe(fn);\n registerOnChange = (fn: (value: Date | null) => void) => this.valueChanges.subscribe(fn);\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nexport { WattDateTimeField } from './watt-datetime-field.component';\n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,EAAA,aAAA,EAChB,iBAAiB,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,EACpC,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,uBAAuB,CAAC;AAChD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA;wBACP,mBAAmB;wBACnB,gBAAgB;wBAChB,WAAW;wBACX,mBAAmB;wBACnB,kBAAkB;qBACnB,EAoBS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yNAAA,CAAA,EAAA;;;AC3HH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -263,7 +263,7 @@ class WattDrawerComponent {
|
|
|
263
263
|
this.writableIsOpen.set(false);
|
|
264
264
|
}
|
|
265
265
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
266
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattDrawerComponent, isStandalone: true, selector: "watt-drawer", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, autoOpen: { classPropertyName: "autoOpen", publicName: "autoOpen", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, animateOnKeyChange: { classPropertyName: "animateOnKeyChange", publicName: "animateOnKeyChange", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, host: { listeners: { "document:click": "handleDocumentClick($event)", "keydown.escape": "handleEscKeyPressed()" } }, queries: [{ propertyName: "content", first: true, predicate: WattDrawerContentComponent, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "heading", first: true, predicate: WattDrawerHeadingComponent, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "topBar", first: true, predicate: WattDrawerTopbarComponent, descendants: true, read: ElementRef, isSignal: true }], viewQueries: [{ propertyName: "cdkTrapFocus", first: true, predicate: CdkTrapFocus, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-drawer-container class=\"watt-drawer-container\" [hasBackdrop]=\"false\">\n <mat-drawer\n class=\"watt-drawer watt-space-inset-s watt-drawer--{{ size() }}\"\n mode=\"side\"\n position=\"end\"\n [opened]=\"isOpen()\"\n (closed)=\"closed.emit()\"\n [disableClose]=\"true\"\n [autoFocus]=\"true\"\n [cdkTrapFocus]=\"true\"\n >\n <div class=\"watt-drawer__grid-container\">\n <header>\n <ng-content select=\"watt-drawer-topbar\" />\n <watt-button class=\"close-btn\" variant=\"icon\" icon=\"close\" (click)=\"close()\" />\n </header>\n\n <article class=\"watt-drawer__content\">\n <div class=\"watt-drawer__actions\">\n <ng-content select=\"watt-drawer-heading\" />\n <ng-content select=\"watt-drawer-actions\" />\n </div>\n <ng-content select=\"watt-drawer-content\" />\n </article>\n </div>\n\n @if (loading()) {\n <div class=\"watt-drawer__spinner\">\n <watt-spinner />\n </div>\n }\n </mat-drawer>\n</mat-drawer-container>\n", styles: [":host{display:block}.watt-drawer-container{box-shadow:0 4px 64px 3px #2e323440;height:100vh;position:fixed;right:0;top:0;width:auto;z-index:500}.watt-drawer{padding:0}.watt-drawer header{display:flex;justify-content:flex-end}.watt-drawer header .close-btn{align-self:center}.watt-drawer__grid-container{display:grid;grid-template-rows:auto 1fr;height:100%}.watt-drawer--small{width:460px;max-width:100vw}.watt-drawer--small .watt-drawer__actions{margin-bottom:var(--watt-space-m)}.watt-drawer--normal{width:888px;max-width:100vw}.watt-drawer--large{width:1174px;max-width:100vw}.watt-drawer__content{display:grid;grid-template-rows:auto 1fr;overflow-y:auto}.watt-drawer__actions{display:flex;border-bottom:1px solid var(--watt-color-neutral-grey-300);padding-bottom:var(--watt-space-m)}.watt-drawer__spinner{z-index:1;position:absolute;inset:0;display:flex;justify-content:center;align-items:center;background-color:var(--watt-color-neutral-white);opacity:.5}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "component", type: i2.MatDrawer, selector: "mat-drawer", inputs: ["position", "mode", "disableClose", "autoFocus", "opened"], outputs: ["openedChange", "opened", "openedStart", "closed", "closedStart", "positionChanged"], exportAs: ["matDrawer"] }, { kind: "component", type: i2.MatDrawerContainer, selector: "mat-drawer-container", inputs: ["autosize", "hasBackdrop"], outputs: ["backdropClick"], exportAs: ["matDrawerContainer"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattSpinnerComponent, selector: "watt-spinner", inputs: ["diameter", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
266
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.1", type: WattDrawerComponent, isStandalone: true, selector: "watt-drawer", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, autoOpen: { classPropertyName: "autoOpen", publicName: "autoOpen", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, animateOnKeyChange: { classPropertyName: "animateOnKeyChange", publicName: "animateOnKeyChange", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed" }, host: { listeners: { "document:click": "handleDocumentClick($event)", "keydown.escape": "handleEscKeyPressed()" } }, queries: [{ propertyName: "content", first: true, predicate: WattDrawerContentComponent, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "heading", first: true, predicate: WattDrawerHeadingComponent, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "topBar", first: true, predicate: WattDrawerTopbarComponent, descendants: true, read: ElementRef, isSignal: true }], viewQueries: [{ propertyName: "cdkTrapFocus", first: true, predicate: CdkTrapFocus, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-drawer-container class=\"watt-drawer-container\" [hasBackdrop]=\"false\">\n <mat-drawer\n class=\"watt-drawer watt-space-inset-s watt-drawer--{{ size() }}\"\n mode=\"side\"\n position=\"end\"\n [opened]=\"isOpen()\"\n (closed)=\"closed.emit()\"\n [disableClose]=\"true\"\n [autoFocus]=\"true\"\n [cdkTrapFocus]=\"true\"\n >\n <div class=\"watt-drawer__grid-container\">\n <header>\n <ng-content select=\"watt-drawer-topbar\" />\n <watt-button class=\"close-btn\" variant=\"icon\" icon=\"close\" (click)=\"close()\" />\n </header>\n\n <article class=\"watt-drawer__content\">\n <div class=\"watt-drawer__actions\">\n <ng-content select=\"watt-drawer-heading\" />\n <ng-content select=\"watt-drawer-actions\" />\n </div>\n <ng-content select=\"watt-drawer-content\" />\n </article>\n </div>\n\n @if (loading()) {\n <div class=\"watt-drawer__spinner\">\n <watt-spinner />\n </div>\n }\n </mat-drawer>\n</mat-drawer-container>\n", styles: [":host{display:block}.watt-drawer-container{box-shadow:0 4px 64px 3px #2e323440;height:100vh;position:fixed;right:0;top:0;width:auto;z-index:500}.watt-drawer{padding:0}.watt-drawer header{display:flex;justify-content:flex-end}.watt-drawer header .close-btn{align-self:center}.watt-drawer__grid-container{display:grid;grid-template-rows:auto 1fr;height:100%}.watt-drawer--small{width:460px;max-width:100vw}.watt-drawer--small .watt-drawer__actions{margin-bottom:var(--watt-space-m)}.watt-drawer--normal{width:888px;max-width:100vw}.watt-drawer--large{width:1174px;max-width:100vw}.watt-drawer__content{display:grid;grid-template-rows:auto 1fr;overflow-y:auto}.watt-drawer__actions{display:flex;border-bottom:1px solid var(--watt-color-neutral-grey-300);padding-bottom:var(--watt-space-m)}.watt-drawer__spinner{z-index:1;position:absolute;inset:0;display:flex;justify-content:center;align-items:center;background-color:var(--watt-color-neutral-white);opacity:.5}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "component", type: i2.MatDrawer, selector: "mat-drawer", inputs: ["position", "mode", "disableClose", "autoFocus", "opened"], outputs: ["openedChange", "opened", "openedStart", "closed", "closedStart", "positionChanged"], exportAs: ["matDrawer"] }, { kind: "component", type: i2.MatDrawerContainer, selector: "mat-drawer-container", inputs: ["autosize", "hasBackdrop"], outputs: ["backdropClick"], exportAs: ["matDrawerContainer"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "size", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattSpinnerComponent, selector: "watt-spinner", inputs: ["diameter", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
267
267
|
}
|
|
268
268
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDrawerComponent, decorators: [{
|
|
269
269
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-drawer.mjs","sources":["../../../libs/watt/package/drawer/watt-drawer-topbar.component.ts","../../../libs/watt/package/drawer/watt-drawer-actions.component.ts","../../../libs/watt/package/drawer/watt-drawer-content.component.ts","../../../libs/watt/package/drawer/watt-drawer-heading.component.ts","../../../libs/watt/package/drawer/watt-drawer.component.ts","../../../libs/watt/package/drawer/watt-drawer.component.html","../../../libs/watt/package/drawer/index.ts","../../../libs/watt/package/drawer/energinet-watt-drawer.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-drawer-topbar',\n template: `<ng-content />`,\n styleUrls: ['./watt-drawer-topbar.component.scss'],\n})\nexport class WattDrawerTopbarComponent {}\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-drawer-actions',\n styles: `\n :host {\n flex-shrink: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-start;\n gap: var(--watt-space-m);\n margin-left: auto;\n margin-right: var(--watt-space-ml);\n }\n `,\n template: `<ng-content select=\"watt-button\" />`,\n})\nexport class WattDrawerActionsComponent {}\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-drawer-content',\n template: `<ng-content />`,\n styles: [\n `\n :host {\n overflow: auto;\n }\n `,\n ],\n})\nexport class WattDrawerContentComponent {}\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-drawer-heading',\n encapsulation: ViewEncapsulation.None,\n template: `<ng-content />`,\n styles: [\n `\n watt-drawer-heading {\n margin-left: var(--watt-space-ml);\n }\n\n watt-drawer-heading h1,\n watt-drawer-heading h2,\n watt-drawer-heading h3,\n watt-drawer-heading h4,\n watt-drawer-heading h5,\n watt-drawer-heading h6 {\n margin: 0;\n line-height: 48px !important; /* align with actions */\n }\n `,\n ],\n})\nexport class WattDrawerHeadingComponent {}\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 inject,\n input,\n output,\n Component,\n OnDestroy,\n viewChild,\n ElementRef,\n ChangeDetectionStrategy,\n signal,\n untracked,\n booleanAttribute,\n contentChild,\n effect,\n} from '@angular/core';\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { CdkTrapFocus, A11yModule } from '@angular/cdk/a11y';\nimport { MatSidenavModule } from '@angular/material/sidenav';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattSpinnerComponent } from '@energinet/watt/spinner';\n\nimport { WattDrawerTopbarComponent } from './watt-drawer-topbar.component';\nimport { WattDrawerActionsComponent } from './watt-drawer-actions.component';\nimport { WattDrawerContentComponent } from './watt-drawer-content.component';\nimport { WattDrawerHeadingComponent } from './watt-drawer-heading.component';\n\nexport type WattDrawerSize = 'small' | 'normal' | 'large';\n\nconst APPEAR_ANIMATION_DELAY = 250;\nconst APPEAR_ANIMATION_FRAMES = {\n transform: ['translateX(30px)', 'translateX(0)'],\n opacity: ['0', '1'],\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'watt-drawer',\n styleUrls: ['./watt-drawer.component.scss'],\n templateUrl: './watt-drawer.component.html',\n host: {\n '(document:click)': 'handleDocumentClick($event)',\n '(keydown.escape)': 'handleEscKeyPressed()',\n },\n imports: [A11yModule, MatSidenavModule, WattButtonComponent, WattSpinnerComponent],\n})\nexport class WattDrawerComponent implements OnDestroy {\n private elementRef = inject(ElementRef);\n private overlayContainer = inject(OverlayContainer);\n private content = contentChild(WattDrawerContentComponent, { read: ElementRef });\n private heading = contentChild(WattDrawerHeadingComponent, { read: ElementRef });\n private topBar = contentChild(WattDrawerTopbarComponent, { read: ElementRef });\n private cdkTrapFocus = viewChild.required(CdkTrapFocus);\n private bypassClickCheck = false;\n private writableIsOpen = signal(false);\n\n // Multiple drawers open at the same time are not allowed. This keeps track of\n // the currently opened drawer and closes it when a new drawer is opened.\n private static currentDrawer?: WattDrawerComponent;\n\n /** Used to adjust drawer size to best fit the content. */\n size = input<WattDrawerSize>('normal');\n\n /**\n * Whether the drawer should open automatically. If `key` is provided and\n * `autoOpen` is true, the drawer will open every time the key changes.\n */\n autoOpen = input(false, { transform: booleanAttribute });\n\n /**\n * Used to track the current drawer when reusing the same drawer instance to\n * render different content. This is required when interactions outside the\n * drawer should result in updating the drawer's content instead of closing it.\n */\n key = input<unknown>();\n\n /** Whether the drawer should show a loading state. */\n loading = input(false);\n\n /** Adds a brief animation to indicate that the content has changed. */\n animateOnKeyChange = input(false);\n\n /** Emits whenever the drawer is fully closed. */\n closed = output<void>();\n\n /** Whether the drawer is open. */\n isOpen = this.writableIsOpen.asReadonly();\n\n constructor() {\n effect(() => {\n this.key();\n if (this.autoOpen()) this.open();\n if (!this.animateOnKeyChange()) return;\n untracked(() => {\n if (!this.isOpen()) return;\n this.content()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n this.heading()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n this.topBar()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n });\n });\n\n // Who doesn't love a good workaround, right?\n // Let's make the drawer resize itself whenever the `size` input changes.\n //\n // The `mat-drawer` component offers the `autosize` input for this.\n // However, it is specifically mentioned that this options should be used at own risk,\n // as it could cause performance issues.\n // See: https://material.angular.dev/components/sidenav/overview#resizing-an-open-sidenav\n //\n // So to work around this, a simple `resize` event is dispatched whenever the `size` input changes.\n // This works because `mat-drawer` uses `ViewportRuler` from `@angular/cdk/scrolling`\n // (see https://github.com/angular/components/blob/19.2.1/src/material/sidenav/drawer.ts#L811-L816)\n // to listen to `resize` events and re-calculates margins applied to the drawer content\n // (see https://github.com/angular/components/blob/20.0.0-rc.2/src/cdk/scrolling/viewport-ruler.ts#L50-L53).\n effect(() => {\n this.size();\n\n document.dispatchEvent(new Event('resize', { bubbles: true }));\n });\n }\n\n /** @ignore */\n handleDocumentClick(event: MouseEvent) {\n // Prevent closing when the click triggered a call to `open`\n if (this.bypassClickCheck) return;\n\n // Check if the click originated from within the drawer element\n const isClickInside = this.elementRef.nativeElement.contains(event.target);\n if (isClickInside) return;\n\n // Check if the click originated from within an overlay (such as a modal)\n const overlayContainerEl = this.overlayContainer.getContainerElement();\n const isOverlayClick = overlayContainerEl.contains(event.target as Node);\n if (isOverlayClick) return;\n\n // Click is allowed to close the drawer now\n this.close();\n }\n\n /** @ignore */\n handleEscKeyPressed() {\n this.close();\n }\n\n /** @ignore */\n ngOnDestroy(): void {\n if (WattDrawerComponent.currentDrawer === this) {\n WattDrawerComponent.currentDrawer = undefined;\n }\n }\n\n /** Opens the drawer. Subsequent calls are ignored while the drawer is opened. */\n open() {\n // Trap focus whenever open is called. This doesn't work on the\n // initial call (when first opening the drawer), but this is\n // handled by the autoFocus property on mat-drawer.\n this.cdkTrapFocus().focusTrap.focusInitialElementWhenReady();\n\n // Disable click outside check until the current event loop is finished.\n // This might seem hackish, but the order of execution is stable here.\n // Also prevents an issue when the drawer is destroyed and then recreated,\n // causing the click outside check to trigger immediately if the drawer\n // is created and opened in response to a click event.\n this.bypassClickCheck = true;\n setTimeout(() => {\n this.bypassClickCheck = false;\n }, 0);\n\n // Without `untracked`, if this is called in a reactive context (such as an `effect`),\n // it will be triggered twice due to `isOpen` being tracked and immediately updated.\n if (untracked(this.isOpen)) return;\n WattDrawerComponent.currentDrawer?.close();\n WattDrawerComponent.currentDrawer = this;\n this.writableIsOpen.set(true);\n }\n\n /** Closes the drawer. */\n close() {\n if (!untracked(this.isOpen)) return;\n WattDrawerComponent.currentDrawer = undefined;\n this.writableIsOpen.set(false);\n }\n}\n\nexport const WATT_DRAWER = [\n WattDrawerComponent,\n WattDrawerTopbarComponent,\n WattDrawerActionsComponent,\n WattDrawerContentComponent,\n WattDrawerHeadingComponent,\n];\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-drawer-container class=\"watt-drawer-container\" [hasBackdrop]=\"false\">\n <mat-drawer\n class=\"watt-drawer watt-space-inset-s watt-drawer--{{ size() }}\"\n mode=\"side\"\n position=\"end\"\n [opened]=\"isOpen()\"\n (closed)=\"closed.emit()\"\n [disableClose]=\"true\"\n [autoFocus]=\"true\"\n [cdkTrapFocus]=\"true\"\n >\n <div class=\"watt-drawer__grid-container\">\n <header>\n <ng-content select=\"watt-drawer-topbar\" />\n <watt-button class=\"close-btn\" variant=\"icon\" icon=\"close\" (click)=\"close()\" />\n </header>\n\n <article class=\"watt-drawer__content\">\n <div class=\"watt-drawer__actions\">\n <ng-content select=\"watt-drawer-heading\" />\n <ng-content select=\"watt-drawer-actions\" />\n </div>\n <ng-content select=\"watt-drawer-content\" />\n </article>\n </div>\n\n @if (loading()) {\n <div class=\"watt-drawer__spinner\">\n <watt-spinner />\n </div>\n }\n </mat-drawer>\n</mat-drawer-container>\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 { WattDrawerTopbarComponent } from './watt-drawer-topbar.component';\nexport { WattDrawerActionsComponent } from './watt-drawer-actions.component';\nexport { WattDrawerContentComponent } from './watt-drawer-content.component';\nexport { WattDrawerHeadingComponent } from './watt-drawer-heading.component';\nexport { WattDrawerComponent, WATT_DRAWER, WattDrawerSize } from './watt-drawer.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAQa,yBAAyB,CAAA;uGAAzB,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAzB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,yBAAyB,8EAH1B,CAAgB,cAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,iLAAA,CAAA,EAAA,CAAA;;2FAGf,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBALrC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,YACpB,CAAgB,cAAA,CAAA,EAAA,MAAA,EAAA,CAAA,iLAAA,CAAA,EAAA;;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IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,mBAAmB,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,oBAAoB,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,aAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAEtE,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAX/B,SAAS;AACS,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EACrC,QAAA,EAAA,aAAa,EAGjB,IAAA,EAAA;AACJ,wBAAA,kBAAkB,EAAE,6BAA6B;AACjD,wBAAA,kBAAkB,EAAE,uBAAuB;qBAC5C,EACQ,OAAA,EAAA,CAAC,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,EAAA,QAAA,EAAA,6nDAAA,EAAA,MAAA,EAAA,CAAA,m8BAAA,CAAA,EAAA;;AA4IvE,MAAA,WAAW,GAAG;IACzB,mBAAmB;IACnB,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;;;AEhN5B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-drawer.mjs","sources":["../../../libs/watt/package/drawer/watt-drawer-topbar.component.ts","../../../libs/watt/package/drawer/watt-drawer-actions.component.ts","../../../libs/watt/package/drawer/watt-drawer-content.component.ts","../../../libs/watt/package/drawer/watt-drawer-heading.component.ts","../../../libs/watt/package/drawer/watt-drawer.component.ts","../../../libs/watt/package/drawer/watt-drawer.component.html","../../../libs/watt/package/drawer/index.ts","../../../libs/watt/package/drawer/energinet-watt-drawer.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component } from '@angular/core';\n\n@Component({\n selector: 'watt-drawer-topbar',\n template: `<ng-content />`,\n styleUrls: ['./watt-drawer-topbar.component.scss'],\n})\nexport class WattDrawerTopbarComponent {}\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-drawer-actions',\n styles: `\n :host {\n flex-shrink: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-start;\n gap: var(--watt-space-m);\n margin-left: auto;\n margin-right: var(--watt-space-ml);\n }\n `,\n template: `<ng-content select=\"watt-button\" />`,\n})\nexport class WattDrawerActionsComponent {}\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-drawer-content',\n template: `<ng-content />`,\n styles: [\n `\n :host {\n overflow: auto;\n }\n `,\n ],\n})\nexport class WattDrawerContentComponent {}\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-drawer-heading',\n encapsulation: ViewEncapsulation.None,\n template: `<ng-content />`,\n styles: [\n `\n watt-drawer-heading {\n margin-left: var(--watt-space-ml);\n }\n\n watt-drawer-heading h1,\n watt-drawer-heading h2,\n watt-drawer-heading h3,\n watt-drawer-heading h4,\n watt-drawer-heading h5,\n watt-drawer-heading h6 {\n margin: 0;\n line-height: 48px !important; /* align with actions */\n }\n `,\n ],\n})\nexport class WattDrawerHeadingComponent {}\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 inject,\n input,\n output,\n Component,\n OnDestroy,\n viewChild,\n ElementRef,\n ChangeDetectionStrategy,\n signal,\n untracked,\n booleanAttribute,\n contentChild,\n effect,\n} from '@angular/core';\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { CdkTrapFocus, A11yModule } from '@angular/cdk/a11y';\nimport { MatSidenavModule } from '@angular/material/sidenav';\n\nimport { WattButtonComponent } from '@energinet/watt/button';\nimport { WattSpinnerComponent } from '@energinet/watt/spinner';\n\nimport { WattDrawerTopbarComponent } from './watt-drawer-topbar.component';\nimport { WattDrawerActionsComponent } from './watt-drawer-actions.component';\nimport { WattDrawerContentComponent } from './watt-drawer-content.component';\nimport { WattDrawerHeadingComponent } from './watt-drawer-heading.component';\n\nexport type WattDrawerSize = 'small' | 'normal' | 'large';\n\nconst APPEAR_ANIMATION_DELAY = 250;\nconst APPEAR_ANIMATION_FRAMES = {\n transform: ['translateX(30px)', 'translateX(0)'],\n opacity: ['0', '1'],\n};\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'watt-drawer',\n styleUrls: ['./watt-drawer.component.scss'],\n templateUrl: './watt-drawer.component.html',\n host: {\n '(document:click)': 'handleDocumentClick($event)',\n '(keydown.escape)': 'handleEscKeyPressed()',\n },\n imports: [A11yModule, MatSidenavModule, WattButtonComponent, WattSpinnerComponent],\n})\nexport class WattDrawerComponent implements OnDestroy {\n private elementRef = inject(ElementRef);\n private overlayContainer = inject(OverlayContainer);\n private content = contentChild(WattDrawerContentComponent, { read: ElementRef });\n private heading = contentChild(WattDrawerHeadingComponent, { read: ElementRef });\n private topBar = contentChild(WattDrawerTopbarComponent, { read: ElementRef });\n private cdkTrapFocus = viewChild.required(CdkTrapFocus);\n private bypassClickCheck = false;\n private writableIsOpen = signal(false);\n\n // Multiple drawers open at the same time are not allowed. This keeps track of\n // the currently opened drawer and closes it when a new drawer is opened.\n private static currentDrawer?: WattDrawerComponent;\n\n /** Used to adjust drawer size to best fit the content. */\n size = input<WattDrawerSize>('normal');\n\n /**\n * Whether the drawer should open automatically. If `key` is provided and\n * `autoOpen` is true, the drawer will open every time the key changes.\n */\n autoOpen = input(false, { transform: booleanAttribute });\n\n /**\n * Used to track the current drawer when reusing the same drawer instance to\n * render different content. This is required when interactions outside the\n * drawer should result in updating the drawer's content instead of closing it.\n */\n key = input<unknown>();\n\n /** Whether the drawer should show a loading state. */\n loading = input(false);\n\n /** Adds a brief animation to indicate that the content has changed. */\n animateOnKeyChange = input(false);\n\n /** Emits whenever the drawer is fully closed. */\n closed = output<void>();\n\n /** Whether the drawer is open. */\n isOpen = this.writableIsOpen.asReadonly();\n\n constructor() {\n effect(() => {\n this.key();\n if (this.autoOpen()) this.open();\n if (!this.animateOnKeyChange()) return;\n untracked(() => {\n if (!this.isOpen()) return;\n this.content()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n this.heading()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n this.topBar()?.nativeElement.animate(APPEAR_ANIMATION_FRAMES, APPEAR_ANIMATION_DELAY);\n });\n });\n\n // Who doesn't love a good workaround, right?\n // Let's make the drawer resize itself whenever the `size` input changes.\n //\n // The `mat-drawer` component offers the `autosize` input for this.\n // However, it is specifically mentioned that this options should be used at own risk,\n // as it could cause performance issues.\n // See: https://material.angular.dev/components/sidenav/overview#resizing-an-open-sidenav\n //\n // So to work around this, a simple `resize` event is dispatched whenever the `size` input changes.\n // This works because `mat-drawer` uses `ViewportRuler` from `@angular/cdk/scrolling`\n // (see https://github.com/angular/components/blob/19.2.1/src/material/sidenav/drawer.ts#L811-L816)\n // to listen to `resize` events and re-calculates margins applied to the drawer content\n // (see https://github.com/angular/components/blob/20.0.0-rc.2/src/cdk/scrolling/viewport-ruler.ts#L50-L53).\n effect(() => {\n this.size();\n\n document.dispatchEvent(new Event('resize', { bubbles: true }));\n });\n }\n\n /** @ignore */\n handleDocumentClick(event: MouseEvent) {\n // Prevent closing when the click triggered a call to `open`\n if (this.bypassClickCheck) return;\n\n // Check if the click originated from within the drawer element\n const isClickInside = this.elementRef.nativeElement.contains(event.target);\n if (isClickInside) return;\n\n // Check if the click originated from within an overlay (such as a modal)\n const overlayContainerEl = this.overlayContainer.getContainerElement();\n const isOverlayClick = overlayContainerEl.contains(event.target as Node);\n if (isOverlayClick) return;\n\n // Click is allowed to close the drawer now\n this.close();\n }\n\n /** @ignore */\n handleEscKeyPressed() {\n this.close();\n }\n\n /** @ignore */\n ngOnDestroy(): void {\n if (WattDrawerComponent.currentDrawer === this) {\n WattDrawerComponent.currentDrawer = undefined;\n }\n }\n\n /** Opens the drawer. Subsequent calls are ignored while the drawer is opened. */\n open() {\n // Trap focus whenever open is called. This doesn't work on the\n // initial call (when first opening the drawer), but this is\n // handled by the autoFocus property on mat-drawer.\n this.cdkTrapFocus().focusTrap.focusInitialElementWhenReady();\n\n // Disable click outside check until the current event loop is finished.\n // This might seem hackish, but the order of execution is stable here.\n // Also prevents an issue when the drawer is destroyed and then recreated,\n // causing the click outside check to trigger immediately if the drawer\n // is created and opened in response to a click event.\n this.bypassClickCheck = true;\n setTimeout(() => {\n this.bypassClickCheck = false;\n }, 0);\n\n // Without `untracked`, if this is called in a reactive context (such as an `effect`),\n // it will be triggered twice due to `isOpen` being tracked and immediately updated.\n if (untracked(this.isOpen)) return;\n WattDrawerComponent.currentDrawer?.close();\n WattDrawerComponent.currentDrawer = this;\n this.writableIsOpen.set(true);\n }\n\n /** Closes the drawer. */\n close() {\n if (!untracked(this.isOpen)) return;\n WattDrawerComponent.currentDrawer = undefined;\n this.writableIsOpen.set(false);\n }\n}\n\nexport const WATT_DRAWER = [\n WattDrawerComponent,\n WattDrawerTopbarComponent,\n WattDrawerActionsComponent,\n WattDrawerContentComponent,\n WattDrawerHeadingComponent,\n];\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-drawer-container class=\"watt-drawer-container\" [hasBackdrop]=\"false\">\n <mat-drawer\n class=\"watt-drawer watt-space-inset-s watt-drawer--{{ size() }}\"\n mode=\"side\"\n position=\"end\"\n [opened]=\"isOpen()\"\n (closed)=\"closed.emit()\"\n [disableClose]=\"true\"\n [autoFocus]=\"true\"\n [cdkTrapFocus]=\"true\"\n >\n <div class=\"watt-drawer__grid-container\">\n <header>\n <ng-content select=\"watt-drawer-topbar\" />\n <watt-button class=\"close-btn\" variant=\"icon\" icon=\"close\" (click)=\"close()\" />\n </header>\n\n <article class=\"watt-drawer__content\">\n <div class=\"watt-drawer__actions\">\n <ng-content select=\"watt-drawer-heading\" />\n <ng-content select=\"watt-drawer-actions\" />\n </div>\n <ng-content select=\"watt-drawer-content\" />\n </article>\n </div>\n\n @if (loading()) {\n <div class=\"watt-drawer__spinner\">\n <watt-spinner />\n </div>\n }\n </mat-drawer>\n</mat-drawer-container>\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 { WattDrawerTopbarComponent } from './watt-drawer-topbar.component';\nexport { WattDrawerActionsComponent } from './watt-drawer-actions.component';\nexport { WattDrawerContentComponent } from './watt-drawer-content.component';\nexport { WattDrawerHeadingComponent } from './watt-drawer-heading.component';\nexport { WattDrawerComponent, WATT_DRAWER, W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kBAAkB,EAAE,6BAA6B;AACjD,wBAAA,kBAAkB,EAAE,uBAAuB;qBAC5C,EACQ,OAAA,EAAA,CAAC,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,EAAA,QAAA,EAAA,6nDAAA,EAAA,MAAA,EAAA,CAAA,m8BAAA,CAAA,EAAA;;AA4IvE,MAAA,WAAW,GAAG;IACzB,mBAAmB;IACnB,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;;;AEhN5B;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject, Directive, input, booleanAttribute, output, signal, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { NG_VALIDATORS, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { WattButtonComponent } from '@energinet/watt/button';
|
|
5
|
+
import { WattFieldComponent } from '@energinet/watt/field';
|
|
6
|
+
import { VaterStackComponent, VaterUtilityDirective } from '@energinet/watt/vater';
|
|
7
|
+
|
|
8
|
+
//#region License
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
12
|
+
*
|
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
14
|
+
* you may not use this file except in compliance with the License.
|
|
15
|
+
* You may obtain a copy of the License at
|
|
16
|
+
*
|
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
* See the License for the specific language governing permissions and
|
|
23
|
+
* limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
//#endregion
|
|
26
|
+
class WattDropZoneIntlService {
|
|
27
|
+
prompt = 'Drop file here';
|
|
28
|
+
promptMultiple = 'Drop files here';
|
|
29
|
+
separator = 'or';
|
|
30
|
+
button = 'Choose file';
|
|
31
|
+
buttonMultiple = 'Choose files';
|
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDropZoneIntlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
33
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDropZoneIntlService, providedIn: 'root' });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDropZoneIntlService, decorators: [{
|
|
36
|
+
type: Injectable,
|
|
37
|
+
args: [{ providedIn: 'root' }]
|
|
38
|
+
}] });
|
|
39
|
+
|
|
40
|
+
//#region License
|
|
41
|
+
/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
44
|
+
*
|
|
45
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
46
|
+
* you may not use this file except in compliance with the License.
|
|
47
|
+
* You may obtain a copy of the License at
|
|
48
|
+
*
|
|
49
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
+
*
|
|
51
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
52
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
53
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
54
|
+
* See the License for the specific language governing permissions and
|
|
55
|
+
* limitations under the License.
|
|
56
|
+
*/
|
|
57
|
+
//#endregion
|
|
58
|
+
/**
|
|
59
|
+
* Directive that validates the file type of provided files. This is automatically
|
|
60
|
+
* applied to the `WattDropZone` component via `hostDirectives`.
|
|
61
|
+
*/
|
|
62
|
+
class FileTypeValidator {
|
|
63
|
+
component = inject(WattDropZone, { host: true, self: true });
|
|
64
|
+
validate(control) {
|
|
65
|
+
const accept = this.component.accept();
|
|
66
|
+
return accept.length > 0 && control.value?.some((i) => !accept.includes(i.type))
|
|
67
|
+
? { type: true }
|
|
68
|
+
: null;
|
|
69
|
+
}
|
|
70
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FileTypeValidator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
71
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.1", type: FileTypeValidator, isStandalone: true, providers: [{ provide: NG_VALIDATORS, useExisting: FileTypeValidator, multi: true }], ngImport: i0 });
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: FileTypeValidator, decorators: [{
|
|
74
|
+
type: Directive,
|
|
75
|
+
args: [{
|
|
76
|
+
providers: [{ provide: NG_VALIDATORS, useExisting: FileTypeValidator, multi: true }],
|
|
77
|
+
}]
|
|
78
|
+
}] });
|
|
79
|
+
/**
|
|
80
|
+
* Directive validating that a single file is selected when `multiple` is false.
|
|
81
|
+
* This is automatically applied to the `WattDropZone` component via `hostDirectives`.
|
|
82
|
+
*/
|
|
83
|
+
class MultipleFilesValidator {
|
|
84
|
+
component = inject(WattDropZone, { host: true, self: true });
|
|
85
|
+
validate(control) {
|
|
86
|
+
const multiple = this.component.multiple();
|
|
87
|
+
return !multiple && control.value?.length !== 1 ? { multiple: true } : null;
|
|
88
|
+
}
|
|
89
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: MultipleFilesValidator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
90
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.1", type: MultipleFilesValidator, isStandalone: true, providers: [{ provide: NG_VALIDATORS, useExisting: MultipleFilesValidator, multi: true }], ngImport: i0 });
|
|
91
|
+
}
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: MultipleFilesValidator, decorators: [{
|
|
93
|
+
type: Directive,
|
|
94
|
+
args: [{
|
|
95
|
+
providers: [{ provide: NG_VALIDATORS, useExisting: MultipleFilesValidator, multi: true }],
|
|
96
|
+
}]
|
|
97
|
+
}] });
|
|
98
|
+
/** Validates that the file size is less than or equal to the specified maximum size. */
|
|
99
|
+
const limitFiles = (limit) => (control) => control.value?.length && control.value.length > limit ? { limit } : null;
|
|
100
|
+
/** Validates that the file size is less than or equal to the specified maximum size. */
|
|
101
|
+
const maxFileSize = (size) => (control) => control.value?.some((file) => file.size > size) ? { size } : null;
|
|
102
|
+
|
|
103
|
+
//#region License
|
|
104
|
+
/**
|
|
105
|
+
* @license
|
|
106
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
107
|
+
*
|
|
108
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
109
|
+
* you may not use this file except in compliance with the License.
|
|
110
|
+
* You may obtain a copy of the License at
|
|
111
|
+
*
|
|
112
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
113
|
+
*
|
|
114
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
115
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
116
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
117
|
+
* See the License for the specific language governing permissions and
|
|
118
|
+
* limitations under the License.
|
|
119
|
+
*/
|
|
120
|
+
//#endregion
|
|
121
|
+
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
122
|
+
class WattDropZone {
|
|
123
|
+
intl = inject(WattDropZoneIntlService);
|
|
124
|
+
/** Whether the dropzone should accept multiple files. */
|
|
125
|
+
multiple = input(false, { transform: booleanAttribute });
|
|
126
|
+
/** Label for the dropzone. */
|
|
127
|
+
label = input();
|
|
128
|
+
/** Comma-separated list of MIME types that the dropzone accepts. */
|
|
129
|
+
accept = input([], { transform: (value) => value.split(',') });
|
|
130
|
+
/** Emits when one or more files are selected. */
|
|
131
|
+
selected = output();
|
|
132
|
+
// Tracks (valid) drag over state
|
|
133
|
+
dragOver = signal(false);
|
|
134
|
+
handleFiles(files) {
|
|
135
|
+
if (!files)
|
|
136
|
+
return;
|
|
137
|
+
this.selected.emit(Array.from(files));
|
|
138
|
+
}
|
|
139
|
+
handleDrop(event) {
|
|
140
|
+
if (!event.dataTransfer)
|
|
141
|
+
return;
|
|
142
|
+
if (!this.dragOver())
|
|
143
|
+
return;
|
|
144
|
+
// Prevent opening the file in the browser
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
this.handleFiles(event.dataTransfer.files);
|
|
147
|
+
}
|
|
148
|
+
handleDragOver(event) {
|
|
149
|
+
if (!event.dataTransfer)
|
|
150
|
+
return;
|
|
151
|
+
// Ignore non-file items such as strings
|
|
152
|
+
if (Array.from(event.dataTransfer.items).some((i) => i.kind !== 'file'))
|
|
153
|
+
return;
|
|
154
|
+
// Prevent opening the file in the browser
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
this.dragOver.set(true);
|
|
157
|
+
}
|
|
158
|
+
// Implementation for ControlValueAccessor
|
|
159
|
+
writeValue = () => { }; // eslint-disable-line @typescript-eslint/no-empty-function
|
|
160
|
+
registerOnTouched = (fn) => this.selected.subscribe(fn);
|
|
161
|
+
registerOnChange = (fn) => this.selected.subscribe(fn);
|
|
162
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDropZone, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: WattDropZone, isStandalone: true, selector: "watt-dropzone", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, providers: [
|
|
164
|
+
{
|
|
165
|
+
provide: NG_VALUE_ACCESSOR,
|
|
166
|
+
useExisting: forwardRef(() => WattDropZone),
|
|
167
|
+
multi: true,
|
|
168
|
+
},
|
|
169
|
+
], hostDirectives: [{ directive: FileTypeValidator }, { directive: MultipleFilesValidator }], ngImport: i0, template: `
|
|
170
|
+
<watt-field [label]="label()">
|
|
171
|
+
<ng-content />
|
|
172
|
+
<ng-content select="watt-field-error" ngProjectAs="watt-field-error" />
|
|
173
|
+
<ng-content select="watt-field-hint" ngProjectAs="watt-field-hint" />
|
|
174
|
+
<span class="wrapper">
|
|
175
|
+
<vater-stack
|
|
176
|
+
inset="0"
|
|
177
|
+
class="dropzone"
|
|
178
|
+
[class.dragOver]="dragOver()"
|
|
179
|
+
(dragover)="handleDragOver($event)"
|
|
180
|
+
(drop)="handleDrop($event)"
|
|
181
|
+
(drop)="dragOver.set(false)"
|
|
182
|
+
(dragleave)="dragOver.set(false)"
|
|
183
|
+
>
|
|
184
|
+
<vater-stack center gap="xs">
|
|
185
|
+
<input
|
|
186
|
+
#input
|
|
187
|
+
hidden
|
|
188
|
+
type="file"
|
|
189
|
+
[multiple]="multiple()"
|
|
190
|
+
[accept]="accept().join(',')"
|
|
191
|
+
(change)="handleFiles(input.files)"
|
|
192
|
+
/>
|
|
193
|
+
<span>{{ multiple() ? intl.promptMultiple : intl.prompt }}</span>
|
|
194
|
+
<span class="watt-on-light--medium-emphasis">{{ intl.separator }}</span>
|
|
195
|
+
<watt-button size="small" variant="secondary" (click)="input.click()">
|
|
196
|
+
{{ multiple() ? intl.buttonMultiple : intl.button }}
|
|
197
|
+
</watt-button>
|
|
198
|
+
</vater-stack>
|
|
199
|
+
</vater-stack>
|
|
200
|
+
</span>
|
|
201
|
+
</watt-field>
|
|
202
|
+
`, isInline: true, styles: [".wrapper{display:block;min-height:184px}.dropzone{background:var(--watt-color-neutral-grey-200)}.dragOver{background:var(--watt-color-state-info-light)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: VaterStackComponent, selector: "vater-stack, [vater-stack]", inputs: ["align", "direction", "gap", "justify", "offset"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "size", "type", "formId", "disabled", "loading"] }, { kind: "component", type: WattFieldComponent, selector: "watt-field", inputs: ["control", "label", "id", "chipMode", "tooltip", "placeholder", "anchorName"] }] });
|
|
203
|
+
}
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattDropZone, decorators: [{
|
|
205
|
+
type: Component,
|
|
206
|
+
args: [{ imports: [
|
|
207
|
+
ReactiveFormsModule,
|
|
208
|
+
VaterStackComponent,
|
|
209
|
+
VaterUtilityDirective,
|
|
210
|
+
WattButtonComponent,
|
|
211
|
+
WattFieldComponent,
|
|
212
|
+
], selector: 'watt-dropzone', hostDirectives: [FileTypeValidator, MultipleFilesValidator], providers: [
|
|
213
|
+
{
|
|
214
|
+
provide: NG_VALUE_ACCESSOR,
|
|
215
|
+
useExisting: forwardRef(() => WattDropZone),
|
|
216
|
+
multi: true,
|
|
217
|
+
},
|
|
218
|
+
], template: `
|
|
219
|
+
<watt-field [label]="label()">
|
|
220
|
+
<ng-content />
|
|
221
|
+
<ng-content select="watt-field-error" ngProjectAs="watt-field-error" />
|
|
222
|
+
<ng-content select="watt-field-hint" ngProjectAs="watt-field-hint" />
|
|
223
|
+
<span class="wrapper">
|
|
224
|
+
<vater-stack
|
|
225
|
+
inset="0"
|
|
226
|
+
class="dropzone"
|
|
227
|
+
[class.dragOver]="dragOver()"
|
|
228
|
+
(dragover)="handleDragOver($event)"
|
|
229
|
+
(drop)="handleDrop($event)"
|
|
230
|
+
(drop)="dragOver.set(false)"
|
|
231
|
+
(dragleave)="dragOver.set(false)"
|
|
232
|
+
>
|
|
233
|
+
<vater-stack center gap="xs">
|
|
234
|
+
<input
|
|
235
|
+
#input
|
|
236
|
+
hidden
|
|
237
|
+
type="file"
|
|
238
|
+
[multiple]="multiple()"
|
|
239
|
+
[accept]="accept().join(',')"
|
|
240
|
+
(change)="handleFiles(input.files)"
|
|
241
|
+
/>
|
|
242
|
+
<span>{{ multiple() ? intl.promptMultiple : intl.prompt }}</span>
|
|
243
|
+
<span class="watt-on-light--medium-emphasis">{{ intl.separator }}</span>
|
|
244
|
+
<watt-button size="small" variant="secondary" (click)="input.click()">
|
|
245
|
+
{{ multiple() ? intl.buttonMultiple : intl.button }}
|
|
246
|
+
</watt-button>
|
|
247
|
+
</vater-stack>
|
|
248
|
+
</vater-stack>
|
|
249
|
+
</span>
|
|
250
|
+
</watt-field>
|
|
251
|
+
`, styles: [".wrapper{display:block;min-height:184px}.dropzone{background:var(--watt-color-neutral-grey-200)}.dragOver{background:var(--watt-color-state-info-light)}\n"] }]
|
|
252
|
+
}] });
|
|
253
|
+
|
|
254
|
+
//#region License
|
|
255
|
+
/**
|
|
256
|
+
* @license
|
|
257
|
+
* Copyright 2020 Energinet DataHub A/S
|
|
258
|
+
*
|
|
259
|
+
* Licensed under the Apache License, Version 2.0 (the "License2");
|
|
260
|
+
* you may not use this file except in compliance with the License.
|
|
261
|
+
* You may obtain a copy of the License at
|
|
262
|
+
*
|
|
263
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
264
|
+
*
|
|
265
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
266
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
267
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
|
+
* See the License for the specific language governing permissions and
|
|
269
|
+
* limitations under the License.
|
|
270
|
+
*/
|
|
271
|
+
//#endregion
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Generated bundle index. Do not edit.
|
|
275
|
+
*/
|
|
276
|
+
|
|
277
|
+
export { FileTypeValidator, MultipleFilesValidator, WattDropZone, WattDropZoneIntlService, limitFiles, maxFileSize };
|
|
278
|
+
//# sourceMappingURL=energinet-watt-dropzone.mjs.map
|
|
@@ -0,0 +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}\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 { 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 ],\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 background: var(--watt-color-neutral-grey-200);\n }\n\n .dragOver {\n background: var(--watt-color-state-info-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 <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 </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 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;uGALpB,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,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CA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A,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,mBAAmB,sIACnB,kBAAkB,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,SAAA,EAAA,OAAA,EAAA,IAAA,EAAA,UAAA,EAAA,SAAA,EAAA,aAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FA6DT,YAAY,EAAA,UAAA,EAAA,CAAA;kBAnExB,SAAS;AACC,YAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EAAA;wBACP,mBAAmB;wBACnB,mBAAmB;wBACnB,qBAAqB;wBACrB,mBAAmB;wBACnB,kBAAkB;AACnB,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,EAeS,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,4JAAA,CAAA,EAAA;;;ACrGH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
@@ -38,7 +38,7 @@ class WattExpansionComponent {
|
|
|
38
38
|
matExpansionPanel.close();
|
|
39
39
|
}
|
|
40
40
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattExpansionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattExpansionComponent, isStandalone: true, selector: "watt-expansion", inputs: { openLabel: "openLabel", closeLabel: "closeLabel", expanded: "expanded" }, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-expansion-panel hideToggle #expansion=\"matExpansionPanel\" [expanded]=\"expanded\">\n <mat-expansion-panel-header>\n <watt-button icon=\"plus\" aria-hidden=\"true\">{{ openLabel }}</watt-button>\n </mat-expansion-panel-header>\n\n <ng-content />\n\n <mat-action-row>\n <watt-button icon=\"minus\" (click)=\"onClose(expansion)\">{{ closeLabel }}</watt-button>\n </mat-action-row>\n</mat-expansion-panel>\n", styles: ["watt-expansion .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header{padding:0;background:none!important}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header .mat-content{justify-content:end}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header button{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out}watt-expansion mat-action-row.mat-action-row{padding:16px 0;border:none}watt-expansion .mat-expanded mat-expansion-panel-header{overflow:hidden}watt-expansion .mat-expanded mat-expansion-panel-header button{transform:translate3d(0,100%,0)}watt-expansion watt-button watt-text-button button.watt-button:focus{outline:none}watt-expansion .mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:0}\n"], dependencies: [{ kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "directive", type: i1.MatExpansionPanelActionRow, selector: "mat-action-row" }, { kind: "component", type: i1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "type", "formId", "disabled", "loading"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
41
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: WattExpansionComponent, isStandalone: true, selector: "watt-expansion", inputs: { openLabel: "openLabel", closeLabel: "closeLabel", expanded: "expanded" }, ngImport: i0, template: "<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-expansion-panel hideToggle #expansion=\"matExpansionPanel\" [expanded]=\"expanded\">\n <mat-expansion-panel-header>\n <watt-button icon=\"plus\" aria-hidden=\"true\">{{ openLabel }}</watt-button>\n </mat-expansion-panel-header>\n\n <ng-content />\n\n <mat-action-row>\n <watt-button icon=\"minus\" (click)=\"onClose(expansion)\">{{ closeLabel }}</watt-button>\n </mat-action-row>\n</mat-expansion-panel>\n", styles: ["watt-expansion .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header{padding:0;background:none!important}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header .mat-content{justify-content:end}watt-expansion mat-expansion-panel-header.mat-expansion-panel-header button{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out}watt-expansion mat-action-row.mat-action-row{padding:16px 0;border:none}watt-expansion .mat-expanded mat-expansion-panel-header{overflow:hidden}watt-expansion .mat-expanded mat-expansion-panel-header button{transform:translate3d(0,100%,0)}watt-expansion watt-button watt-text-button button.watt-button:focus{outline:none}watt-expansion .mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:0}\n"], dependencies: [{ kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i1.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "directive", type: i1.MatExpansionPanelActionRow, selector: "mat-action-row" }, { kind: "component", type: i1.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "component", type: WattButtonComponent, selector: "watt-button", inputs: ["icon", "variant", "size", "type", "formId", "disabled", "loading"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
42
42
|
}
|
|
43
43
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: WattExpansionComponent, decorators: [{
|
|
44
44
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-expansion.mjs","sources":["../../../libs/watt/package/expansion/expansion.component.ts","../../../libs/watt/package/expansion/expansion.component.html","../../../libs/watt/package/expansion/index.ts","../../../libs/watt/package/expansion/energinet-watt-expansion.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, Input, ViewEncapsulation } from '@angular/core';\nimport { MatExpansionPanel, MatExpansionModule } from '@angular/material/expansion';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\n/**\n * Usage:\n * `import { WattExpansionComponent } from '@energinet-datahub/watt/expansion';`\n */\n@Component({\n selector: 'watt-expansion',\n styleUrls: ['./expansion.component.scss'],\n templateUrl: './expansion.component.html',\n encapsulation: ViewEncapsulation.None,\n imports: [MatExpansionModule, WattButtonComponent],\n})\nexport class WattExpansionComponent {\n @Input() openLabel = '';\n @Input() closeLabel = '';\n @Input() expanded = false;\n\n /**\n * @ignore\n * @param matExpansionPanel\n */\n onClose(matExpansionPanel: MatExpansionPanel) {\n matExpansionPanel.close();\n }\n}\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-expansion-panel hideToggle #expansion=\"matExpansionPanel\" [expanded]=\"expanded\">\n <mat-expansion-panel-header>\n <watt-button icon=\"plus\" aria-hidden=\"true\">{{ openLabel }}</watt-button>\n </mat-expansion-panel-header>\n\n <ng-content />\n\n <mat-action-row>\n <watt-button icon=\"minus\" (click)=\"onClose(expansion)\">{{ closeLabel }}</watt-button>\n </mat-action-row>\n</mat-expansion-panel>\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 { WattExpansionComponent } from './expansion.component';\n","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A,MAAA,EAAA,CAAA,y1BAAA,CAAA,EAAA;8BAGzC,SAAS,EAAA,CAAA;sBAAjB;gBACQ,UAAU,EAAA,CAAA;sBAAlB;gBACQ,QAAQ,EAAA,CAAA;sBAAhB;;;AEpCH;AACA;;;;;;;;;;;;;;;AAeG;AACH;;ACjBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-expansion.mjs","sources":["../../../libs/watt/package/expansion/expansion.component.ts","../../../libs/watt/package/expansion/expansion.component.html","../../../libs/watt/package/expansion/index.ts","../../../libs/watt/package/expansion/energinet-watt-expansion.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, Input, ViewEncapsulation } from '@angular/core';\nimport { MatExpansionPanel, MatExpansionModule } from '@angular/material/expansion';\nimport { WattButtonComponent } from '@energinet/watt/button';\n\n/**\n * Usage:\n * `import { WattExpansionComponent } from '@energinet-datahub/watt/expansion';`\n */\n@Component({\n selector: 'watt-expansion',\n styleUrls: ['./expansion.component.scss'],\n templateUrl: './expansion.component.html',\n encapsulation: ViewEncapsulation.None,\n imports: [MatExpansionModule, WattButtonComponent],\n})\nexport class WattExpansionComponent {\n @Input() openLabel = '';\n @Input() closeLabel = '';\n @Input() expanded = false;\n\n /**\n * @ignore\n * @param matExpansionPanel\n */\n onClose(matExpansionPanel: MatExpansionPanel) {\n matExpansionPanel.close();\n }\n}\n","<!--\n@license\nCopyright 2020 Energinet DataHub A/S\n\nLicensed under the Apache License, Version 2.0 (the \"License2\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n<mat-expansion-panel hideToggle #expansion=\"matExpansionPanel\" [expanded]=\"expanded\">\n <mat-expansion-panel-header>\n <watt-button icon=\"plus\" aria-hidden=\"true\">{{ openLabel }}</watt-button>\n </mat-expansion-panel-header>\n\n <ng-content />\n\n <mat-action-row>\n <watt-button icon=\"minus\" (click)=\"onClose(expansion)\">{{ closeLabel }}</watt-button>\n </mat-action-row>\n</mat-expansion-panel>\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 { WattExpansionComponent } from './expansion.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAKA;;;AAGG;MAQU,sBAAsB,CAAA;IACxB,SAAS,GAAG,EAAE;IACd,UAAU,GAAG,EAAE;IACf,QAAQ,GAAG,KAAK;AAEzB;;;AAGG;AACH,IAAA,OAAO,CAAC,iBAAoC,EAAA;QAC1C,iBAAiB,CAAC,KAAK,EAAE;;uGAVhB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAtB,IAAA,OAAA,IAAA,GAAA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