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