commons-shared-web-ui 0.0.59 → 0.0.61

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 { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, OnDestroy, ElementRef, QueryList, PipeTransform, AfterViewInit, NgZone } from '@angular/core';
2
+ import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, AfterViewInit, OnDestroy, ElementRef, QueryList, PipeTransform, NgZone } from '@angular/core';
3
3
  import * as i2 from '@angular/material/snack-bar';
4
4
  import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
5
5
  import * as i2$1 from '@angular/common';
@@ -258,6 +258,14 @@ interface FieldConfig {
258
258
  subType?: string;
259
259
  visible?: boolean;
260
260
  visibilityExpression?: string;
261
+ /**
262
+ * A boolean expression string (same syntax as visibilityExpression) evaluated
263
+ * at runtime to dynamically toggle the `required` validator on this control.
264
+ * When omitted, the static `required` boolean governs validation as before —
265
+ * fully backwards-compatible.
266
+ * Example: "[12,15].indexOf(Number(sessionTypeId)) !== -1"
267
+ */
268
+ requiredExpression?: string;
261
269
  isEnabled?: boolean;
262
270
  required?: boolean;
263
271
  disabled?: boolean;
@@ -1387,10 +1395,11 @@ interface TimePickerConfig {
1387
1395
  disabledColor?: string;
1388
1396
  }
1389
1397
 
1390
- declare class FormFieldComponent implements OnInit, OnDestroy {
1398
+ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1391
1399
  private fb;
1392
1400
  private expressionService;
1393
1401
  private http;
1402
+ private hostRef;
1394
1403
  config: FieldConfig;
1395
1404
  controller: SmartFormController;
1396
1405
  /**
@@ -1446,6 +1455,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1446
1455
  mediaDeviceInput: ElementRef<HTMLInputElement>;
1447
1456
  /** Host div for the library picker — always in DOM, moved to body to escape parent transforms */
1448
1457
  libraryModalRef: ElementRef<HTMLDivElement>;
1458
+ private portalElement;
1449
1459
  showMediaMenu: boolean;
1450
1460
  showYoutubeInput: boolean;
1451
1461
  youtubeUrlInput: string;
@@ -1525,7 +1535,9 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1525
1535
  * Priority: sectionConfig.name > field.name > camelCase(label) > '__group__'
1526
1536
  */
1527
1537
  get groupKey(): string;
1528
- constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient);
1538
+ constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>);
1539
+ /** Portal root, resolved from this component's own node rather than the global document. */
1540
+ private get portalRoot();
1529
1541
  ngOnInit(): void;
1530
1542
  get addMultiLabel(): string;
1531
1543
  /** Getter for Select placeholder label */
@@ -1588,6 +1600,25 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1588
1600
  */
1589
1601
  setupMatchValidation(): void;
1590
1602
  setupVisibility(): void;
1603
+ /**
1604
+ * When config.requiredExpression is set, dynamically re-evaluates the required
1605
+ * validator whenever any referenced variable changes in the controller.
1606
+ * Fully backwards-compatible: fields without requiredExpression are unaffected.
1607
+ */
1608
+ setupRequiredExpression(): void;
1609
+ /**
1610
+ * Returns all validators from getValidators() except Validators.required.
1611
+ * Used by setupRequiredExpression() to rebuild the validator list without
1612
+ * duplicating the required validator.
1613
+ */
1614
+ private getValidatorsWithoutRequired;
1615
+ /**
1616
+ * trackBy function for field *ngFor loops in ROW containers.
1617
+ * Keying by field name (or type as fallback for unnamed containers) prevents
1618
+ * Angular from destroying and recreating FormFieldComponent instances on re-render,
1619
+ * preserving localOptionList cache and avoiding duplicate API calls.
1620
+ */
1621
+ trackByFieldName(_: number, field: FieldConfig): string;
1591
1622
  setupMinDateField(): void;
1592
1623
  /**
1593
1624
  * Wires up a dynamic minimum for a TIME field from a sibling TIME field
@@ -1684,7 +1715,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1684
1715
  /** Execute client-side or server-side dropdown search. */
1685
1716
  private executeDropdownSearch;
1686
1717
  /** Resets the dropdown search text and filtered list. */
1687
- resetDropdownSearch(): void;
1718
+ resetDropdownSearch(forceLoad?: boolean, bypassCache?: boolean): void;
1688
1719
  /** Merges option(s) from selectedOptionsData into the local dropdown options list */
1689
1720
  mergeSelectedOptionsIntoList(): void;
1690
1721
  /**
@@ -2034,6 +2065,14 @@ declare class FormSectionComponent implements OnInit, OnDestroy {
2034
2065
  get flatFormGroup(): FormGroup;
2035
2066
  /** Flatten a field tree to get all leaf fields (for ROW children etc.) */
2036
2067
  getFlatFields(fields: FieldConfig[]): FieldConfig[];
2068
+ /**
2069
+ * trackBy function for field *ngFor loops.
2070
+ * Keying by field name (or type as fallback for unnamed containers) prevents
2071
+ * Angular from destroying and recreating FormFieldComponent instances when the
2072
+ * parent re-renders — preserving localOptionList cache and avoiding duplicate
2073
+ * API calls.
2074
+ */
2075
+ trackByFieldName(_: number, field: FieldConfig): string;
2037
2076
  static ɵfac: i0.ɵɵFactoryDeclaration<FormSectionComponent, never>;
2038
2077
  static ɵcmp: i0.ɵɵComponentDeclaration<FormSectionComponent, "lib-form-section", never, { "config": { "alias": "config"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; }, {}, never, never, false, never>;
2039
2078
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.59",
3
+ "version": "0.0.61",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",