commons-shared-web-ui 0.0.15 → 0.0.16

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
@@ -1720,9 +1720,62 @@ interface AttachmentConfig {
1720
1720
  features?: string[];
1721
1721
  }
1722
1722
  interface LocationConfig {
1723
+ /** Default active tab: 'VENUE' | 'ONLINE' | 'TBA'. Defaults to 'VENUE'. */
1724
+ defaultTab?: 'VENUE' | 'ONLINE' | 'TBA';
1725
+ /** Allow multiple locations. Replaces the need for maxLocations. */
1726
+ allowMulti?: boolean;
1727
+ /** Maximum number of venue locations allowed. Defaults to 5 if allowMulti is true. */
1728
+ maxLocations?: number;
1729
+ /** Placeholder for the venue search input */
1730
+ venuePlaceholder?: string;
1731
+ /** Google Maps API Key – required for map rendering and autocomplete */
1732
+ googleMapsApiKey?: string;
1733
+ /** Height of the embedded Google Map. Defaults to '300px'. */
1734
+ mapHeight?: string;
1735
+ /** Default map center latitude when no locations are added (e.g., India: 20.5937) */
1736
+ defaultLat?: number;
1737
+ /** Default map center longitude when no locations are added (e.g., India: 78.9629) */
1738
+ defaultLng?: number;
1739
+ /** Default zoom level when no locations are added (e.g., 4) */
1740
+ defaultZoom?: number;
1741
+ /** Placeholder for the online event URL input */
1742
+ onlinePlaceholder?: string;
1743
+ /** Show map preview after locations are added (default: true) */
1744
+ showMap?: boolean;
1745
+ /** Whether the current location button is enabled inside venue tab */
1723
1746
  enableCurrentLocation?: boolean;
1747
+ /** @deprecated Use showMap instead */
1724
1748
  enableMapPicker?: boolean;
1725
1749
  }
1750
+ /** A single venue location picked from Google Places autocomplete. */
1751
+ interface LocationItem {
1752
+ uuid?: string;
1753
+ isActive?: boolean;
1754
+ id?: number;
1755
+ locationCode?: string;
1756
+ latitude?: number;
1757
+ longitude?: number;
1758
+ address?: string;
1759
+ name?: string;
1760
+ cityLabel?: string;
1761
+ stateLabel?: string;
1762
+ countryLabel?: string;
1763
+ placeId?: string;
1764
+ type?: string;
1765
+ /** Legacy field for UI binding */
1766
+ description?: string;
1767
+ }
1768
+ /**
1769
+ * Value shape stored in the FormControl for a LOCATION field.
1770
+ * `tab` indicates which mode is active.
1771
+ */
1772
+ interface LocationFieldValue {
1773
+ tab: 'VENUE' | 'ONLINE' | 'TBA';
1774
+ /** Array of venue locations (only valid when tab === 'VENUE') */
1775
+ venues?: LocationItem[];
1776
+ /** Event URL (only valid when tab === 'ONLINE') */
1777
+ onlineUrl?: string;
1778
+ }
1726
1779
  interface RatingConfig {
1727
1780
  maxRating?: number;
1728
1781
  allowHalf?: boolean;
@@ -1962,6 +2015,22 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1962
2015
  libraryLoading: boolean;
1963
2016
  libraryError: string;
1964
2017
  mediaUploadError: string;
2018
+ /** Active tab: VENUE | ONLINE | TBA */
2019
+ locationActiveTab: 'VENUE' | 'ONLINE' | 'TBA';
2020
+ /** Current text in the venue search box */
2021
+ locationSearchText: string;
2022
+ /** Google Places autocomplete suggestions */
2023
+ locationSuggestions: any[];
2024
+ /** Show the suggestions dropdown */
2025
+ locationShowSuggestions: boolean;
2026
+ /** Cached Google AutocompleteService instance */
2027
+ private _googleAcService;
2028
+ /** Whether Google Maps is loaded */
2029
+ locationMapLoaded: boolean;
2030
+ /** Map instance */
2031
+ private _googleMap;
2032
+ /** Map markers */
2033
+ private _mapMarkers;
1965
2034
  /** FormControl used ONLY for the autocomplete text-input display value */
1966
2035
  autocompleteInputCtrl: FormControl<string>;
1967
2036
  /** Filtered option list shown in the mat-autocomplete panel */
@@ -2063,6 +2132,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
2063
2132
  get isGenerated(): boolean;
2064
2133
  get isRow(): boolean;
2065
2134
  get isGroup(): boolean;
2135
+ get isLocation(): boolean;
2066
2136
  /**
2067
2137
  * Initialise the separate display-control that drives the mat-autocomplete
2068
2138
  * text input. The real form control always stores the *code* value.
@@ -2125,6 +2195,21 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
2125
2195
  removeMediaItem(index: number): void;
2126
2196
  private _appendMediaItem;
2127
2197
  private showMediaError;
2198
+ private initLocationField;
2199
+ private _ensureGoogleMapsScript;
2200
+ onLocationTabChange(tab: 'VENUE' | 'ONLINE' | 'TBA'): void;
2201
+ get locationValue(): LocationFieldValue;
2202
+ get locationVenues(): LocationItem[];
2203
+ get locationOnlineUrl(): string;
2204
+ get locationMaxReached(): boolean;
2205
+ handleLocationSearchInput(event: Event): void;
2206
+ onLocationSuggestionSelect(prediction: any): void;
2207
+ private _addVenueAndUpdate;
2208
+ removeLocationVenue(index: number): void;
2209
+ onLocationUrlChange(url: string): void;
2210
+ hideLocationSuggestions(): void;
2211
+ getLocationMapEmbedUrl(): string;
2212
+ private _renderMap;
2128
2213
  static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldComponent, never>;
2129
2214
  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>;
2130
2215
  }
@@ -2620,6 +2705,7 @@ declare const SAMPLE_FORMS: {
2620
2705
  demandDefinitionForm: string;
2621
2706
  projectInfoForm: string;
2622
2707
  faqForm: string;
2708
+ locationForm: string;
2623
2709
  };
2624
2710
 
2625
2711
  declare const smartForm_examples_d_SAMPLE_FORMS: typeof SAMPLE_FORMS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",