@fluig-kit/ecm 1.0.12 → 1.0.13
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/index.cjs +1 -1
- package/dist/index.js +267 -269
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),l=require("react"),I=require("react-hook-form"),N=require("@hookform/resolvers"),U=require("zod"),A=require("@fluig-kit/core");var B=function(e,t){for(var r={};e.length;){var n=e[0],i=n.code,s=n.message,c=n.path.join(".");if(!r[c])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[c]={message:a.message,type:a.code}}else r[c]={message:s,type:i};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(m){return e.push(m)})}),t){var u=r[c].types,o=u&&u[n.code];r[c]=I.appendErrors(c,t,r,i,o?[].concat(o,n.message):n.message)}e.shift()}return r},G=function(e,t,r){return r===void 0&&(r={}),function(n,i,s){try{return Promise.resolve(function(c,a){try{var u=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(o){return s.shouldUseNativeValidation&&N.validateFieldsNatively({},s),{errors:{},values:r.raw?n:o}})}catch(o){return a(o)}return u&&u.then?u.then(void 0,a):u}(0,function(c){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(c))return{values:{},errors:N.toNestErrors(B(c.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw c}))}catch(c){return Promise.reject(c)}}};const M=l.createContext(null);function z({children:e,baseSchema:t}){const[r,n]=l.useState([]),i=l.useMemo(()=>t??U.z.object({}),[t]),s=l.useCallback((o,h)=>{n(m=>m.some(b=>b.id===o)?m:[...m,{id:o,schema:h}])},[]),c=l.useCallback(o=>{n(h=>h.some(m=>m.id===o)?h.filter(m=>m.id!==o):h)},[]),a=l.useMemo(()=>r.length?r.map(o=>o.schema).reduce((o,h)=>o.and(h),i):i,[r,i]),u=l.useMemo(()=>({registerSchema:s,unregisterSchema:c,mergedSchema:a}),[s,c,a]);return p.jsx(M.Provider,{value:u,children:e})}function T(){const e=l.useContext(M);if(!e)throw new Error("useSchemaRegistry deve ser usado dentro de <SchemaRegistryProvider>");return e}function j(e){return typeof e=="number"?e:isNaN(Number(e))?null:Number(e)}function L(e,t,r){if(!e)return!0;const n=Array.isArray(t)?t[0]:t,i=e.field??n,s=r==null?void 0:r[i];return e.hasValue!==void 0?e.hasValue?s!=null&&s!=="":s==null||s==="":e.equals!==void 0?s===e.equals:e.notEquals!==void 0?s!==e.notEquals:!0}function H(e,t,r,n,i){const s=new Set(e),c=new Set(t);return r==null||r.forEach(a=>{if(a.from!==void 0){const o=Array.isArray(a.from)?a.from:[a.from];if(n===null||!o.includes(n))return}if(!L(a.when,a.target,i))return;const u=Array.isArray(a.target)?a.target:[a.target];switch(a.type){case"readonly":u.forEach(o=>{c.add(o),s.delete(o)});break;case"active":u.forEach(o=>{s.add(o),c.delete(o)});break;case"hidden":u.forEach(o=>{s.delete(o),c.delete(o)});break}}),{active:Array.from(s),readonly:Array.from(c)}}function $(e,t,r,n){const i=new Set(e.active),s=new Set(e.readonly),c=new Set(e.hidden??[]);return t==null||t.forEach(a=>{if(a.from!==void 0){const o=Array.isArray(a.from)?a.from:[a.from];if(r===null||!o.includes(r))return}if(!L(a.when,a.target,n))return;const u=Array.isArray(a.target)?a.target:[a.target];switch(a.type){case"hidden":u.forEach(o=>{c.add(o),i.delete(o),s.delete(o)});break;case"active":u.forEach(o=>{i.add(o),s.delete(o),c.delete(o)});break;case"readonly":u.forEach(o=>{s.add(o),i.delete(o),c.delete(o)});break}}),{active:Array.from(i),readonly:Array.from(s),hidden:Array.from(c)}}function K(e,t){if(!(e!=null&&e.length))return t;const r=new Map(t.map(i=>[i.name,i])),n=[];return e.forEach(i=>{r.has(i)&&(n.push(r.get(i)),r.delete(i))}),r.forEach(i=>n.push(i)),n}function J(e){var n,i;const t=new Set,r=(s=[])=>{s.forEach(c=>{var a;c.target&&(Array.isArray(c.target)?c.target:[c.target]).forEach(o=>t.add(o)),(a=c.when)!=null&&a.field&&t.add(c.when.field)})};return r((n=e==null?void 0:e.fields)==null?void 0:n.rules),r((i=e==null?void 0:e.sections)==null?void 0:i.rules),Array.from(t)}function Q({activityId:e,previousActivityId:t,control:r,workflowStructure:n,sectionsRegistry:i}){const{registerSchema:s,unregisterSchema:c}=T(),a=j(e),u=j(t),o=a!==null?n[a]:null,h=l.useMemo(()=>J(o),[a,o]),m=I.useWatch({control:r,name:h,defaultValue:{}}),b=l.useMemo(()=>{const v={};return h.forEach((f,w)=>{v[f]=Array.isArray(m)?m[w]:m}),v},[m,h]),d=l.useMemo(()=>{if(!o)return{sections:[],fields:{active:[],readonly:[],hidden:[]}};const v=H(o.sections.active,o.sections.readonly,o.sections.rules,u,b);let f=[...v.readonly.map(y=>({name:y,mode:"readonly"})),...v.active.map(y=>({name:y,mode:"active"}))];f=K(o.sections.order,f);const w=$({active:o.fields.active,readonly:o.fields.readonly,hidden:o.fields.hidden},o.fields.rules,u,b);return{sections:f,fields:w}},[o,u,b,i]);return l.useEffect(()=>{const v=d.sections.filter(f=>f.mode==="active").map(f=>f.name);v.forEach(f=>{var y;const w=(y=i==null?void 0:i[f])==null?void 0:y.schema;w&&s(f,w)}),Object.keys(i??{}).filter(f=>!v.includes(f)).forEach(c)},[d.sections,i,s,c]),d}function X(){if(typeof document>"u")return{};const e={};return document.querySelectorAll("input[type='radio'][name]").forEach(t=>{const r=t,n=r.getAttribute("name");n&&r.checked&&(e[n]=r.value)}),document.querySelectorAll("input[name], textarea[name], select[name]").forEach(t=>{const r=t,n=r.getAttribute("name");if(!n||e[n]!==void 0)return;const i=r.getAttribute("value")??r.value??r.textContent??"";e[n]=String(i).trim()}),document.querySelectorAll("span[name]").forEach(t=>{var i;const r=t,n=r.getAttribute("name");if(n){const s=((i=r.textContent)==null?void 0:i.trim())??"";s!==""&&(e[n]=s)}}),e}const q=()=>{var u;if(typeof window>"u")return null;const e=window.top,t=((u=e.ECM)==null?void 0:u.workflowView)||e.ECM_WKFView,r=new URLSearchParams(window.location.search),n=(t==null?void 0:t.newRequest)===!0||(t==null?void 0:t.isNewRequest)===!0,i=(t==null?void 0:t.movimentWindow)===!0,s=r.get("edit")==="true"||r.get("mode")==="edit",c=n||i||s;return{isCreation:n,isEdit:c,isView:!c}},Z=()=>{var e;return((e=q())==null?void 0:e.isCreation)??!1},ee=()=>{var e;return((e=q())==null?void 0:e.isEdit)??!1},O=l.createContext(null);function te({children:e,devConfig:t}){const[r,n]=l.useState(null),i=l.useMemo(()=>X()??{},[]);return l.useEffect(()=>{let s=!0;const c=async()=>{let u=(r==null?void 0:r.activityId)??null;try{const y=await A.parentProxy.top.ECM.workflowView.sequence;y!=null&&(u=Number(y))}catch(y){t!=null&&t.showDebugLogs&&console.warn("Erro ao detectar atividade",y)}const o=Z(),h=ee(),m=typeof window<"u"&&window.location.hostname==="localhost",b=typeof window<"u"&&window.self!==window.top,d=!m&&b&&!(o||h),v=i.LASTACTIVITYID?Number(i.LASTACTIVITYID):null,f={isView:d,isReadOnly:d,activityId:u,previousActivityId:v,prefilledValues:i,showDebugSubmit:(t==null?void 0:t.showDebugSubmit)??!1,showDebugLogs:(t==null?void 0:t.showDebugLogs)??!1,isDev:!!(t!=null&&t.enabled)};let w=f;if(t!=null&&t.enabled){const y=t.isView??f.isView;w={...f,...t,isView:y,isReadOnly:y,isDev:!0,activityId:t.activityId??u}}s&&n(y=>y&&y.isView===w.isView&&y.activityId===w.activityId?y:w)};c();const a=setInterval(c,1e3);return()=>{s=!1,clearInterval(a)}},[t,i]),r?p.jsx(O.Provider,{value:r,children:e}):null}function F(){const e=l.useContext(O);if(!e)throw new Error("useFluigRuntime deve ser usado dentro de <FluigRuntimeProvider>");return e}function re(e){const{activityId:t,previousActivityId:r}=F();l.useEffect(()=>{t!=null&&e.setValue("CURRENTACTIVITYID",t),r!=null&&e.setValue("LASTACTIVITYID",r)},[t,r,e]),l.useEffect(()=>{var i,s;if(typeof window>"u")return;const n=((i=window.top)==null?void 0:i.document.getElementById("send-process-button"))||((s=window.parent)==null?void 0:s.document.getElementById("workflow-actions-send"))||document.getElementById("send-process-button");if(!n){console.warn("[FluigWorkflowReact] Botão de envio do Fluig não encontrado. A validação automática pode falhar.");return}return window.beforeSendValidate=()=>(e.handleSubmit(()=>{window.top.__FLUIG_REACT_FORM_DATA__=e.getValues(),window.beforeSendValidate=()=>!0;try{n.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))}catch{n.click()}},c=>{var a,u,o;console.error("[Validation Errors]",c),(u=(a=window.top)==null?void 0:a.FLUIGC)!=null&&u.toast?(o=window.top)==null||o.FLUIGC.toast({title:"Atenção",message:"Verifique os campos obrigatórios destacados em vermelho.",type:"danger"}):alert("Verifique os campos obrigatórios.")})(),!1),()=>{}},[e])}const ne=({workflowStructure:e,sectionsRegistry:t,className:r})=>{const{control:n,handleSubmit:i,register:s,setValue:c,getValues:a}=I.useFormContext(),u=F(),o=l.useRef(!1);l.useEffect(()=>{o.current||(u.activityId!=null&&c("CURRENTACTIVITYID",u.activityId),u.previousActivityId!=null&&c("LASTACTIVITYID",u.previousActivityId),o.current=!0)},[u,c]);const{sections:h,fields:m}=Q({control:n,activityId:u.activityId,previousActivityId:u.previousActivityId,workflowStructure:e,sectionsRegistry:t}),b=d=>{console.log("✅ [FluigWorkflowForm] Dados válidos:",d)};return p.jsxs("form",{id:"fluig-react-form",className:r,onSubmit:i(b),noValidate:!0,children:[p.jsxs("div",{className:"hidden",style:{display:"none"},children:[p.jsx("input",{type:"hidden",...s("CURRENTACTIVITYID")}),p.jsx("input",{type:"hidden",...s("LASTACTIVITYID")})]}),h.length===0&&u.activityId!==null&&p.jsxs("p",{children:["Não foi possível encontrar a atividade: ",String(u.activityId)]}),h.map(({name:d,mode:v})=>{if(v==="hidden")return null;const f=t[d];if(!f)return null;const w=f.Component;return p.jsx(w,{id:d,fields:m,readOnly:v==="readonly"},d)}),u.isDev&&u.showDebugSubmit&&p.jsx("div",{style:{width:"100%",padding:"16px",paddingTop:"0"},children:p.jsx("button",{type:"submit",className:"btn btn-primary btn-lg btn-block",children:"Submit (Debug)"})})]})},oe=e=>{const{mergedSchema:t}=T(),r=F(),n=I.useForm({resolver:t?G(t):void 0,defaultValues:r.prefilledValues,mode:"onBlur"});return re(n),l.useEffect(()=>{r.showDebugLogs&&(A.DebugLogger.header("Form Initialized"),A.DebugLogger.table("Prefilled Values (DOM Capture)",r.prefilledValues),A.DebugLogger.info("RHF Current Values",n.getValues()),A.DebugLogger.end())},[r.showDebugLogs,r.prefilledValues,n]),p.jsx(I.FormProvider,{...n,children:p.jsx(ne,{...e})})};async function ie(e){if(!e)return console.warn("[setFluigNextActivity] Nenhuma atividade informada."),!1;const{wfView:t,wkfView:r}=await se();if(!t||!r)return!1;ae(t);const n=Number(e),i=ce(t,n);return i?(ue(t,r,i,n),console.log(`[setFluigNextActivity] Próxima atividade definida: ${n}`),!0):(console.warn(`[setFluigNextActivity] Estado ${n} não encontrado nas próximas atividades disponíveis.`),console.log("Estados disponíveis:",t.availableStatesCOPY||t.availableStates),!1)}async function se(){const e=await A.parentProxy.top.ECM.workflowView,t=await A.parentProxy.top.ECM_WKFView;return!e||!t?(console.warn("[setFluigNextActivity] Contexto Fluig inválido ou não carregado."),{}):{wfView:e,wkfView:t}}function ae(e){e.availableStatesCOPY||(e.availableStatesCOPY=e.availableStates)}function ce(e,t){const r=e.availableStatesCOPY||e.availableStates;return r==null?void 0:r.find(n=>n.sequence===t)}function ue(e,t,r,n){e.availableUsers.users=[],e.availableStates=[r],t.selectActivity=()=>n}const W=l.createContext(null);function le(){const e=l.useContext(W);if(!e)throw new Error("useSection deve ser usado dentro de um componente <Section>");return e}function de({id:e,className:t,schema:r,children:n,form:i,prefilledValues:s,readOnly:c,fields:a={},hidden:u=!1}){const{isView:o,activityId:h}=F(),m=h,b=I.useFormContext(),d=i||b;if(!d)return console.error(`[FluigWorkflowReact] Section "${e}" não encontrou o 'form'.`),null;if(u)return null;const v=l.useCallback(g=>{var E,V,P;return(E=a.hidden)!=null&&E.includes(g)?"hidden":(V=a.readonly)!=null&&V.includes(g)?"readonly":(P=a.active)!=null&&P.includes(g)?"active":c?"readonly":"active"},[a,c]),f=l.useCallback(g=>v(g)==="hidden",[v]),w=l.useCallback(g=>v(g)==="readonly",[v]),y=l.useCallback(g=>{if(!g)return;const E=d.getValues("CURRENTACTIVITYID");d.setValue("LASTACTIVITYID",E),d.setValue("CURRENTACTIVITYID",m),ie(Number(g))},[d,m]);l.useEffect(()=>{if(!o||!s||!r||!d)return;const g=d.getValues(),E=r.shape;E&&Object.entries(E).forEach(([V,P])=>{var D,k;let S=P;for(;(D=S==null?void 0:S._def)!=null&&D.schema;)S=S._def.schema;const x=(k=S==null?void 0:S._def)==null?void 0:k.fluig;if((x==null?void 0:x.type)!=="options"||!Array.isArray(x.values)||g[V]!==void 0)return;const C={};x.values.forEach(R=>{C[R]=s[R]==="on"}),d.setValue(V,C,{shouldDirty:!1,shouldValidate:!1})})},[o,s,r,d]);const _=l.useMemo(()=>({id:e,form:d,isHidden:f,isReadOnly:w,isView:o,next:y,wf_activity_id:m}),[e,d,f,w,o,y,m]);return p.jsx(W.Provider,{value:_,children:p.jsx("section",{id:e,className:[e,t].filter(Boolean).join(" "),children:n})})}const Y=l.createContext(null);function fe({children:e,config:t}){const r=l.useMemo(()=>A.createFluigClient(t),[t]);return p.jsx(Y.Provider,{value:r,children:e})}function me(){const e=l.useContext(Y);if(!e)throw new Error("useFluigApi deve ser usado dentro de um <FluigApiProvider>");return e}Object.defineProperty(exports,"DebugLogger",{enumerable:!0,get:()=>A.DebugLogger});Object.defineProperty(exports,"createFluigClient",{enumerable:!0,get:()=>A.createFluigClient});Object.defineProperty(exports,"parentProxy",{enumerable:!0,get:()=>A.parentProxy});exports.FluigApiProvider=fe;exports.FluigRuntimeProvider=te;exports.FluigWorkflowForm=oe;exports.SchemaRegistryProvider=z;exports.Section=de;exports.useFluigApi=me;exports.useFluigRuntime=F;exports.useSchemaRegistry=T;exports.useSection=le;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),l=require("react"),E=require("react-hook-form"),N=require("@hookform/resolvers"),W=require("zod"),A=require("@fluig-kit/core");var _=function(e,r){for(var t={};e.length;){var o=e[0],i=o.code,s=o.message,c=o.path.join(".");if(!t[c])if("unionErrors"in o){var a=o.unionErrors[0].errors[0];t[c]={message:a.message,type:a.code}}else t[c]={message:s,type:i};if("unionErrors"in o&&o.unionErrors.forEach(function(y){return y.errors.forEach(function(d){return e.push(d)})}),r){var u=t[c].types,n=u&&u[o.code];t[c]=E.appendErrors(c,r,t,i,n?[].concat(n,o.message):o.message)}e.shift()}return t},B=function(e,r,t){return t===void 0&&(t={}),function(o,i,s){try{return Promise.resolve(function(c,a){try{var u=Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](o,r)).then(function(n){return s.shouldUseNativeValidation&&N.validateFieldsNatively({},s),{errors:{},values:t.raw?o:n}})}catch(n){return a(n)}return u&&u.then?u.then(void 0,a):u}(0,function(c){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(c))return{values:{},errors:N.toNestErrors(_(c.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw c}))}catch(c){return Promise.reject(c)}}};const M=l.createContext(null);function G({children:e,baseSchema:r}){const[t,o]=l.useState([]),i=l.useMemo(()=>r??W.z.object({}),[r]),s=l.useCallback((n,y)=>{o(d=>d.some(b=>b.id===n)?d:[...d,{id:n,schema:y}])},[]),c=l.useCallback(n=>{o(y=>y.some(d=>d.id===n)?y.filter(d=>d.id!==n):y)},[]),a=l.useMemo(()=>t.length?t.map(n=>n.schema).reduce((n,y)=>n.and(y),i):i,[t,i]),u=l.useMemo(()=>({registerSchema:s,unregisterSchema:c,mergedSchema:a}),[s,c,a]);return g.jsx(M.Provider,{value:u,children:e})}function P(){const e=l.useContext(M);if(!e)throw new Error("useSchemaRegistry deve ser usado dentro de <SchemaRegistryProvider>");return e}function j(e){return typeof e=="number"?e:isNaN(Number(e))?null:Number(e)}function L(e,r,t){if(!e)return!0;const o=Array.isArray(r)?r[0]:r,i=e.field??o,s=t==null?void 0:t[i];return e.hasValue!==void 0?e.hasValue?s!=null&&s!=="":s==null||s==="":e.equals!==void 0?s===e.equals:e.notEquals!==void 0?s!==e.notEquals:!0}function z(e,r,t,o,i){const s=new Set(e),c=new Set(r);return t==null||t.forEach(a=>{if(a.from!==void 0){const n=Array.isArray(a.from)?a.from:[a.from];if(o===null||!n.includes(o))return}if(!L(a.when,a.target,i))return;const u=Array.isArray(a.target)?a.target:[a.target];switch(a.type){case"readonly":u.forEach(n=>{c.add(n),s.delete(n)});break;case"active":u.forEach(n=>{s.add(n),c.delete(n)});break;case"hidden":u.forEach(n=>{s.delete(n),c.delete(n)});break}}),{active:Array.from(s),readonly:Array.from(c)}}function H(e,r,t,o){const i=new Set(e.active),s=new Set(e.readonly),c=new Set(e.hidden??[]);return r==null||r.forEach(a=>{if(a.from!==void 0){const n=Array.isArray(a.from)?a.from:[a.from];if(t===null||!n.includes(t))return}if(!L(a.when,a.target,o))return;const u=Array.isArray(a.target)?a.target:[a.target];switch(a.type){case"hidden":u.forEach(n=>{c.add(n),i.delete(n),s.delete(n)});break;case"active":u.forEach(n=>{i.add(n),s.delete(n),c.delete(n)});break;case"readonly":u.forEach(n=>{s.add(n),i.delete(n),c.delete(n)});break}}),{active:Array.from(i),readonly:Array.from(s),hidden:Array.from(c)}}function $(e,r){if(!(e!=null&&e.length))return r;const t=new Map(r.map(i=>[i.name,i])),o=[];return e.forEach(i=>{t.has(i)&&(o.push(t.get(i)),t.delete(i))}),t.forEach(i=>o.push(i)),o}function K(e){var o,i;const r=new Set,t=(s=[])=>{s.forEach(c=>{var a;c.target&&(Array.isArray(c.target)?c.target:[c.target]).forEach(n=>r.add(n)),(a=c.when)!=null&&a.field&&r.add(c.when.field)})};return t((o=e==null?void 0:e.fields)==null?void 0:o.rules),t((i=e==null?void 0:e.sections)==null?void 0:i.rules),Array.from(r)}function J({activityId:e,previousActivityId:r,control:t,workflowStructure:o,sectionsRegistry:i}){const{registerSchema:s,unregisterSchema:c}=P(),a=j(e),u=j(r),n=a!==null?o[a]:null,y=l.useMemo(()=>K(n),[a,n]),d=E.useWatch({control:t,name:y,defaultValue:{}}),b=l.useMemo(()=>{const v={};return y.forEach((m,w)=>{v[m]=Array.isArray(d)?d[w]:d}),v},[d,y]),f=l.useMemo(()=>{if(!n)return{sections:[],fields:{active:[],readonly:[],hidden:[]}};const v=z(n.sections.active,n.sections.readonly,n.sections.rules,u,b);let m=[...v.readonly.map(h=>({name:h,mode:"readonly"})),...v.active.map(h=>({name:h,mode:"active"}))];m=$(n.sections.order,m);const w=H({active:n.fields.active,readonly:n.fields.readonly,hidden:n.fields.hidden},n.fields.rules,u,b);return{sections:m,fields:w}},[n,u,b,i]);return l.useEffect(()=>{const v=f.sections.filter(m=>m.mode==="active").map(m=>m.name);v.forEach(m=>{var h;const w=(h=i==null?void 0:i[m])==null?void 0:h.schema;w&&s(m,w)}),Object.keys(i??{}).filter(m=>!v.includes(m)).forEach(c)},[f.sections,i,s,c]),f}function Q(){if(typeof document>"u")return{};const e={};return document.querySelectorAll("input[type='radio'][name]").forEach(r=>{const t=r,o=t.getAttribute("name");o&&t.checked&&(e[o]=t.value)}),document.querySelectorAll("input[name], textarea[name], select[name]").forEach(r=>{const t=r,o=t.getAttribute("name");if(!o||e[o]!==void 0)return;const i=t.getAttribute("value")??t.value??t.textContent??"";e[o]=String(i).trim()}),document.querySelectorAll("span[name]").forEach(r=>{var i;const t=r,o=t.getAttribute("name");if(o){const s=((i=t.textContent)==null?void 0:i.trim())??"";s!==""&&(e[o]=s)}}),e}const X=()=>{var d;const e={isCreation:!1,isEdit:!1,isView:!0};if(typeof window>"u"||!window.top)return e;const r=new URLSearchParams(window.location.search),t=window.top,o=window.top.document,i=((d=t.ECM)==null?void 0:d.workflowView)||t.ECM_WKFView,s=(i==null?void 0:i.newRequest)===!0||(i==null?void 0:i.isNewRequest)===!0,c=r.get("edit")==="true"||r.get("mode")==="edit",a=r.has("taskUserId"),u=r.get("view")==="true"||r.get("publicView")==="true",n=!!o.getElementById("sendModal")||!!o.querySelector(".fluig-style-guide.modal-dialog"),y=s||c||a&&!u&&n;return{isCreation:s,isEdit:y,isView:!y}},q=l.createContext(null);function Z({children:e,devConfig:r}){const[t,o]=l.useState(null),i=l.useMemo(()=>Q()??{},[]);return l.useEffect(()=>{let s=!0;const c=async()=>{let u=(t==null?void 0:t.activityId)??null;try{const h=await A.parentProxy.top.ECM.workflowView.sequence;h!=null&&(u=Number(h))}catch{}const{isEdit:n,isView:y}=X(),d=typeof window<"u"&&window.location.hostname==="localhost",b=typeof window<"u"&&window.self!==window.top,f=!d&&b?y:!1,v=i.LASTACTIVITYID?Number(i.LASTACTIVITYID):null,m={isView:f,isReadOnly:f,activityId:u,previousActivityId:v,prefilledValues:i,showDebugSubmit:(r==null?void 0:r.showDebugSubmit)??!1,showDebugLogs:(r==null?void 0:r.showDebugLogs)??!1,isDev:!1};let w=m;if(r!=null&&r.enabled){const h=r.isView??m.isView;w={...m,...r,isView:h,isReadOnly:h,isDev:!0,activityId:r.activityId??u}}s&&o(h=>h&&h.isView===w.isView&&h.activityId===w.activityId?h:w),r!=null&&r.showDebugLogs&&n&&console.log("[FluigRuntime] Modo Edição Detectado via Modal/URL")};c();const a=setInterval(c,800);return()=>{s=!1,clearInterval(a)}},[r,i]),t?g.jsx(q.Provider,{value:t,children:e}):null}function F(){const e=l.useContext(q);if(!e)throw new Error("useFluigRuntime deve ser usado dentro de FluigRuntimeProvider");return e}function ee(e){const{activityId:r,previousActivityId:t}=F();l.useEffect(()=>{r!=null&&e.setValue("CURRENTACTIVITYID",r),t!=null&&e.setValue("LASTACTIVITYID",t)},[r,t,e]),l.useEffect(()=>{var i,s;if(typeof window>"u")return;const o=((i=window.top)==null?void 0:i.document.getElementById("send-process-button"))||((s=window.parent)==null?void 0:s.document.getElementById("workflow-actions-send"))||document.getElementById("send-process-button");if(!o){console.warn("[FluigWorkflowReact] Botão de envio do Fluig não encontrado. A validação automática pode falhar.");return}return window.beforeSendValidate=()=>(e.handleSubmit(()=>{window.top.__FLUIG_REACT_FORM_DATA__=e.getValues(),window.beforeSendValidate=()=>!0;try{o.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))}catch{o.click()}},c=>{var a,u,n;console.error("[Validation Errors]",c),(u=(a=window.top)==null?void 0:a.FLUIGC)!=null&&u.toast?(n=window.top)==null||n.FLUIGC.toast({title:"Atenção",message:"Verifique os campos obrigatórios destacados em vermelho.",type:"danger"}):alert("Verifique os campos obrigatórios.")})(),!1),()=>{}},[e])}const te=({workflowStructure:e,sectionsRegistry:r,className:t})=>{const{control:o,handleSubmit:i,register:s,setValue:c,getValues:a}=E.useFormContext(),u=F(),n=l.useRef(!1);l.useEffect(()=>{n.current||(u.activityId!=null&&c("CURRENTACTIVITYID",u.activityId),u.previousActivityId!=null&&c("LASTACTIVITYID",u.previousActivityId),n.current=!0)},[u,c]);const{sections:y,fields:d}=J({control:o,activityId:u.activityId,previousActivityId:u.previousActivityId,workflowStructure:e,sectionsRegistry:r}),b=f=>{console.log("✅ [FluigWorkflowForm] Dados válidos:",f)};return g.jsxs("form",{id:"fluig-react-form",className:t,onSubmit:i(b),noValidate:!0,children:[g.jsxs("div",{className:"hidden",style:{display:"none"},children:[g.jsx("input",{type:"hidden",...s("CURRENTACTIVITYID")}),g.jsx("input",{type:"hidden",...s("LASTACTIVITYID")})]}),y.length===0&&u.activityId!==null&&g.jsxs("p",{children:["Não foi possível encontrar a atividade: ",String(u.activityId)]}),y.map(({name:f,mode:v})=>{if(v==="hidden")return null;const m=r[f];if(!m)return null;const w=m.Component;return g.jsx(w,{id:f,fields:d,readOnly:v==="readonly"},f)}),u.isDev&&u.showDebugSubmit&&g.jsx("div",{style:{width:"100%",padding:"16px",paddingTop:"0"},children:g.jsx("button",{type:"submit",className:"btn btn-primary btn-lg btn-block",children:"Submit (Debug)"})})]})},re=e=>{const{mergedSchema:r}=P(),t=F(),o=E.useForm({resolver:r?B(r):void 0,defaultValues:t.prefilledValues,mode:"onBlur"});return ee(o),l.useEffect(()=>{t.showDebugLogs&&(A.DebugLogger.header("Form Initialized"),A.DebugLogger.table("Prefilled Values (DOM Capture)",t.prefilledValues),A.DebugLogger.info("RHF Current Values",o.getValues()),A.DebugLogger.end())},[t.showDebugLogs,t.prefilledValues,o]),g.jsx(E.FormProvider,{...o,children:g.jsx(te,{...e})})};async function ne(e){if(!e)return console.warn("[setFluigNextActivity] Nenhuma atividade informada."),!1;const{wfView:r,wkfView:t}=await oe();if(!r||!t)return!1;ie(r);const o=Number(e),i=se(r,o);return i?(ae(r,t,i,o),console.log(`[setFluigNextActivity] Próxima atividade definida: ${o}`),!0):(console.warn(`[setFluigNextActivity] Estado ${o} não encontrado nas próximas atividades disponíveis.`),console.log("Estados disponíveis:",r.availableStatesCOPY||r.availableStates),!1)}async function oe(){const e=await A.parentProxy.top.ECM.workflowView,r=await A.parentProxy.top.ECM_WKFView;return!e||!r?(console.warn("[setFluigNextActivity] Contexto Fluig inválido ou não carregado."),{}):{wfView:e,wkfView:r}}function ie(e){e.availableStatesCOPY||(e.availableStatesCOPY=e.availableStates)}function se(e,r){const t=e.availableStatesCOPY||e.availableStates;return t==null?void 0:t.find(o=>o.sequence===r)}function ae(e,r,t,o){e.availableUsers.users=[],e.availableStates=[t],r.selectActivity=()=>o}const O=l.createContext(null);function ce(){const e=l.useContext(O);if(!e)throw new Error("useSection deve ser usado dentro de um componente <Section>");return e}function ue({id:e,className:r,schema:t,children:o,form:i,prefilledValues:s,readOnly:c,fields:a={},hidden:u=!1}){const{isView:n,activityId:y}=F(),d=y,b=E.useFormContext(),f=i||b;if(!f)return console.error(`[FluigWorkflowReact] Section "${e}" não encontrou o 'form'.`),null;if(u)return null;const v=l.useCallback(p=>{var I,V,C;return(I=a.hidden)!=null&&I.includes(p)?"hidden":(V=a.readonly)!=null&&V.includes(p)?"readonly":(C=a.active)!=null&&C.includes(p)?"active":c?"readonly":"active"},[a,c]),m=l.useCallback(p=>v(p)==="hidden",[v]),w=l.useCallback(p=>v(p)==="readonly",[v]),h=l.useCallback(p=>{if(!p)return;const I=f.getValues("CURRENTACTIVITYID");f.setValue("LASTACTIVITYID",I),f.setValue("CURRENTACTIVITYID",d),ne(Number(p))},[f,d]);l.useEffect(()=>{if(!n||!s||!t||!f)return;const p=f.getValues(),I=t.shape;I&&Object.entries(I).forEach(([V,C])=>{var D,k;let S=C;for(;(D=S==null?void 0:S._def)!=null&&D.schema;)S=S._def.schema;const x=(k=S==null?void 0:S._def)==null?void 0:k.fluig;if((x==null?void 0:x.type)!=="options"||!Array.isArray(x.values)||p[V]!==void 0)return;const T={};x.values.forEach(R=>{T[R]=s[R]==="on"}),f.setValue(V,T,{shouldDirty:!1,shouldValidate:!1})})},[n,s,t,f]);const Y=l.useMemo(()=>({id:e,form:f,isHidden:m,isReadOnly:w,isView:n,next:h,wf_activity_id:d}),[e,f,m,w,n,h,d]);return g.jsx(O.Provider,{value:Y,children:g.jsx("section",{id:e,className:[e,r].filter(Boolean).join(" "),children:o})})}const U=l.createContext(null);function le({children:e,config:r}){const t=l.useMemo(()=>A.createFluigClient(r),[r]);return g.jsx(U.Provider,{value:t,children:e})}function de(){const e=l.useContext(U);if(!e)throw new Error("useFluigApi deve ser usado dentro de um <FluigApiProvider>");return e}Object.defineProperty(exports,"DebugLogger",{enumerable:!0,get:()=>A.DebugLogger});Object.defineProperty(exports,"createFluigClient",{enumerable:!0,get:()=>A.createFluigClient});Object.defineProperty(exports,"parentProxy",{enumerable:!0,get:()=>A.parentProxy});exports.FluigApiProvider=le;exports.FluigRuntimeProvider=Z;exports.FluigWorkflowForm=re;exports.SchemaRegistryProvider=G;exports.Section=ue;exports.useFluigApi=de;exports.useFluigRuntime=F;exports.useSchemaRegistry=P;exports.useSection=ce;
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsx as p, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { appendErrors as
|
|
4
|
-
import { validateFieldsNatively as
|
|
5
|
-
import { z as
|
|
6
|
-
import { parentProxy as k, DebugLogger as x, createFluigClient as
|
|
7
|
-
import { DebugLogger as
|
|
8
|
-
var
|
|
9
|
-
for (var
|
|
10
|
-
var
|
|
11
|
-
if (!
|
|
12
|
-
var s =
|
|
13
|
-
|
|
14
|
-
} else
|
|
15
|
-
if ("unionErrors" in
|
|
16
|
-
return
|
|
17
|
-
return e.push(
|
|
1
|
+
import { jsx as p, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as D, useState as U, useMemo as b, useCallback as V, useContext as N, useEffect as I, useRef as H } from "react";
|
|
3
|
+
import { appendErrors as K, useWatch as J, useForm as Q, FormProvider as X, useFormContext as Y } from "react-hook-form";
|
|
4
|
+
import { validateFieldsNatively as Z, toNestErrors as ee } from "@hookform/resolvers";
|
|
5
|
+
import { z as te } from "zod";
|
|
6
|
+
import { parentProxy as k, DebugLogger as x, createFluigClient as ne } from "@fluig-kit/core";
|
|
7
|
+
import { DebugLogger as Ce, createFluigClient as Le, parentProxy as Me } from "@fluig-kit/core";
|
|
8
|
+
var re = function(e, n) {
|
|
9
|
+
for (var t = {}; e.length; ) {
|
|
10
|
+
var o = e[0], i = o.code, a = o.message, c = o.path.join(".");
|
|
11
|
+
if (!t[c]) if ("unionErrors" in o) {
|
|
12
|
+
var s = o.unionErrors[0].errors[0];
|
|
13
|
+
t[c] = { message: s.message, type: s.code };
|
|
14
|
+
} else t[c] = { message: a, type: i };
|
|
15
|
+
if ("unionErrors" in o && o.unionErrors.forEach(function(m) {
|
|
16
|
+
return m.errors.forEach(function(l) {
|
|
17
|
+
return e.push(l);
|
|
18
18
|
});
|
|
19
|
-
}),
|
|
20
|
-
var u =
|
|
21
|
-
|
|
19
|
+
}), n) {
|
|
20
|
+
var u = t[c].types, r = u && u[o.code];
|
|
21
|
+
t[c] = K(c, n, t, i, r ? [].concat(r, o.message) : o.message);
|
|
22
22
|
}
|
|
23
23
|
e.shift();
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
return
|
|
25
|
+
return t;
|
|
26
|
+
}, oe = function(e, n, t) {
|
|
27
|
+
return t === void 0 && (t = {}), function(o, i, a) {
|
|
28
28
|
try {
|
|
29
29
|
return Promise.resolve(function(c, s) {
|
|
30
30
|
try {
|
|
31
|
-
var u = Promise.resolve(e[
|
|
32
|
-
return a.shouldUseNativeValidation &&
|
|
31
|
+
var u = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](o, n)).then(function(r) {
|
|
32
|
+
return a.shouldUseNativeValidation && Z({}, a), { errors: {}, values: t.raw ? o : r };
|
|
33
33
|
});
|
|
34
|
-
} catch (
|
|
35
|
-
return s(
|
|
34
|
+
} catch (r) {
|
|
35
|
+
return s(r);
|
|
36
36
|
}
|
|
37
37
|
return u && u.then ? u.then(void 0, s) : u;
|
|
38
38
|
}(0, function(c) {
|
|
39
39
|
if (function(s) {
|
|
40
40
|
return Array.isArray(s == null ? void 0 : s.errors);
|
|
41
|
-
}(c)) return { values: {}, errors:
|
|
41
|
+
}(c)) return { values: {}, errors: ee(re(c.errors, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
|
|
42
42
|
throw c;
|
|
43
43
|
}));
|
|
44
44
|
} catch (c) {
|
|
@@ -46,18 +46,18 @@ var oe = function(e, t) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const _ = D(
|
|
50
50
|
null
|
|
51
51
|
);
|
|
52
|
-
function
|
|
52
|
+
function Ee({
|
|
53
53
|
children: e,
|
|
54
|
-
baseSchema:
|
|
54
|
+
baseSchema: n
|
|
55
55
|
}) {
|
|
56
|
-
const [
|
|
57
|
-
|
|
58
|
-
}, []), c = V((
|
|
59
|
-
|
|
60
|
-
}, []), s =
|
|
56
|
+
const [t, o] = U([]), i = b(() => n ?? te.object({}), [n]), a = V((r, m) => {
|
|
57
|
+
o((l) => l.some((g) => g.id === r) ? l : [...l, { id: r, schema: m }]);
|
|
58
|
+
}, []), c = V((r) => {
|
|
59
|
+
o((m) => m.some((l) => l.id === r) ? m.filter((l) => l.id !== r) : m);
|
|
60
|
+
}, []), s = b(() => t.length ? t.map((r) => r.schema).reduce((r, m) => r.and(m), i) : i, [t, i]), u = b(
|
|
61
61
|
() => ({
|
|
62
62
|
registerSchema: a,
|
|
63
63
|
unregisterSchema: c,
|
|
@@ -65,75 +65,75 @@ function Te({
|
|
|
65
65
|
}),
|
|
66
66
|
[a, c, s]
|
|
67
67
|
);
|
|
68
|
-
return /* @__PURE__ */ p(
|
|
68
|
+
return /* @__PURE__ */ p(_.Provider, { value: u, children: e });
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const e =
|
|
70
|
+
function W() {
|
|
71
|
+
const e = N(_);
|
|
72
72
|
if (!e)
|
|
73
73
|
throw new Error(
|
|
74
74
|
"useSchemaRegistry deve ser usado dentro de <SchemaRegistryProvider>"
|
|
75
75
|
);
|
|
76
76
|
return e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function O(e) {
|
|
79
79
|
return typeof e == "number" ? e : isNaN(Number(e)) ? null : Number(e);
|
|
80
80
|
}
|
|
81
|
-
function j(e,
|
|
81
|
+
function j(e, n, t) {
|
|
82
82
|
if (!e) return !0;
|
|
83
|
-
const
|
|
83
|
+
const o = Array.isArray(n) ? n[0] : n, i = e.field ?? o, a = t == null ? void 0 : t[i];
|
|
84
84
|
return e.hasValue !== void 0 ? e.hasValue ? a != null && a !== "" : a == null || a === "" : e.equals !== void 0 ? a === e.equals : e.notEquals !== void 0 ? a !== e.notEquals : !0;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
const a = new Set(e), c = new Set(
|
|
88
|
-
return
|
|
86
|
+
function ie(e, n, t, o, i) {
|
|
87
|
+
const a = new Set(e), c = new Set(n);
|
|
88
|
+
return t == null || t.forEach((s) => {
|
|
89
89
|
if (s.from !== void 0) {
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
90
|
+
const r = Array.isArray(s.from) ? s.from : [s.from];
|
|
91
|
+
if (o === null || !r.includes(o)) return;
|
|
92
92
|
}
|
|
93
93
|
if (!j(s.when, s.target, i)) return;
|
|
94
94
|
const u = Array.isArray(s.target) ? s.target : [s.target];
|
|
95
95
|
switch (s.type) {
|
|
96
96
|
case "readonly":
|
|
97
|
-
u.forEach((
|
|
98
|
-
c.add(
|
|
97
|
+
u.forEach((r) => {
|
|
98
|
+
c.add(r), a.delete(r);
|
|
99
99
|
});
|
|
100
100
|
break;
|
|
101
101
|
case "active":
|
|
102
|
-
u.forEach((
|
|
103
|
-
a.add(
|
|
102
|
+
u.forEach((r) => {
|
|
103
|
+
a.add(r), c.delete(r);
|
|
104
104
|
});
|
|
105
105
|
break;
|
|
106
106
|
case "hidden":
|
|
107
|
-
u.forEach((
|
|
108
|
-
a.delete(
|
|
107
|
+
u.forEach((r) => {
|
|
108
|
+
a.delete(r), c.delete(r);
|
|
109
109
|
});
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
}), { active: Array.from(a), readonly: Array.from(c) };
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function ae(e, n, t, o) {
|
|
115
115
|
const i = new Set(e.active), a = new Set(e.readonly), c = new Set(e.hidden ?? []);
|
|
116
|
-
return
|
|
116
|
+
return n == null || n.forEach((s) => {
|
|
117
117
|
if (s.from !== void 0) {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
118
|
+
const r = Array.isArray(s.from) ? s.from : [s.from];
|
|
119
|
+
if (t === null || !r.includes(t)) return;
|
|
120
120
|
}
|
|
121
|
-
if (!j(s.when, s.target,
|
|
121
|
+
if (!j(s.when, s.target, o)) return;
|
|
122
122
|
const u = Array.isArray(s.target) ? s.target : [s.target];
|
|
123
123
|
switch (s.type) {
|
|
124
124
|
case "hidden":
|
|
125
|
-
u.forEach((
|
|
126
|
-
c.add(
|
|
125
|
+
u.forEach((r) => {
|
|
126
|
+
c.add(r), i.delete(r), a.delete(r);
|
|
127
127
|
});
|
|
128
128
|
break;
|
|
129
129
|
case "active":
|
|
130
|
-
u.forEach((
|
|
131
|
-
i.add(
|
|
130
|
+
u.forEach((r) => {
|
|
131
|
+
i.add(r), a.delete(r), c.delete(r);
|
|
132
132
|
});
|
|
133
133
|
break;
|
|
134
134
|
case "readonly":
|
|
135
|
-
u.forEach((
|
|
136
|
-
a.add(
|
|
135
|
+
u.forEach((r) => {
|
|
136
|
+
a.add(r), i.delete(r), c.delete(r);
|
|
137
137
|
});
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
@@ -143,179 +143,177 @@ function se(e, t, n, r) {
|
|
|
143
143
|
hidden: Array.from(c)
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
if (!(e != null && e.length)) return
|
|
148
|
-
const
|
|
146
|
+
function se(e, n) {
|
|
147
|
+
if (!(e != null && e.length)) return n;
|
|
148
|
+
const t = new Map(n.map((i) => [i.name, i])), o = [];
|
|
149
149
|
return e.forEach((i) => {
|
|
150
|
-
|
|
151
|
-
}),
|
|
150
|
+
t.has(i) && (o.push(t.get(i)), t.delete(i));
|
|
151
|
+
}), t.forEach((i) => o.push(i)), o;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
var
|
|
155
|
-
const
|
|
153
|
+
function ce(e) {
|
|
154
|
+
var o, i;
|
|
155
|
+
const n = /* @__PURE__ */ new Set(), t = (a = []) => {
|
|
156
156
|
a.forEach((c) => {
|
|
157
157
|
var s;
|
|
158
|
-
c.target && (Array.isArray(c.target) ? c.target : [c.target]).forEach((
|
|
158
|
+
c.target && (Array.isArray(c.target) ? c.target : [c.target]).forEach((r) => n.add(r)), (s = c.when) != null && s.field && n.add(c.when.field);
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
|
-
return
|
|
161
|
+
return t((o = e == null ? void 0 : e.fields) == null ? void 0 : o.rules), t((i = e == null ? void 0 : e.sections) == null ? void 0 : i.rules), Array.from(n);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function ue({
|
|
164
164
|
activityId: e,
|
|
165
|
-
previousActivityId:
|
|
166
|
-
control:
|
|
167
|
-
workflowStructure:
|
|
165
|
+
previousActivityId: n,
|
|
166
|
+
control: t,
|
|
167
|
+
workflowStructure: o,
|
|
168
168
|
sectionsRegistry: i
|
|
169
169
|
}) {
|
|
170
|
-
const { registerSchema: a, unregisterSchema: c } =
|
|
171
|
-
control:
|
|
172
|
-
name:
|
|
170
|
+
const { registerSchema: a, unregisterSchema: c } = W(), s = O(e), u = O(n), r = s !== null ? o[s] : null, m = b(() => ce(r), [s, r]), l = J({
|
|
171
|
+
control: t,
|
|
172
|
+
name: m,
|
|
173
173
|
defaultValue: {}
|
|
174
|
-
}),
|
|
174
|
+
}), g = b(() => {
|
|
175
175
|
const h = {};
|
|
176
|
-
return
|
|
177
|
-
h[
|
|
176
|
+
return m.forEach((f, v) => {
|
|
177
|
+
h[f] = Array.isArray(l) ? l[v] : l;
|
|
178
178
|
}), h;
|
|
179
|
-
}, [
|
|
180
|
-
if (!
|
|
179
|
+
}, [l, m]), d = b(() => {
|
|
180
|
+
if (!r)
|
|
181
181
|
return {
|
|
182
182
|
sections: [],
|
|
183
183
|
fields: { active: [], readonly: [], hidden: [] }
|
|
184
184
|
};
|
|
185
|
-
const h =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
const h = ie(
|
|
186
|
+
r.sections.active,
|
|
187
|
+
r.sections.readonly,
|
|
188
|
+
r.sections.rules,
|
|
189
189
|
u,
|
|
190
|
-
|
|
190
|
+
g
|
|
191
191
|
);
|
|
192
|
-
let
|
|
193
|
-
...h.readonly.map((
|
|
194
|
-
name:
|
|
192
|
+
let f = [
|
|
193
|
+
...h.readonly.map((y) => ({
|
|
194
|
+
name: y,
|
|
195
195
|
mode: "readonly"
|
|
196
196
|
})),
|
|
197
|
-
...h.active.map((
|
|
198
|
-
name:
|
|
197
|
+
...h.active.map((y) => ({
|
|
198
|
+
name: y,
|
|
199
199
|
mode: "active"
|
|
200
200
|
}))
|
|
201
201
|
];
|
|
202
|
-
|
|
203
|
-
const v =
|
|
202
|
+
f = se(r.sections.order, f);
|
|
203
|
+
const v = ae(
|
|
204
204
|
{
|
|
205
|
-
active:
|
|
206
|
-
readonly:
|
|
207
|
-
hidden:
|
|
205
|
+
active: r.fields.active,
|
|
206
|
+
readonly: r.fields.readonly,
|
|
207
|
+
hidden: r.fields.hidden
|
|
208
208
|
},
|
|
209
|
-
|
|
209
|
+
r.fields.rules,
|
|
210
210
|
u,
|
|
211
|
-
|
|
211
|
+
g
|
|
212
212
|
);
|
|
213
|
-
return { sections:
|
|
214
|
-
}, [
|
|
213
|
+
return { sections: f, fields: v };
|
|
214
|
+
}, [r, u, g, i]);
|
|
215
215
|
return I(() => {
|
|
216
|
-
const h =
|
|
217
|
-
h.forEach((
|
|
218
|
-
var
|
|
219
|
-
const v = (
|
|
220
|
-
v && a(
|
|
221
|
-
}), Object.keys(i ?? {}).filter((
|
|
222
|
-
}, [
|
|
216
|
+
const h = d.sections.filter((f) => f.mode === "active").map((f) => f.name);
|
|
217
|
+
h.forEach((f) => {
|
|
218
|
+
var y;
|
|
219
|
+
const v = (y = i == null ? void 0 : i[f]) == null ? void 0 : y.schema;
|
|
220
|
+
v && a(f, v);
|
|
221
|
+
}), Object.keys(i ?? {}).filter((f) => !h.includes(f)).forEach(c);
|
|
222
|
+
}, [d.sections, i, a, c]), d;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function le() {
|
|
225
225
|
if (typeof document > "u") return {};
|
|
226
226
|
const e = {};
|
|
227
|
-
return document.querySelectorAll("input[type='radio'][name]").forEach((
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
}), document.querySelectorAll("input[name], textarea[name], select[name]").forEach((
|
|
231
|
-
const
|
|
232
|
-
if (!
|
|
233
|
-
const i =
|
|
234
|
-
e[
|
|
235
|
-
}), document.querySelectorAll("span[name]").forEach((
|
|
227
|
+
return document.querySelectorAll("input[type='radio'][name]").forEach((n) => {
|
|
228
|
+
const t = n, o = t.getAttribute("name");
|
|
229
|
+
o && t.checked && (e[o] = t.value);
|
|
230
|
+
}), document.querySelectorAll("input[name], textarea[name], select[name]").forEach((n) => {
|
|
231
|
+
const t = n, o = t.getAttribute("name");
|
|
232
|
+
if (!o || e[o] !== void 0) return;
|
|
233
|
+
const i = t.getAttribute("value") ?? t.value ?? t.textContent ?? "";
|
|
234
|
+
e[o] = String(i).trim();
|
|
235
|
+
}), document.querySelectorAll("span[name]").forEach((n) => {
|
|
236
236
|
var i;
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
const a = ((i =
|
|
240
|
-
a !== "" && (e[
|
|
237
|
+
const t = n, o = t.getAttribute("name");
|
|
238
|
+
if (o) {
|
|
239
|
+
const a = ((i = t.textContent) == null ? void 0 : i.trim()) ?? "";
|
|
240
|
+
a !== "" && (e[o] = a);
|
|
241
241
|
}
|
|
242
242
|
}), e;
|
|
243
243
|
}
|
|
244
|
-
const
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
function xe({
|
|
244
|
+
const de = () => {
|
|
245
|
+
var l;
|
|
246
|
+
const e = { isCreation: !1, isEdit: !1, isView: !0 };
|
|
247
|
+
if (typeof window > "u" || !window.top) return e;
|
|
248
|
+
const n = new URLSearchParams(window.location.search), t = window.top, o = window.top.document, i = ((l = t.ECM) == null ? void 0 : l.workflowView) || t.ECM_WKFView, a = (i == null ? void 0 : i.newRequest) === !0 || (i == null ? void 0 : i.isNewRequest) === !0, c = n.get("edit") === "true" || n.get("mode") === "edit", s = n.has("taskUserId"), u = n.get("view") === "true" || n.get("publicView") === "true", r = !!o.getElementById("sendModal") || !!o.querySelector(".fluig-style-guide.modal-dialog"), m = a || c || s && !u && r;
|
|
249
|
+
return {
|
|
250
|
+
isCreation: a,
|
|
251
|
+
isEdit: m,
|
|
252
|
+
isView: !m
|
|
253
|
+
};
|
|
254
|
+
}, B = D(null);
|
|
255
|
+
function Fe({
|
|
257
256
|
children: e,
|
|
258
|
-
devConfig:
|
|
257
|
+
devConfig: n
|
|
259
258
|
}) {
|
|
260
|
-
const [
|
|
259
|
+
const [t, o] = U(null), i = b(() => le() ?? {}, []);
|
|
261
260
|
return I(() => {
|
|
262
261
|
let a = !0;
|
|
263
262
|
const c = async () => {
|
|
264
|
-
let u = (
|
|
263
|
+
let u = (t == null ? void 0 : t.activityId) ?? null;
|
|
265
264
|
try {
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
} catch
|
|
269
|
-
t != null && t.showDebugLogs && console.warn("Erro ao detectar atividade", m);
|
|
265
|
+
const y = await k.top.ECM.workflowView.sequence;
|
|
266
|
+
y != null && (u = Number(y));
|
|
267
|
+
} catch {
|
|
270
268
|
}
|
|
271
|
-
const
|
|
272
|
-
isView:
|
|
273
|
-
isReadOnly:
|
|
269
|
+
const { isEdit: r, isView: m } = de(), l = typeof window < "u" && window.location.hostname === "localhost", g = typeof window < "u" && window.self !== window.top, d = !l && g ? m : !1, h = i.LASTACTIVITYID ? Number(i.LASTACTIVITYID) : null, f = {
|
|
270
|
+
isView: d,
|
|
271
|
+
isReadOnly: d,
|
|
274
272
|
activityId: u,
|
|
275
273
|
previousActivityId: h,
|
|
276
274
|
prefilledValues: i,
|
|
277
|
-
showDebugSubmit: (
|
|
278
|
-
showDebugLogs: (
|
|
279
|
-
isDev:
|
|
275
|
+
showDebugSubmit: (n == null ? void 0 : n.showDebugSubmit) ?? !1,
|
|
276
|
+
showDebugLogs: (n == null ? void 0 : n.showDebugLogs) ?? !1,
|
|
277
|
+
isDev: !1
|
|
280
278
|
};
|
|
281
|
-
let v =
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
279
|
+
let v = f;
|
|
280
|
+
if (n != null && n.enabled) {
|
|
281
|
+
const y = n.isView ?? f.isView;
|
|
284
282
|
v = {
|
|
285
|
-
...
|
|
286
|
-
...
|
|
287
|
-
isView:
|
|
288
|
-
isReadOnly:
|
|
283
|
+
...f,
|
|
284
|
+
...n,
|
|
285
|
+
isView: y,
|
|
286
|
+
isReadOnly: y,
|
|
289
287
|
isDev: !0,
|
|
290
|
-
activityId:
|
|
288
|
+
activityId: n.activityId ?? u
|
|
291
289
|
};
|
|
292
290
|
}
|
|
293
|
-
a &&
|
|
291
|
+
a && o((y) => y && y.isView === v.isView && y.activityId === v.activityId ? y : v), n != null && n.showDebugLogs && r && console.log("[FluigRuntime] Modo Edição Detectado via Modal/URL");
|
|
294
292
|
};
|
|
295
293
|
c();
|
|
296
|
-
const s = setInterval(c,
|
|
294
|
+
const s = setInterval(c, 800);
|
|
297
295
|
return () => {
|
|
298
296
|
a = !1, clearInterval(s);
|
|
299
297
|
};
|
|
300
|
-
}, [
|
|
298
|
+
}, [n, i]), t ? /* @__PURE__ */ p(B.Provider, { value: t, children: e }) : null;
|
|
301
299
|
}
|
|
302
|
-
function
|
|
303
|
-
const e =
|
|
300
|
+
function R() {
|
|
301
|
+
const e = N(B);
|
|
304
302
|
if (!e)
|
|
305
303
|
throw new Error(
|
|
306
|
-
"useFluigRuntime deve ser usado dentro de
|
|
304
|
+
"useFluigRuntime deve ser usado dentro de FluigRuntimeProvider"
|
|
307
305
|
);
|
|
308
306
|
return e;
|
|
309
307
|
}
|
|
310
|
-
function
|
|
311
|
-
const { activityId:
|
|
308
|
+
function fe(e) {
|
|
309
|
+
const { activityId: n, previousActivityId: t } = R();
|
|
312
310
|
I(() => {
|
|
313
|
-
|
|
314
|
-
}, [
|
|
311
|
+
n != null && e.setValue("CURRENTACTIVITYID", n), t != null && e.setValue("LASTACTIVITYID", t);
|
|
312
|
+
}, [n, t, e]), I(() => {
|
|
315
313
|
var i, a;
|
|
316
314
|
if (typeof window > "u") return;
|
|
317
|
-
const
|
|
318
|
-
if (!
|
|
315
|
+
const o = ((i = window.top) == null ? void 0 : i.document.getElementById("send-process-button")) || ((a = window.parent) == null ? void 0 : a.document.getElementById("workflow-actions-send")) || document.getElementById("send-process-button");
|
|
316
|
+
if (!o) {
|
|
319
317
|
console.warn(
|
|
320
318
|
"[FluigWorkflowReact] Botão de envio do Fluig não encontrado. A validação automática pode falhar."
|
|
321
319
|
);
|
|
@@ -325,7 +323,7 @@ function ye(e) {
|
|
|
325
323
|
() => {
|
|
326
324
|
window.top.__FLUIG_REACT_FORM_DATA__ = e.getValues(), window.beforeSendValidate = () => !0;
|
|
327
325
|
try {
|
|
328
|
-
|
|
326
|
+
o.dispatchEvent(
|
|
329
327
|
new MouseEvent("click", {
|
|
330
328
|
view: window,
|
|
331
329
|
bubbles: !0,
|
|
@@ -333,12 +331,12 @@ function ye(e) {
|
|
|
333
331
|
})
|
|
334
332
|
);
|
|
335
333
|
} catch {
|
|
336
|
-
|
|
334
|
+
o.click();
|
|
337
335
|
}
|
|
338
336
|
},
|
|
339
337
|
(c) => {
|
|
340
|
-
var s, u,
|
|
341
|
-
console.error("[Validation Errors]", c), (u = (s = window.top) == null ? void 0 : s.FLUIGC) != null && u.toast ? (
|
|
338
|
+
var s, u, r;
|
|
339
|
+
console.error("[Validation Errors]", c), (u = (s = window.top) == null ? void 0 : s.FLUIGC) != null && u.toast ? (r = window.top) == null || r.FLUIGC.toast({
|
|
342
340
|
title: "Atenção",
|
|
343
341
|
message: "Verifique os campos obrigatórios destacados em vermelho.",
|
|
344
342
|
type: "danger"
|
|
@@ -348,117 +346,117 @@ function ye(e) {
|
|
|
348
346
|
};
|
|
349
347
|
}, [e]);
|
|
350
348
|
}
|
|
351
|
-
const
|
|
349
|
+
const me = ({
|
|
352
350
|
workflowStructure: e,
|
|
353
|
-
sectionsRegistry:
|
|
354
|
-
className:
|
|
351
|
+
sectionsRegistry: n,
|
|
352
|
+
className: t
|
|
355
353
|
}) => {
|
|
356
|
-
const { control:
|
|
354
|
+
const { control: o, handleSubmit: i, register: a, setValue: c, getValues: s } = Y(), u = R(), r = H(!1);
|
|
357
355
|
I(() => {
|
|
358
|
-
|
|
356
|
+
r.current || (u.activityId != null && c("CURRENTACTIVITYID", u.activityId), u.previousActivityId != null && c("LASTACTIVITYID", u.previousActivityId), r.current = !0);
|
|
359
357
|
}, [u, c]);
|
|
360
|
-
const { sections:
|
|
361
|
-
control:
|
|
358
|
+
const { sections: m, fields: l } = ue({
|
|
359
|
+
control: o,
|
|
362
360
|
activityId: u.activityId,
|
|
363
361
|
previousActivityId: u.previousActivityId,
|
|
364
362
|
workflowStructure: e,
|
|
365
|
-
sectionsRegistry:
|
|
363
|
+
sectionsRegistry: n
|
|
366
364
|
});
|
|
367
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ P(
|
|
368
366
|
"form",
|
|
369
367
|
{
|
|
370
368
|
id: "fluig-react-form",
|
|
371
|
-
className:
|
|
372
|
-
onSubmit: i((
|
|
373
|
-
console.log("✅ [FluigWorkflowForm] Dados válidos:",
|
|
369
|
+
className: t,
|
|
370
|
+
onSubmit: i((d) => {
|
|
371
|
+
console.log("✅ [FluigWorkflowForm] Dados válidos:", d);
|
|
374
372
|
}),
|
|
375
373
|
noValidate: !0,
|
|
376
374
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ P("div", { className: "hidden", style: { display: "none" }, children: [
|
|
378
376
|
/* @__PURE__ */ p("input", { type: "hidden", ...a("CURRENTACTIVITYID") }),
|
|
379
377
|
/* @__PURE__ */ p("input", { type: "hidden", ...a("LASTACTIVITYID") })
|
|
380
378
|
] }),
|
|
381
|
-
|
|
379
|
+
m.length === 0 && u.activityId !== null && /* @__PURE__ */ P("p", { children: [
|
|
382
380
|
"Não foi possível encontrar a atividade: ",
|
|
383
381
|
String(u.activityId)
|
|
384
382
|
] }),
|
|
385
|
-
|
|
383
|
+
m.map(({ name: d, mode: h }) => {
|
|
386
384
|
if (h === "hidden") return null;
|
|
387
|
-
const
|
|
388
|
-
if (!
|
|
389
|
-
const v =
|
|
385
|
+
const f = n[d];
|
|
386
|
+
if (!f) return null;
|
|
387
|
+
const v = f.Component;
|
|
390
388
|
return /* @__PURE__ */ p(
|
|
391
389
|
v,
|
|
392
390
|
{
|
|
393
|
-
id:
|
|
394
|
-
fields:
|
|
391
|
+
id: d,
|
|
392
|
+
fields: l,
|
|
395
393
|
readOnly: h === "readonly"
|
|
396
394
|
},
|
|
397
|
-
|
|
395
|
+
d
|
|
398
396
|
);
|
|
399
397
|
}),
|
|
400
398
|
u.isDev && u.showDebugSubmit && /* @__PURE__ */ p("div", { style: { width: "100%", padding: "16px", paddingTop: "0" }, children: /* @__PURE__ */ p("button", { type: "submit", className: "btn btn-primary btn-lg btn-block", children: "Submit (Debug)" }) })
|
|
401
399
|
]
|
|
402
400
|
}
|
|
403
401
|
);
|
|
404
|
-
},
|
|
405
|
-
const { mergedSchema:
|
|
406
|
-
resolver:
|
|
407
|
-
defaultValues:
|
|
402
|
+
}, Te = (e) => {
|
|
403
|
+
const { mergedSchema: n } = W(), t = R(), o = Q({
|
|
404
|
+
resolver: n ? oe(n) : void 0,
|
|
405
|
+
defaultValues: t.prefilledValues,
|
|
408
406
|
mode: "onBlur"
|
|
409
407
|
});
|
|
410
|
-
return
|
|
411
|
-
|
|
408
|
+
return fe(o), I(() => {
|
|
409
|
+
t.showDebugLogs && (x.header("Form Initialized"), x.table(
|
|
412
410
|
"Prefilled Values (DOM Capture)",
|
|
413
|
-
|
|
414
|
-
), x.info("RHF Current Values",
|
|
415
|
-
}, [
|
|
411
|
+
t.prefilledValues
|
|
412
|
+
), x.info("RHF Current Values", o.getValues()), x.end());
|
|
413
|
+
}, [t.showDebugLogs, t.prefilledValues, o]), /* @__PURE__ */ p(X, { ...o, children: /* @__PURE__ */ p(me, { ...e }) });
|
|
416
414
|
};
|
|
417
|
-
async function
|
|
415
|
+
async function ye(e) {
|
|
418
416
|
if (!e)
|
|
419
417
|
return console.warn("[setFluigNextActivity] Nenhuma atividade informada."), !1;
|
|
420
|
-
const { wfView:
|
|
421
|
-
if (!
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
return i ? (
|
|
418
|
+
const { wfView: n, wkfView: t } = await he();
|
|
419
|
+
if (!n || !t) return !1;
|
|
420
|
+
ve(n);
|
|
421
|
+
const o = Number(e), i = we(n, o);
|
|
422
|
+
return i ? (pe(n, t, i, o), console.log(`[setFluigNextActivity] Próxima atividade definida: ${o}`), !0) : (console.warn(`[setFluigNextActivity] Estado ${o} não encontrado nas próximas atividades disponíveis.`), console.log("Estados disponíveis:", n.availableStatesCOPY || n.availableStates), !1);
|
|
425
423
|
}
|
|
426
|
-
async function
|
|
427
|
-
const e = await k.top.ECM.workflowView,
|
|
428
|
-
return !e || !
|
|
424
|
+
async function he() {
|
|
425
|
+
const e = await k.top.ECM.workflowView, n = await k.top.ECM_WKFView;
|
|
426
|
+
return !e || !n ? (console.warn("[setFluigNextActivity] Contexto Fluig inválido ou não carregado."), {}) : { wfView: e, wkfView: n };
|
|
429
427
|
}
|
|
430
|
-
function
|
|
428
|
+
function ve(e) {
|
|
431
429
|
e.availableStatesCOPY || (e.availableStatesCOPY = e.availableStates);
|
|
432
430
|
}
|
|
433
|
-
function
|
|
434
|
-
const
|
|
435
|
-
return
|
|
431
|
+
function we(e, n) {
|
|
432
|
+
const t = e.availableStatesCOPY || e.availableStates;
|
|
433
|
+
return t == null ? void 0 : t.find((o) => o.sequence === n);
|
|
436
434
|
}
|
|
437
|
-
function
|
|
438
|
-
e.availableUsers.users = [], e.availableStates = [
|
|
435
|
+
function pe(e, n, t, o) {
|
|
436
|
+
e.availableUsers.users = [], e.availableStates = [t], n.selectActivity = () => o;
|
|
439
437
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
442
|
-
const e =
|
|
438
|
+
const G = D(null);
|
|
439
|
+
function xe() {
|
|
440
|
+
const e = N(G);
|
|
443
441
|
if (!e)
|
|
444
442
|
throw new Error(
|
|
445
443
|
"useSection deve ser usado dentro de um componente <Section>"
|
|
446
444
|
);
|
|
447
445
|
return e;
|
|
448
446
|
}
|
|
449
|
-
function
|
|
447
|
+
function De({
|
|
450
448
|
id: e,
|
|
451
|
-
className:
|
|
452
|
-
schema:
|
|
453
|
-
children:
|
|
449
|
+
className: n,
|
|
450
|
+
schema: t,
|
|
451
|
+
children: o,
|
|
454
452
|
form: i,
|
|
455
453
|
prefilledValues: a,
|
|
456
454
|
readOnly: c,
|
|
457
455
|
fields: s = {},
|
|
458
456
|
hidden: u = !1
|
|
459
457
|
}) {
|
|
460
|
-
const { isView:
|
|
461
|
-
if (!
|
|
458
|
+
const { isView: r, activityId: m } = R(), l = m, g = Y(), d = i || g;
|
|
459
|
+
if (!d)
|
|
462
460
|
return console.error(
|
|
463
461
|
`[FluigWorkflowReact] Section "${e}" não encontrou o 'form'.`
|
|
464
462
|
), null;
|
|
@@ -469,60 +467,60 @@ function Pe({
|
|
|
469
467
|
return (S = s.hidden) != null && S.includes(w) ? "hidden" : (E = s.readonly) != null && E.includes(w) ? "readonly" : (T = s.active) != null && T.includes(w) ? "active" : c ? "readonly" : "active";
|
|
470
468
|
},
|
|
471
469
|
[s, c]
|
|
472
|
-
),
|
|
470
|
+
), f = V(
|
|
473
471
|
(w) => h(w) === "hidden",
|
|
474
472
|
[h]
|
|
475
473
|
), v = V(
|
|
476
474
|
(w) => h(w) === "readonly",
|
|
477
475
|
[h]
|
|
478
|
-
),
|
|
476
|
+
), y = V(
|
|
479
477
|
(w) => {
|
|
480
478
|
if (!w) return;
|
|
481
|
-
const S =
|
|
482
|
-
|
|
479
|
+
const S = d.getValues("CURRENTACTIVITYID");
|
|
480
|
+
d.setValue("LASTACTIVITYID", S), d.setValue("CURRENTACTIVITYID", l), ye(Number(w));
|
|
483
481
|
},
|
|
484
|
-
[
|
|
482
|
+
[d, l]
|
|
485
483
|
);
|
|
486
484
|
I(() => {
|
|
487
|
-
if (!
|
|
488
|
-
const w =
|
|
485
|
+
if (!r || !a || !t || !d) return;
|
|
486
|
+
const w = d.getValues(), S = t.shape;
|
|
489
487
|
S && Object.entries(S).forEach(([E, T]) => {
|
|
490
488
|
var L, M;
|
|
491
|
-
let
|
|
492
|
-
for (; (L =
|
|
493
|
-
|
|
494
|
-
const F = (M =
|
|
489
|
+
let A = T;
|
|
490
|
+
for (; (L = A == null ? void 0 : A._def) != null && L.schema; )
|
|
491
|
+
A = A._def.schema;
|
|
492
|
+
const F = (M = A == null ? void 0 : A._def) == null ? void 0 : M.fluig;
|
|
495
493
|
if ((F == null ? void 0 : F.type) !== "options" || !Array.isArray(F.values) || w[E] !== void 0) return;
|
|
496
494
|
const C = {};
|
|
497
495
|
F.values.forEach((q) => {
|
|
498
496
|
C[q] = a[q] === "on";
|
|
499
|
-
}),
|
|
497
|
+
}), d.setValue(E, C, {
|
|
500
498
|
shouldDirty: !1,
|
|
501
499
|
shouldValidate: !1
|
|
502
500
|
});
|
|
503
501
|
});
|
|
504
|
-
}, [
|
|
505
|
-
const
|
|
502
|
+
}, [r, a, t, d]);
|
|
503
|
+
const z = b(
|
|
506
504
|
() => ({
|
|
507
505
|
id: e,
|
|
508
|
-
form:
|
|
509
|
-
isHidden:
|
|
506
|
+
form: d,
|
|
507
|
+
isHidden: f,
|
|
510
508
|
isReadOnly: v,
|
|
511
|
-
isView:
|
|
512
|
-
next:
|
|
513
|
-
wf_activity_id:
|
|
509
|
+
isView: r,
|
|
510
|
+
next: y,
|
|
511
|
+
wf_activity_id: l
|
|
514
512
|
}),
|
|
515
|
-
[e,
|
|
513
|
+
[e, d, f, v, r, y, l]
|
|
516
514
|
);
|
|
517
|
-
return /* @__PURE__ */ p(
|
|
515
|
+
return /* @__PURE__ */ p(G.Provider, { value: z, children: /* @__PURE__ */ p("section", { id: e, className: [e, n].filter(Boolean).join(" "), children: o }) });
|
|
518
516
|
}
|
|
519
|
-
const
|
|
520
|
-
function
|
|
521
|
-
const
|
|
522
|
-
return /* @__PURE__ */ p(
|
|
517
|
+
const $ = D(null);
|
|
518
|
+
function Ne({ children: e, config: n }) {
|
|
519
|
+
const t = b(() => ne(n), [n]);
|
|
520
|
+
return /* @__PURE__ */ p($.Provider, { value: t, children: e });
|
|
523
521
|
}
|
|
524
|
-
function
|
|
525
|
-
const e =
|
|
522
|
+
function Re() {
|
|
523
|
+
const e = N($);
|
|
526
524
|
if (!e)
|
|
527
525
|
throw new Error(
|
|
528
526
|
"useFluigApi deve ser usado dentro de um <FluigApiProvider>"
|
|
@@ -530,16 +528,16 @@ function ke() {
|
|
|
530
528
|
return e;
|
|
531
529
|
}
|
|
532
530
|
export {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
531
|
+
Ce as DebugLogger,
|
|
532
|
+
Ne as FluigApiProvider,
|
|
533
|
+
Fe as FluigRuntimeProvider,
|
|
534
|
+
Te as FluigWorkflowForm,
|
|
535
|
+
Ee as SchemaRegistryProvider,
|
|
536
|
+
De as Section,
|
|
537
|
+
Le as createFluigClient,
|
|
538
|
+
Me as parentProxy,
|
|
539
|
+
Re as useFluigApi,
|
|
540
|
+
R as useFluigRuntime,
|
|
541
|
+
W as useSchemaRegistry,
|
|
542
|
+
xe as useSection
|
|
545
543
|
};
|