commons-shared-web-ui 0.0.26 → 0.0.27

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,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnInit, OnDestroy, ElementRef, PipeTransform, AfterViewInit, QueryList, NgZone } from '@angular/core';
3
+ import * as i2 from '@angular/material/snack-bar';
4
+ import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
3
5
  import * as i2$1 from '@angular/common';
4
6
  import * as i3$1 from '@angular/forms';
5
7
  import { FormGroup, FormBuilder, FormArray, FormControl, ValidatorFn, ControlValueAccessor, AbstractControl, ValidationErrors } from '@angular/forms';
@@ -7,8 +9,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
7
9
  import * as i3$2 from '@angular/router';
8
10
  import { Router, ActivatedRoute } from '@angular/router';
9
11
  import { BehaviorSubject, Subject, Observable } from 'rxjs';
10
- import * as i2 from '@angular/material/snack-bar';
11
- import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar';
12
12
  import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
13
13
  import * as i1 from '@angular/material/card';
14
14
  import * as i3 from '@angular/material/checkbox';
@@ -632,8 +632,15 @@ declare class FieldSelectionService {
632
632
  * Initialize the store from a FormSchema.
633
633
  */
634
634
  loadSchema(schema: FormSchema): void;
635
+ /**
636
+ * Load a schema while preserving the expanded/collapsed state of sections and groups.
637
+ * Used when the schema structure hasn't changed but field selections have.
638
+ * This prevents the UI from unexpectedly collapsing sections when the user toggles a field.
639
+ */
640
+ loadSchemaPreservingExpanded(schema: FormSchema): void;
635
641
  /**
636
642
  * Toggle a group's enabled state. Disabling cascades to all sections + fields.
643
+ * When enabling, all fields are selected (unless locked).
637
644
  */
638
645
  toggleGroup(groupIndex: number): void;
639
646
  /**
@@ -658,9 +665,19 @@ declare class FieldSelectionService {
658
665
  */
659
666
  buildUpdatedSchema(): FormSchema | null;
660
667
  private _disableAllSections;
668
+ /**
669
+ * Enable all sections and their fields (except locked ones).
670
+ * Used when toggling a section/group back ON to restore field selections.
671
+ */
672
+ private _enableAllSections;
661
673
  private _toggleSectionAtPath;
662
674
  private _toggleExpandedAtPath;
663
675
  private _toggleFieldAtPath;
676
+ /**
677
+ * Recursively merge expansion state from old sections into new sections.
678
+ * Preserves which sections were expanded/collapsed by the user.
679
+ */
680
+ private _mergeExpandedSections;
664
681
  static ɵfac: i0.ɵɵFactoryDeclaration<FieldSelectionService, never>;
665
682
  static ɵprov: i0.ɵɵInjectableDeclaration<FieldSelectionService>;
666
683
  }
@@ -677,6 +694,11 @@ declare class FieldSelectionComponent implements OnChanges {
677
694
  */
678
695
  hideToggleForOptionTypes: boolean;
679
696
  protected readonly store: FieldSelectionService;
697
+ /**
698
+ * Flag to track if the next schema change is from internal toggles.
699
+ * When true, we'll use loadSchemaPreservingExpanded() to keep user's expansion state.
700
+ */
701
+ private _isInternalChange;
680
702
  ngOnChanges(changes: SimpleChanges): void;
681
703
  onToggleGroup(groupIndex: number): void;
682
704
  onToggleGroupExpanded(groupIndex: number): void;
@@ -887,9 +909,32 @@ declare class ConfiguratorTreeComponent {
887
909
  static ɵcmp: i0.ɵɵComponentDeclaration<ConfiguratorTreeComponent, "lib-configurator-tree", never, { "tree": { "alias": "tree"; "required": false; }; "selectedFieldPath": { "alias": "selectedFieldPath"; "required": false; }; }, { "selectField": "selectField"; "toggleExpanded": "toggleExpanded"; }, never, never, false, never>;
888
910
  }
889
911
 
912
+ type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
913
+ interface SnackbarConfig {
914
+ message: string;
915
+ variant?: SnackbarVariant;
916
+ duration?: number;
917
+ horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
918
+ verticalPosition?: 'top' | 'bottom';
919
+ showCloseButton?: boolean;
920
+ }
921
+
922
+ declare class SnackbarService {
923
+ private snackBar;
924
+ constructor(snackBar: MatSnackBar);
925
+ show(config: SnackbarConfig): void;
926
+ success(message: string, duration?: number): void;
927
+ error(message: string, duration?: number): void;
928
+ warning(message: string, duration?: number): void;
929
+ info(message: string, duration?: number): void;
930
+ static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
931
+ static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
932
+ }
933
+
890
934
  declare class ConfiguratorConfigPanelComponent implements OnChanges {
891
935
  private cdr;
892
- constructor(cdr: ChangeDetectorRef);
936
+ private snackbarService;
937
+ constructor(cdr: ChangeDetectorRef, snackbarService: SnackbarService);
893
938
  selectedField: FieldConfig | null;
894
939
  selectedFieldInfo: ConfiguratorFieldInfo | null;
895
940
  builderFieldType: string | null;
@@ -938,8 +983,14 @@ declare class ConfiguratorConfigPanelComponent implements OnChanges {
938
983
  */
939
984
  private _buildConfigFormForType;
940
985
  /**
941
- * Deep-clones the schema and removes any field whose `name` starts with
942
- * `optionConfig.` and removes entire sections that become empty after that.
986
+ * Deep-clones the schema and removes any field whose `name` matches developer-only fields.
987
+ * This prevents end users from modifying system-level configurations like:
988
+ * - optionConfig.* (API URLs, data paths, etc.)
989
+ * - payloadPath (payload mapping)
990
+ * - className (CSS styling)
991
+ * - name (system identifier)
992
+ *
993
+ * Also removes entire sections that become empty after filtering.
943
994
  */
944
995
  private _filterSchemaForOptionConfig;
945
996
  private _extractInitialValuesFromField;
@@ -993,28 +1044,6 @@ declare class ExpressionService {
993
1044
  static ɵprov: i0.ɵɵInjectableDeclaration<ExpressionService>;
994
1045
  }
995
1046
 
996
- type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
997
- interface SnackbarConfig {
998
- message: string;
999
- variant?: SnackbarVariant;
1000
- duration?: number;
1001
- horizontalPosition?: 'start' | 'center' | 'end' | 'left' | 'right';
1002
- verticalPosition?: 'top' | 'bottom';
1003
- showCloseButton?: boolean;
1004
- }
1005
-
1006
- declare class SnackbarService {
1007
- private snackBar;
1008
- constructor(snackBar: MatSnackBar);
1009
- show(config: SnackbarConfig): void;
1010
- success(message: string, duration?: number): void;
1011
- error(message: string, duration?: number): void;
1012
- warning(message: string, duration?: number): void;
1013
- info(message: string, duration?: number): void;
1014
- static ɵfac: i0.ɵɵFactoryDeclaration<SnackbarService, never>;
1015
- static ɵprov: i0.ɵɵInjectableDeclaration<SnackbarService>;
1016
- }
1017
-
1018
1047
  declare class SmartFormComponent implements OnInit, OnChanges, OnDestroy {
1019
1048
  private fb;
1020
1049
  controller: SmartFormController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",