@cityway/basic-ui 1.1.0-beta002 → 1.1.0-beta004

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/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { EventEmitter, OnInit, AfterViewInit, ElementRef, AfterContentInit, OnDe
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
4
  import { Options } from '@angular-slider/ngx-slider';
5
5
  export { Options } from '@angular-slider/ngx-slider';
6
- import { FormControl, AbstractControl, FormGroup, ValidationErrors } from '@angular/forms';
6
+ import { FormControl, AbstractControl, FormGroup, ValidationErrors, ControlValueAccessor } from '@angular/forms';
7
7
  import { TranslateService } from '@ngx-translate/core';
8
8
  import { ConnectedPosition } from '@angular/cdk/overlay';
9
9
 
@@ -1907,6 +1907,133 @@ declare class BreadcrumbComponent {
1907
1907
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<BreadcrumbComponent, "cw-breadcrumb", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1908
1908
  }
1909
1909
 
1910
+ /** Presentation de la dropzone. */
1911
+ declare enum FileDropModeEnum {
1912
+ /** Liste de fichiers (icone + nom + taille). */
1913
+ file = "file",
1914
+ /** Image(s) avec miniature de preview et placeholder illustre. */
1915
+ picture = "picture"
1916
+ }
1917
+ /** Etat d'un fichier dans la liste. */
1918
+ declare enum FileDropFileStatusEnum {
1919
+ /** Accepte (validation locale OK). */
1920
+ success = "success",
1921
+ /** Rejete (format / taille). `error` porte le message. */
1922
+ error = "error"
1923
+ }
1924
+ /** Raison de rejet d'un fichier (cle i18n resolue par le composant). */
1925
+ declare enum FileDropRejectReasonEnum {
1926
+ format = "format",
1927
+ size = "size"
1928
+ }
1929
+ /** Fichier gere par la dropzone (etat interne + expose via `filesChange`). */
1930
+ interface CwFileDropItem {
1931
+ /** Le fichier natif. */
1932
+ file: File;
1933
+ /** Etat de validation locale. */
1934
+ status: FileDropFileStatusEnum;
1935
+ /** Raison du rejet si `status === error`. */
1936
+ reason?: FileDropRejectReasonEnum;
1937
+ /** Data URL de previsualisation (mode `picture`, images uniquement). */
1938
+ previewUrl?: string;
1939
+ }
1940
+ /** Payload de l'output `rejected`. */
1941
+ interface CwFileDropRejection {
1942
+ file: File;
1943
+ reason: FileDropRejectReasonEnum;
1944
+ }
1945
+
1946
+ /**
1947
+ * Zone de depot de fichiers « tout maison » (drag & drop + parcourir), sans lib externe.
1948
+ * Implemente `ControlValueAccessor` : utilisable avec `formControlName` / `[(ngModel)]`.
1949
+ *
1950
+ * - `multiple=false` (defaut) : valeur du formulaire = `File | null`.
1951
+ * - `multiple=true` : valeur du formulaire = `File[]`.
1952
+ *
1953
+ * Style base sur les tokens DS (BOU) `File Upload / Dropzone / *` (tokens globaux
1954
+ * `--cw-border-*`, `--cw-surface-*`, `--cw-status-*`, `--cw-text/icon-*`).
1955
+ */
1956
+ declare class FileDropComponent implements ControlValueAccessor {
1957
+ /** Presentation : liste de fichiers (`file`) ou images avec preview (`picture`). */
1958
+ readonly mode: _angular_core.InputSignal<FileDropModeEnum>;
1959
+ /** Autorise plusieurs fichiers. */
1960
+ readonly multiple: _angular_core.InputSignal<boolean>;
1961
+ /** Filtre natif + validation. Ex. `'.pdf,.png'` ou `'image/*'`. Defaut `image/*` en mode picture. */
1962
+ readonly accept: _angular_core.InputSignal<string>;
1963
+ /** Libelle lisible des formats acceptes (texte d'aide). Ex. `'PDF, PNG, JPG'`. */
1964
+ readonly acceptLabel: _angular_core.InputSignal<string>;
1965
+ /** Taille maximale par fichier, en Mo. */
1966
+ readonly maxSizeMb: _angular_core.InputSignal<number>;
1967
+ /** Dimensions recommandees (mode picture), texte d'aide. Ex. `'200 x 200 px'`. */
1968
+ readonly recommendedDimensions: _angular_core.InputSignal<string>;
1969
+ /** Libelle accessible de la zone (aria-label). */
1970
+ readonly label: _angular_core.InputSignal<string>;
1971
+ /** Desactive le composant (en plus de `setDisabledState` du formulaire). */
1972
+ readonly isDisabled: _angular_core.InputSignal<boolean>;
1973
+ /**
1974
+ * Message d'erreur global (ex. echec d'upload cote serveur) : bascule la zone en
1975
+ * etat « erreur de connexion » avec un bouton Reessayer (output `retry`).
1976
+ */
1977
+ readonly errorMessage: _angular_core.InputSignal<string>;
1978
+ /** Attribut `data-test-ctw`. */
1979
+ readonly dataTest: _angular_core.InputSignal<string>;
1980
+ /** Emis a chaque changement : liste complete des fichiers (valides + en erreur). */
1981
+ readonly filesChange: _angular_core.OutputEmitterRef<CwFileDropItem[]>;
1982
+ /** Emis avec les fichiers rejetes par la validation locale (format / taille). */
1983
+ readonly rejected: _angular_core.OutputEmitterRef<CwFileDropRejection[]>;
1984
+ /** Emis au clic sur Reessayer (etat d'erreur global). */
1985
+ readonly retry: _angular_core.OutputEmitterRef<void>;
1986
+ private readonly fileInput;
1987
+ protected readonly items: _angular_core.WritableSignal<CwFileDropItem[]>;
1988
+ protected readonly isDragging: _angular_core.WritableSignal<boolean>;
1989
+ private readonly disabledByForm;
1990
+ private dragDepth;
1991
+ protected readonly modeEnum: typeof FileDropModeEnum;
1992
+ protected readonly statusEnum: typeof FileDropFileStatusEnum;
1993
+ protected readonly reasonEnum: typeof FileDropRejectReasonEnum;
1994
+ protected readonly spriteIcon: typeof SpriteIconEnum;
1995
+ protected readonly iconSize: typeof IconSizeEnum;
1996
+ protected readonly iconUiType: typeof IconUiTypeEnum;
1997
+ protected readonly buttonType: typeof BoButtonTypeEnum;
1998
+ protected readonly buttonIconSize: typeof ButtonIconSizeEnum;
1999
+ protected readonly disabled: _angular_core.Signal<boolean>;
2000
+ protected readonly isPicture: _angular_core.Signal<boolean>;
2001
+ /** `accept` effectif (defaut `image/*` en mode picture). */
2002
+ protected readonly effectiveAccept: _angular_core.Signal<string>;
2003
+ private onChange;
2004
+ private onTouched;
2005
+ writeValue(value: File | File[] | null): void;
2006
+ registerOnChange(fn: (value: File | File[] | null) => void): void;
2007
+ registerOnTouched(fn: () => void): void;
2008
+ setDisabledState(isDisabled: boolean): void;
2009
+ protected openPicker(): void;
2010
+ /** Clic sur le bouton « Parcourir » : empeche le double-declenchement via le clic de la zone. */
2011
+ protected onBrowse(event: Event): void;
2012
+ /** Cle i18n du message d'erreur d'un fichier rejete. */
2013
+ protected reasonKey(item: CwFileDropItem): string;
2014
+ protected onKeydown(event: KeyboardEvent): void;
2015
+ protected onInputChange(event: Event): void;
2016
+ protected onDragOver(event: DragEvent): void;
2017
+ protected onDragEnter(event: DragEvent): void;
2018
+ protected onDragLeave(event: DragEvent): void;
2019
+ protected onDrop(event: DragEvent): void;
2020
+ protected remove(target: CwFileDropItem): void;
2021
+ protected onRetry(): void;
2022
+ private handleFiles;
2023
+ /** Retourne la raison de rejet, ou `undefined` si le fichier est valide. */
2024
+ private validate;
2025
+ /** Match d'un fichier contre l'attribut `accept` (extensions et types MIME). */
2026
+ private acceptsType;
2027
+ /** Genere la data URL de preview (mode picture + image) et la rattache a l'item. */
2028
+ private attachPreview;
2029
+ private propagate;
2030
+ /** Formate une taille en octets en libelle court (ex. `1,2 Mo`). */
2031
+ protected humanSize(bytes: number): string;
2032
+ private round;
2033
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileDropComponent, never>;
2034
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileDropComponent, "cw-file-drop", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "acceptLabel": { "alias": "acceptLabel"; "required": false; "isSignal": true; }; "maxSizeMb": { "alias": "maxSizeMb"; "required": false; "isSignal": true; }; "recommendedDimensions": { "alias": "recommendedDimensions"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "isDisabled": { "alias": "isDisabled"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "dataTest": { "alias": "dataTest"; "required": false; "isSignal": true; }; }, { "filesChange": "filesChange"; "rejected": "rejected"; "retry": "retry"; }, never, never, true, never>;
2035
+ }
2036
+
1910
2037
  /**
1911
2038
  * Sélecteur de langue présentational.
1912
2039
  *
@@ -2195,5 +2322,5 @@ interface DataCustomListGroup {
2195
2322
  fields: DataCustomList[];
2196
2323
  }
2197
2324
 
2198
- export { AccordionComponent, AlertComponent, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CW_DEFAULT_THEME_OPTIONS, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, CwThemeKeyEnum, CwTooltipDirective, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LanguageSelectorComponent, LegendComponent, LegendTypeEnum, LoaderComponent, LoaderSizeEnum, ModalsComponent, ModalsService, ModalsSize, ModalsState, ModalsTextType, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, ThemeSelectorComponent, ThemeService, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TooltipPositionEnum, TriggerTooltipEnum, TypeTooltipEnum, rangeValidator, resolveArrowPos };
2199
- export type { Attachment, CwAutocompleteColumn, CwAutocompleteFetcher, CwAutocompleteItem, CwAutocompleteOptions, CwAutocompleteResolver, CwBreadcrumbItem, CwThemeOption, DataCustomList, DataCustomListGroup, DataLegend, FormFieldOption, FormFieldRangeOption, FormFieldValidationOption, Legend, ModalConfig, ModalRef, ShowToastOptions, SkipLink, ThemeServiceConfig, Toast, ToastAction };
2325
+ export { AccordionComponent, AlertComponent, AlertTypeEnum, BadgeComponent, BadgePositionEnum, BadgeTypeEnum, BoButtonTypeEnum, BoTabTypeEnum, BreadcrumbComponent, ButtonComponent, ButtonIconSizeEnum, ButtonPositionEnum, CW_DEFAULT_THEME_OPTIONS, CardComponent, CardTitleRankEnum, CardTypeEnum, ClickOutsideDirective, CollapseDirective, CwThemeKeyEnum, CwTooltipDirective, DropdownComponent, DropdownItemDirective, DropdownPositionEnum, FileDropComponent, FileDropFileStatusEnum, FileDropModeEnum, FileDropRejectReasonEnum, FileToDownloadComponent, FoButtonTypeEnum, FoTabTypeEnum, FocusTrackerService, FormFieldComponent, FormFieldTypeEnum, IconComponent, IconNotifSizeEnum, IconNotifTypeEnum, IconNotificationComponent, IconSizeEnum, IconTypeEnum, IconUiTypeEnum, ImageComponent, LanguageSelectorComponent, LegendComponent, LegendTypeEnum, LoaderComponent, LoaderSizeEnum, ModalsComponent, ModalsService, ModalsSize, ModalsState, ModalsTextType, ModalsType, NumericalRangeComponent, NumericalRangeLabelPositionEnum, NumericalRangeTypeEnum, PlacementEnum, RequiredInfoComponent, ResponsiveService, SkipLinksComponent, SpriteIconEnum, StepperComponent, TOAST_AUTOHIDE_DELAY_MS, TabComponent, TabContentComponent, ThemeSelectorComponent, ThemeService, TitleComponent, TitleContextEnum, TitleTagEnum, ToastComponent, ToastItemComponent, ToastService, TooltipPositionEnum, TriggerTooltipEnum, TypeTooltipEnum, rangeValidator, resolveArrowPos };
2326
+ export type { Attachment, CwAutocompleteColumn, CwAutocompleteFetcher, CwAutocompleteItem, CwAutocompleteOptions, CwAutocompleteResolver, CwBreadcrumbItem, CwFileDropItem, CwFileDropRejection, CwThemeOption, DataCustomList, DataCustomListGroup, DataLegend, FormFieldOption, FormFieldRangeOption, FormFieldValidationOption, Legend, ModalConfig, ModalRef, ShowToastOptions, SkipLink, ThemeServiceConfig, Toast, ToastAction };
@@ -154,6 +154,20 @@
154
154
  "HIDE": "Hide password"
155
155
  }
156
156
  },
157
+ "_FILE_DROP": {
158
+ "DROP_FILE": "Drag and drop your files here",
159
+ "DROP_PICTURE": "Drag and drop your image here",
160
+ "OR": "or",
161
+ "BROWSE": "Browse",
162
+ "BROWSE_PICTURE": "Choose an image",
163
+ "ACCEPTED_FORMATS": "Accepted formats: {{formats}}",
164
+ "MAX_SIZE": "Maximum size: {{size}}",
165
+ "RECOMMENDED_DIMENSIONS": "Recommended dimensions: {{dimensions}}",
166
+ "REMOVE": "Remove {{name}}",
167
+ "ERROR_FORMAT": "Unsupported format",
168
+ "ERROR_SIZE": "File too large",
169
+ "RETRY": "Retry"
170
+ },
157
171
  "_HTTP": {
158
172
  "TXT_CONNECTION_ISSUE": "Connection issue",
159
173
  "TXT_LOADING": "Loading...",
@@ -148,6 +148,20 @@
148
148
  "HIDE" : "Masquer le mot de passe"
149
149
  }
150
150
  },
151
+ "_FILE_DROP": {
152
+ "DROP_FILE": "Glissez-déposez vos fichiers ici",
153
+ "DROP_PICTURE": "Glissez-déposez votre image ici",
154
+ "OR": "ou",
155
+ "BROWSE": "Parcourir",
156
+ "BROWSE_PICTURE": "Choisir une image",
157
+ "ACCEPTED_FORMATS": "Formats acceptés : {{formats}}",
158
+ "MAX_SIZE": "Taille maximale : {{size}}",
159
+ "RECOMMENDED_DIMENSIONS": "Dimensions recommandées : {{dimensions}}",
160
+ "REMOVE": "Supprimer {{name}}",
161
+ "ERROR_FORMAT": "Format non accepté",
162
+ "ERROR_SIZE": "Fichier trop volumineux",
163
+ "RETRY": "Réessayer"
164
+ },
151
165
  "_HTTP": {
152
166
  "TXT_CONNECTION_ISSUE": "Problème de connexion",
153
167
  "TXT_LOADING": "Chargement en cours...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityway/basic-ui",
3
- "version": "1.1.0-beta002",
3
+ "version": "1.1.0-beta004",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.3.0",
@@ -9,7 +9,7 @@
9
9
  "@angular/animations": "^20.3.0",
10
10
  "@angular/cdk": "^20.2.2",
11
11
  "@angular/platform-browser": "^20.3.0",
12
- "@cityway/design-tokens": "1.1.0-beta002",
12
+ "@cityway/design-tokens": "1.1.0-beta004",
13
13
  "intl-tel-input": "^28.0.7"
14
14
  },
15
15
  "peerDependenciesMeta": {