UNPKG

@edugouvfr/ngx-dsfr

Version:

NgxDsfr est un portage Angular des éléments d'interface du Système de Design de l'État Français (DSFR).

1,039 lines (1,014 loc) 1 MB
import * as i1 from '@angular/common'; import { CommonModule, NgOptimizedImage, DOCUMENT, KeyValuePipe } from '@angular/common'; import * as i0 from '@angular/core'; import { Component, Input, ViewEncapsulation, NgModule, Directive, HostBinding, EventEmitter, Output, InjectionToken, Optional, Injectable, Inject, Pipe, inject, Renderer2, ViewChild, viewChild, ElementRef, signal, CUSTOM_ELEMENTS_SCHEMA, contentChildren, effect, afterNextRender, ContentChildren, forwardRef, ChangeDetectionStrategy, computed, ContentChild, input, ViewContainerRef, ChangeDetectorRef, ViewChildren, HostListener } from '@angular/core'; import { v4 } from 'uuid'; import * as i1$1 from '@angular/router'; import { RouterModule } from '@angular/router'; import { BehaviorSubject, Observable, merge, Subject, skip, takeUntil, combineLatest, map } from 'rxjs'; import { fromFetch } from 'rxjs/internal/observable/dom/fetch'; import * as i2 from '@angular/forms'; import { FormsModule, NG_VALUE_ACCESSOR, Validators, ReactiveFormsModule, NG_VALIDATORS } from '@angular/forms'; import * as i1$2 from '@angular/platform-browser'; import { toObservable } from '@angular/core/rxjs-interop'; /** * @since 0.7 */ class DateUtils { constructor() { } /** * Transforme un string représentant une date au format `'dd/mm/yyyy'` en objet `Date`. * Le siècle peut-être sur 2 digits, dans ce cas, cela correspond à `'19yy'`. * @returns Date ou undefined */ static parseDateFr(dateStr) { const regexp = /^(?<day>3[01]|0?[1-9]|[12][0-9])\/(?<month>1[0-2]|0?[1-9])\/(?<year>[0-9]{4})$/; return DateUtils.parseDate(dateStr, regexp); } /** * Transforme un string représentant une date au format ISO 8601 en objet `Date`. * @returns Date ou undefined */ static parseDateIso(dateStr, withHours = false) { // https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html const regexp = /^(?<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?<month>1[0-2]|0[1-9])-(?<day>3[01]|0[1-9]|[12][0-9])(T(?<hour>2[0-4]|[01][0-9]):(?<minute>[0-5][0-9]):(?<second>[0-5][0-9])(?<ms>\.[0-9]+)?(?<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?)?$/; return DateUtils.parseDate(dateStr, regexp, withHours); } /** * Retourne une Date UTC, sans heure, minute seconde, à partir d'une date * @param date */ static date2Utc(date, withHours = false) { if (withHours) { return this.createDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours()); } else { return this.createDate(date.getFullYear(), date.getMonth(), date.getDate()); } } /** * Retourne une Date UTC, sans heure, minute seconde, selon plusieurs formats en entrée * @param value */ static dateUtcOf(value) { let date = undefined; if (typeof value === 'string') date = DateUtils.parseDateIso(value); else if (typeof value === 'number') date = DateUtils.numberToDateUtc(value); else if (value) date = DateUtils.date2Utc(value); return date; } /** * Retourne une Date UTC, sans minute et seconde, selon plusieurs formats en entrée * @param value */ static dateUtcOfWithHours(value) { let date = undefined; if (typeof value === 'string') date = DateUtils.parseDateIso(value, true); else if (typeof value === 'number') date = DateUtils.numberToDateUtc(value, true); else if (value) date = DateUtils.date2Utc(value, true); return date; } static isTwoDigitsYear(year) { return year >= 0 && year < 100; } /** * Permet de créer une date avec un année contenant seulement un ou deux digits (i.e: année 27) * * @param year Année, possiblement négative. * @param month Mois * @param day Jour * @param hour Heure * @param needsOffsetting Défini si la date créée à besoin d'être basculée à minuit, heure locale * @returns La date correspondant aux paramètres d'entrée */ static createDate(year, month, day, hour = 0, needsOffsetting = true) { const date = needsOffsetting ? new Date(Date.UTC(year, month, day, hour)) : new Date(year, month, day, hour); if (this.isTwoDigitsYear(year)) { date.setFullYear(year); } return date; } static parseDate(dateStr, regexp, withHours = false) { if (!dateStr) return undefined; const execArr = regexp.exec(dateStr); const groups = execArr?.groups; const valid = !!groups && !!groups['year'] && !!groups['month'] && !!groups['day']; if (!valid) { return undefined; } else if (withHours) { const offset = groups['timezone'] === 'Z' ? 0 : Number(groups['timezone'].split(':')[0]); return this.createDate(Number(groups['year']), Number(groups['month']) - 1, Number(groups['day']), Number(groups['hour']) + offset); } else { return this.createDate(Number(groups['year']), Number(groups['month']) - 1, Number(groups['day'])); } } static numberToDateUtc(n, withHours = false) { const d = new Date(n); if (withHours) { return this.createDate(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours()); } else { return this.createDate(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()); } } } class DomUtils { constructor() { } static surroundElementsWithLi(container, elements) { DomUtils.removeEmptyLi(container); for (const elem of elements) { if (elem.nativeElement?.parentElement?.tagName !== 'LI') { DomUtils.insertNodeInLi(elem.nativeElement); } } } static surroundNativeElementsWithLi(container, elements) { DomUtils.removeEmptyLi(container); for (const elem of elements) { if (elem?.parentElement?.tagName !== 'LI' && elem?.tagName !== 'LI') { DomUtils.insertNodeInLi(elem); } } } static removeEmptyLi({ nativeElement }) { const nonProgrammaticLiElements = nativeElement.querySelectorAll('li[data-ngx-dsfr-li]'); nonProgrammaticLiElements.forEach((li) => { if (li.childElementCount === 0) { li.remove(); } }); } static insertNodeInLi(child) { const li = document.createElement('li'); li.setAttribute('data-ngx-dsfr-li', 'true'); child.replaceWith(li); // Ne remplace pas l'élément en lui même mais modifie la Node parent de l'élément: https://developer.mozilla.org/fr/docs/Web/API/Element/replaceWith li.appendChild(child); } } /** * Les types MIME de fichiers supportés par le composant. * * @see https://developer.mozilla.org/fr/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types */ var DsfrMimeTypeConst; (function (DsfrMimeTypeConst) { // TEXT DsfrMimeTypeConst["TEXT_CSS"] = "text/css"; DsfrMimeTypeConst["TEXT_CSV"] = "text/csv"; DsfrMimeTypeConst["TEXT_HTML"] = "text/html"; DsfrMimeTypeConst["TEXT_CALENDAR"] = "text/calendar"; DsfrMimeTypeConst["TEXT_PLAIN"] = "text/plain"; DsfrMimeTypeConst["TEXT_XML"] = "text/xml"; // FONT DsfrMimeTypeConst["FONT_OTF"] = "font/otf"; DsfrMimeTypeConst["FONT_TTF"] = "font/ttf"; DsfrMimeTypeConst["FONT_WOFF"] = "font/woff"; DsfrMimeTypeConst["FONT_WOFF2"] = "font/woff2"; // IMAGE DsfrMimeTypeConst["IMAGE_BMP"] = "image/bmp"; DsfrMimeTypeConst["IMAGE_GIF"] = "image/gif"; DsfrMimeTypeConst["IMAGE_ICON"] = "image/x-icon"; DsfrMimeTypeConst["IMAGE_JPEG"] = "image/jpeg"; DsfrMimeTypeConst["IMAGE_PNG"] = "image/png"; DsfrMimeTypeConst["IMAGE_SVG"] = "image/svg+xml"; DsfrMimeTypeConst["IMAGE_TIFF"] = "image/tiff"; DsfrMimeTypeConst["IMAGE_WEBP"] = "image/webp"; // AUDIO DsfrMimeTypeConst["AUDIO_3GPP"] = "audio/3gpp"; DsfrMimeTypeConst["AUDIO_3GPP2"] = "audio/3gpp2"; DsfrMimeTypeConst["AUDIO_ACC"] = "audio/aac"; DsfrMimeTypeConst["AUDIO_OGG"] = "audio/ogg"; DsfrMimeTypeConst["AUDIO_MIDI"] = "audio/midi"; DsfrMimeTypeConst["AUDIO_WAV"] = "audio/x-wav"; DsfrMimeTypeConst["AUDIO_WEBM"] = "audio/webm"; // VIDEO DsfrMimeTypeConst["VIDEO_3GPP"] = "video/3gpp"; DsfrMimeTypeConst["VIDEO_3GPP2"] = "video/3gpp2"; DsfrMimeTypeConst["VIDEO_MPEG"] = "video/mpeg"; DsfrMimeTypeConst["VIDEO_OGG"] = "video/ogg"; DsfrMimeTypeConst["VIDEO_WEBM"] = "video/webm"; // APPLICATION DsfrMimeTypeConst["APPLICATION_ABIWORD"] = "application/x-abiword"; DsfrMimeTypeConst["APPLICATION_CSH"] = "application/x-csh"; DsfrMimeTypeConst["APPLICATION_EPUB"] = "application/epub+zip"; DsfrMimeTypeConst["APPLICATION_FLASH"] = "application/x-shockwave-flash"; DsfrMimeTypeConst["APPLICATION_FORM_URLENCODED"] = "application/x-www-form-urlencoded"; DsfrMimeTypeConst["APPLICATION_JAVASCRIPT"] = "application/javascript"; DsfrMimeTypeConst["APPLICATION_JSON"] = "application/json"; DsfrMimeTypeConst["APPLICATION_OCTET_STREAM"] = "application/octet-stream"; DsfrMimeTypeConst["APPLICATION_OGG"] = "application/ogg"; DsfrMimeTypeConst["APPLICATION_PDF"] = "application/pdf"; DsfrMimeTypeConst["APPLICATION_RTF"] = "application/rtf"; DsfrMimeTypeConst["APPLICATION_TYPESCRIPT"] = "application/typescript"; DsfrMimeTypeConst["APPLICATION_XML"] = "application/xml"; DsfrMimeTypeConst["APPLICATION_XML_ATOM"] = "application/atom+xml"; DsfrMimeTypeConst["APPLICATION_XML_SVG"] = "application/svg+xml"; DsfrMimeTypeConst["APPLICATION_XML_XHTML"] = "application/xhtml+xml"; DsfrMimeTypeConst["APPLICATION_XML_XUL"] = "application/vnd.mozilla.xul+xml"; // ARCHIVE DsfrMimeTypeConst["ARCHIVE_7Z_COMPRESSED"] = "application/x-7z-compressed"; DsfrMimeTypeConst["ARCHIVE_BZIP"] = "application/x-bzip"; DsfrMimeTypeConst["ARCHIVE_BZIP2"] = "application/x-bzip2"; DsfrMimeTypeConst["ARCHIVE_JAVA"] = "application/java-archive"; DsfrMimeTypeConst["ARCHIVE_GZIP"] = "application/gzip"; DsfrMimeTypeConst["ARCHIVE_RAR_COMPRESSED"] = "application/x-rar-compressed"; DsfrMimeTypeConst["ARCHIVE_TAR"] = "application/x-tar"; DsfrMimeTypeConst["ARCHIVE_RAR"] = "application/vnd.rar"; DsfrMimeTypeConst["ARCHIVE_ZIP"] = "application/zip"; DsfrMimeTypeConst["ARCHIVE_ZIP_COMPRESSED"] = "application/x-zip-compressed"; // MICROSOFT DsfrMimeTypeConst["MS_FONT_OBJECT"] = "application/vnd.ms-fontobject"; DsfrMimeTypeConst["MS_EXCEL"] = "application/vnd.ms-excel"; DsfrMimeTypeConst["MS_EXCEL_XML"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; DsfrMimeTypeConst["MS_POWERPOINT"] = "application/vnd.ms-powerpoint"; DsfrMimeTypeConst["MS_POWERPOINT_XML"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; DsfrMimeTypeConst["MS_VIDEO"] = "video/x-msvideo"; DsfrMimeTypeConst["MS_VISIO"] = "application/vnd.visio"; DsfrMimeTypeConst["MS_WORD"] = "application/msword"; DsfrMimeTypeConst["MS_WORD_XML"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; // Autres DsfrMimeTypeConst["MULTIPART_FORM_DATA"] = "multipart/form-data"; DsfrMimeTypeConst["SCRIPT_SHELL"] = "application/x-sh"; DsfrMimeTypeConst["OPEN_PRESENTATION"] = "application/vnd.oasis.opendocument.presentation"; DsfrMimeTypeConst["OPEN_SPREADSHEET"] = "application/vnd.oasis.opendocument.spreadsheet"; DsfrMimeTypeConst["OPEN_TEXT"] = "application/vnd.oasis.opendocument.text"; })(DsfrMimeTypeConst || (DsfrMimeTypeConst = {})); /** * Fonction utilitaire * * @ignore */ function convertMimeType2FileFormat(mineType) { const element = mimeType2FileFormat.find((e) => e[0] === mineType); return element ? element[1] : undefined; } /** * @ignore */ var FileFormat; (function (FileFormat) { FileFormat["XLS"] = "XLS"; FileFormat["XLSX"] = "XLSX"; FileFormat["PPT"] = "PPT"; FileFormat["PPTX"] = "PPTX"; FileFormat["DOC"] = "DOC"; FileFormat["DOCX"] = "DOCX"; FileFormat["ODS"] = "ODS"; FileFormat["ODP"] = "ODP"; FileFormat["ODT"] = "ODT"; FileFormat["XML"] = "XML"; FileFormat["JPG"] = "JPG"; FileFormat["PNG"] = "PNG"; FileFormat["PDF"] = "PDF"; FileFormat["CSV"] = "CSV"; FileFormat["HTML"] = "HTML"; FileFormat["SVG"] = "SVG"; FileFormat["TXT"] = "TXT"; FileFormat["ZIP"] = "ZIP"; FileFormat["SEVEN_ZIP"] = "7Z"; FileFormat["RAR"] = "RAR"; FileFormat["XHTML"] = "XHTML"; FileFormat["BMP"] = "BMP"; FileFormat["GIF"] = "GIF"; FileFormat["TIF"] = "TIF"; FileFormat["RTF"] = "RTF"; FileFormat["GZIP"] = "GZIP"; FileFormat["TAR"] = "TAR"; })(FileFormat || (FileFormat = {})); /** * @ignore */ const mimeType2FileFormat = [ [DsfrMimeTypeConst.APPLICATION_PDF, FileFormat.PDF], [DsfrMimeTypeConst.APPLICATION_RTF, FileFormat.RTF], [DsfrMimeTypeConst.APPLICATION_XML, FileFormat.XML], [DsfrMimeTypeConst.APPLICATION_XML_ATOM, FileFormat.XML], [DsfrMimeTypeConst.APPLICATION_XML_XHTML, FileFormat.XHTML], [DsfrMimeTypeConst.ARCHIVE_7Z_COMPRESSED, FileFormat.SEVEN_ZIP], [DsfrMimeTypeConst.ARCHIVE_GZIP, FileFormat.GZIP], [DsfrMimeTypeConst.ARCHIVE_RAR, FileFormat.RAR], [DsfrMimeTypeConst.ARCHIVE_TAR, FileFormat.TAR], [DsfrMimeTypeConst.ARCHIVE_ZIP, FileFormat.ZIP], [DsfrMimeTypeConst.ARCHIVE_ZIP_COMPRESSED, FileFormat.ZIP], [DsfrMimeTypeConst.IMAGE_BMP, FileFormat.BMP], [DsfrMimeTypeConst.IMAGE_GIF, FileFormat.GIF], [DsfrMimeTypeConst.IMAGE_JPEG, FileFormat.JPG], [DsfrMimeTypeConst.IMAGE_PNG, FileFormat.PNG], [DsfrMimeTypeConst.IMAGE_SVG, FileFormat.SVG], [DsfrMimeTypeConst.IMAGE_TIFF, FileFormat.TIF], [DsfrMimeTypeConst.MS_EXCEL, FileFormat.XLS], [DsfrMimeTypeConst.MS_EXCEL_XML, FileFormat.XLSX], [DsfrMimeTypeConst.MS_POWERPOINT, FileFormat.PPT], [DsfrMimeTypeConst.MS_POWERPOINT_XML, FileFormat.PPTX], [DsfrMimeTypeConst.MS_WORD, FileFormat.DOC], [DsfrMimeTypeConst.MS_WORD_XML, FileFormat.DOCX], [DsfrMimeTypeConst.OPEN_PRESENTATION, FileFormat.ODP], [DsfrMimeTypeConst.OPEN_SPREADSHEET, FileFormat.ODS], [DsfrMimeTypeConst.OPEN_TEXT, FileFormat.ODT], [DsfrMimeTypeConst.TEXT_CSV, FileFormat.CSV], [DsfrMimeTypeConst.TEXT_HTML, FileFormat.HTML], [DsfrMimeTypeConst.TEXT_PLAIN, FileFormat.TXT], [DsfrMimeTypeConst.TEXT_XML, FileFormat.XML], ]; const KILO_OCTETS = 1024; const MEGA_OCTETS = KILO_OCTETS * 1024; const GIGA_OCTETS = MEGA_OCTETS * 1024; /** * Construit le libellé de détail dans un composant de téléchargement lorsque ce libellé n'est pas fourni par le Dsfr * @param mimeType Type mime du fichier * @param sizeBytes Nombre d'octets * @param sizeUnit Unité utilisée dans la restitution * @return par exemple 'PDF - 10 octets' */ function downloadDetail(mimeType, sizeBytes, sizeUnit) { return !sizeBytes ? convertMimeType2FileFormat(mimeType) || '' : convertMimeType2FileFormat(mimeType) + ' - ' + fileSizeToString(sizeBytes, sizeUnit); } /** * Retourne la taille sous forme de string sous forme de 'nombre unité' * @param bytes Taille à transformer exprimée en octets * @param sizeUnit Si true, l'unité sera en bytes (KB, MB, ... ) sinon en octets (ko, mo, ...) */ function fileSizeToString(bytes, sizeUnit) { if (!bytes) return ''; const bytesUnit = sizeUnit === 'bytes'; let fileSize; let fileSizeUnit; if (bytes < KILO_OCTETS) { fileSize = bytes; fileSizeUnit = bytesUnit ? FileSizeUnit.BYTES : FileSizeUnit.OCTETS; } else if (bytes < MEGA_OCTETS) { fileSize = bytes / 1024; fileSizeUnit = bytesUnit ? FileSizeUnit.KB : FileSizeUnit.KO; } else if (bytes < GIGA_OCTETS) { fileSize = bytes / 1048576; fileSizeUnit = bytesUnit ? FileSizeUnit.MB : FileSizeUnit.MO; } else { fileSize = bytes / 1073741824; fileSizeUnit = bytesUnit ? FileSizeUnit.GB : FileSizeUnit.GO; } fileSize = Math.round(fileSize * 100) / 100; // since 1.8, les options régionales sont prise en compte pour les décimales //FIXME: ne devrait-ton pas transmettre la locale depuis l'extérieur de manière à pouvoir la transmettre depuis i18nService ? const localSize = fileSize.toLocaleString(); return localSize + ' ' + fileSizeUnit; } // -- Constantes d'unités de taille de fichier ------------------------------------------------------------------------- var FileSizeUnit; (function (FileSizeUnit) { FileSizeUnit["OCTETS"] = "octets"; FileSizeUnit["KO"] = "ko"; FileSizeUnit["MO"] = "Mo"; FileSizeUnit["GO"] = "Go"; FileSizeUnit["BYTES"] = "bytes"; FileSizeUnit["KB"] = "KB"; FileSizeUnit["MB"] = "MB"; FileSizeUnit["GB"] = "GB"; })(FileSizeUnit || (FileSizeUnit = {})); var DsfrFileSizeUnitConst; (function (DsfrFileSizeUnitConst) { DsfrFileSizeUnitConst["BYTES"] = "bytes"; DsfrFileSizeUnitConst["OCTETS"] = "octets"; })(DsfrFileSizeUnitConst || (DsfrFileSizeUnitConst = {})); /** * https://www.w3resource.com/JSON/JSONPath-with-JavaScript.php * @param obj : object|array This parameter represents the Object representing the JSON structure. * @param path : string This parameter represents JSONPath expression string. * @return une valeur extrait de l'objet Json ou undefined si le path est erroné */ function jsonPath2Value(obj, path) { const keys = path.split('.'); // value est soit un objet JSON, soit une valeur terminale let value = obj; const breakException = {}; try { keys.forEach((key) => { if (!value) throw breakException; // key, ex: 'labels[20]' const matchArr = key.match(/([^\[]*)\[(\d*)\]/); const k = matchArr ? matchArr[1] : undefined; // clé sans l'indice, ex : 'labels' const i = matchArr ? matchArr[2] : undefined; // indice, ex : 20 value = k && i ? value[k][i] : value[key]; }); } catch (e) { // console.error(`Le chemin '${path}' ne correspond pas à une valeur`); } return value; } /** * La fonction permet de savoir si le code en cours s'exécute côté serveur ou côté browser. */ function isOnBrowser() { return typeof window !== 'undefined'; } /** * Les méthodes statiques de cette classe permettent de gérer le local storage uniquement si le code s'exécute côté browser. */ class LocalStorage { /** * The setItem() method of the Storage interface, when passed a key name and value, will add that key to the given * Storage object, or update that key's value if it already exists. */ static set(key, value) { if (isOnBrowser()) window.localStorage?.setItem(key, value); } /** * The getItem() method of the Storage interface, when passed a key name, will return that key's value, or null if * he key does not exist, in the given Storage object. * @return Signature identique à l'interface Storage.getItem(key: string): string | null */ static get(key) { return isOnBrowser() ? window.localStorage?.getItem(key) : null; } /** * The removeItem() method of the Storage interface, when passed a key name, will remove that key from the given * Storage object if it exists. The Storage interface of the Web Storage API provides access to a * particular domain's session or local storage. */ static remove(key) { if (isOnBrowser()) window.localStorage?.removeItem(key); } } var StorageEnum; (function (StorageEnum) { StorageEnum["SCHEME"] = "scheme"; StorageEnum["REMEMBER_ME"] = "rememberMe"; StorageEnum["LOGIN"] = "login"; // 'lang' pour la langue (dans _commons) })(StorageEnum || (StorageEnum = {})); /** * Retourne vrai si la string 's' est null, undefined ou vide. * @param s la chaïne à considére */ function isStringEmptyOrNull(s) { return !s || s.trim() === ''; } /** * Fournit un identifiant unique de type string basé, actuellement, sur uuidv4. */ function newUniqueId() { return v4(); } /** * Base class for all ControlValueAccessor classes defined in Forms package. Contains common logic and utility functions. * Le type de `value` est : T | undefined, undefined par défaut. Par exemple si on manipule un input de type number, celui-ci * sera initialisé à undefined par défaut. */ // Même si on ne précise pas undefined, à l'exécution, c'est quand même le cas. // Même si on indique un type number, à l'exécution, si l'utilisateur saisie "1a", value sera de type string class DefaultValueAccessorComponent { constructor() { /** * Permet de désactiver le champ. */ this.disabled = false; /** @internal */ this.fnOnChange = (_) => { }; /** @internal */ this.fnOnTouched = () => { }; } get value() { return this._value; } /** * La valeur gérée par le champ de formulaire. */ set value(value) { this._value = value; this.fnOnChange(this.value); } /** * Writes a new value to the element. * This method is called by the forms API to write to the view when programmatic changes from model to view are requested. * * @internal */ writeValue(value) { this._value = value; } /** * Registers a callback function that is called when the control's value changes in the UI. * When the value changes in the UI, call the registered function to allow the forms API to update itself: * host: { * '(change)': '_onChange($event.target.value)' * } * @internal */ registerOnChange(fn) { this.fnOnChange = fn; } /** * Registers a callback function that is called by the forms API on initialization to update the form model on blur. * On blur (or equivalent), your class should call the registered function to allow the forms API to update itself: * host: { * '(blur)': '_onTouched()' * } * @internal */ registerOnTouched(fn) { this.fnOnTouched = fn; } /** @internal */ onBlur() { this.fnOnTouched(); } /** * Function that is called by the forms API when the control status changes to or from 'DISABLED'. * Depending on the status, it enables or disables the appropriate DOM element. * * @internal */ setDisabledState(isDisabled) { this.disabled = isDisabled; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DefaultValueAccessorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DefaultValueAccessorComponent, selector: "ng-component", inputs: { disabled: "disabled", value: "value" }, ngImport: i0, template: '', isInline: true }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DefaultValueAccessorComponent, decorators: [{ type: Component, args: [{ template: '', }] }], propDecorators: { disabled: [{ type: Input }], value: [{ type: Input }] } }); /** * Ce composant est le contrôle abstrait des contrôles Dsfr possédant un id, un name et un label. */ // Renamed from AbstractControlComponent class DefaultControlComponent extends DefaultValueAccessorComponent { /** * Cet attribut doit être utilisé en tant que propriété et non en attribut, ex. `[id]="'monid'"`. * * @deprecated since 1.5, utiliser `inputId` à la place. */ set id(value) { if (value) { this._id = value; this.inputId ??= this._id; } } /** @internal */ ngOnInit() { this.inputId = this.inputId || newUniqueId(); // même si this.inputId = '', l'id sera valorisé (contrairement à '') this.labelId = `${this.inputId}-label`; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DefaultControlComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DefaultControlComponent, selector: "ng-component", inputs: { ariaControls: "ariaControls", inputId: "inputId", hint: "hint", label: "label", name: "name", id: "id" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DefaultControlComponent, decorators: [{ type: Component, args: [{ template: '', }] }], propDecorators: { ariaControls: [{ type: Input }], inputId: [{ type: Input }], hint: [{ type: Input }], label: [{ type: Input }], name: [{ type: Input }], id: [{ type: Input }] } }); /** * Permet de définir le titre de composant d'un niveau de titre de `<h2>` à `<h6>`, avec un niveau par défaut de `<h2>` à `<h6>` ou `<p>`. * Ne permets pas la projection du titre. */ class HeadingComponent { /** @internal */ getLevel() { return this.level ?? this.defaultLevel; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: HeadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: HeadingComponent, isStandalone: true, selector: "edu-heading", inputs: { customClass: "customClass", heading: "heading", headingId: "headingId", level: "level", defaultLevel: "defaultLevel" }, ngImport: i0, template: "@switch (getLevel()) {\n @case ('H2') {\n <h2 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h2>\n }\n @case ('H3') {\n <h3 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h3>\n }\n @case ('H4') {\n <h4 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h4>\n }\n @case ('H5') {\n <h5 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h5>\n }\n @case ('H6') {\n <h6 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h6>\n }\n @case ('P') {\n <p [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </p>\n }\n @default {\n <p [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </p>\n }\n}\n\n<!-- FIXME ne plus utiliser outerhtml -->\n<ng-template #headingTemplate>\n @if (heading) {\n <span [outerHTML]=\"heading\"></span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: HeadingComponent, decorators: [{ type: Component, args: [{ selector: 'edu-heading', encapsulation: ViewEncapsulation.None, standalone: true, imports: [CommonModule], template: "@switch (getLevel()) {\n @case ('H2') {\n <h2 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h2>\n }\n @case ('H3') {\n <h3 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h3>\n }\n @case ('H4') {\n <h4 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h4>\n }\n @case ('H5') {\n <h5 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h5>\n }\n @case ('H6') {\n <h6 [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </h6>\n }\n @case ('P') {\n <p [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </p>\n }\n @default {\n <p [attr.id]=\"headingId || null\" [class]=\"customClass\">\n <ng-container *ngTemplateOutlet=\"headingTemplate\"></ng-container>\n </p>\n }\n}\n\n<!-- FIXME ne plus utiliser outerhtml -->\n<ng-template #headingTemplate>\n @if (heading) {\n <span [outerHTML]=\"heading\"></span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n" }] }], propDecorators: { customClass: [{ type: Input }], heading: [{ type: Input }], headingId: [{ type: Input }], level: [{ type: Input }], defaultLevel: [{ type: Input }] } }); class HeadingModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: HeadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: HeadingModule, imports: [CommonModule, HeadingComponent], exports: [HeadingComponent] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: HeadingModule, imports: [CommonModule, HeadingComponent] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: HeadingModule, decorators: [{ type: NgModule, args: [{ exports: [HeadingComponent], imports: [CommonModule, HeadingComponent], }] }] }); /** * Définit les types de bouton supportés par le composant `dsfr-button`. */ var DsfrButtonTypeConst; (function (DsfrButtonTypeConst) { /** * A utiliser pour un bouton de soumission de formulaire. */ DsfrButtonTypeConst["SUBMIT"] = "submit"; /** * A utiliser pour un bouton de réinitialisation de formulaire. */ DsfrButtonTypeConst["RESET"] = "reset"; /** * A utiliser pour un bouton d'action sur la page courante. */ DsfrButtonTypeConst["BUTTON"] = "button"; })(DsfrButtonTypeConst || (DsfrButtonTypeConst = {})); /** * Définit les variantes supportées par le composant `dsfr-button`. */ var DsfrButtonVariantConst; (function (DsfrButtonVariantConst) { /** * A utiliser pour un bouton primaire. */ DsfrButtonVariantConst["PRIMARY"] = "primary"; /** * A utiliser pour un bouton secondaire. */ DsfrButtonVariantConst["SECONDARY"] = "secondary"; /** * A utiliser pour un bouton tertiaire. */ DsfrButtonVariantConst["TERTIARY"] = "tertiary"; /** * A utiliser pour un bouton tertiaire sans bordure. */ DsfrButtonVariantConst["TERTIARY_NO_OUTLINE"] = "tertiary-no-outline"; })(DsfrButtonVariantConst || (DsfrButtonVariantConst = {})); /** * Définit les niveaux de titre supportés par le DSFR du H2 à H6. */ var DsfrHeadingLevelConst; (function (DsfrHeadingLevelConst) { /** * @deprecated (since 1.8) use `undefined` instead */ DsfrHeadingLevelConst["NONE"] = "none"; /** * Niveau de titre H2. */ DsfrHeadingLevelConst["H2"] = "H2"; /** * Niveau de titre H3. */ DsfrHeadingLevelConst["H3"] = "H3"; /** * Niveau de titre H4. */ DsfrHeadingLevelConst["H4"] = "H4"; /** * Niveau de titre H5. */ DsfrHeadingLevelConst["H5"] = "H5"; /** * Niveau de titre H6. */ DsfrHeadingLevelConst["H6"] = "H6"; })(DsfrHeadingLevelConst || (DsfrHeadingLevelConst = {})); /** * Définit les valeurs possibles pour l'attribut `target` d'un lien html. */ var DsfrLinkTargetConst; (function (DsfrLinkTargetConst) { DsfrLinkTargetConst["BLANK"] = "_blank"; DsfrLinkTargetConst["SELF"] = "_self"; DsfrLinkTargetConst["PARENT"] = "_parent"; DsfrLinkTargetConst["TOP"] = "_top"; })(DsfrLinkTargetConst || (DsfrLinkTargetConst = {})); /** @deprecated (since 1.4) use {@link DsfrLinkTargetConst} instead */ var DsfrTargetLinkConst; (function (DsfrTargetLinkConst) { DsfrTargetLinkConst["BLANK"] = "_blank"; DsfrTargetLinkConst["SELF"] = "_self"; DsfrTargetLinkConst["PARENT"] = "_parent"; DsfrTargetLinkConst["TOP"] = "_top"; })(DsfrTargetLinkConst || (DsfrTargetLinkConst = {})); /** * Définit les différentes positions supportées par le DSFR. */ var DsfrPositionConst; (function (DsfrPositionConst) { /** * Positionne à gauche. */ DsfrPositionConst["LEFT"] = "left"; /** * Positione à droite. */ DsfrPositionConst["RIGHT"] = "right"; })(DsfrPositionConst || (DsfrPositionConst = {})); /** * Définit les différents niveaux de sévérité supportés par le DSFR. */ var DsfrSeverityConst; (function (DsfrSeverityConst) { /** * Spécifie un niveau "information". */ DsfrSeverityConst["INFO"] = "info"; /** * Spécifie un niveau "erreur". */ DsfrSeverityConst["ERROR"] = "error"; /** * Spécifie un niveau "information" et/ou un état "valide". */ DsfrSeverityConst["VALID"] = "valid"; /** * Spécifie un niveau "avertissement". */ DsfrSeverityConst["WARNING"] = "warning"; /** * Spécifie un niveau "succès". * * @deprecated (since 1.13.0) Utiliser {@link VALID} à la place. */ DsfrSeverityConst["SUCCESS"] = "success"; })(DsfrSeverityConst || (DsfrSeverityConst = {})); /** * Définit les différentes tailles supportées par le DSFR. */ var DsfrSizeConst; (function (DsfrSizeConst) { /** * Spécifie une taille "réduite". */ DsfrSizeConst["SM"] = "SM"; /** * Spécifie une taille "moyenne". */ DsfrSizeConst["MD"] = "MD"; /** * Spécifie une taille "large". */ DsfrSizeConst["LG"] = "LG"; })(DsfrSizeConst || (DsfrSizeConst = {})); /** * Définit les tailles de texte supportées par le DSFR. */ var DsfrTextSizeConst; (function (DsfrTextSizeConst) { /** * Texte très petit. */ DsfrTextSizeConst["XS"] = "XS"; /** * Texte petit. */ DsfrTextSizeConst["SM"] = "SM"; /** * Texte moyen. */ DsfrTextSizeConst["MD"] = "MD"; /** * Texte large. */ DsfrTextSizeConst["LG"] = "LG"; /** * Texte très grand. */ DsfrTextSizeConst["XL"] = "XL"; })(DsfrTextSizeConst || (DsfrTextSizeConst = {})); /** */ class EduMessageSeverityDirective { constructor() { this._severity = null; } get className() { switch (this._severity) { case DsfrSeverityConst.ERROR: return 'fr-message--error'; case DsfrSeverityConst.SUCCESS: case DsfrSeverityConst.VALID: return 'fr-message--valid'; case DsfrSeverityConst.INFO: return 'fr-message--info'; case DsfrSeverityConst.WARNING: return 'fr-message--warning'; default: return ''; } } set severity(value) { this._severity = value; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EduMessageSeverityDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: EduMessageSeverityDirective, isStandalone: true, selector: "[eduMessageSeverity]", inputs: { severity: ["eduMessageSeverity", "severity"] }, host: { properties: { "class": "this.className" } }, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EduMessageSeverityDirective, decorators: [{ type: Directive, args: [{ selector: '[eduMessageSeverity]', standalone: true }] }], propDecorators: { className: [{ type: HostBinding, args: ['class'] }], severity: [{ type: Input, args: ['eduMessageSeverity'] }] } }); /** * InputGroupComponent contient : * - Le label et l'aide textuel de l'input, * - Les messages de l'input * * @since 1.11.0 */ class InputGroupComponent { constructor() { /** * Permet de désactiver le champ. */ this.disabled = false; /** * Message d'information lié au composant */ this.message = undefined; this.DsfrSeverity = DsfrSeverityConst; } hasMessage(severity) { return !isStringEmptyOrNull(this.message) && severity === this.severity; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: InputGroupComponent, isStandalone: true, selector: "edu-input-group", inputs: { label: "label", inputId: "inputId", hint: "hint", disabled: "disabled", message: "message", severity: "severity", messagesGroupId: "messagesGroupId" }, ngImport: i0, template: "<div\n [ngClass]=\"{\n 'fr-input-group': true,\n 'fr-input-group--disabled': disabled,\n 'fr-input-group--error': message && severity === DsfrSeverity.ERROR,\n 'fr-input-group--valid': message && (severity === DsfrSeverity.SUCCESS || severity === DsfrSeverity.VALID),\n 'fr-input-group--info': message && severity === DsfrSeverity.INFO,\n 'fr-input-group--warning': message && severity === DsfrSeverity.WARNING,\n }\">\n <ng-content />\n <div class=\"fr-messages-group\" [id]=\"messagesGroupId\" aria-live=\"polite\">\n <!-- prettier-ignore -->\n @if (message) {\n <p\n class=\"fr-message\"\n [eduMessageSeverity]=\"severity\"\n >{{ message }}</p>\n }\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: EduMessageSeverityDirective, selector: "[eduMessageSeverity]", inputs: ["eduMessageSeverity"] }], encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputGroupComponent, decorators: [{ type: Component, args: [{ selector: 'edu-input-group', encapsulation: ViewEncapsulation.None, standalone: true, imports: [CommonModule, EduMessageSeverityDirective], template: "<div\n [ngClass]=\"{\n 'fr-input-group': true,\n 'fr-input-group--disabled': disabled,\n 'fr-input-group--error': message && severity === DsfrSeverity.ERROR,\n 'fr-input-group--valid': message && (severity === DsfrSeverity.SUCCESS || severity === DsfrSeverity.VALID),\n 'fr-input-group--info': message && severity === DsfrSeverity.INFO,\n 'fr-input-group--warning': message && severity === DsfrSeverity.WARNING,\n }\">\n <ng-content />\n <div class=\"fr-messages-group\" [id]=\"messagesGroupId\" aria-live=\"polite\">\n <!-- prettier-ignore -->\n @if (message) {\n <p\n class=\"fr-message\"\n [eduMessageSeverity]=\"severity\"\n >{{ message }}</p>\n }\n </div>\n</div>\n" }] }], propDecorators: { label: [{ type: Input }], inputId: [{ type: Input }], hint: [{ type: Input }], disabled: [{ type: Input }], message: [{ type: Input }], severity: [{ type: Input }], messagesGroupId: [{ type: Input }] } }); /** Ce composant correspond au lien de téléchargement utilisé par card, tile et download */ class LinkDownloadComponent { constructor() { /** * Active la version download avec l'attribut download. * Permet l'utilisation de `downloadAssessFile` et `langCode` */ this.downloadDirect = false; /** Option de détail de téléchargement renseigné automatiquement. * Si la valeur est 'bytes', l'unité sera en Bytes */ this.downloadAssessFile = false; /** * Langue courante. hreflang ne sera indiquée que différent de la langue courante. */ this.langCode = 'fr'; /** Remplacer le lien par un markup de bouton */ this.isButton = false; /** * Propage la valeur de 'route' ou de 'link' (selon le cas) lors du click sur le lien. */ this.linkSelect = new EventEmitter(); } get disabled() { return !(this.item.route || this.item.routerLink || this.item.link); } get item() { return this._item; } /** Item représentant un lien `<a>` avec ou sans `routerLink`. */ set item(item) { if (item.label) { this._item = { ...item, label: item.label }; } else { this._item = item; } if (this.item) this.item.customClass = this.getLinkClasses(); } /** * Si === 'true', télécharge directement le fichier sans l'ouvrir, 'false' par défaut. * @internal */ isDirectDownload() { return this.downloadDirect !== false; } /** @internal */ getHref() { if (this.item.route) return this.item.route; if (this.item.link) return this.item.link; return undefined; } /** @internal */ getNewFileName() { return typeof this.downloadDirect === 'string' ? this.downloadDirect : ''; } onLinkSelect(event) { if (this.item.route && !this.item.routerLink) { event.preventDefault(); this.linkSelect.emit(this.item.route); } else if (this.item.link) { this.linkSelect.emit(this.item.link); } } /** @internal */ getLinkTarget(item) { return item.target ?? item.linkTarget; } /** @internal */ getLinkClasses() { const classes = []; classes.push(!this.customClass ? 'fr-link' : this.customClass); if (this._item.icon) { classes.push(this._item.icon); // Dans le header, les liens utilisent la classe fr-btn, pour être cohérent, on va utiliser fr-btn--icon-left et right const likeButton = this.customClass?.search('fr-btn') >= 0; const prefixPos = likeButton ? 'fr-btn--icon-' : 'fr-link--icon-'; classes.push(this._item.iconPosition === DsfrPositionConst.RIGHT ? prefixPos + 'right' : prefixPos + 'left'); } return classes.join(' '); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkDownloadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LinkDownloadComponent, isStandalone: true, selector: "edu-link-download", inputs: { customClass: "customClass", downloadDirect: "downloadDirect", downloadAssessFile: "downloadAssessFile", langCode: "langCode", linkTarget: "linkTarget", isButton: "isButton", item: "item" }, outputs: { linkSelect: "linkSelect" }, ngImport: i0, template: "<!-- Lien de t\u00E9l\u00E9chargement-->\n@if (!isButton) {\n <a\n [ngClass]=\"customClass\"\n [attr.aria-controls]=\"item.ariaControls || null\"\n [attr.aria-disabled]=\"disabled || null\"\n [attr.aria-label]=\"item.ariaLabel || null\"\n [attr.href]=\"getHref() || null\"\n [attr.download]=\"!isDirectDownload() ? null : getNewFileName()\"\n [attr.data-fr-assess-file]=\"downloadAssessFile || null\"\n [attr.hreflang]=\"langCode || null\"\n [attr.target]=\"linkTarget || null\"\n (click)=\"onLinkSelect($event)\"\n [innerHTML]=\"item.label\">\n </a>\n} @else {\n <button\n type=\"button\"\n (click)=\"onLinkSelect($event)\"\n [disabled]=\"disabled\"\n [ngClass]=\"customClass\"\n [innerHTML]=\"item.label\"></button>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }], encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkDownloadComponent, decorators: [{ type: Component, args: [{ selector: 'edu-link-download', encapsulation: ViewEncapsulation.None, standalone: true, imports: [CommonModule, RouterModule], template: "<!-- Lien de t\u00E9l\u00E9chargement-->\n@if (!isButton) {\n <a\n [ngClass]=\"customClass\"\n [attr.aria-controls]=\"item.ariaControls || null\"\n [attr.aria-disabled]=\"disabled || null\"\n [attr.aria-label]=\"item.ariaLabel || null\"\n [attr.href]=\"getHref() || null\"\n [attr.download]=\"!isDirectDownload() ? null : getNewFileName()\"\n [attr.data-fr-assess-file]=\"downloadAssessFile || null\"\n [attr.hreflang]=\"langCode || null\"\n [attr.target]=\"linkTarget || null\"\n (click)=\"onLinkSelect($event)\"\n [innerHTML]=\"item.label\">\n </a>\n} @else {\n <button\n type=\"button\"\n (click)=\"onLinkSelect($event)\"\n [disabled]=\"disabled\"\n [ngClass]=\"customClass\"\n [innerHTML]=\"item.label\"></button>\n}\n" }] }], propDecorators: { customClass: [{ type: Input }], downloadDirect: [{ type: Input }], downloadAssessFile: [{ type: Input }], langCode: [{ type: Input }], linkTarget: [{ type: Input }], isButton: [{ type: Input }], linkSelect: [{ type: Output }], item: [{ type: Input }] } }); /** Ce composant permet de gérer facilement les pictogrammes issus du DSFR. */ class PictogramComponent { constructor() { /** * Chemin vers le répertoire exposant les pictogrammes illustratifs DSFR. */ this.artworkDirPath = 'artwork'; /** * Détermine l'affichage du pictogramme associé aux téléchargements. */ this.download = false; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: PictogramComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: PictogramComponent, isStandalone: true, selector: "edu-pictogram", inputs: { artworkDirPath: "artworkDirPath", artworkFilePath: "artworkFilePath", download: "download" }, ngImport: i0, template: "@if (artworkFilePath) {\n <svg aria-hidden=\"true\" class=\"fr-artwork\" viewBox=\"0 0 80 80\" width=\"80px\" height=\"80px\">\n <use class=\"fr-artwork-decorative\" [attr.href]=\"artworkFilePath + '#artwork-decorative'\"></use>\n <use class=\"fr-artwork-minor\" [attr.href]=\"artworkFilePath + '#artwork-minor'\"></use>\n <use class=\"fr-artwork-major\" [attr.href]=\"artworkFilePath + '#artwork-major'\"></use>\n </svg>\n} @else if (download && !artworkFilePath) {\n <!---DOWNLOAD-->\n <svg aria-hidden=\"true\" class=\"fr-artwork\" viewBox=\"0 0 80 80\" width=\"80px\" height=\"80px\">\n <use\n class=\"fr-artwork-decorative\"\n [attr.href]=\"artworkDirPath + '/pictograms/document/document-download.svg#artwork-decorative'\"></use>\n <use\n class=\"fr-artwork-minor\"\n [attr.href]=\"artworkDirPath + '/pictograms/document/document-download.svg#artwork-minor'\"></use>\n <use\n class=\"fr-artwork-major\"\n [attr.href]=\"artworkDirPath + '/pictograms/document/document-download.svg#artwork-major'\"></use>\n </svg>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }], encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: PictogramComponent, decorators: [{ type: Component, args: [{ selector: 'edu-pictogram', encapsulation: ViewEncapsulation.None, standalone: true, imports: [CommonModule, RouterModule], template: "@if (artworkFilePath) {\n <svg aria-hidden=\"true\" class=\"fr-artwork\" viewBox=\"0 0 80 80\" width=\"80px\" height=\"80px\">\n <use class=\"fr-artwork-decorative\" [attr.href]=\"