commons-shared-web-ui 0.0.77 → 0.0.79

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
@@ -526,6 +526,33 @@ interface OptionConfig$1 {
526
526
  * pagination is added.
527
527
  */
528
528
  customUI?: boolean;
529
+ /** Edit-mode lookup for resolving primitive initial values (id/code) into full option objects via targeted API call. */
530
+ lookupConfig?: LookupConfig;
531
+ }
532
+ /**
533
+ * Configuration for resolving primitive initial values (id/code) into full
534
+ * option objects during edit-mode form initialization.
535
+ * Only fires when selectedOptionsData is absent and initialValues contains
536
+ * a primitive (not a full object).
537
+ */
538
+ interface LookupConfig {
539
+ /** Endpoint URL. Supports {value} placeholder for single-item GET. */
540
+ apiUrl: string;
541
+ /** HTTP method. Default: 'GET'. Same convention as OptionConfig.apiMethod. */
542
+ apiMethod?: 'GET' | 'POST';
543
+ /** Static base payload for POST. Lookup value(s) merged via paramName key. */
544
+ apiPayload?: any;
545
+ /** Parameter key for the lookup value.
546
+ * GET: query param (?id=2415 or ?ids=5,12,18)
547
+ * POST: body key ({ "codes": ["MATH_01"] })
548
+ * Default: 'id' (single) / 'ids' (multiple). */
549
+ paramName?: string;
550
+ /** Response path to extract results. Falls back to parent optionConfig.dataPath. */
551
+ dataPath?: string;
552
+ /** Custom HTTP headers. Same convention as AutocompleteConfig.headers. */
553
+ headers?: {
554
+ [key: string]: string;
555
+ };
529
556
  }
530
557
  interface AutocompleteDisplayField {
531
558
  /** Dot-notation path to the value in the API response item (e.g. 'login', 'contact.phone'). */
@@ -1560,6 +1587,7 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1560
1587
  private hostRef;
1561
1588
  private overlay;
1562
1589
  private dateAdapter;
1590
+ private cdr;
1563
1591
  config: FieldConfig;
1564
1592
  controller: SmartFormController;
1565
1593
  /**
@@ -1767,7 +1795,7 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1767
1795
  */
1768
1796
  get groupKey(): string;
1769
1797
  readonly dropdownScrollStrategy: ScrollStrategy;
1770
- constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>, overlay: Overlay, dateAdapter: DateAdapter<Date>);
1798
+ constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>, overlay: Overlay, dateAdapter: DateAdapter<Date>, cdr: ChangeDetectorRef);
1771
1799
  isFieldVisible(field: FieldConfig, rowController?: SmartFormController): boolean;
1772
1800
  /** Portal root, resolved from this component's own node rather than the global document. */
1773
1801
  private get portalRoot();
@@ -1973,6 +2001,12 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1973
2001
  resetDropdownSearch(forceLoad?: boolean, bypassCache?: boolean): void;
1974
2002
  /** Merges option(s) from selectedOptionsData into the local dropdown options list */
1975
2003
  mergeSelectedOptionsIntoList(): void;
2004
+ /**
2005
+ * If the field's initial value is a primitive (not an object) and no
2006
+ * selectedOptionsData was provided, uses lookupConfig to fire a targeted
2007
+ * API call to resolve the display label for edit-mode prefilling.
2008
+ */
2009
+ private _resolveLookupIfNeeded;
1976
2010
  /**
1977
2011
  * Extracts option(s) and their corresponding raw codes from an initial value object or array of objects.
1978
2012
  * If the value is a primitive but initialLabelField is configured, it looks up the sibling field value.
@@ -5379,6 +5413,14 @@ interface HierarchyCfg {
5379
5413
  colSpan: number;
5380
5414
  payloadPrefix: string;
5381
5415
  dependencyParam: string;
5416
+ /**
5417
+ * Per-classCode overrides, keyed by the template's classCode (e.g. "GREF.REGION_DISTRICT").
5418
+ * Recognized keys: name, label, placeholder, payloadField, colSpan, required, errorMessage,
5419
+ * noDependency, hidden (skip this node but keep walking its children), disabled (render the
5420
+ * generated field as disabled — e.g. to lock a level to a known value), and leaf (stop
5421
+ * descending past this classCode, so deeper template levels — e.g. Ward below District —
5422
+ * are never generated for this consumer).
5423
+ */
5382
5424
  nodes: Record<string, any>;
5383
5425
  branchSubType: string;
5384
5426
  showLoader: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",