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