commons-shared-web-ui 0.0.10 → 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
@@ -38,6 +38,7 @@ import * as i11$1 from '@angular/cdk/scrolling';
38
38
  import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
39
39
  import { HttpClient, HttpHeaders } from '@angular/common/http';
40
40
  import { Observable, Subject } from 'rxjs';
41
+ import * as i9$1 from 'ngx-quill';
41
42
 
42
43
  declare class MaterialModule {
43
44
  static ɵfac: i0.ɵɵFactoryDeclaration<MaterialModule, never>;
@@ -1520,6 +1521,27 @@ interface SectionConfig {
1520
1521
  allowMulti?: boolean;
1521
1522
  name?: string;
1522
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;
1523
1545
  }
1524
1546
  interface StepperConfig {
1525
1547
  children: FieldConfig[];
@@ -1576,6 +1598,7 @@ interface FieldConfig {
1576
1598
  attachmentConfig?: AttachmentConfig;
1577
1599
  locationConfig?: LocationConfig;
1578
1600
  ratingConfig?: RatingConfig;
1601
+ richTextConfig?: RichTextConfig;
1579
1602
  children?: FieldConfig[];
1580
1603
  }
1581
1604
  interface TextConfig {
@@ -1664,6 +1687,17 @@ interface AttachmentConfig {
1664
1687
  acceptLabel?: string;
1665
1688
  /** Legacy: explicit list of allowed extensions (e.g. ['.pdf', '.jpg']) */
1666
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;
1667
1701
  }
1668
1702
  interface LocationConfig {
1669
1703
  enableCurrentLocation?: boolean;
@@ -1673,6 +1707,10 @@ interface RatingConfig {
1673
1707
  maxRating?: number;
1674
1708
  allowHalf?: boolean;
1675
1709
  }
1710
+ interface RichTextConfig {
1711
+ height?: string;
1712
+ placeholder?: string;
1713
+ }
1676
1714
  interface ValidationResult {
1677
1715
  isValid: boolean;
1678
1716
  errorMessage?: string;
@@ -1868,7 +1906,15 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1868
1906
  showPassword: boolean;
1869
1907
  isDragOver: boolean;
1870
1908
  fileUploadError: string;
1909
+ multiSaveError: string;
1871
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
+ }[];
1872
1918
  /** For GROUP fields with allowMulti = true */
1873
1919
  groupFormArray: FormArray;
1874
1920
  /** For GROUP fields with allowMulti = false — single nested FormGroup */
@@ -1878,11 +1924,17 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1878
1924
  * Using a separate array (not FormArray.controls) + trackBy(id) ensures
1879
1925
  * Angular creates FRESH child components for every new row, preventing
1880
1926
  * cached values from bleeding into new instances.
1927
+ *
1928
+ * Enhanced with isEditing and isSaved flags for the 'multiSave' card UI.
1881
1929
  */
1882
- instanceList: Array<{
1930
+ instanceList: {
1883
1931
  id: number;
1884
1932
  fg: FormGroup;
1885
- }>;
1933
+ initialValue?: any;
1934
+ isEditing?: boolean;
1935
+ isSaved?: boolean;
1936
+ isExpanded?: boolean;
1937
+ }[];
1886
1938
  private _nextInstanceId;
1887
1939
  /**
1888
1940
  * Key used to register the GROUP control on the parent formGroup.
@@ -1891,6 +1943,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1891
1943
  get groupKey(): string;
1892
1944
  constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient);
1893
1945
  ngOnInit(): void;
1946
+ get addMultiLabel(): string;
1894
1947
  private initGroupField;
1895
1948
  /**
1896
1949
  * Sets up cross-field validation based on the `onValidate` formula.
@@ -1899,7 +1952,11 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1899
1952
  */
1900
1953
  private setupFormulaValidation;
1901
1954
  addGroupInstance(): void;
1902
- 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;
1903
1960
  trackByInstanceId(_: number, item: {
1904
1961
  id: number;
1905
1962
  fg: FormGroup;
@@ -1936,16 +1993,35 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1936
1993
  get isTextField(): boolean;
1937
1994
  get isNumberField(): boolean;
1938
1995
  get isDateField(): boolean;
1996
+ get isTimeField(): boolean;
1939
1997
  get isDropdown(): boolean;
1998
+ get isAutocomplete(): boolean;
1940
1999
  get isFileUpload(): boolean;
1941
2000
  get isRadio(): boolean;
1942
2001
  get isCheckbox(): boolean;
1943
2002
  get isChip(): boolean;
1944
2003
  get isSwitch(): boolean;
1945
2004
  get isRating(): boolean;
2005
+ get isRichText(): boolean;
1946
2006
  get isGenerated(): boolean;
1947
2007
  get isRow(): boolean;
1948
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;
1949
2025
  /**
1950
2026
  * Returns the effective grid column span for a child inside a ROW.
1951
2027
  * If the child declares an explicit colSpan, use it.
@@ -1972,7 +2048,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1972
2048
 
1973
2049
  declare class SmartFormModule {
1974
2050
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormModule, never>;
1975
- 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 SmartFormComponent]>;
2051
+ 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]>;
1976
2052
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartFormModule>;
1977
2053
  }
1978
2054
 
@@ -2378,6 +2454,7 @@ declare const SAMPLE_FORMS: {
2378
2454
  documentUploadForm: string;
2379
2455
  demandDefinitionForm: string;
2380
2456
  projectInfoForm: string;
2457
+ faqForm: string;
2381
2458
  };
2382
2459
 
2383
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.10",
3
+ "version": "0.0.12",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -13,7 +13,9 @@
13
13
  "@angular/platform-browser-dynamic": "20.3.15",
14
14
  "@angular/router": "20.3.15",
15
15
  "rxjs": "7.8.0",
16
- "zone.js": "~0.14.0 || ~0.15.0"
16
+ "zone.js": "~0.14.0 || ~0.15.0",
17
+ "ngx-quill": "^28.0.0",
18
+ "quill": "^2.0.3"
17
19
  },
18
20
  "dependencies": {
19
21
  "tslib": "^2.3.0"
@@ -1,3 +1,5 @@
1
+ @import 'quill/dist/quill.snow.css';
2
+
1
3
  :root {
2
4
  /* Default Variables (Can be overridden) */
3
5
  --cc-card-bg: #ffffff;
@@ -47,6 +49,19 @@
47
49
  --field-input-height: 40px;
48
50
  --field-input-radius: 7px;
49
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
+
50
65
  }
51
66
 
52
67
  /* ----------------------------------------------------