@zealicsolutions/web-ui 1.0.140-beta.184 → 1.0.140-beta.185
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import{useRef as t,useEffect as r}from"react";import{useFormContext as o,useFieldArray as n}from"../../node_modules/react-hook-form/dist/index.esm.mjs.js";import"../../contexts/ReplicatorFormContext/ReplicatorFormContext.js";import{ReplicatorFormContextProvider as
|
|
1
|
+
import{jsx as e}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import{useRef as t,useEffect as r}from"react";import{useFormContext as o,useFieldArray as n}from"../../node_modules/react-hook-form/dist/index.esm.mjs.js";import{useOrganismContext as i}from"../../contexts/OrganismContext/useOrganismContext.js";import"../../contexts/ReplicatorFormContext/ReplicatorFormContext.js";import{ReplicatorFormContextProvider as s}from"../../contexts/ReplicatorFormContext/ReplicatorFormContextProvider.js";import{useReplicatorRegistry as a}from"../../contexts/ReplicatorRegistryContext/ReplicatorRegistryContext.js";const m=50,l=({replicatorFieldId:m,nestedPathSegments:l=[],minInstances:c=1,maxInstances:d=50,children:p})=>{const{control:f,getValues:x}=o(),g=a(),{prefillData:h}=i(),u=t(!1),y=l.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId).filter(Boolean).join(".");const I=y?`${y}.${m}`:m,j=n({control:f,name:I}),{fields:A,append:C,replace:F}=j,R=h?.[m],$=Array.isArray(R)&&R.length>0;return r(()=>{if(u.current)return;u.current=!0;const e=x(I),t=Array.isArray(e)&&e.length>0;if(A.length,!($||t||A.length>0)&&c>0){Array.from({length:c},()=>({})).forEach(e=>{C(e,{shouldFocus:!1})})}},[]),r(()=>{$&&A.length!==R.length&&(A.length,R.length,F(R))},[$,R,A.length,F,m]),r(()=>{if(g)return g.register({replicatorFieldId:m,fieldArrayName:I,fieldArrayMethods:j,minInstances:c,maxInstances:d}),()=>{g.unregister(m)}},[g,m,I,j,c,d]),e(s,{replicatorFieldId:m,fieldArrayName:I,fieldArrayMethods:j,minInstances:c,maxInstances:d,children:p})};export{m as DEFAULT_MAX_REPLICATOR_INSTANCES,l as ReplicatorFormSetup};
|
|
2
2
|
//# sourceMappingURL=ReplicatorFormSetup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReplicatorFormSetup.js","sources":["../../../../../src/containers/ReplicatorContainer/ReplicatorFormSetup.tsx"],"sourcesContent":[null],"names":["DEFAULT_MAX_REPLICATOR_INSTANCES","ReplicatorFormSetup","replicatorFieldId","nestedPathSegments","minInstances","maxInstances","children","control","useFormContext","registry","useReplicatorRegistry","initializedRef","useRef","currentPath","map","seg","undefined","index","dmfId","filter","Boolean","join","fieldArrayName","fieldArrayMethods","useFieldArray","name","fields","append","useEffect","current","
|
|
1
|
+
{"version":3,"file":"ReplicatorFormSetup.js","sources":["../../../../../src/containers/ReplicatorContainer/ReplicatorFormSetup.tsx"],"sourcesContent":[null],"names":["DEFAULT_MAX_REPLICATOR_INSTANCES","ReplicatorFormSetup","replicatorFieldId","nestedPathSegments","minInstances","maxInstances","children","control","getValues","useFormContext","registry","useReplicatorRegistry","prefillData","useOrganismContext","initializedRef","useRef","currentPath","map","seg","undefined","index","dmfId","filter","Boolean","join","fieldArrayName","fieldArrayMethods","useFieldArray","name","fields","append","replace","prefillArrayValue","hasPrefillData","Array","isArray","length","useEffect","current","currentFormValue","hasFormValue","from","forEach","instance","shouldFocus","register","unregister","_jsx","ReplicatorFormContextProvider"],"mappings":"yoBAQO,MAAMA,EAAmC,GA0CnCC,EAAuE,EAClFC,oBACAC,qBAAqB,GACrBC,eAAe,EACfC,eA9C8C,GA+C9CC,eAEA,MAAMC,QAAEA,EAAOC,UAAEA,GAAcC,IACzBC,EAAWC,KACXC,YAAEA,GAAgBC,IAClBC,EAAiBC,GAAO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