commons-shared-web-ui 0.0.11 → 0.0.12

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
@@ -1521,6 +1521,27 @@ interface SectionConfig {
1521
1521
  allowMulti?: boolean;
1522
1522
  name?: string;
1523
1523
  label?: string;
1524
+ /** Configuration for the card-based multi-save UI (FAQ style) */
1525
+ multiSaveConfig?: MultiSaveConfig;
1526
+ }
1527
+ interface MultiSaveConfig {
1528
+ /** If TRUE, enable the Save/Cancel card-based flow for this repeater */
1529
+ active?: boolean;
1530
+ /**
1531
+ * The name of the field to show as the main 'heading' in the collapsed card.
1532
+ * Typically matches the question or name.
1533
+ */
1534
+ summaryField?: string;
1535
+ /**
1536
+ * Optional name of the field to show as the sub-text in the collapsed card.
1537
+ * Typically matches the answer or description.
1538
+ */
1539
+ descriptionField?: string;
1540
+ /**
1541
+ * Custom label key for the 'Add' button. If omitted, defaults to
1542
+ * '+ Add a [label]'.
1543
+ */
1544
+ addLabel?: string;
1524
1545
  }
1525
1546
  interface StepperConfig {
1526
1547
  children: FieldConfig[];
@@ -1666,6 +1687,17 @@ interface AttachmentConfig {
1666
1687
  acceptLabel?: string;
1667
1688
  /** Legacy: explicit list of allowed extensions (e.g. ['.pdf', '.jpg']) */
1668
1689
  allowedExtensions?: string[];
1690
+ /**
1691
+ * API endpoint to upload the file to. When provided, the file is POSTed as
1692
+ * multipart/form-data and the returned URL is stored as dataUrl instead of
1693
+ * the base64 data URL produced by FileReader.
1694
+ */
1695
+ uploadUrl?: string;
1696
+ /**
1697
+ * Entity type sent along with the upload request (e.g. 'ENTITY_TYPE.SESSION').
1698
+ * Only relevant when uploadUrl is set.
1699
+ */
1700
+ entityType?: string;
1669
1701
  }
1670
1702
  interface LocationConfig {
1671
1703
  enableCurrentLocation?: boolean;
@@ -1874,7 +1906,15 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1874
1906
  showPassword: boolean;
1875
1907
  isDragOver: boolean;
1876
1908
  fileUploadError: string;
1909
+ multiSaveError: string;
1877
1910
  private destroy$;
1911
+ /** FormControl used ONLY for the autocomplete text-input display value */
1912
+ autocompleteInputCtrl: FormControl<string>;
1913
+ /** Filtered option list shown in the mat-autocomplete panel */
1914
+ filteredOptions: {
1915
+ label: string;
1916
+ code: any;
1917
+ }[];
1878
1918
  /** For GROUP fields with allowMulti = true */
1879
1919
  groupFormArray: FormArray;
1880
1920
  /** For GROUP fields with allowMulti = false — single nested FormGroup */
@@ -1884,11 +1924,17 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1884
1924
  * Using a separate array (not FormArray.controls) + trackBy(id) ensures
1885
1925
  * Angular creates FRESH child components for every new row, preventing
1886
1926
  * cached values from bleeding into new instances.
1927
+ *
1928
+ * Enhanced with isEditing and isSaved flags for the 'multiSave' card UI.
1887
1929
  */
1888
- instanceList: Array<{
1930
+ instanceList: {
1889
1931
  id: number;
1890
1932
  fg: FormGroup;
1891
- }>;
1933
+ initialValue?: any;
1934
+ isEditing?: boolean;
1935
+ isSaved?: boolean;
1936
+ isExpanded?: boolean;
1937
+ }[];
1892
1938
  private _nextInstanceId;
1893
1939
  /**
1894
1940
  * Key used to register the GROUP control on the parent formGroup.
@@ -1897,6 +1943,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1897
1943
  get groupKey(): string;
1898
1944
  constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient);
1899
1945
  ngOnInit(): void;
1946
+ get addMultiLabel(): string;
1900
1947
  private initGroupField;
1901
1948
  /**
1902
1949
  * Sets up cross-field validation based on the `onValidate` formula.
@@ -1905,7 +1952,11 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1905
1952
  */
1906
1953
  private setupFormulaValidation;
1907
1954
  addGroupInstance(): void;
1908
- removeGroupInstance(index: number): void;
1955
+ saveGroupInstance(index: number): void;
1956
+ cancelGroupInstance(index: number): void;
1957
+ editGroupInstance(index: number): void;
1958
+ toggleExpandGroupInstance(index: number): void;
1959
+ removeGroupInstance(index: number, force?: boolean): void;
1909
1960
  trackByInstanceId(_: number, item: {
1910
1961
  id: number;
1911
1962
  fg: FormGroup;
@@ -1942,7 +1993,9 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1942
1993
  get isTextField(): boolean;
1943
1994
  get isNumberField(): boolean;
1944
1995
  get isDateField(): boolean;
1996
+ get isTimeField(): boolean;
1945
1997
  get isDropdown(): boolean;
1998
+ get isAutocomplete(): boolean;
1946
1999
  get isFileUpload(): boolean;
1947
2000
  get isRadio(): boolean;
1948
2001
  get isCheckbox(): boolean;
@@ -1953,6 +2006,22 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1953
2006
  get isGenerated(): boolean;
1954
2007
  get isRow(): boolean;
1955
2008
  get isGroup(): boolean;
2009
+ /**
2010
+ * Initialise the separate display-control that drives the mat-autocomplete
2011
+ * text input. The real form control always stores the *code* value.
2012
+ */
2013
+ private initAutocomplete;
2014
+ /** Filter options by the user's search text (matches label or code). */
2015
+ private _filterOptions;
2016
+ /** Put the human-readable label into the display control based on the stored code. */
2017
+ private _syncAutocompleteDisplayValue;
2018
+ /** Called when user picks an option from the mat-autocomplete panel. */
2019
+ onAutocompleteSelected(option: {
2020
+ label: string;
2021
+ code: any;
2022
+ }): void;
2023
+ /** Called when the input loses focus — clear display & value if text was manually deleted. */
2024
+ onAutocompleteClear(): void;
1956
2025
  /**
1957
2026
  * Returns the effective grid column span for a child inside a ROW.
1958
2027
  * If the child declares an explicit colSpan, use it.
@@ -2385,6 +2454,7 @@ declare const SAMPLE_FORMS: {
2385
2454
  documentUploadForm: string;
2386
2455
  demandDefinitionForm: string;
2387
2456
  projectInfoForm: string;
2457
+ faqForm: string;
2388
2458
  };
2389
2459
 
2390
2460
  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.11",
3
+ "version": "0.0.12",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -49,6 +49,19 @@
49
49
  --field-input-height: 40px;
50
50
  --field-input-radius: 7px;
51
51
  --field-hint-color: #5f6368;
52
+
53
+ /* MultiSave (Card Repeater) */
54
+ --ms-card-bg: #ffffff;
55
+ --ms-card-border: #e8eaed;
56
+ --ms-card-radius: 10px;
57
+ --ms-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
58
+ --ms-card-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.08);
59
+ --ms-title-color: #111827;
60
+ --ms-desc-color: #6b7280;
61
+ --ms-btn-add-color: #3b82f6;
62
+ --ms-btn-add-hover: #2563eb;
63
+
64
+
52
65
  }
53
66
 
54
67
  /* ----------------------------------------------------