commons-shared-web-ui 0.0.63 → 0.0.64

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
@@ -960,7 +960,7 @@ interface ConfiguratorTreeNode {
960
960
  label: string;
961
961
  /** Node type */
962
962
  type: ConfiguratorNodeType;
963
- /** Whether the node is expanded (for groups/sections) */
963
+ /** Whether the node is expanded (for groups/sections, and for a 'field' node with children — see geoClassCode) */
964
964
  expanded: boolean;
965
965
  /** Reference to the FieldConfig (only for field nodes) */
966
966
  fieldConfig: FieldConfig | null;
@@ -968,6 +968,14 @@ interface ConfiguratorTreeNode {
968
968
  path: number[];
969
969
  /** Child nodes */
970
970
  children: ConfiguratorTreeNode[];
971
+ /**
972
+ * Set only on synthetic geography-hierarchy-level nodes (children of a GEOGRAPHY_DYNAMIC
973
+ * field, e.g. Country/State/District). These don't exist as real schema array children —
974
+ * they live in the parent field's nested `geographyConfig.field.nodes` map — so `path` on
975
+ * these nodes equals the PARENT GEOGRAPHY_DYNAMIC field's own path, and `geoClassCode` is
976
+ * what actually distinguishes one level (and the parent itself, where it's undefined).
977
+ */
978
+ geoClassCode?: string;
971
979
  }
972
980
 
973
981
  /**
@@ -980,6 +988,16 @@ declare class FieldConfiguratorService {
980
988
  readonly tree: i0.Signal<ConfiguratorTreeNode[]>;
981
989
  readonly schema: i0.Signal<FormSchema>;
982
990
  readonly selectedFieldPath: i0.Signal<number[]>;
991
+ readonly selectedGeoClassCode: i0.Signal<string>;
992
+ /**
993
+ * Resolves to the real FieldConfig at the selected path — UNLESS the selection is a
994
+ * synthetic geography-hierarchy-level node (selectedGeoClassCode set), in which case this
995
+ * returns a small synthetic FieldConfig built from that level's entry in the parent
996
+ * GEOGRAPHY_DYNAMIC field's `geographyConfig.field.nodes` map instead. Every downstream
997
+ * consumer (selectedFieldInfo, selectedFieldBuilderType, the config panel itself) works
998
+ * against whichever shape comes out of here unchanged — mapFieldTypeToBuilderType('GEOGRAPHY_NODE')
999
+ * resolves the right minimal config schema (label/colSpan only, see field-type-schema.map.ts).
1000
+ */
983
1001
  readonly selectedField: i0.Signal<FieldConfig>;
984
1002
  readonly selectedFieldInfo: i0.Signal<ConfiguratorFieldInfo>;
985
1003
  /**
@@ -992,9 +1010,11 @@ declare class FieldConfiguratorService {
992
1010
  */
993
1011
  loadSchema(schema: FormSchema, preserveSelection?: boolean): void;
994
1012
  /**
995
- * Select a field by its path. Pass null to deselect.
1013
+ * Select a field by its path. Pass null to deselect. `geoClassCode` selects a synthetic
1014
+ * geography-hierarchy-level child of the GEOGRAPHY_DYNAMIC field at `path` instead of the
1015
+ * field itself — see ConfiguratorTreeNode.geoClassCode / selectedField above.
996
1016
  */
997
- selectField(path: number[] | null): void;
1017
+ selectField(path: number[] | null, geoClassCode?: string | null): void;
998
1018
  /**
999
1019
  * Toggle a tree node's expanded state.
1000
1020
  */
@@ -1007,7 +1027,8 @@ declare class FieldConfiguratorService {
1007
1027
  /**
1008
1028
  * Change the type (and optionally subType) of the currently selected field.
1009
1029
  * Mapping goes from builderType keys (e.g. 'richText') → {type, subType?}.
1010
- * DROPDOWN fields cannot be changed and are guarded here as well.
1030
+ * DROPDOWN fields cannot be changed and are guarded here as well — same for a synthetic
1031
+ * geography-hierarchy-level selection, which has no real `type` to switch at all.
1011
1032
  */
1012
1033
  changeFieldType(builderType: string): void;
1013
1034
  /**
@@ -1048,7 +1069,10 @@ declare class FieldConfiguratorComponent implements OnChanges {
1048
1069
  finalFieldTypeSchemaMap: Record<string, FormSchema>;
1049
1070
  private _isInternalChange;
1050
1071
  ngOnChanges(changes: SimpleChanges): void;
1051
- onFieldSelected(path: number[]): void;
1072
+ onFieldSelected(selection: {
1073
+ path: number[];
1074
+ geoClassCode?: string;
1075
+ }): void;
1052
1076
  onNodeToggleExpanded(nodeId: string): void;
1053
1077
  onConfigChange(patch: Record<string, unknown>): void;
1054
1078
  onTypeChange(builderType: string): void;
@@ -1128,7 +1152,13 @@ declare class SelectionFieldNodeComponent {
1128
1152
  declare class ConfiguratorTreeComponent {
1129
1153
  tree: ConfiguratorTreeNode[];
1130
1154
  selectedFieldPath: number[] | null;
1131
- selectField: EventEmitter<number[]>;
1155
+ /** Distinguishes a GEOGRAPHY_DYNAMIC field itself from one of its synthetic hierarchy-level
1156
+ * children — both share the same `path`, so `path` alone can't tell them apart. */
1157
+ selectedGeoClassCode: string | null;
1158
+ selectField: EventEmitter<{
1159
+ path: number[];
1160
+ geoClassCode?: string;
1161
+ }>;
1132
1162
  toggleExpanded: EventEmitter<string>;
1133
1163
  onNodeClick(node: ConfiguratorTreeNode): void;
1134
1164
  onFieldSelect(node: ConfiguratorTreeNode): void;
@@ -1137,7 +1167,7 @@ declare class ConfiguratorTreeComponent {
1137
1167
  trackByNodeId(_index: number, node: ConfiguratorTreeNode): string;
1138
1168
  private pathsEqual;
1139
1169
  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>;
1170
+ 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
1171
  }
1142
1172
 
1143
1173
  type SnackbarVariant = 'success' | 'error' | 'warning' | 'info';
@@ -1200,7 +1230,8 @@ declare class ConfiguratorConfigPanelComponent implements OnChanges {
1200
1230
  currentBuilderType: string | null;
1201
1231
  /** Identity key of the currently rendered field — used to detect real field switches. */
1202
1232
  private _currentFieldKey;
1203
- /** True when the current field type is DROPDOWN — type switching is disabled for these fields. */
1233
+ /** True when type switching should be disabled — DROPDOWN-based fields, and synthetic
1234
+ * geography-hierarchy-level nodes (GEOGRAPHY_NODE), which have no real `type` to switch. */
1204
1235
  get isDropdownType(): boolean;
1205
1236
  ngOnChanges(changes: SimpleChanges): void;
1206
1237
  /**
@@ -4962,9 +4993,22 @@ declare function appendBaseUrlRecursively(obj: any, baseURL: string): void;
4962
4993
  interface HierarchyCfg {
4963
4994
  templateApiUrl: string;
4964
4995
  templateListPath: string | null;
4965
- templateSelect: 'default' | 'first' | 'byCode';
4996
+ templateSelect: 'default' | 'first' | 'byCode' | 'byId';
4966
4997
  templateSelectField: string;
4967
4998
  templateSelectCode?: string;
4999
+ /** Used when templateSelect === 'byId' — matches a template by its numeric `id`, since
5000
+ * multiple templates can share the same templateCode (distinguished by templateName). */
5001
+ templateSelectId?: number;
5002
+ /**
5003
+ * When set, the caller already has the resolved MdmClassHierarchyTemplateDTO-shaped object
5004
+ * (e.g. it fetched and picked it client-side already) — used as-is, skipping the runtime's
5005
+ * own HTTP GET to templateApiUrl and the templateSelect/templateSelectId matching entirely.
5006
+ * Trades the always-live "re-fetch and re-match by id" behavior for zero extra network
5007
+ * round-trips; the caller is responsible for re-supplying fresh data if the underlying
5008
+ * template changes later. Analogous to how optionConfig.optionList is a static alternative
5009
+ * to optionConfig.apiUrl for dropdown fields.
5010
+ */
5011
+ templateData?: any;
4968
5012
  rootCodePath: string;
4969
5013
  templateCodePath: string;
4970
5014
  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.64",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",