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