commons-shared-web-ui 0.0.63 → 0.0.65

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
@@ -10,7 +10,7 @@ import * as i3$2 from '@angular/router';
10
10
  import { Router, ActivatedRoute } from '@angular/router';
11
11
  import { BehaviorSubject, Subject, Observable } from 'rxjs';
12
12
  import * as i8$1 from '@angular/cdk/overlay';
13
- import { ConnectedPosition } from '@angular/cdk/overlay';
13
+ import { ScrollStrategy, Overlay, ConnectedPosition } from '@angular/cdk/overlay';
14
14
  import { DomSanitizer, SafeResourceUrl, SafeHtml } from '@angular/platform-browser';
15
15
  import * as i1 from '@angular/material/card';
16
16
  import * as i3 from '@angular/material/checkbox';
@@ -420,16 +420,70 @@ interface DropdownSearchConfig {
420
420
  mode?: 'local' | 'server';
421
421
  /** Query parameter key for the search term sent to the API (default: 'search'). Only used in 'server' mode. */
422
422
  searchKey?: string;
423
+ /** Handling mode: 'standard' (e.g. ?search=term) or 'nested_string' (e.g. ?params=...--SEARCH_TEXT=term) */
424
+ handling?: 'standard' | 'nested_string';
423
425
  /** Minimum characters required before triggering a server-side search (default: 3). Only used in 'server' mode. */
424
426
  minSearchLength?: number;
425
427
  /** Debounce delay in milliseconds before firing search (default: 300). */
426
428
  debounceTime?: number;
427
429
  }
