commons-shared-web-ui 0.0.8 → 0.0.10

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
@@ -3,7 +3,7 @@ import { OnInit, OnDestroy, EventEmitter, OnChanges, SimpleChanges, ElementRef,
3
3
  import * as i2$1 from '@angular/common';
4
4
  import * as i1 from '@angular/material/card';
5
5
  import * as i2 from '@angular/material/snack-bar';
6
- import { MatSnackBar } from '@angular/material/snack-bar';
6
+ import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
7
7
  import * as i3 from '@angular/material/checkbox';
8
8
  import * as i4 from '@angular/material/divider';
9
9
  import * as i5 from '@angular/material/select';
@@ -1472,6 +1472,8 @@ interface FormSchema {
1472
1472
  tokenHeader?: string;
1473
1473
  /** Custom label keys for form actions */
1474
1474
  labels?: FormLabels;
1475
+ /** Config for form editing (GET to load, PATCH/PUT to submit) */
1476
+ editConfig?: EditConfig;
1475
1477
  }
1476
1478
  interface FormLabels {
1477
1479
  nextLabel?: string;
@@ -1485,6 +1487,33 @@ interface SubmitConfig {
1485
1487
  method?: 'POST' | 'PUT' | 'PATCH';
1486
1488
  successMessage?: string;
1487
1489
  errorMessage?: string;
1490
+ redirectUrl?: string;
1491
+ extraPayload?: {
1492
+ [key: string]: any;
1493
+ };
1494
+ snackbarConfig?: {
1495
+ duration?: number;
1496
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1497
+ verticalPosition?: 'top' | 'bottom';
1498
+ showCloseButton?: boolean;
1499
+ };
1500
+ }
1501
+ interface EditConfig {
1502
+ loadApiUrl: string;
1503
+ submitApiUrl: string;
1504
+ submitMethod?: 'PATCH' | 'PUT' | 'POST';
1505
+ successMessage?: string;
1506
+ errorMessage?: string;
1507
+ redirectUrl?: string;
1508
+ extraPayload?: {
1509
+ [key: string]: any;
1510
+ };
1511
+ snackbarConfig?: {
1512
+ duration?: number;
1513
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1514
+ verticalPosition?: 'top' | 'bottom';
1515
+ showCloseButton?: boolean;
1516
+ };
1488
1517
  }
1489
1518
  interface SectionConfig {
1490
1519
  children: FieldConfig[];
@@ -1509,6 +1538,8 @@ interface FieldConfig {
1509
1538
  defaultValue?: any;
1510
1539
  placeholder?: string;
1511
1540
  hint?: string;
1541
+ /** Dot-notation path for nested payload mapping (e.g., 'status.code') */
1542
+ payloadPath?: string;
1512
1543
  /**
1513
1544
  * Column span in a 12-column grid (1–12).
1514
1545
  * Use this on any field or ROW to control its width.
@@ -1692,11 +1723,34 @@ declare class ExpressionService {
1692
1723
  static ɵprov: i0.ɵɵInjectableDeclaration<ExpressionService>;
1693
1724
  }
1694
1725
 
1726
+ type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
1727
+ interface SnackbarConfig {
1728
+ message: string;
1729
+ variant?: SnackbarVariant;
1730
+ duration?: number;
1731
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1732
+ verticalPosition?: 'top' | 'bottom';
1733
+ showCloseButton?: boolean;
1734
+ }
1735
+
1736
+ declare class SnackbarService {
1737
+ private snackBar;
1738
+ constructor(snackBar: MatSnackBar);
1739
+ show(config: SnackbarConfig): void;
1740
+ success(message: string, duration?: number): void;
1741
+ error(message: string, duration?: number): void;
1742
+ warning(message: string, duration?: number): void;
1743
+ info(message: string, duration?: number): void;
1744
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
1745
+ static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
1746
+ }
1747
+
1695
1748
  declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1696
1749
  private fb;
1697
1750
  controller: SmartFormController;
1698
1751
  private expressionService;
1699
1752
  private http;
1753
+ private snackbarService;
1700
1754
  formJson: string;
1701
1755
  initialValues?: {
1702
1756
  [key: string]: any;
@@ -1708,6 +1762,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1708
1762
  * Mirrors the pattern used by ConfigurableFormComponent + translateConfig.
1709
1763
  */
1710
1764
  labels: any;
1765
+ mode: 'CREATE' | 'EDIT';
1711
1766
  submit: EventEmitter<{
1712
1767
  [key: string]: any;
1713
1768
  }>;
@@ -1718,8 +1773,9 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1718
1773
  isStepper: boolean;
1719
1774
  currentStep: number;
1720
1775
  isLoading: boolean;
1721
- constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient);
1776
+ constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient, snackbarService: SnackbarService);
1722
1777
  ngOnInit(): void;
1778
+ loadEditData(): void;
1723
1779
  ngOnChanges(changes: SimpleChanges): void;
1724
1780
  ngOnDestroy(): void;
1725
1781
  parseFormJson(): void;
@@ -1727,16 +1783,22 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1727
1783
  collectFields(fields: FieldConfig[]): void;
1728
1784
  handleSubmit(): void;
1729
1785
  /**
1730
- * Recursively extracts values from the formGroup, converting FormArrays to
1731
- * arrays of objects so repeater groups come out as expected.
1786
+ * Constructs nested payload by checking field properties on form controls.
1732
1787
  */
1733
1788
  collectFormData(): {
1734
1789
  [key: string]: any;
1735
1790
  };
1791
+ /**
1792
+ * Deep merges the source object (e.g. extraPayload) into the target object (e.g. form payload).
1793
+ */
1794
+ private deepMerge;
1795
+ private buildNestedPayload;
1796
+ private setNestedValue;
1736
1797
  private extractGroupValue;
1737
1798
  validate(): boolean;
1738
1799
  scrollToFirstInvalidControl(): void;
1739
1800
  submitToApi(formData: any): void;
1801
+ showAlert(type: 'success' | 'error' | 'warning' | 'info', message: string, customConfig?: any): void;
1740
1802
  /** Builds HttpHeaders from the token stored in the controller (sourced from configJSON). */
1741
1803
  getHeaders(): HttpHeaders;
1742
1804
  nextStep(): void;
@@ -1748,7 +1810,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1748
1810
  get submitLabel(): string;
1749
1811
  get previousLabel(): string;
1750
1812
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormComponent, never>;
1751
- static ɵcmp: i0.ɵɵComponentDeclaration<SmartFormComponent, "lib-smart-form", never, { "formJson": { "alias": "formJson"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "enableDraftAutoSave": { "alias": "enableDraftAutoSave"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; }, { "submit": "submit"; "draftSave": "draftSave"; }, never, never, false, never>;
1813
+ static ɵcmp: i0.ɵɵComponentDeclaration<SmartFormComponent, "lib-smart-form", never, { "formJson": { "alias": "formJson"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "enableDraftAutoSave": { "alias": "enableDraftAutoSave"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; }, { "submit": "submit"; "draftSave": "draftSave"; }, never, never, false, never>;
1752
1814
  }
1753
1815
 
1754
1816
  declare class FormSectionComponent implements OnInit, OnDestroy {
@@ -1910,7 +1972,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1910
1972
 
1911
1973
  declare class SmartFormModule {
1912
1974
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartFormModule, never>;
1913
- 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 SmartFormComponent]>;
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]>;
1914
1976
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartFormModule>;
1915
1977
  }
1916
1978
 
@@ -2246,6 +2308,7 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
2246
2308
  [key: string]: any;
2247
2309
  };
2248
2310
  hasStickyColumns: boolean;
2311
+ openDropdownId: string | null;
2249
2312
  searchSubject: Subject<string>;
2250
2313
  stickyHeaders: QueryList<ElementRef>;
2251
2314
  private resizeObserver;
@@ -2281,13 +2344,15 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
2281
2344
  get columnCount(): number;
2282
2345
  onColumnClick(row: any, col: TableColumn): void;
2283
2346
  private getHeaders;
2347
+ toggleDropdown(id: string, event: Event): void;
2348
+ closeDropdown(): void;
2284
2349
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableComponent, never>;
2285
2350
  static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; "columnClick": "columnClick"; }, never, never, false, never>;
2286
2351
  }
2287
2352
 
2288
2353
  declare class SmartTableModule {
2289
2354
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableModule, never>;
2290
- static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof i16.MatMenuModule, typeof i12.MatIconModule], [typeof SmartTableComponent]>;
2355
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof MaterialModule], [typeof SmartTableComponent]>;
2291
2356
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartTableModule>;
2292
2357
  }
