@camstack/ui-library 1.2.109 → 1.2.111

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.
@@ -11,6 +11,10 @@ export interface ContainerChild {
11
11
  readonly sourceInfo?: {
12
12
  readonly id: string;
13
13
  } | undefined;
14
+ /** `DeviceRole`, ranked above `type` when picking a container's primary. */
15
+ readonly role?: string | null | undefined;
16
+ /** Operator-facing name — used for the namesake tiebreak. */
17
+ readonly name?: string | undefined;
14
18
  }
15
19
  /**
16
20
  * Re-sync-stable identity of a child. Prefers the upstream-system dispatch key
@@ -10,7 +10,8 @@ export interface PrimaryChildPickerProps {
10
10
  /** Numeric id of the currently-resolved primary child. */
11
11
  readonly selectedId: number;
12
12
  /** Called with the picked child's re-sync/rename-stable `entityId`. */
13
- readonly onSetPrimary: (childEntityId: string) => void;
13
+ /** Called with the picked child's `stableId` — the canonical override key. */
14
+ readonly onSetPrimary: (childStableId: string) => void;
14
15
  /** Disable the control while a persist is in flight. */
15
16
  readonly disabled?: boolean;
16
17
  /** Optional extra classes for the `<select>` (so a host row can size it). */
@@ -15,6 +15,10 @@ export interface ChildRef {
15
15
  readonly id: number;
16
16
  readonly entityId: string;
17
17
  readonly type: string;
18
+ /** `DeviceRole`, ranked ABOVE `type` — see `CONTAINER_CHILD_ROLE_PRIORITY`. */
19
+ readonly role?: string | undefined;
20
+ /** Operator-facing name — used for the namesake tiebreak. */
21
+ readonly name?: string | undefined;
18
22
  }
19
23
  /**
20
24
  * Resolve a container's primary child: the operator's pick when it still
@@ -24,4 +28,4 @@ export interface ChildRef {
24
28
  * The shared resolver matches its canonical `stableId` key first and accepts
25
29
  * that legacy value too, so a pick stored under either keeps resolving.
26
30
  */
27
- export declare function resolvePrimaryChild(children: readonly ChildRef[], overrideEntityId: string | undefined): ChildRef | null;
31
+ export declare function resolvePrimaryChild(children: readonly ChildRef[], overrideEntityId: string | undefined, containerName?: string): ChildRef | null;
package/dist/index.cjs CHANGED
@@ -39656,12 +39656,14 @@ var PRIORITY = _camstack_types.CONTAINER_CHILD_PRIORITY;
39656
39656
  * The shared resolver matches its canonical `stableId` key first and accepts
39657
39657
  * that legacy value too, so a pick stored under either keeps resolving.
39658
39658
  */
39659
- function resolvePrimaryChild(children, overrideEntityId) {
39659
+ function resolvePrimaryChild(children, overrideEntityId, containerName) {
39660
39660
  const picked = (0, _camstack_types.resolveContainerPrimaryChild)(children.map((c) => ({
39661
39661
  id: c.id,
39662
39662
  stableId: c.entityId,
39663
- type: c.type
39664
- })), overrideEntityId);
39663
+ type: c.type,
39664
+ ...c.role !== void 0 ? { role: c.role } : {},
39665
+ ...c.name !== void 0 ? { name: c.name } : {}
39666
+ })), overrideEntityId, containerName);
39665
39667
  return picked === null ? null : children.find((c) => c.id === picked.id) ?? null;
39666
39668
  }
39667
39669
  //#endregion
@@ -39680,7 +39682,9 @@ function containerChildToRef(child) {
39680
39682
  return {
39681
39683
  id: child.id,
39682
39684
  entityId: childEntityId(child),
39683
- type: child.type
39685
+ type: child.type,
39686
+ ...child.role !== void 0 && child.role !== null ? { role: child.role } : {},
39687
+ ...child.name !== void 0 ? { name: child.name } : {}
39684
39688
  };
39685
39689
  }
39686
39690
  /**
@@ -39741,7 +39745,7 @@ function PrimaryChildPicker({ childrenList, selectedId, onSetPrimary, disabled,
39741
39745
  const nextId = Number(e.target.value);
39742
39746
  if (!Number.isFinite(nextId) || nextId === selectedId) return;
39743
39747
  const picked = childrenList.find((c) => c.id === nextId);
39744
- if (picked !== void 0) onSetPrimary(childEntityId(picked));
39748
+ if (picked !== void 0) onSetPrimary(picked.stableId);
39745
39749
  },
39746
39750
  className: className === void 0 ? BASE_SELECT_CLASS : `${BASE_SELECT_CLASS} ${className}`,
39747
39751
  children: childrenList.map((c) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("option", {
package/dist/index.js CHANGED
@@ -39632,12 +39632,14 @@ var PRIORITY = CONTAINER_CHILD_PRIORITY;
39632
39632
  * The shared resolver matches its canonical `stableId` key first and accepts
39633
39633
  * that legacy value too, so a pick stored under either keeps resolving.
39634
39634
  */
39635
- function resolvePrimaryChild(children, overrideEntityId) {
39635
+ function resolvePrimaryChild(children, overrideEntityId, containerName) {
39636
39636
  const picked = resolveContainerPrimaryChild(children.map((c) => ({
39637
39637
  id: c.id,
39638
39638
  stableId: c.entityId,
39639
- type: c.type
39640
- })), overrideEntityId);
39639
+ type: c.type,
39640
+ ...c.role !== void 0 ? { role: c.role } : {},
39641
+ ...c.name !== void 0 ? { name: c.name } : {}
39642
+ })), overrideEntityId, containerName);
39641
39643
  return picked === null ? null : children.find((c) => c.id === picked.id) ?? null;
39642
39644
  }
39643
39645
  //#endregion
@@ -39656,7 +39658,9 @@ function containerChildToRef(child) {
39656
39658
  return {
39657
39659
  id: child.id,
39658
39660
  entityId: childEntityId(child),
39659
- type: child.type
39661
+ type: child.type,
39662
+ ...child.role !== void 0 && child.role !== null ? { role: child.role } : {},
39663
+ ...child.name !== void 0 ? { name: child.name } : {}
39660
39664
  };
39661
39665
  }
39662
39666
  /**
@@ -39717,7 +39721,7 @@ function PrimaryChildPicker({ childrenList, selectedId, onSetPrimary, disabled,
39717
39721
  const nextId = Number(e.target.value);
39718
39722
  if (!Number.isFinite(nextId) || nextId === selectedId) return;
39719
39723
  const picked = childrenList.find((c) => c.id === nextId);
39720
- if (picked !== void 0) onSetPrimary(childEntityId(picked));
39724
+ if (picked !== void 0) onSetPrimary(picked.stableId);
39721
39725
  },
39722
39726
  className: className === void 0 ? BASE_SELECT_CLASS : `${BASE_SELECT_CLASS} ${className}`,
39723
39727
  children: childrenList.map((c) => /* @__PURE__ */ jsxs("option", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/ui-library",
3
- "version": "1.2.109",
3
+ "version": "1.2.111",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",