430
+ interface NestedStringConfig$1 {
431
+ /** Name of the URL query parameter holding the packed string. Default: 'params' */
432
+ paramName: string;
433
+ /** Static base string prepended before dynamic parameters. E.g. 'MARKET_ID=5' */
434
+ baseValue?: string;
435
+ /** Delimiter string between key-value pairs. Default: '--' */
436
+ separator: string;
437
+ /** Key-value assignment operator. Default: '=' */
438
+ assignment?: string;
439
+ }
440
+ interface QueryParamsConfig$1 {
441
+ /** Query parameter key for page index. Default: 'page' */
442
+ pageKey?: string;
443
+ /** Query parameter key for page size. Default: 'size' */
444
+ sizeKey?: string;
445
+ /** Page index offset adjustment (e.g. -1 or 0 or 1). Default: 0 */
446
+ pageIndexOffset?: number;
447
+ /** Handling mode: 'standard' or 'nested_string' */
448
+ filterHandling?: 'standard' | 'nested_string';
449
+ /** Nested string configuration for Dataset APIs */
450
+ nestedStringConfig?: NestedStringConfig$1;
451
+ }
452
+ interface TotalCountConfig {
453
+ /** 'same' (count returned in data response) or 'separate' (dedicated count endpoint). Default: 'same' */
454
+ source?: 'same' | 'separate';
455
+ /** Dedicated Count API URL (required when source === 'separate') */
456
+ apiUrl?: string;
457
+ /** Dot-notation path to extract count (e.g. '0.totalCount', '[0].totalCount', 'totalElements', 'data.total') */
458
+ responsePath?: string;
459
+ }
460
+ interface DropdownPaginationConfig {
461
+ /** Enable server-side pagination. */
462
+ enabled: boolean;
463
+ /** 'loadMore' button or 'infiniteScroll' on scroll. Default: 'loadMore' */
464
+ mode?: 'loadMore' | 'infiniteScroll';
465
+ /** Page size per request. Default: 10 */
466
+ pageSize?: number;
467
+ /** Query param for page index (shorthand when queryParamsConfig is not provided). Default: 'page' */
468
+ pageKey?: string;
469
+ /** Query param for page size (shorthand when queryParamsConfig is not provided). Default: 'size' */
470
+ sizeKey?: string;
471
+ /** 0 for 0-indexed APIs, 1 for 1-indexed APIs. Default: 0 */
472
+ pageOffset?: number;
473
+ /** Configuration for dataset separate count API or same-response count parsing */
474
+ totalCountConfig?: TotalCountConfig;
475
+ /** Shorthand for totalCountConfig.responsePath */
476
+ totalCountPath?: string;
477
+ }
428
478
  interface OptionConfig$1 {
429
479
  optionClass?: string;
430
480
  optionUrl?: string;
431
481
  apiUrl?: string;
432
482
  apiUrls?: string[];
483
+ /** HTTP method for option API requests. Default: 'GET' */
484
+ apiMethod?: 'GET' | 'POST' | 'PUT' | 'PATCH';
485
+ /** Custom request payload body sent with POST/PUT/PATCH requests. */
486
+ apiPayload?: any;
433
487
  dataPath?: string;
434
488
  labelPath?: string;
435
489
  valuePath?: string;
@@ -442,6 +496,12 @@ interface OptionConfig$1 {
442
496
  optionList?: OptionItem[];
443
497
  /** Configuration for enabling search functionality inside the dropdown panel. */
444
498
  searchConfig?: DropdownSearchConfig;
499
+ /** Query parameters configuration matching smart-table (for pagination and dataset APIs). */
500
+ queryParamsConfig?: QueryParamsConfig$1;
501
+ /** Server-side pagination configuration (loadMore or infiniteScroll). */
502
+ pagination?: DropdownPaginationConfig;
503
+ /** Nested string config shorthand for Dataset APIs. */
504
+ nestedStringConfig?: NestedStringConfig$1;
445
505
  /** When true, renders a 'Select All' checkbox at the top of a MULTIPLE select dropdown. */
446
506
  showSelectAll?: boolean;
447
507
  /** When true, displays a loading spinner during options API requests. */
@@ -960,7 +1020,7 @@ interface ConfiguratorTreeNode {
960
1020
  label: string;
961
1021
  /** Node type */
962
1022
  type: ConfiguratorNodeType;
963
- /** Whether the node is expanded (for groups/sections) */
1023
+ /** Whether the node is expanded (for groups/sections, and for a 'field' node with children — see geoClassCode) */
964
1024
  expanded: boolean;
965
1025
  /** Reference to the FieldConfig (only for field nodes) */
966
1026
  fieldConfig: FieldConfig | null;
@@ -968,6 +1028,14 @@ interface ConfiguratorTreeNode {
968
1028
  path: number[];
969
1029
  /** Child nodes */
970
1030
  children: ConfiguratorTreeNode[];
1031
+ /**
1032
+ * Set only on synthetic geography-hierarchy-level nodes (children of a GEOGRAPHY_DYNAMIC
1033
+ * field, e.g. Country/State/District). These don't exist as real schema array children —
1034
+ * they live in the parent field's nested `geographyConfig.field.nodes` map — so `path` on
1035
+ * these nodes equals the PARENT GEOGRAPHY_DYNAMIC field's own path, and `geoClassCode` is
1036
+ * what actually distinguishes one level (and the parent itself, where it's undefined).
1037
+ */
1038
+ geoClassCode?: string;
971
1039
  }
972
1040
 
973
1041
  /**
@@ -980,6 +1048,16 @@ declare class FieldConfiguratorService {
980
1048
  readonly tree: i0.Signal<ConfiguratorTreeNode[]>;
981
1049
  readonly schema: i0.Signal<FormSchema>;
982
1050
  readonly selectedFieldPath: i0.Signal<number[]>;
1051
+ readonly selectedGeoClassCode: i0.Signal<string>;
1052
+ /**
1053
+ * Resolves to the real FieldConfig at the selected path — UNLESS the selection is a
1054
+ * synthetic geography-hierarchy-level node (selectedGeoClassCode set), in which case this
1055
+ * returns a small synthetic FieldConfig built from that level's entry in the parent
1056
+ * GEOGRAPHY_DYNAMIC field's `geographyConfig.field.nodes` map instead. Every downstream
1057
+ * consumer (selectedFieldInfo, selectedFieldBuilderType, the config panel itself) works
1058
+ * against whichever shape comes out of here unchanged — mapFieldTypeToBuilderType('GEOGRAPHY_NODE')
1059
+ * resolves the right minimal config schema (label/colSpan only, see field-type-schema.map.ts).
1060
+ */
983
1061
  readonly selectedField: i0.Signal<FieldConfig>;
984
1062
  readonly selectedFieldInfo: i0.Signal<ConfiguratorFieldInfo>;
985
1063
  /**
@@ -992,9 +1070,11 @@ declare class FieldConfiguratorService {
992
1070
  */
993
1071
  loadSchema(schema: FormSchema, preserveSelection?: boolean): void;
994
1072
  /**
995
- * Select a field by its path. Pass null to deselect.
1073
+ * Select a field by its path. Pass null to deselect. `geoClassCode` selects a synthetic
1074
+ * geography-hierarchy-level child of the GEOGRAPHY_DYNAMIC field at `path` instead of the
1075
+ * field itself — see ConfiguratorTreeNode.geoClassCode / selectedField above.
996
1076
  */
997
- selectField(path: number[] | null): void;
1077
+ selectField(path: number[] | null, geoClassCode?: string | null): void;
998
1078
  /**
999
1079
  * Toggle a tree node's expanded state.
1000
1080
  */
@@ -1007,7 +1087,8 @@ declare class FieldConfiguratorService {
1007
1087
  /**
1008
1088
  * Change the type (and optionally subType) of the currently selected field.
1009
1089
  * Mapping goes from builderType keys (e.g. 'richText') → {type, subType?}.
1010
- * DROPDOWN fields cannot be changed and are guarded here as well.
1090
+ * DROPDOWN fields cannot be changed and are guarded here as well — same for a synthetic
1091
+ * geography-hierarchy-level selection, which has no real `type` to switch at all.
1011
1092
  */
1012
1093
  changeFieldType(builderType: string): void;
1013
1094
  /**
@@ -1048,7 +1129,10 @@ declare class FieldConfiguratorComponent implements OnChanges {
1048
1129
  finalFieldTypeSchemaMap: Record<string, FormSchema>;
1049
1130
  private _isInternalChange;
1050
1131
  ngOnChanges(changes: SimpleChanges): void;
1051
- onFieldSelected(path: number[]): void;
1132
+ onFieldSelected(selection: {
1133
+ path: number[];
1134
+ geoClassCode?: string;
1135
+ }): void;
1052
1136
  onNodeToggleExpanded(nodeId: string): void;
1053
1137
  onConfigChange(patch: Record<string, unknown>): void;
1054
1138
  onTypeChange(builderType: string): void;
@@ -1128,7 +1212,13 @@ declare class SelectionFieldNodeComponent {
1128
1212
  declare class ConfiguratorTreeComponent {
1129
1213
  tree: ConfiguratorTreeNode[];
1130
1214
  selectedFieldPath: number[] | null;
1131
- selectField: EventEmitter<number[]>;
1215
+ /** Distinguishes a GEOGRAPHY_DYNAMIC field itself from one of its synthetic hierarchy-level
1216
+ * children — both share the same `path`, so `path` alone can't tell them apart. */
1217
+ selectedGeoClassCode: string | null;
1218
+ selectField: EventEmitter<{
1219
+ path: number[];
1220
+ geoClassCode?: string;
1221
+ }>;
1132
1222
  toggleExpanded: EventEmitter<string>;
1133
1223
  onNodeClick(node: ConfiguratorTreeNode): void;
1134
1224
  onFieldSelect(node: ConfiguratorTreeNode): void;
@@ -1137,7 +1227,7 @@ declare class ConfiguratorTreeComponent {
1137
1227
  trackByNodeId(_index: number, node: ConfiguratorTreeNode): string;
1138
1228
  private pathsEqual;
1139
1229
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfiguratorTreeComponent, never>;
1140
- 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>;
1230
+ static ɵcmp: i0.ɵɵComponentDeclaration<ConfiguratorTreeComponent, "lib-configurator-tree", never, { "tree": { "alias": "tree"; "required": false; }; "selectedFieldPath": { "alias": "selectedFieldPath"; "required": false; }; "selectedGeoClassCode": { "alias": "selectedGeoClassCode"; "required": false; }; }, { "selectField": "selectField"; "toggleExpanded": "toggleExpanded"; }, never, never, false, never>;
1141
1231
  }
1142
1232
 
1143
1233
  type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
@@ -1200,7 +1290,8 @@ declare class ConfiguratorConfigPanelComponent implements OnChanges {
1200
1290
  currentBuilderType: string | null;
1201
1291
  /** Identity key of the currently rendered field — used to detect real field switches. */
1202
1292
  private _currentFieldKey;
1203
- /** True when the current field type is DROPDOWN — type switching is disabled for these fields. */
1293
+ /** True when type switching should be disabled — DROPDOWN-based fields, and synthetic
1294
+ * geography-hierarchy-level nodes (GEOGRAPHY_NODE), which have no real `type` to switch. */
1204
1295
  get isDropdownType(): boolean;
1205
1296
  ngOnChanges(changes: SimpleChanges): void;
1206
1297
  /**
@@ -1402,6 +1493,7 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1402
1493
  private expressionService;
1403
1494
  private http;
1404
1495
  private hostRef;
1496
+ private overlay;
1405
1497
  config: FieldConfig;
1406
1498
  controller: SmartFormController;
1407
1499
  /**
@@ -1450,6 +1542,10 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1450
1542
  get effectiveMaxTime(): string | null;
1451
1543
  isMultiDropdownOpen: boolean;
1452
1544
  isSingleDropdownOpen: boolean;
1545
+ dropdownCurrentPage: number;
1546
+ dropdownTotalCount: number;
1547
+ hasMoreDropdownPages: boolean;
1548
+ isDropdownLoadingMore: boolean;
1453
1549
  searchText: string;
1454
1550
  filteredOptionList: any[];
1455
1551
  dropdownSearch$: Subject<string>;
@@ -1542,9 +1638,11 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1542
1638
  * Priority: sectionConfig.name > field.name > camelCase(label) > '__group__'
1543
1639
  */
1544
1640
  get groupKey(): string;
1545
- constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>);
1641
+ readonly dropdownScrollStrategy: ScrollStrategy;
1642
+ constructor(fb: FormBuilder, expressionService: ExpressionService, http: HttpClient, hostRef: ElementRef<HTMLElement>, overlay: Overlay);
1546
1643
  /** Portal root, resolved from this component's own node rather than the global document. */
1547
1644
  private get portalRoot();
1645
+ private _onGlobalScroll;
1548
1646
  ngOnInit(): void;
1549
1647
  get addMultiLabel(): string;
1550
1648
  /** Getter for Select placeholder label */
@@ -1565,6 +1663,8 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1565
1663
  get singleSelectedLabel(): string;
1566
1664
  /** Whether the dropdown search feature is enabled for this field */
1567
1665
  get isSearchableDropdown(): boolean;
1666
+ /** Whether the custom single-select dropdown overlay is required (for search OR pagination) */
1667
+ get isCustomSingleDropdown(): boolean;
1568
1668
  private initGroupField;
1569
1669
  /**
1570
1670
  * Sets up cross-field validation based on the `onValidate` formula.
@@ -1640,9 +1740,21 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1640
1740
  }): any;
1641
1741
  extractFunctionName(formula: string): string | null;
1642
1742
  setupDependencies(): void;
1743
+ /** Extracts the total item count from an API response using the configured path or fallbacks. */
1744
+ private extractTotalCount;
1745
+ /** Builds HttpParams for dropdown requests supporting both standard and nested_string (dataset) formats. */
1746
+ private buildDropdownQueryParams;
1747
+ /**
1748
+ * Loads options for DROPDOWN / AUTOCOMPLETE fields.
1749
+ * Supports server-side pagination, separate Dataset count endpoints, and nested_string params.
1750
+ */
1643
1751
  loadDropdownOptions(dynamicParams?: {
1644
1752
  [key: string]: any;
1645
- }): void;
1753
+ }, pageIndex?: number, isLoadMore?: boolean): void;
1754
+ /** Triggers loading the next page of dropdown options. */
1755
+ loadMoreDropdownOptions(): void;
1756
+ /** Handles scroll event on the dropdown options panel for infiniteScroll mode. */
1757
+ onDropdownScroll(event: Event): void;
1646
1758
  private getValueByPath;
1647
1759
  /**
1648
1760
  * Replaces `{placeholder}` tokens in a URL with values resolved from the
@@ -1692,6 +1804,7 @@ declare class FormFieldComponent implements OnInit, AfterViewInit, OnDestroy {
1692
1804
  toggleSingleDropdown(event: MouseEvent): void;
1693
1805
  selectSingleOption(option: any): void;
1694
1806
  onDocumentClick(): void;
1807
+ onWindowResize(): void;
1695
1808
  onEscapeKey(): void;
1696
1809
  get multiSelectedCount(): number;
1697
1810
  /** Cache of values currently chosen for this field name by OTHER repeater instances.
@@ -4962,9 +5075,22 @@ declare function appendBaseUrlRecursively(obj: any, baseURL: string): void;
4962
5075
  interface HierarchyCfg {
4963
5076
  templateApiUrl: string;
4964
5077
  templateListPath: string | null;
4965
- templateSelect: 'default' | 'first' | 'byCode';
5078
+ templateSelect: 'default' | 'first' | 'byCode' | 'byId';
4966
5079
  templateSelectField: string;
4967
5080
  templateSelectCode?: string;
5081
+ /** Used when templateSelect === 'byId' — matches a template by its numeric `id`, since
5082
+ * multiple templates can share the same templateCode (distinguished by templateName). */
5083
+ templateSelectId?: number;
5084
+ /**
5085
+ * When set, the caller already has the resolved MdmClassHierarchyTemplateDTO-shaped object
5086
+ * (e.g. it fetched and picked it client-side already) — used as-is, skipping the runtime's
5087
+ * own HTTP GET to templateApiUrl and the templateSelect/templateSelectId matching entirely.
5088
+ * Trades the always-live "re-fetch and re-match by id" behavior for zero extra network
5089
+ * round-trips; the caller is responsible for re-supplying fresh data if the underlying
5090
+ * template changes later. Analogous to how optionConfig.optionList is a static alternative
5091
+ * to optionConfig.apiUrl for dropdown fields.
5092
+ */
5093
+ templateData?: any;
4968
5094
  rootCodePath: string;
4969
5095
  templateCodePath: string;
4970
5096
  hierarchyListPath: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",