@zealicsolutions/web-ui 1.0.140-beta.185 → 1.0.140-beta.186

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.
@@ -14,12 +14,31 @@ export interface ReplicatorFormSetupProps {
14
14
  }
15
15
  /**
16
16
  * Sets up useFieldArray for a replicator container in form mode.
17
- * This component should wrap the replicator Container when the organism is a form.
18
17
  *
19
- * CRITICAL: useFieldArray name must include full nested path for nested replicators.
20
- * Example: "visits" for top-level, "visits.0.medications" for nested
18
+ * This component bridges the gap between the Container/Replicator system and
19
+ * react-hook-form's useFieldArray. It handles:
21
20
  *
22
- * Also registers with the ReplicatorRegistry so buttons outside the replicator
23
- * can control it via targetReplicatorFieldId.
21
+ * 1. **Field Array Registration**: Creates a useFieldArray instance for the replicator
22
+ * and provides it via ReplicatorFormContext to child components.
23
+ *
24
+ * 2. **Nested Path Handling**: Builds the correct field array name for nested replicators.
25
+ * Example: "visits" for top-level, "visits.0.medications" for nested.
26
+ *
27
+ * 3. **Prefill Data Integration**: When navigateToPrepopulateForm passes array data
28
+ * via prefillData, this component syncs it with the field array using replace().
29
+ *
30
+ * 4. **Default Instance Creation**: For new forms without data, creates minInstances
31
+ * empty objects to ensure at least one replicator item is shown.
32
+ *
33
+ * 5. **Registry Integration**: Registers with ReplicatorRegistry so external buttons
34
+ * (e.g., "Add Item") can control this replicator via targetReplicatorFieldId.
35
+ *
36
+ * @usage
37
+ * Wrap a replicator Container in form organisms:
38
+ * ```tsx
39
+ * <ReplicatorFormSetup replicatorFieldId="visits">
40
+ * <Container type="replicator" ... />
41
+ * </ReplicatorFormSetup>
42
+ * ```
24
43
  */
25
44
  export declare const ReplicatorFormSetup: FC<PropsWithChildren<ReplicatorFormSetupProps>>;