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