@zealicsolutions/web-ui 1.0.40-beta-5 → 1.0.40-beta-6
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/dist/cjs/containers/FormContainer.d.ts +4 -0
- package/dist/cjs/index.js +1560 -1560
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/containers/FormContainer.d.ts +4 -0
- package/dist/esm/containers/FormContainer.js +1 -1
- package/dist/esm/containers/FormContainer.js.map +1 -1
- package/package.json +1 -1
@@ -1,4 +1,8 @@
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
2
|
+
export declare const walkFields: (node: Record<string, any>, fn: (f: {
|
3
|
+
name: string;
|
4
|
+
rules?: any;
|
5
|
+
}) => void) => void;
|
2
6
|
export declare type FormContainerProps = PropsWithChildren<{
|
3
7
|
mode?: 'onSubmit' | 'onBlur' | 'onChange' | 'all';
|
4
8
|
state?: 'default' | 'required_error' | 'validation_error';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__awaiter as t,__assign as
|
1
|
+
import{__awaiter as t,__assign as e,__generator as o}from"../node_modules/tslib/tslib.es6.js";import{jsx as r}from"../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import{useForm as n,FormProvider as i}from"../node_modules/react-hook-form/dist/index.esm.mjs.js";import{FormStepContextProvider as s}from"../contexts/FormStepContext/FormStepContextProvider.js";import{useEffect as m}from"react";import{useStateModifierHandler as c}from"./hooks/useStateModifierHandler.js";import"../contexts/FormStepContext/FormStepContext.js";import"../contexts/ButtonActionsContext/ButtonActionsContext.js";import"../contexts/MlrRichTextViewerContext/MlrRichTextViewerContext.js";import{useOrganismContext as u}from"../contexts/hooks/useOrganismContext.js";import"../contexts/StateContext/StateContext.js";import"../contexts/AccountButtonContext/AccountButtonContext.js";var a=function(t,e){Object.values(t).forEach((function(t){(null==t?void 0:t._f)?e(t._f):t&&"object"==typeof t&&a(t,e)}))},d=function(d){var f=d.mode,l=void 0===f?"onChange":f,x=d.state,p=d.children,j=n({mode:l}),v=c().onStateChange,C=u().formId,h=void 0===C?"":C;return m((function(){if(x&&"default"!==x)if("required_error"!==x){if("validation_error"===x){var e=setTimeout((function(){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,j.trigger()];case 1:return t.sent(),a(j.control._fields,(function(t){var e=t.name,o=t.rules,r=null==o?void 0:o.pattern;r&&(j.getValues(e)||j.setError(e,{type:"pattern",message:"object"==typeof r&&(null==r?void 0:r.message)||"Invalid value"}))})),[2]}}))}))}),0);return function(){return clearTimeout(e)}}}else j.trigger();else j.clearErrors()}),[x]),m((function(){j.formState.isDirty&&v({id:h,type:"started"})}),[j.formState.isDirty]),r(i,e({},j,{children:r(s,{children:p})}))};export{d as FormContainer,a as walkFields};
|
2
2
|
//# sourceMappingURL=FormContainer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormContainer.js","sources":["../../../../src/containers/FormContainer.tsx"],"sourcesContent":[null],"names":["
|
1
|
+
{"version":3,"file":"FormContainer.js","sources":["../../../../src/containers/FormContainer.tsx"],"sourcesContent":[null],"names":["walkFields","node","fn","Object","values","forEach","child","_f","FormContainer","_a","_b","mode","state","children","methods","useForm","onStateChange","useStateModifierHandler","_c","useOrganismContext","formId","useEffect","t_1","setTimeout","__awaiter","trigger","sent","control","_fields","name","rules","patternRule","pattern","getValues","setError","type","message","clearTimeout","clearErrors","formState","isDirty","id","_jsx","FormProvider","__assign","FormStepContextProvider"],"mappings":"u3BAMa,IAAAA,EAAa,SACxBC,EACAC,GAEAC,OAAOC,OAAOH,GAAMI,SAAQ,SAACC,IACvBA,aAAA,EAAAA,EAAOC,IAAIL,EAAGI,EAAMC,IACfD,GAA0B,iBAAVA,GAAoBN,EAAWM,EAAOJ,EACjE,GACF,EAOaM,EAAgB,SAACC,OAAEC,EAAiBD,EAAAE,KAAjBA,OAAI,IAAAD,EAAG,WAAUA,EAAEE,EAAKH,EAAAG,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