commons-shared-web-ui 0.0.9 → 0.0.11

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';
@@ -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>;
@@ -1472,6 +1473,8 @@ interface FormSchema {
1472
1473
  tokenHeader?: string;
1473
1474
  /** Custom label keys for form actions */
1474
1475
  labels?: FormLabels;
1476
+ /** Config for form editing (GET to load, PATCH/PUT to submit) */
1477
+ editConfig?: EditConfig;
1475
1478
  }
1476
1479
  interface FormLabels {
1477
1480
  nextLabel?: string;
@@ -1485,6 +1488,33 @@ interface SubmitConfig {
1485
1488
  method?: 'POST' | 'PUT' | 'PATCH';
1486
1489
  successMessage?: string;
1487
1490
  errorMessage?: string;
1491
+ redirectUrl?: string;
1492
+ extraPayload?: {
1493
+ [key: string]: any;
1494
+ };
1495
+ snackbarConfig?: {
1496
+ duration?: number;
1497
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1498
+ verticalPosition?: 'top' | 'bottom';
1499
+ showCloseButton?: boolean;
1500
+ };
1501
+ }
1502
+ interface EditConfig {
1503
+ loadApiUrl: string;
1504
+ submitApiUrl: string;
1505
+ submitMethod?: 'PATCH' | 'PUT' | 'POST';
1506
+ successMessage?: string;
1507
+ errorMessage?: string;
1508
+ redirectUrl?: string;
1509
+ extraPayload?: {
1510
+ [key: string]: any;
1511
+ };
1512
+ snackbarConfig?: {
1513
+ duration?: number;
1514
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1515
+ verticalPosition?: 'top' | 'bottom';
1516
+ showCloseButton?: boolean;
1517
+ };
1488
1518
  }
1489
1519
  interface SectionConfig {
1490
1520
  children: FieldConfig[];
@@ -1509,6 +1539,8 @@ interface FieldConfig {
1509
1539
  defaultValue?: any;
1510
1540
  placeholder?: string;
1511
1541
  hint?: string;
1542
+ /** Dot-notation path for nested payload mapping (e.g., 'status.code') */
1543
+ payloadPath?: string;
1512
1544
  /**
1513
1545
  * Column span in a 12-column grid (1–12).
1514
1546
  * Use this on any field or ROW to control its width.
@@ -1545,6 +1577,7 @@ interface FieldConfig {
1545
1577
  attachmentConfig?: AttachmentConfig;
1546
1578
  locationConfig?: LocationConfig;
1547
1579
  ratingConfig?: RatingConfig;
1580
+ richTextConfig?: RichTextConfig;
1548
1581
  children?: FieldConfig[];
1549
1582
  }
1550
1583
  interface TextConfig {
@@ -1642,6 +1675,10 @@ interface RatingConfig {
1642
1675
  maxRating?: number;
1643
1676
  allowHalf?: boolean;
1644
1677
  }
1678
+ interface RichTextConfig {
1679
+ height?: string;
1680
+ placeholder?: string;
1681
+ }
1645
1682
  interface ValidationResult {
1646
1683
  isValid: boolean;
1647
1684
  errorMessage?: string;
@@ -1692,11 +1729,34 @@ declare class ExpressionService {
1692
1729
  static ɵprov: i0.ɵɵInjectableDeclaration<ExpressionService>;
1693
1730
  }
1694
1731
 
1732
+ type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
1733
+ interface SnackbarConfig {
1734
+ message: string;
1735
+ variant?: SnackbarVariant;
1736
+ duration?: number;
1737
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1738
+ verticalPosition?: 'top' | 'bottom';
1739
+ showCloseButton?: boolean;
1740
+ }
1741
+
1742
+ declare class SnackbarService {
1743
+ private snackBar;
1744
+ constructor(snackBar: MatSnackBar);
1745
+ show(config: SnackbarConfig): void;
1746
+ success(message: string, duration?: number): void;
1747
+ error(message: string, duration?: number): void;
1748
+ warning(message: string, duration?: number): void;
1749
+ info(message: string, duration?: number): void;
1750
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
1751
+ static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
1752
+ }
1753
+
1695
1754
  declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1696
1755
  private fb;
1697
1756
  controller: SmartFormController;
1698
1757
  private expressionService;
1699
1758
  private http;
1759
+ private snackbarService;
1700
1760
  formJson: string;
1701
1761
  initialValues?: {
1702
1762
  [key: string]: any;
@@ -1708,6 +1768,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1708
1768
  * Mirrors the pattern used by ConfigurableFormComponent + translateConfig.
1709
1769
  */
1710
1770
  labels: any;
1771
+ mode: 'CREATE' | 'EDIT';
1711
1772
  submit: EventEmitter<{
1712
1773
  [key: string]: any;
1713
1774
  }>;
@@ -1718,8 +1779,9 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1718
1779
  isStepper: boolean;
1719
1780
  currentStep: number;
1720
1781
  isLoading: boolean;
1721
- constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient);
1782
+ constructor(fb: FormBuilder, controller: SmartFormController, expressionService: ExpressionService, http: HttpClient, snackbarService: SnackbarService);
1722
1783
  ngOnInit(): void;
1784
+ loadEditData(): void;
1723
1785
  ngOnChanges(changes: SimpleChanges): void;
1724
1786
  ngOnDestroy(): void;
1725
1787
  parseFormJson(): void;
@@ -1727,16 +1789,22 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1727
1789
  collectFields(fields: FieldConfig[]): void;
1728
1790
  handleSubmit(): void;
1729
1791
  /**
1730
- * Recursively extracts values from the formGroup, converting FormArrays to
1731
- * arrays of objects so repeater groups come out as expected.
1792
+ * Constructs nested payload by checking field properties on form controls.
1732
1793
  */
1733
1794
  collectFormData(): {
1734
1795
  [key: string]: any;
1735
1796
  };
1797
+ /**
1798
+ * Deep merges the source object (e.g. extraPayload) into the target object (e.g. form payload).
1799
+ */
1800
+ private deepMerge;
1801
+ private buildNestedPayload;
1802
+ private setNestedValue;
1736
1803
  private extractGroupValue;
1737
1804
  validate(): boolean;
1738
1805
  scrollToFirstInvalidControl(): void;
1739
1806
  submitToApi(formData: any): void;
1807
+ showAlert(type: 'success' | 'error' | 'warning' | 'info', message: string, customConfig?: any): void;
1740
1808
  /** Builds HttpHeaders from the token stored in the controller (sourced from configJSON). */
1741
1809
  getHeaders(): HttpHeaders;
1742
1810
  nextStep(): void;
@@ -1748,7 +1816,7 @@ declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1748
1816
  get submitLabel(): string;
1749
1817
  get previousLabel(): string;
1750
1818
  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>;
1819
+ 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
1820
  }
1753
1821
 
1754
1822
  declare class FormSectionComponent implements OnInit, OnDestroy {
@@ -1881,6 +1949,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1881
1949
  get isChip(): boolean;
1882
1950
  get isSwitch(): boolean;
1883
1951
  get isRating(): boolean;
1952
+ get isRichText(): boolean;
1884
1953
  get isGenerated(): boolean;
1885
1954
  get isRow(): boolean;
1886
1955
  get isGroup(): boolean;
@@ -1910,7 +1979,7 @@ declare class FormFieldComponent implements OnInit, OnDestroy {
1910
1979
 
1911
1980
  declare class SmartFormModule {
1912
1981
  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]>;
1982
+ 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]>;
1914
1983
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartFormModule>;
1915
1984
  }
1916
1985
 
@@ -2325,5 +2394,19 @@ declare namespace smartForm_examples_d {
2325
2394
  };
2326
2395
  }
2327
2396
 
2328
- 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 };
2329
- 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 };
2397
+ declare class SnackbarComponent {
2398
+ data: SnackbarConfig;
2399
+ snackBarRef: MatSnackBarRef<SnackbarComponent>;
2400
+ get variantClass(): string;
2401
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarComponent, never>;
2402
+ static ɵcmp: i0.ɵɵComponentDeclaration<SnackbarComponent, "lib-snackbar", never, {}, {}, never, never, false, never>;
2403
+ }
2404
+
2405
+ declare class SnackbarModule {
2406
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarModule, never>;
2407
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SnackbarModule, [typeof SnackbarComponent], [typeof i2$1.CommonModule, typeof i2.MatSnackBarModule], [typeof SnackbarComponent]>;
2408
+ static ɵinj: i0.ɵɵInjectorDeclaration<SnackbarModule>;
2409
+ }
2410
+
2411
+ 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 };
2412
+ 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.9",
3
+ "version": "0.0.11",
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;