2293
2358
 
@@ -2322,5 +2387,19 @@ declare namespace smartForm_examples_d {
2322
2387
  };
2323
2388
  }
2324
2389
 
2325
- export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CheckboxComponent, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DatepickerComponent, DropdownComponent, ExpressionService, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FormComponentsModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SmartFormComponent, SmartFormController, smartForm_examples_d as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, StringUtils, SummaryCardComponent, SummaryCardModule, ToggleComponent, ValidationUtils, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
2326
- export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig$1 as OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableConfig, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
2390
+ declare class SnackbarComponent {
2391
+ data: SnackbarConfig;
2392
+ snackBarRef: MatSnackBarRef<SnackbarComponent>;
2393
+ get variantClass(): string;
2394
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarComponent, never>;
2395
+ static ɵcmp: i0.ɵɵComponentDeclaration<SnackbarComponent, "lib-snackbar", never, {}, {}, never, never, false, never>;
2396
+ }
2397
+
2398
+ declare class SnackbarModule {
2399
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarModule, never>;
2400
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SnackbarModule, [typeof SnackbarComponent], [typeof i2$1.CommonModule, typeof i2.MatSnackBarModule], [typeof SnackbarComponent]>;
2401
+ static ɵinj: i0.ɵɵInjectorDeclaration<SnackbarModule>;
2402
+ }
2403
+
2404
+ export { AlertComponent, AlertModule, ButtonComponent, ButtonModule, CheckboxComponent, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DatepickerComponent, DropdownComponent, ExpressionService, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FormComponentsModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SmartFormComponent, SmartFormController, smartForm_examples_d as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, ToggleComponent, ValidationUtils, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
2405
+ export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig$1 as OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableConfig, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",