commons-shared-web-ui 0.0.14 → 0.0.15

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
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, OnDestroy, EventEmitter, OnChanges, SimpleChanges, ElementRef, AfterViewInit, QueryList, ChangeDetectorRef, NgZone } from '@angular/core';
2
+ import { OnInit, OnDestroy, EventEmitter, OnChanges, SimpleChanges, ElementRef, PipeTransform, AfterViewInit, QueryList, ChangeDetectorRef, NgZone } from '@angular/core';
3
3
  import * as i2$1 from '@angular/common';
4
4
  import * as i1 from '@angular/material/card';
5
5
  import * as i2 from '@angular/material/snack-bar';
@@ -40,7 +40,8 @@ import * as i11$1 from '@angular/cdk/scrolling';
40
40
  import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
41
41
  import { HttpClient, HttpHeaders } from '@angular/common/http';
42
42
  import { Observable, Subject } from 'rxjs';
43
- import * as i9$1 from 'ngx-quill';
43
+ import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
44
+ import * as i10$1 from 'ngx-quill';
44
45
 
45
46
  declare class MaterialModule {
46
47
  static ɵfac: i0.ɵɵFactoryDeclaration<MaterialModule, never>;
@@ -1615,6 +1616,7 @@ interface TextConfig {
1615
1616
  * the check on the field that carries matchField config.
1616
1617
  */
1617
1618
  matchField?: string;
1619
+ showCharCount?: boolean;
1618
1620
  }
1619
1621
  interface LengthConstraint {
1620
1622
  min?: number;
@@ -1700,6 +1702,22 @@ interface AttachmentConfig {
1700
1702
  * Only relevant when uploadUrl is set.
1701
1703
  */
1702
1704
  entityType?: string;
1705
+ /**
1706
+ * API endpoint to delete the file. Called when an uploaded file with an ID != 0 is removed.
1707
+ */
1708
+ deleteUrl?: string;
1709
+ /** API endpoint to GET the default library images list */
1710
+ libraryApiUrl?: string;
1711
+ /** Dot-notation path to the image array in the library API response (e.g. 'data.items') */
1712
+ libraryDataPath?: string;
1713
+ /** Dot-notation path to the image URL within each library item (e.g. 'url') */
1714
+ libraryUrlPath?: string;
1715
+ /** Dot-notation path to the image ID within each library item */
1716
+ libraryIdPath?: string;
1717
+ /** Optional description shown in the left info panel for media upload */
1718
+ description?: string;
1719
+ /** Optional bullet-point feature lines shown in the left info panel for media upload */
1720
+ features?: string[];
1703
1721
  }
1704
1722
  interface LocationConfig {
1705
1723
  enableCurrentLocation?: boolean;
@@ -1712,6 +1730,8 @@ interface RatingConfig {
1712
1730
  interface RichTextConfig {
1713
1731
  height?: string;
1714
1732
  placeholder?: string;
1733
+ maxLength?: number;
1734
+ showCharCount?: boolean;
1715
1735
  }
1716
1736
  interface ValidationResult {
1717
1737
  isValid: boolean;
@@ -1720,6 +1740,26 @@ interface ValidationResult {
1720
1740
  [key: string]: string;
1721
1741
  };
1722
1742
  }
1743
+ /**
1744
+ * A single media item stored in the MEDIA_UPLOAD field value array.
1745
+ * Can represent an uploaded image (from device or library) or a YouTube video.
1746
+ */
1747
+ interface MediaItem {
1748
+ /** Server-assigned ID (for pre-filled items) */
1749
+ id?: number;
1750
+ /** 'image' | 'youtube' */
1751
+ mediaType: 'image' | 'youtube';
1752
+ /** Remote URL of the image returned by the upload API, or the YouTube embed URL */
1753
+ url: string;
1754
+ /** Thumbnail URL (for YouTube previews) */
1755
+ thumbnailUrl?: string;
1756
+ /** MIME type returned by the upload API (e.g. 'image/png') */
1757
+ mimeType?: string;
1758
+ /** File name returned by the upload API */
1759
+ fileName?: string;
1760
+ /** True while the file is being uploaded */
1761
+ isUploading?: boolean;
1762
+ }
1723
1763
 
1724
1764
  declare class SmartFormController {
1725
1765
  private formData;
@@ -1910,6 +1950,18 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1910
1950
  fileUploadError: string;
1911
1951
  multiSaveError: string;
1912
1952
  private destroy$;
1953
+ mediaDeviceInput: ElementRef<HTMLInputElement>;
1954
+ showMediaMenu: boolean;
1955
+ showYoutubeInput: boolean;
1956
+ youtubeUrlInput: string;
1957
+ youtubeUrlError: string;
1958
+ mediaCarouselIndex: number;
1959
+ showLibraryModal: boolean;
1960
+ libraryImages: any[];
1961
+ librarySelectedIds: Set<any>;
1962
+ libraryLoading: boolean;
1963
+ libraryError: string;
1964
+ mediaUploadError: string;
1913
1965
  /** FormControl used ONLY for the autocomplete text-input display value */
1914
1966
  autocompleteInputCtrl: FormControl<string>;
1915
1967
  /** Filtered option list shown in the mat-autocomplete panel */
@@ -1992,6 +2044,8 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1992
2044
  onCheckboxListChange(code: string, checked: boolean): void;
1993
2045
  isChecked(code: string): boolean;
1994
2046
  get errorMessage(): string;
2047
+ get showCharCount(): boolean;
2048
+ get remainingCharacters(): number | null;
1995
2049
  get isTextField(): boolean;
1996
2050
  get isNumberField(): boolean;
1997
2051
  get isDateField(): boolean;
@@ -1999,6 +2053,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1999
2053
  get isDropdown(): boolean;
2000
2054
  get isAutocomplete(): boolean;
2001
2055
  get isFileUpload(): boolean;
2056
+ get isMediaUpload(): boolean;
2002
2057
  get isRadio(): boolean;
2003
2058
  get isCheckbox(): boolean;
2004
2059
  get isChip(): boolean;
@@ -2044,13 +2099,51 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
2044
2099
  formatFileSize(bytes: number): string;
2045
2100
  get addLabel(): string;
2046
2101
  get removeLabel(): string;
2102
+ get mediaItems(): MediaItem[];
2103
+ /** Number of active items (used to clamp carousel index) */
2104
+ get mediaCount(): number;
2105
+ /** The currently visible carousel item */
2106
+ get activeMediaItem(): MediaItem | null;
2107
+ /** Thumbnail strip items */
2108
+ get mediaThumbnails(): MediaItem[];
2109
+ mediaCarouselPrev(): void;
2110
+ mediaCarouselNext(): void;
2111
+ mediaGoTo(index: number): void;
2112
+ onMediaMenuVideo(): void;
2113
+ addYoutubeMedia(): void;
2114
+ private _extractYoutubeId;
2115
+ onMediaMenuDevice(): void;
2116
+ onMediaFileSelected(event: Event): void;
2117
+ onMediaMenuLibrary(): void;
2118
+ private _loadLibraryImages;
2119
+ getLibraryItemUrl(item: any): string;
2120
+ getLibraryItemId(item: any): any;
2121
+ isLibraryItemSelected(item: any): boolean;
2122
+ toggleLibraryItem(item: any): void;
2123
+ closeLibraryModal(): void;
2124
+ confirmLibrarySelection(): void;
2125
+ removeMediaItem(index: number): void;
2126
+ private _appendMediaItem;
2127
+ private showMediaError;
2047
2128
  static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldComponent, never>;
2048
2129
  static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldComponent, "lib-form-field", never, { "config": { "alias": "config"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "allowMulti": { "alias": "allowMulti"; "required": false; }; }, {}, never, never, false, never>;
2049
2130
  }
2050
2131
 
2132
+ /**
2133
+ * Bypasses Angular's DomSanitizer for resource URLs (e.g. YouTube embed iframes).
2134
+ * Used only for trusted URLs such as YouTube embed links derived from user-provided video IDs.
2135
+ */
2136
+ declare class TrustedUrlPipe implements PipeTransform {
2137
+ private sanitizer;
2138
+ constructor(sanitizer: DomSanitizer);
2139
+ transform(url: string): SafeResourceUrl | null;
2140
+ static ɵfac: i0.ɵɵFactoryDeclaration<TrustedUrlPipe, never>;
2141
+ static ɵpipe: i0.ɵɵPipeDeclaration<TrustedUrlPipe, "trustedUrl", false>;
2142
+ }
2143
+
2051
2144
  declare class SmartFormModule {
2052
2145
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormModule, never>;
2053
- static ɵmod: i0.ɵɵNgModuleDeclaration<SmartFormModule, [typeof SmartFormComponent, typeof FormSectionComponent, typeof FormFieldComponent], [typeof i2$1.CommonModule, typeof i3$1.ReactiveFormsModule, typeof i3$1.FormsModule, typeof MaterialModule, typeof ButtonModule, typeof AlertModule, typeof i9$1.QuillModule], [typeof SmartFormComponent]>;
2146
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SmartFormModule, [typeof SmartFormComponent, typeof FormSectionComponent, typeof FormFieldComponent, typeof TrustedUrlPipe], [typeof i2$1.CommonModule, typeof i3$1.ReactiveFormsModule, typeof i3$1.FormsModule, typeof MaterialModule, typeof ButtonModule, typeof AlertModule, typeof i10$1.QuillModule], [typeof SmartFormComponent]>;
2054
2147
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartFormModule>;
2055
2148
  }
2056
2149
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -119,7 +119,7 @@ $default-smart-form-config: (
119
119
  generated-padding: 0.625rem 0.875rem,
120
120
 
121
121
  // ── File upload drop-zone ───────────────────────────────────────────────────
122
- dropzone-bg: #F8FAFC,
122
+ dropzone-bg: #FFFAF1,
123
123
  dropzone-border: 1.5px dashed #CBD5E1,
124
124
  dropzone-radius: 12px,
125
125
  dropzone-hover-bg: #EFF6FF,