diefra_ecm_ui 1.0.7 → 1.0.8

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 CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),W=require("react-hook-form"),K=require("react-imask"),E=require("@fluig-kit/ecm"),T=require("date-fns"),M={cpf:"000.000.000-00",cnpj:"00.000.000/0000-00",telefone:"(00) 00000-0000",cep:"00000-000"};function ee({name:e,label:s="",placeholder:n="",type:a="text",mask:r,className:l="",forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:i,errorManual:w}){var N,P;const p=v!==void 0&&!!i,{isReadOnly:_,isHidden:A}=E.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O}=E.useFluigRuntime();let y=null;try{y=W.useFormContext()}catch{}const m=!p&&y?W.useController({name:e,control:y.control}):null,f=!p&&y?W.useFormState({name:e}):null,x=p?v:m==null?void 0:m.field.value,c=p?w:(P=(N=f==null?void 0:f.errors)==null?void 0:N[e])==null?void 0:P.message,h=u.useMemo(()=>r?M[r]??r:null,[r]),b=u.useCallback(j=>{if(!j)return"";const D=j.replace(/\D/g,"");return(Number(D)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),F=u.useCallback(j=>a==="monetary"?b(j):j,[a,b]),$=j=>{const D=F(j);p?i==null||i(D):m==null||m.field.onChange(D)},k=()=>{p||m==null||m.field.onBlur()};if(O)return t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:x||"-"})]});const g=`form-control ${C?"readOnly":""} ${c?"border-red":""} ${l}`;return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[s&&t.jsx("label",{children:s}),h?t.jsx(K.IMaskInput,{name:e,mask:h,value:String(x??""),unmask:!1,onAccept:j=>$(j),placeholder:n,readOnly:C,className:g,inputRef:p||m==null?void 0:m.field.ref,onBlur:k}):t.jsx("input",{type:"text",name:e,value:x??"",onChange:j=>$(j.target.value),onBlur:k,placeholder:n,readOnly:C,className:g}),c&&t.jsx("p",{className:"text-danger",children:String(c)})]})}const te=u.memo(ee);function se({name:e,label:s="",options:n=[],placeholder:a="",labelKey:r="label",valueKey:l="value",enableSearch:d=!1,searchPlaceholder:o="Buscar...",loading:v=!1,onSearchChange:i,debounceTime:w=300,onSelect:p,forceReadOnly:_=!1,forceHidden:A=!1,valueManual:C,onChangeManual:R,errorManual:O}){var Q;const y=C!==void 0&&!!R,{isReadOnly:m,isHidden:f}=E.useSection(),x=_||!!m(e),c=A||!!f(e),{isView:h}=E.useFluigRuntime();let b="",F=()=>{},$,k=null,g=()=>{};if(y)b=C;else try{const S=W.useFormContext(),V=W.useController({name:e,control:S.control});b=V.field.value,F=V.field.onChange,$=V.field.ref,k=(Q=V.fieldState)==null?void 0:Q.error,g=S.clearErrors}catch{}const[N,P]=u.useState(!1),[j,D]=u.useState(""),H=u.useRef(null),q=u.useRef(i);u.useEffect(()=>{q.current=i},[i]),u.useEffect(()=>{const S=V=>{H.current&&!H.current.contains(V.target)&&P(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),u.useEffect(()=>{N||D("")},[N]),u.useEffect(()=>{if(!d)return;const S=setTimeout(()=>{var V;(V=q.current)==null||V.call(q,j)},w);return()=>clearTimeout(S)},[j,d,w]);const X=u.useMemo(()=>d&&!i&&j.trim()?n.filter(S=>String((S==null?void 0:S[r])??"").toLowerCase().includes(j.toLowerCase())):n??[],[n,d,i,j,r]),U=u.useMemo(()=>{if(b==null)return"";if(typeof b=="object")return String(b[l]??"");const S=(n||[]).find(V=>String(V==null?void 0:V[l])===String(b));return String(S?(S==null?void 0:S[r])??"":b)},[b,n,l,r]),Z=S=>{x||(y?R==null||R(S[l]):(F(S[l]),g==null||g(e)),p==null||p(S),P(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${c?"hidden":""}`,ref:H,children:[t.jsx("label",{className:"control-label",children:s}),h?t.jsx("span",{className:"form-control",children:U||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${k?"border-red":""} ${x?"readOnly":""}`,onClick:()=>!x&&P(S=>!S),ref:$,children:[t.jsx("span",{className:`select-display ${x?"readOnly":""}`,children:U||a}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),N&&!x&&t.jsxs("div",{className:"select-dropdown",children:[d&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:j,onChange:S=>D(S.target.value),placeholder:v?"Carregando...":o,autoFocus:!0,onClick:S=>S.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:v?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):X.length>0?X.map(S=>t.jsx("li",{onClick:()=>Z(S),className:"select-option handleHover",children:S[r]},S[l])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),!y&&t.jsx("input",{type:"hidden",name:e,value:b||""}),(k||O)&&t.jsx("p",{className:"text-danger",children:String((k==null?void 0:k.message)??O)})]})}const ne=u.memo(se);function re({name:e,options:s=[],label:n="",valueKey:a="value",labelKey:r="label",forceReadOnly:l=!1,forceHidden:d=!1,valueManual:o,onChangeManual:v}){var $,k;let i=null;try{i=W.useFormContext()}catch{}const w=o!==void 0&&!!v,{isView:p,isReadOnly:_}=E.useFluigRuntime(),{isReadOnly:A,isHidden:C}=E.useSection(),R=A?A(e):!1,O=C?C(e):!1,y=l||R,m=d||O,f=y||_||p,x=()=>s?s.reduce((g,N)=>{const P=String(N[a]);if(w)g[P]=!!(o!=null&&o[P]);else if(i){const j=i.getValues(P);g[P]=j==="on"}else g[P]=!1;return g},{}):{},c=!w&&i?i.watch(e):void 0,h=u.useMemo(()=>w&&o?o:c&&typeof c=="object"?c:x(),[c,o,s]);u.useEffect(()=>{if(w||!i)return;const g=i.getValues(e);(!g||typeof g!="object")&&i.setValue(e,h,{shouldDirty:!1,shouldValidate:!1})},[h,e,i,w]);const b=(g,N)=>{if(f)return;const P={...h,[g]:N};if(w){v&&v(P);return}i&&(i.setValue(e,P,{shouldDirty:!0,shouldValidate:!0}),i.setValue(g,N?"on":"",{shouldValidate:!1}))},F=w?null:(k=($=i==null?void 0:i.formState)==null?void 0:$.errors)==null?void 0:k[e];return t.jsxs("div",{className:`form-group ${m?"hidden":""}`,children:[n&&t.jsx("label",{children:n}),t.jsx("div",{className:`checkbox-group-custom ${f?"readOnly":""}`,children:s.map(g=>{const N=String(g[a]),P=h[N]===!0;return t.jsxs("div",{children:[!w&&i&&t.jsx("input",{type:"hidden",...i.register(N)}),t.jsxs("label",{className:`custom-checkbox ${P?"checked":""} ${f?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:P,disabled:f,onChange:j=>b(N,j.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:g[r]})]})]},N)})}),F&&t.jsx("p",{className:"text-danger",children:String(F.message)})]})}function ae({name:e,label:s="",options:n=[],valueKey:a="value",labelKey:r="label",iconKey:l="icon",forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:i,errorManual:w}){var $;const p=v!==void 0&&!!i,{isReadOnly:_,isHidden:A}=E.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O,isReadOnly:y}=E.useFluigRuntime();let m=null,f=null,x=null;try{x=W.useFormContext()}catch{}const c=!p&&x?W.useController({name:e,control:x.control}):null;!p&&c&&(m=c.field,f=($=c.fieldState)==null?void 0:$.error);const h=C||y||O,b=p?v:(m==null?void 0:m.value)??"",F=u.useCallback(k=>{h||(p?i==null||i(k):m==null||m.onChange(k))},[h,p,i,m]);return t.jsxs("div",{className:`form-group column ${R?"hidden":""}`,children:[s&&t.jsx("label",{className:"control-label",children:s}),t.jsx("div",{className:`btn-group ${h?"view-mode":""}`,"data-field-name":e,children:n.map(k=>{const g=k[a],N=b===g,P=k.color?{"--customColor":k.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${g}`,style:P,className:`btn fs-ellipsis ${N?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${g}`,name:(m==null?void 0:m.name)||e,value:g,checked:N,className:"hidden",onChange:()=>F(g),onBlur:m==null?void 0:m.onBlur,ref:m==null?void 0:m.ref,disabled:h}),k[l]&&t.jsx("i",{className:`${k[l]} icon-sm`})," ",k[r]]},g)})}),(f||w)&&t.jsx("p",{className:"text-danger",children:String((f==null?void 0:f.message)??w)})]})}const ie=u.memo(ae),oe=({name:e,label:s="",placeholder:n="",className:a="",rows:r=4,maxLength:l,forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:i,errorManual:w})=>{var h;const p=v!==void 0&&!!i,{isReadOnly:_,isHidden:A}=E.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O}=E.useFluigRuntime(),y=u.useRef(null);let m={value:v??"",onChange:b=>i==null?void 0:i(b)},f=null;if(!p)try{const{control:b}=W.useFormContext(),F=W.useController({name:e,control:b});m=F.field,f=(h=F.fieldState)==null?void 0:h.error}catch{}const x=()=>{y.current&&(y.current.style.height="auto",y.current.style.height=`${y.current.scrollHeight}px`)};if(u.useEffect(()=>{x()},[m.value]),O)return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:m.value||"-"})]});const c=`form-control ${C?"readOnly":""} ${f||w?"border-red":""} ${a}`;return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[s&&t.jsx("label",{children:s}),t.jsx("textarea",{ref:y,rows:r,maxLength:l,value:m.value||"",placeholder:n,readOnly:C,className:c,style:{resize:"none",maxHeight:"400px",overflowY:"auto"},onChange:b=>{p?i==null||i(b.target.value):m.onChange(b)},onInput:x}),(f||w)&&t.jsx("p",{className:"text-danger",children:String((f==null?void 0:f.message)??w)})]})},ce=u.memo(oe);function B(e){return(s={})=>{const n=s.width?String(s.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function I(e){return(s,n)=>{const a=n!=null&&n.context?String(n.context):"standalone";let r;if(a==="formatting"&&e.formattingValues){const d=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):d;r=e.formattingValues[o]||e.formattingValues[d]}else{const d=e.defaultWidth,o=n!=null&&n.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[d]}const l=e.argumentCallback?e.argumentCallback(s):s;return r[l]}}function L(e){return(s,n={})=>{const a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],l=s.match(r);if(!l)return null;const d=l[0],o=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],v=Array.isArray(o)?de(o,p=>p.test(d)):le(o,p=>p.test(d));let i;i=e.valueCallback?e.valueCallback(v):v,i=n.valueCallback?n.valueCallback(i):i;const w=s.slice(d.length);return{value:i,rest:w}}}function le(e,s){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&s(e[n]))return n}function de(e,s){for(let n=0;n<e.length;n++)if(s(e[n]))return n}function ue(e){return(s,n={})=>{const a=s.match(e.matchPattern);if(!a)return null;const r=a[0],l=s.match(e.parsePattern);if(!l)return null;let d=e.valueCallback?e.valueCallback(l[0]):l[0];d=n.valueCallback?n.valueCallback(d):d;const o=s.slice(r.length);return{value:d,rest:o}}}const me={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},fe=(e,s,n)=>{let a;const r=me[e];return typeof r=="string"?a=r:s===1?a=r.one:a=r.other.replace("{{count}}",String(s)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+a:"há "+a:a},he={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},xe={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ye={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},pe={date:B({formats:he,defaultWidth:"full"}),time:B({formats:xe,defaultWidth:"full"}),dateTime:B({formats:ye,defaultWidth:"full"})},ge={lastWeek:e=>{const s=e.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},ve=(e,s,n,a)=>{const r=ge[e];return typeof r=="function"?r(s):r},be={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},je={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},we={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},ke={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},Ne={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},Se={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},Re=(e,s)=>{const n=Number(e);return(s==null?void 0:s.unit)==="week"?n+"ª":n+"º"},Pe={ordinalNumber:Re,era:I({values:be,defaultWidth:"wide"}),quarter:I({values:je,defaultWidth:"wide",argumentCallback:e=>e-1}),month:I({values:we,defaultWidth:"wide"}),day:I({values:ke,defaultWidth:"wide"}),dayPeriod:I({values:Ne,defaultWidth:"wide",formattingValues:Se,defaultFormattingWidth:"wide"})},Ce=/^(\d+)[ºªo]?/i,$e=/\d+/i,Oe={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},_e={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},Ae={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Fe={any:[/1/i,/2/i,/3/i,/4/i]},We={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Ee={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},Te={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},Ve={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},De={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},He={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},qe={ordinalNumber:ue({matchPattern:Ce,parsePattern:$e,valueCallback:e=>parseInt(e,10)}),era:L({matchPatterns:Oe,defaultMatchWidth:"wide",parsePatterns:_e,defaultParseWidth:"any"}),quarter:L({matchPatterns:Ae,defaultMatchWidth:"wide",parsePatterns:Fe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:L({matchPatterns:We,defaultMatchWidth:"wide",parsePatterns:Ee,defaultParseWidth:"any"}),day:L({matchPatterns:Te,defaultMatchWidth:"wide",parsePatterns:Ve,defaultParseWidth:"any"}),dayPeriod:L({matchPatterns:De,defaultMatchWidth:"any",parsePatterns:He,defaultParseWidth:"any"})},Ie={code:"pt-BR",formatDistance:fe,formatLong:pe,formatRelative:ve,localize:Pe,match:qe,options:{weekStartsOn:0,firstWeekContainsDate:1}};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),E=require("react-hook-form"),K=require("react-imask"),V=require("@fluig-kit/ecm"),W=require("date-fns"),M={cpf:"000.000.000-00",cnpj:"00.000.000/0000-00",telefone:"(00) 00000-0000",cep:"00000-000"};function ee({name:e,label:s="",placeholder:n="",type:i="text",mask:r,className:l="",forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:a,errorManual:w}){var N,P;const y=v!==void 0&&!!a,{isReadOnly:_,isHidden:A}=V.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O}=V.useFluigRuntime();let p=null;try{p=E.useFormContext()}catch{}const m=!y&&p?E.useController({name:e,control:p.control}):null,f=!y&&p?E.useFormState({name:e}):null,h=y?v:m==null?void 0:m.field.value,c=y?w:(P=(N=f==null?void 0:f.errors)==null?void 0:N[e])==null?void 0:P.message,x=u.useMemo(()=>r?M[r]??r:null,[r]),b=u.useCallback(j=>{if(!j)return"";const D=j.replace(/\D/g,"");return(Number(D)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),F=u.useCallback(j=>i==="monetary"?b(j):j,[i,b]),$=j=>{const D=F(j);y?a==null||a(D):m==null||m.field.onChange(D)},k=()=>{y||m==null||m.field.onBlur()};if(O)return t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:h||"-"})]});const g=`form-control ${C?"readOnly":""} ${c?"border-red":""} ${l}`;return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[s&&t.jsx("label",{children:s}),x?t.jsx(K.IMaskInput,{name:e,mask:x,value:String(h??""),unmask:!1,onAccept:j=>$(j),placeholder:n,readOnly:C,className:g,inputRef:y||m==null?void 0:m.field.ref,onBlur:k}):t.jsx("input",{type:"text",name:e,value:h??"",onChange:j=>$(j.target.value),onBlur:k,placeholder:n,readOnly:C,className:g}),c&&t.jsx("p",{className:"text-danger",children:String(c)})]})}const te=u.memo(ee);function se({name:e,label:s="",options:n=[],placeholder:i="",labelKey:r="label",valueKey:l="value",enableSearch:d=!1,searchPlaceholder:o="Buscar...",loading:v=!1,onSearchChange:a,debounceTime:w=300,onSelect:y,forceReadOnly:_=!1,forceHidden:A=!1,valueManual:C,onChangeManual:R,errorManual:O}){var Q;const p=C!==void 0&&!!R,{isReadOnly:m,isHidden:f}=V.useSection(),h=_||!!m(e),c=A||!!f(e),{isView:x}=V.useFluigRuntime();let b="",F=()=>{},$,k=null,g=()=>{};if(p)b=C;else try{const S=E.useFormContext(),T=E.useController({name:e,control:S.control});b=T.field.value,F=T.field.onChange,$=T.field.ref,k=(Q=T.fieldState)==null?void 0:Q.error,g=S.clearErrors}catch{}const[N,P]=u.useState(!1),[j,D]=u.useState(""),H=u.useRef(null),q=u.useRef(a);u.useEffect(()=>{q.current=a},[a]),u.useEffect(()=>{const S=T=>{H.current&&!H.current.contains(T.target)&&P(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),u.useEffect(()=>{N||D("")},[N]),u.useEffect(()=>{if(!d)return;const S=setTimeout(()=>{var T;(T=q.current)==null||T.call(q,j)},w);return()=>clearTimeout(S)},[j,d,w]);const X=u.useMemo(()=>d&&!a&&j.trim()?n.filter(S=>String((S==null?void 0:S[r])??"").toLowerCase().includes(j.toLowerCase())):n??[],[n,d,a,j,r]),U=u.useMemo(()=>{if(b==null)return"";if(typeof b=="object")return String(b[l]??"");const S=(n||[]).find(T=>String(T==null?void 0:T[l])===String(b));return String(S?(S==null?void 0:S[r])??"":b)},[b,n,l,r]),Z=S=>{h||(p?R==null||R(S[l]):(F(S[l]),g==null||g(e)),y==null||y(S),P(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${c?"hidden":""}`,ref:H,children:[t.jsx("label",{className:"control-label",children:s}),x?t.jsx("span",{className:"form-control",children:U||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${k?"border-red":""} ${h?"readOnly":""}`,onClick:()=>!h&&P(S=>!S),ref:$,children:[t.jsx("span",{className:`select-display ${h?"readOnly":""}`,children:U||i}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),N&&!h&&t.jsxs("div",{className:"select-dropdown",children:[d&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:j,onChange:S=>D(S.target.value),placeholder:v?"Carregando...":o,autoFocus:!0,onClick:S=>S.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:v?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):X.length>0?X.map(S=>t.jsx("li",{onClick:()=>Z(S),className:"select-option handleHover",children:S[r]},S[l])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),!p&&t.jsx("input",{type:"hidden",name:e,value:b||""}),(k||O)&&t.jsx("p",{className:"text-danger",children:String((k==null?void 0:k.message)??O)})]})}const ne=u.memo(se);function re({name:e,options:s=[],label:n="",valueKey:i="value",labelKey:r="label",forceReadOnly:l=!1,forceHidden:d=!1,valueManual:o,onChangeManual:v}){var $,k;let a=null;try{a=E.useFormContext()}catch{}const w=o!==void 0&&!!v,{isView:y,isReadOnly:_}=V.useFluigRuntime(),{isReadOnly:A,isHidden:C}=V.useSection(),R=A?A(e):!1,O=C?C(e):!1,p=l||R,m=d||O,f=p||_||y,h=()=>s?s.reduce((g,N)=>{const P=String(N[i]);if(w)g[P]=!!(o!=null&&o[P]);else if(a){const j=a.getValues(P);g[P]=j==="on"}else g[P]=!1;return g},{}):{},c=!w&&a?a.watch(e):void 0,x=u.useMemo(()=>w&&o?o:c&&typeof c=="object"?c:h(),[c,o,s]);u.useEffect(()=>{if(w||!a)return;const g=a.getValues(e);(!g||typeof g!="object")&&a.setValue(e,x,{shouldDirty:!1,shouldValidate:!1})},[x,e,a,w]);const b=(g,N)=>{if(f)return;const P={...x,[g]:N};if(w){v&&v(P);return}a&&(a.setValue(e,P,{shouldDirty:!0,shouldValidate:!0}),a.setValue(g,N?"on":"",{shouldValidate:!1}))},F=w?null:(k=($=a==null?void 0:a.formState)==null?void 0:$.errors)==null?void 0:k[e];return t.jsxs("div",{className:`form-group ${m?"hidden":""}`,children:[n&&t.jsx("label",{children:n}),t.jsx("div",{className:`checkbox-group-custom ${f?"readOnly":""}`,children:s.map(g=>{const N=String(g[i]),P=x[N]===!0;return t.jsxs("div",{children:[!w&&a&&t.jsx("input",{type:"hidden",...a.register(N)}),t.jsxs("label",{className:`custom-checkbox ${P?"checked":""} ${f?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:P,disabled:f,onChange:j=>b(N,j.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:g[r]})]})]},N)})}),F&&t.jsx("p",{className:"text-danger",children:String(F.message)})]})}function ie({name:e,label:s="",options:n=[],valueKey:i="value",labelKey:r="label",iconKey:l="icon",forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:a,errorManual:w}){var $;const y=v!==void 0&&!!a,{isReadOnly:_,isHidden:A}=V.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O,isReadOnly:p}=V.useFluigRuntime();let m=null,f=null,h=null;try{h=E.useFormContext()}catch{}const c=!y&&h?E.useController({name:e,control:h.control}):null;!y&&c&&(m=c.field,f=($=c.fieldState)==null?void 0:$.error);const x=C||p||O,b=y?v:(m==null?void 0:m.value)??"",F=u.useCallback(k=>{x||(y?a==null||a(k):m==null||m.onChange(k))},[x,y,a,m]);return u.useEffect(()=>{if(y||!h)return;h.getValues(e)===void 0&&h.setValue(e,"",{shouldDirty:!1,shouldValidate:!1})},[e,h,y]),t.jsxs("div",{className:`form-group column ${R?"hidden":""}`,children:[s&&t.jsx("label",{className:"control-label",children:s}),t.jsx("div",{className:`btn-group ${x?"view-mode":""}`,"data-field-name":e,children:n.map(k=>{const g=k[i],N=b===g,P=k.color?{"--customColor":k.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${g}`,style:P,className:`btn fs-ellipsis ${N?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${g}`,name:(m==null?void 0:m.name)||e,value:g,checked:N,className:"hidden",onChange:()=>F(g),onBlur:m==null?void 0:m.onBlur,ref:m==null?void 0:m.ref,disabled:x}),k[l]&&t.jsx("i",{className:`${k[l]} icon-sm`})," ",k[r]]},g)})}),(f||w)&&t.jsx("p",{className:"text-danger",children:String((f==null?void 0:f.message)??w)})]})}const ae=u.memo(ie),oe=({name:e,label:s="",placeholder:n="",className:i="",rows:r=4,maxLength:l,forceReadOnly:d=!1,forceHidden:o=!1,valueManual:v,onChangeManual:a,errorManual:w})=>{var x;const y=v!==void 0&&!!a,{isReadOnly:_,isHidden:A}=V.useSection(),C=d||!!_(e),R=o||!!A(e),{isView:O}=V.useFluigRuntime(),p=u.useRef(null);let m={value:v??"",onChange:b=>a==null?void 0:a(b)},f=null;if(!y)try{const{control:b}=E.useFormContext(),F=E.useController({name:e,control:b});m=F.field,f=(x=F.fieldState)==null?void 0:x.error}catch{}const h=()=>{p.current&&(p.current.style.height="auto",p.current.style.height=`${p.current.scrollHeight}px`)};if(u.useEffect(()=>{h()},[m.value]),O)return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:m.value||"-"})]});const c=`form-control ${C?"readOnly":""} ${f||w?"border-red":""} ${i}`;return t.jsxs("div",{className:`form-group ${R?"hidden":""}`,children:[s&&t.jsx("label",{children:s}),t.jsx("textarea",{ref:p,rows:r,maxLength:l,value:m.value||"",placeholder:n,readOnly:C,className:c,style:{resize:"none",maxHeight:"400px",overflowY:"auto"},onChange:b=>{y?a==null||a(b.target.value):m.onChange(b)},onInput:h}),(f||w)&&t.jsx("p",{className:"text-danger",children:String((f==null?void 0:f.message)??w)})]})},ce=u.memo(oe);function B(e){return(s={})=>{const n=s.width?String(s.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function I(e){return(s,n)=>{const i=n!=null&&n.context?String(n.context):"standalone";let r;if(i==="formatting"&&e.formattingValues){const d=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):d;r=e.formattingValues[o]||e.formattingValues[d]}else{const d=e.defaultWidth,o=n!=null&&n.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[d]}const l=e.argumentCallback?e.argumentCallback(s):s;return r[l]}}function L(e){return(s,n={})=>{const i=n.width,r=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],l=s.match(r);if(!l)return null;const d=l[0],o=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],v=Array.isArray(o)?de(o,y=>y.test(d)):le(o,y=>y.test(d));let a;a=e.valueCallback?e.valueCallback(v):v,a=n.valueCallback?n.valueCallback(a):a;const w=s.slice(d.length);return{value:a,rest:w}}}function le(e,s){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&s(e[n]))return n}function de(e,s){for(let n=0;n<e.length;n++)if(s(e[n]))return n}function ue(e){return(s,n={})=>{const i=s.match(e.matchPattern);if(!i)return null;const r=i[0],l=s.match(e.parsePattern);if(!l)return null;let d=e.valueCallback?e.valueCallback(l[0]):l[0];d=n.valueCallback?n.valueCallback(d):d;const o=s.slice(r.length);return{value:d,rest:o}}}const me={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},fe=(e,s,n)=>{let i;const r=me[e];return typeof r=="string"?i=r:s===1?i=r.one:i=r.other.replace("{{count}}",String(s)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+i:"há "+i:i},he={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},xe={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ye={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},pe={date:B({formats:he,defaultWidth:"full"}),time:B({formats:xe,defaultWidth:"full"}),dateTime:B({formats:ye,defaultWidth:"full"})},ge={lastWeek:e=>{const s=e.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},ve=(e,s,n,i)=>{const r=ge[e];return typeof r=="function"?r(s):r},be={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},je={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},we={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},ke={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},Ne={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},Se={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},Re=(e,s)=>{const n=Number(e);return(s==null?void 0:s.unit)==="week"?n+"ª":n+"º"},Pe={ordinalNumber:Re,era:I({values:be,defaultWidth:"wide"}),quarter:I({values:je,defaultWidth:"wide",argumentCallback:e=>e-1}),month:I({values:we,defaultWidth:"wide"}),day:I({values:ke,defaultWidth:"wide"}),dayPeriod:I({values:Ne,defaultWidth:"wide",formattingValues:Se,defaultFormattingWidth:"wide"})},Ce=/^(\d+)[ºªo]?/i,$e=/\d+/i,Oe={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},_e={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},Ae={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Fe={any:[/1/i,/2/i,/3/i,/4/i]},Ee={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Ve={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},We={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},Te={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},De={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},He={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},qe={ordinalNumber:ue({matchPattern:Ce,parsePattern:$e,valueCallback:e=>parseInt(e,10)}),era:L({matchPatterns:Oe,defaultMatchWidth:"wide",parsePatterns:_e,defaultParseWidth:"any"}),quarter:L({matchPatterns:Ae,defaultMatchWidth:"wide",parsePatterns:Fe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:L({matchPatterns:Ee,defaultMatchWidth:"wide",parsePatterns:Ve,defaultParseWidth:"any"}),day:L({matchPatterns:We,defaultMatchWidth:"wide",parsePatterns:Te,defaultParseWidth:"any"}),dayPeriod:L({matchPatterns:De,defaultMatchWidth:"any",parsePatterns:He,defaultParseWidth:"any"})},Ie={code:"pt-BR",formatDistance:fe,formatLong:pe,formatRelative:ve,localize:Pe,match:qe,options:{weekStartsOn:0,firstWeekContainsDate:1}};/**
2
2
  * @license lucide-react v0.575.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const G=(...e)=>e.filter((s,n,a)=>!!s&&s.trim()!==""&&a.indexOf(s)===n).join(" ").trim();/**
6
+ */const G=(...e)=>e.filter((s,n,i)=>!!s&&s.trim()!==""&&i.indexOf(s)===n).join(" ").trim();/**
7
7
  * @license lucide-react v0.575.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const Be=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
16
+ */const Be=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,n,i)=>i?i.toUpperCase():n.toLowerCase());/**
17
17
  * @license lucide-react v0.575.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
@@ -33,12 +33,12 @@
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const Ue=u.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:l,iconNode:d,...o},v)=>u.createElement("svg",{ref:v,...ze,width:s,height:s,stroke:e,strokeWidth:a?Number(n)*24/Number(s):n,className:G("lucide",r),...!l&&!Xe(o)&&{"aria-hidden":"true"},...o},[...d.map(([i,w])=>u.createElement(i,w)),...Array.isArray(l)?l:[l]]));/**
36
+ */const Ue=u.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:l,iconNode:d,...o},v)=>u.createElement("svg",{ref:v,...ze,width:s,height:s,stroke:e,strokeWidth:i?Number(n)*24/Number(s):n,className:G("lucide",r),...!l&&!Xe(o)&&{"aria-hidden":"true"},...o},[...d.map(([a,w])=>u.createElement(a,w)),...Array.isArray(l)?l:[l]]));/**
37
37
  * @license lucide-react v0.575.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const z=(e,s)=>{const n=u.forwardRef(({className:a,...r},l)=>u.createElement(Ue,{ref:l,iconNode:s,className:G(`lucide-${Le(Y(e))}`,`lucide-${e}`,a),...r}));return n.displayName=Y(e),n};/**
41
+ */const z=(e,s)=>{const n=u.forwardRef(({className:i,...r},l)=>u.createElement(Ue,{ref:l,iconNode:s,className:G(`lucide-${Le(Y(e))}`,`lucide-${e}`,i),...r}));return n.displayName=Y(e),n};/**
42
42
  * @license lucide-react v0.575.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
@@ -53,7 +53,7 @@
53
53
  *
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
- */const Ze=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ke=z("chevron-right",Ze);function Me(e){const s=u.useRef(null);return u.useEffect(()=>{function n(a){s.current&&!s.current.contains(a.target)&&e()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e]),s}const J="dd/MM/yyyy",et=e=>{if(!e)return null;const s=T.parse(e,J,new Date);return T.isValid(s)?s:null},tt=e=>e?T.format(e,J):"",st=({name:e,label:s="",placeholder:n="dd/mm/aaaa",className:a="",forceReadOnly:r=!1,forceHidden:l=!1,valueManual:d,onChangeManual:o,errorManual:v})=>{var g;const[i,w]=u.useState(!1),[p,_]=u.useState(new Date),A=Me(()=>w(!1)),C=d!==void 0&&!!o;let R=null;try{R=W.useFormContext()}catch{}const{isView:O}=E.useFluigRuntime(),{isReadOnly:y,isHidden:m}=E.useSection(),f=r||!!y(e),x=l||!!m(e),c=!C&&R?W.useController({name:e,control:R.control}):null,h=C?d:c==null?void 0:c.field.value,b=C?v:(g=c==null?void 0:c.fieldState.error)==null?void 0:g.message,F=u.useMemo(()=>et(h),[h]),$=N=>{if(f)return;const P=tt(N);C?o==null||o(P):c==null||c.field.onChange(P),w(!1)},k=N=>{const P=T.eachDayOfInterval({start:T.startOfWeek(T.startOfMonth(N)),end:T.endOfWeek(T.endOfMonth(N))});return t.jsxs("div",{className:"dfe-calendar-pane",children:[t.jsxs("div",{className:"dfe-calendar-header",children:[t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),_(T.subMonths(p,1))},className:"dfe-nav-btn",children:t.jsx(Je,{size:16})}),t.jsx("span",{className:"dfe-month-label",children:T.format(N,"MMMM yyyy",{locale:Ie})}),t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),_(T.addMonths(p,1))},className:"dfe-nav-btn",children:t.jsx(Ke,{size:16})})]}),t.jsx("div",{className:"dfe-calendar-grid-header",children:["D","S","T","Q","Q","S","S"].map((j,D)=>t.jsx("span",{children:j},D))}),t.jsx("div",{className:"dfe-calendar-grid",children:P.map((j,D)=>{const H=!T.isSameMonth(j,N),q=F&&T.isSameDay(j,F);return t.jsx("div",{onClick:()=>!H&&$(j),className:`dfe-calendar-day
56
+ */const Ze=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ke=z("chevron-right",Ze);function Me(e){const s=u.useRef(null);return u.useEffect(()=>{function n(i){s.current&&!s.current.contains(i.target)&&e()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e]),s}const J="dd/MM/yyyy",et=e=>{if(!e)return null;const s=W.parse(e,J,new Date);return W.isValid(s)?s:null},tt=e=>e?W.format(e,J):"",st=({name:e,label:s="",placeholder:n="dd/mm/aaaa",className:i="",forceReadOnly:r=!1,forceHidden:l=!1,valueManual:d,onChangeManual:o,errorManual:v})=>{var g;const[a,w]=u.useState(!1),[y,_]=u.useState(new Date),A=Me(()=>w(!1)),C=d!==void 0&&!!o;let R=null;try{R=E.useFormContext()}catch{}const{isView:O}=V.useFluigRuntime(),{isReadOnly:p,isHidden:m}=V.useSection(),f=r||!!p(e),h=l||!!m(e),c=!C&&R?E.useController({name:e,control:R.control}):null,x=C?d:c==null?void 0:c.field.value,b=C?v:(g=c==null?void 0:c.fieldState.error)==null?void 0:g.message,F=u.useMemo(()=>et(x),[x]),$=N=>{if(f)return;const P=tt(N);C?o==null||o(P):c==null||c.field.onChange(P),w(!1)},k=N=>{const P=W.eachDayOfInterval({start:W.startOfWeek(W.startOfMonth(N)),end:W.endOfWeek(W.endOfMonth(N))});return t.jsxs("div",{className:"dfe-calendar-pane",children:[t.jsxs("div",{className:"dfe-calendar-header",children:[t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),_(W.subMonths(y,1))},className:"dfe-nav-btn",children:t.jsx(Je,{size:16})}),t.jsx("span",{className:"dfe-month-label",children:W.format(N,"MMMM yyyy",{locale:Ie})}),t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),_(W.addMonths(y,1))},className:"dfe-nav-btn",children:t.jsx(Ke,{size:16})})]}),t.jsx("div",{className:"dfe-calendar-grid-header",children:["D","S","T","Q","Q","S","S"].map((j,D)=>t.jsx("span",{children:j},D))}),t.jsx("div",{className:"dfe-calendar-grid",children:P.map((j,D)=>{const H=!W.isSameMonth(j,N),q=F&&W.isSameDay(j,F);return t.jsx("div",{onClick:()=>!H&&$(j),className:`dfe-calendar-day
57
57
  ${q?"selected":""}
58
58
  ${H?"outside":""}
59
- ${T.isToday(j)?"today":""}`,children:T.format(j,"d")},D)})})]})};return x?null:O?t.jsxs("div",{className:`form-group ${a}`,children:[s&&t.jsx("label",{children:s}),t.jsx("span",{className:"form-control readOnly",style:{display:"block",height:"auto"},children:h||"-"})]}):t.jsxs("div",{ref:A,className:`form-group dfe-datepicker-container ${a}`,style:{position:"relative"},children:[s&&t.jsx("label",{children:s}),t.jsxs("div",{className:`form-control dfe-datepicker-trigger ${b?"border-red":""} ${f?"disabled":""}`,onClick:()=>!f&&w(!i),style:{display:"flex",alignItems:"center",cursor:f?"default":"pointer"},children:[t.jsx(Ye,{size:16,className:"dfe-calendar-icon",style:{marginRight:"8px",opacity:.5}}),t.jsx("span",{children:h||n})]}),i&&!f&&t.jsx("div",{className:"dfe-popover-content",children:t.jsx("div",{className:"dfe-calendars-wrapper",children:k(p)})}),b&&t.jsx("p",{className:"text-danger",children:String(b)})]})},nt=u.memo(st);function rt({mapping:e={},defaultLabel:s="Não reconhecido",className:n="",hidden:a=!1,label:r}){const{activityId:l}=E.useFluigRuntime(),d=u.useMemo(()=>!e||l===null||l===void 0?null:e[l],[l,e]);if(!d)return t.jsxs("div",{className:`form-group ${a?"hidden":""}`,children:[r&&t.jsx("label",{children:r}),t.jsx("div",{className:`status-badge default ${n}`,children:s})]});const o={"--customColor":d.color};return t.jsxs("div",{className:`form-group ${a?"hidden":""}`,children:[r&&t.jsx("label",{children:r}),t.jsxs("div",{className:`status-badge ${n}`,style:o,children:[d.icon&&t.jsx("i",{className:d.icon}),t.jsx("span",{children:d.label})]})]})}const at=u.memo(rt);function it({name:e,control:s,defaultRowValue:n,isView:a,isReadOnly:r,filters:l=[]}){const{field:d}=W.useController({name:e,control:s}),[o,v]=u.useState([]),[i,w]=u.useState([]),p=()=>Date.now()+Math.random(),_=x=>{try{const c=JSON.parse(x);return Array.isArray(c)?c.map(h=>({...h,_uid:h._uid||p()})):[]}catch(c){return console.error(`Erro ao ler dados da tabela "${e}":`,c),[]}};u.useEffect(()=>{if(!(o.length>0&&!a)&&d.value&&typeof d.value=="string"){const x=JSON.stringify(o);if(d.value===x)return;const c=_(d.value);v(c)}},[d.value,a]),u.useEffect(()=>{if(r)return;const x=JSON.stringify(o);d.value!==x&&d.onChange(x)},[o,d,r]);const A=u.useCallback(()=>{const x={_uid:p(),...n};v(c=>[...c,x])},[n]),C=u.useCallback(()=>{v(x=>x.filter(c=>!i.includes(c._uid))),w([])},[i]),R=u.useCallback((x,c,h)=>{v(b=>b.map(F=>F._uid===x?{...F,[c]:h}:F))},[]),O=u.useCallback(x=>{w(c=>c.includes(x)?c.filter(h=>h!==x):[...c,x])},[]),y=u.useCallback(x=>{w(x?o.map(c=>c._uid):[])},[o]),m=o.length>0&&i.length===o.length,f=u.useMemo(()=>!l||l.length===0?o:o.filter(x=>l.every(c=>{if("custom"in c)return c.custom(x);const h=x[c.field];switch(c.operator){case"===":return h===c.value;case"!==":return h!==c.value;case">":return h>c.value;case"<":return h<c.value;case">=":return h>=c.value;case"<=":return h<=c.value;default:return!0}})),[o,l]);return{field:d,tableRows:o,visibleRows:f,selectedRowIds:i,isAllSelected:m,handle:{addRow:A,removeRows:C,updateCellValue:R,toggleSelection:O,toggleSelectAll:y}}}const ot=({name:e,title:s="Tabela Dinâmica",columns:n,defaultRowValue:a={},forceReadOnly:r=!1,layout:l="fluid",actions:d=!0,filters:o=[]})=>{const{control:v}=W.useFormContext(),{isView:i,isReadOnly:w}=E.useFluigRuntime(),{isReadOnly:p}=E.useSection(),_=r||i||w||p&&p(e),{field:A,visibleRows:C,selectedRowIds:R,isAllSelected:O,handle:y}=it({name:e,control:v,defaultRowValue:a,isView:i,isReadOnly:!!_,filters:o}),m=l==="fixed";return t.jsxs("div",{className:`table-wrapper ${m?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...A}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:s}),!_&&d&&t.jsxs("div",{className:"handle-actions",children:[t.jsxs("button",{type:"button",className:`btn ${R.length>0?"btn-danger":"btn-primary"}`,disabled:R.length===0,onClick:y.removeRows,children:["Remover (",R.length,")"]}),t.jsx("button",{type:"button",className:"btn-add",onClick:y.addRow,children:"Adicionar"})]})]}),t.jsx("div",{className:"table-scroll",children:t.jsxs("table",{className:"table-custom",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[!_&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:O,onChange:f=>y.toggleSelectAll(f.target.checked)})}),n.map(f=>t.jsx("th",{style:f.width?{minWidth:m?f.width:"100%"}:{width:"max-content"},children:f.label},String(f.key)))]})}),t.jsxs("tbody",{children:[C.map((f,x)=>t.jsxs("tr",{children:[!_&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:R.includes(f._uid),onChange:()=>y.toggleSelection(f._uid)})}),n.map(c=>t.jsx("td",{children:c.render?c.render.length<=1?c.render({row:f,index:x,updateRow:(h,b)=>y.updateCellValue(f._uid,String(h),b),isLocked:!!_,isView:!!i}):c.render(f,x,(h,b)=>y.updateCellValue(f._uid,h,b),!!_,!!i):f[c.key]},`${f._uid}-${String(c.key)}`))]},f._uid)),C.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:_?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ct=(e,s)=>{const[n,a]=u.useState(null);let r=null;try{r=W.useFormContext().watch}catch{}const l=s!==void 0?s:r?r(e):void 0,d=u.useCallback(()=>{try{const v=window.top.__REACT_ATTACHMENT_BRIDGE__;if(v){const i=v.getAttachment(e,l);a(i||(l?{name:l,documentId:0}:null))}else a(l?{name:l,documentId:0}:null)}catch{a(l?{name:l,documentId:0}:null)}},[e,l,s]);return u.useEffect(()=>{d();const o=setInterval(d,2e3);return()=>clearInterval(o)},[d]),{attachment:n,sync:d}},lt=({name:e,label:s,help:n,valueManual:a,onChangeManual:r,forceReadOnly:l=!1,forceHidden:d=!1})=>{const o=!!r,{isReadOnly:v,isHidden:i}=E.useSection(),{isView:w}=E.useFluigRuntime(),p=l||w||!!v(e),_=d||!!i(e),[A,C]=u.useState(!1);let R=null;try{R=W.useFormContext().control}catch{}const O=R&&!o?W.useController({name:e,control:R}).field:{value:a,onChange:$=>r==null?void 0:r($)},{attachment:y,sync:m}=ct(e,a),f=()=>{var $;try{const k=window.top;return{bridge:k.__REACT_ATTACHMENT_BRIDGE__,toast:($=k.FLUIGC)==null?void 0:$.toast}}catch{return{bridge:null,toast:null}}},x=u.useCallback(()=>{if(p)return;const $=document.createElement("input");$.type="file",$.onchange=k=>{const g=k.target.files[0];if(!g)return;const{bridge:N,toast:P}=f();C(!0),N?N.upload(g,e,j=>{o?r==null||r(j.name):O.onChange(j.name),setTimeout(()=>{C(!1),m()},1e3),P&&P({title:"Sucesso",message:"Arquivo enviado",type:"success"})}):(o?r==null||r(g.name):O.onChange(g.name),C(!1))},$.click()},[e,O,m,r,p,o]),c=$=>{if($.stopPropagation(),p)return;const k=(y==null?void 0:y.name)||a||O.value;if(!k)return;const{bridge:g,toast:N}=f();g?g.removeByFileName(k)?(o?r==null||r(""):O.onChange(""),m()):N&&N({title:"Erro",message:"Erro ao remover anexo",type:"danger"}):(o?r==null||r(""):O.onChange(""),m())},h=!!y&&!A,b=(y==null?void 0:y.name)||a||O.value,F=["fluig-attachment__box",h?"fluig-attachment__box--has-file":"",A?"fluig-attachment__box--uploading":"",p&&!h?"readOnly":"",p&&h?"fluig-attachment__box--readonly-view":""].join(" ");return _?null:t.jsxs("div",{className:"form-group fluig-attachment",children:[s&&t.jsx("label",{className:"fluig-attachment__label",children:s}),t.jsxs("div",{className:F,onClick:()=>{if(h){const $=f(),k=(y==null?void 0:y.physicalFileName)||(y==null?void 0:y.description)||(y==null?void 0:y.name)||b;$.bridge&&k&&$.bridge.view(k)}else x()},children:[t.jsxs("span",{className:"fluig-attachment__content",children:[t.jsx("i",{className:`flaticon icon-sm ${A?"flaticon-loading":h?"flaticon-file":"flaticon-paperclip"} fluig-attachment__icon`}),t.jsx("span",{className:"fluig-attachment__filename",children:A?" Enviando...":h?b:p?"Nenhum arquivo":n||"Anexar"})]}),h&&!p&&t.jsx("button",{type:"button",className:"fluig-attachment__btn-remove btn btn-link text-danger",onClick:c,children:t.jsx("i",{className:"flaticon flaticon-trash icon-sm"})})]}),!o&&R&&t.jsx("input",{type:"hidden",name:e,value:O.value||""})]})},dt=u.memo(lt);function ut({title:e,isOpen:s,onOpen:n,onClose:a,content:r,footer:l,width:d}){const o=u.useCallback(v=>{v.key==="Escape"&&a()},[a]);return u.useEffect(()=>(s&&(document.addEventListener("keydown",o),n==null||n(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",o),document.body.style.overflow="auto"}),[s,o,n]),s?t.jsx("div",{className:"modal-overlay",onClick:a,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:d},className:"modal-container",onClick:v=>v.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:a,role:"button","aria-label":"Fechar modal",children:t.jsx("i",{className:"flaticon flaticon-close icon-md","aria-hidden":"true"})})]}),t.jsx("div",{className:"modal-content",children:r}),l&&t.jsx("div",{className:"modal-footer",children:l})]})}):null}exports.Attachment=dt;exports.Checkbox=re;exports.DatePicker=nt;exports.Input=te;exports.Modal=ut;exports.RadioBtn=ie;exports.Select=ne;exports.SimpleTable=ot;exports.StatusBadge=at;exports.TextArea=ce;
59
+ ${W.isToday(j)?"today":""}`,children:W.format(j,"d")},D)})})]})};return h?null:O?t.jsxs("div",{className:`form-group ${i}`,children:[s&&t.jsx("label",{children:s}),t.jsx("span",{className:"form-control readOnly",style:{display:"block",height:"auto"},children:x||"-"})]}):t.jsxs("div",{ref:A,className:`form-group dfe-datepicker-container ${i}`,style:{position:"relative"},children:[s&&t.jsx("label",{children:s}),t.jsxs("div",{className:`form-control dfe-datepicker-trigger ${b?"border-red":""} ${f?"disabled":""}`,onClick:()=>!f&&w(!a),style:{display:"flex",alignItems:"center",cursor:f?"default":"pointer"},children:[t.jsx(Ye,{size:16,className:"dfe-calendar-icon",style:{marginRight:"8px",opacity:.5}}),t.jsx("span",{children:x||n})]}),a&&!f&&t.jsx("div",{className:"dfe-popover-content",children:t.jsx("div",{className:"dfe-calendars-wrapper",children:k(y)})}),b&&t.jsx("p",{className:"text-danger",children:String(b)})]})},nt=u.memo(st);function rt({mapping:e={},defaultLabel:s="Não reconhecido",className:n="",hidden:i=!1,label:r}){const{activityId:l}=V.useFluigRuntime(),d=u.useMemo(()=>!e||l===null||l===void 0?null:e[l],[l,e]);if(!d)return t.jsxs("div",{className:`form-group ${i?"hidden":""}`,children:[r&&t.jsx("label",{children:r}),t.jsx("div",{className:`status-badge default ${n}`,children:s})]});const o={"--customColor":d.color};return t.jsxs("div",{className:`form-group ${i?"hidden":""}`,children:[r&&t.jsx("label",{children:r}),t.jsxs("div",{className:`status-badge ${n}`,style:o,children:[d.icon&&t.jsx("i",{className:d.icon}),t.jsx("span",{children:d.label})]})]})}const it=u.memo(rt);function at({name:e,control:s,defaultRowValue:n,isView:i,isReadOnly:r,filters:l=[]}){const{field:d}=E.useController({name:e,control:s}),[o,v]=u.useState([]),[a,w]=u.useState([]),y=()=>Date.now()+Math.random(),_=h=>{try{const c=JSON.parse(h);return Array.isArray(c)?c.map(x=>({...x,_uid:x._uid||y()})):[]}catch(c){return console.error(`Erro ao ler dados da tabela "${e}":`,c),[]}};u.useEffect(()=>{if(!(o.length>0&&!i)&&d.value&&typeof d.value=="string"){const h=JSON.stringify(o);if(d.value===h)return;const c=_(d.value);v(c)}},[d.value,i]),u.useEffect(()=>{if(r)return;const h=JSON.stringify(o);d.value!==h&&d.onChange(h)},[o,d,r]);const A=u.useCallback(()=>{const h={_uid:y(),...n};v(c=>[...c,h])},[n]),C=u.useCallback(()=>{v(h=>h.filter(c=>!a.includes(c._uid))),w([])},[a]),R=u.useCallback((h,c,x)=>{v(b=>b.map(F=>F._uid===h?{...F,[c]:x}:F))},[]),O=u.useCallback(h=>{w(c=>c.includes(h)?c.filter(x=>x!==h):[...c,h])},[]),p=u.useCallback(h=>{w(h?o.map(c=>c._uid):[])},[o]),m=o.length>0&&a.length===o.length,f=u.useMemo(()=>!l||l.length===0?o:o.filter(h=>l.every(c=>{if("custom"in c)return c.custom(h);const x=h[c.field];switch(c.operator){case"===":return x===c.value;case"!==":return x!==c.value;case">":return x>c.value;case"<":return x<c.value;case">=":return x>=c.value;case"<=":return x<=c.value;default:return!0}})),[o,l]);return{field:d,tableRows:o,visibleRows:f,selectedRowIds:a,isAllSelected:m,handle:{addRow:A,removeRows:C,updateCellValue:R,toggleSelection:O,toggleSelectAll:p}}}const ot=({name:e,title:s="Tabela Dinâmica",columns:n,defaultRowValue:i={},forceReadOnly:r=!1,layout:l="fluid",actions:d=!0,filters:o=[]})=>{const{control:v}=E.useFormContext(),{isView:a,isReadOnly:w}=V.useFluigRuntime(),{isReadOnly:y}=V.useSection(),_=r||a||w||y&&y(e),{field:A,visibleRows:C,selectedRowIds:R,isAllSelected:O,handle:p}=at({name:e,control:v,defaultRowValue:i,isView:a,isReadOnly:!!_,filters:o}),m=l==="fixed";return t.jsxs("div",{className:`table-wrapper ${m?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...A}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:s}),!_&&d&&t.jsxs("div",{className:"handle-actions",children:[t.jsxs("button",{type:"button",className:`btn ${R.length>0?"btn-danger":"btn-primary"}`,disabled:R.length===0,onClick:p.removeRows,children:["Remover (",R.length,")"]}),t.jsx("button",{type:"button",className:"btn-add",onClick:p.addRow,children:"Adicionar"})]})]}),t.jsx("div",{className:"table-scroll",children:t.jsxs("table",{className:"table-custom",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[!_&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:O,onChange:f=>p.toggleSelectAll(f.target.checked)})}),n.map(f=>t.jsx("th",{style:f.width?{minWidth:m?f.width:"100%"}:{width:"max-content"},children:f.label},String(f.key)))]})}),t.jsxs("tbody",{children:[C.map((f,h)=>t.jsxs("tr",{children:[!_&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:R.includes(f._uid),onChange:()=>p.toggleSelection(f._uid)})}),n.map(c=>t.jsx("td",{children:c.render?c.render.length<=1?c.render({row:f,index:h,updateRow:(x,b)=>p.updateCellValue(f._uid,String(x),b),isLocked:!!_,isView:!!a}):c.render(f,h,(x,b)=>p.updateCellValue(f._uid,x,b),!!_,!!a):f[c.key]},`${f._uid}-${String(c.key)}`))]},f._uid)),C.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:_?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ct=(e,s)=>{const[n,i]=u.useState(null);let r=null;try{r=E.useFormContext().watch}catch{}const l=s!==void 0?s:r?r(e):void 0,d=u.useCallback(()=>{try{const v=window.top.__REACT_ATTACHMENT_BRIDGE__;if(v){const a=v.getAttachment(e,l);i(a||(l?{name:l,documentId:0}:null))}else i(l?{name:l,documentId:0}:null)}catch{i(l?{name:l,documentId:0}:null)}},[e,l,s]);return u.useEffect(()=>{d();const o=setInterval(d,2e3);return()=>clearInterval(o)},[d]),{attachment:n,sync:d}},lt=({name:e,label:s,help:n,valueManual:i,onChangeManual:r,forceReadOnly:l=!1,forceHidden:d=!1})=>{const o=!!r,{isReadOnly:v,isHidden:a}=V.useSection(),{isView:w}=V.useFluigRuntime(),y=l||w||!!v(e),_=d||!!a(e),[A,C]=u.useState(!1);let R=null;try{R=E.useFormContext().control}catch{}const O=R&&!o?E.useController({name:e,control:R}).field:{value:i,onChange:$=>r==null?void 0:r($)},{attachment:p,sync:m}=ct(e,i),f=()=>{var $;try{const k=window.top;return{bridge:k.__REACT_ATTACHMENT_BRIDGE__,toast:($=k.FLUIGC)==null?void 0:$.toast}}catch{return{bridge:null,toast:null}}},h=u.useCallback(()=>{if(y)return;const $=document.createElement("input");$.type="file",$.onchange=k=>{const g=k.target.files[0];if(!g)return;const{bridge:N,toast:P}=f();C(!0),N?N.upload(g,e,j=>{o?r==null||r(j.name):O.onChange(j.name),setTimeout(()=>{C(!1),m()},1e3),P&&P({title:"Sucesso",message:"Arquivo enviado",type:"success"})}):(o?r==null||r(g.name):O.onChange(g.name),C(!1))},$.click()},[e,O,m,r,y,o]),c=$=>{if($.stopPropagation(),y)return;const k=(p==null?void 0:p.name)||i||O.value;if(!k)return;const{bridge:g,toast:N}=f();g?g.removeByFileName(k)?(o?r==null||r(""):O.onChange(""),m()):N&&N({title:"Erro",message:"Erro ao remover anexo",type:"danger"}):(o?r==null||r(""):O.onChange(""),m())},x=!!p&&!A,b=(p==null?void 0:p.name)||i||O.value,F=["fluig-attachment__box",x?"fluig-attachment__box--has-file":"",A?"fluig-attachment__box--uploading":"",y&&!x?"readOnly":"",y&&x?"fluig-attachment__box--readonly-view":""].join(" ");return _?null:t.jsxs("div",{className:"form-group fluig-attachment",children:[s&&t.jsx("label",{className:"fluig-attachment__label",children:s}),t.jsxs("div",{className:F,onClick:()=>{if(x){const $=f(),k=(p==null?void 0:p.physicalFileName)||(p==null?void 0:p.description)||(p==null?void 0:p.name)||b;$.bridge&&k&&$.bridge.view(k)}else h()},children:[t.jsxs("span",{className:"fluig-attachment__content",children:[t.jsx("i",{className:`flaticon icon-sm ${A?"flaticon-loading":x?"flaticon-file":"flaticon-paperclip"} fluig-attachment__icon`}),t.jsx("span",{className:"fluig-attachment__filename",children:A?" Enviando...":x?b:y?"Nenhum arquivo":n||"Anexar"})]}),x&&!y&&t.jsx("button",{type:"button",className:"fluig-attachment__btn-remove btn btn-link text-danger",onClick:c,children:t.jsx("i",{className:"flaticon flaticon-trash icon-sm"})})]}),!o&&R&&t.jsx("input",{type:"hidden",name:e,value:O.value||""})]})},dt=u.memo(lt);function ut({title:e,isOpen:s,onOpen:n,onClose:i,content:r,footer:l,width:d}){const o=u.useCallback(v=>{v.key==="Escape"&&i()},[i]);return u.useEffect(()=>(s&&(document.addEventListener("keydown",o),n==null||n(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",o),document.body.style.overflow="auto"}),[s,o,n]),s?t.jsx("div",{className:"modal-overlay",onClick:i,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:d},className:"modal-container",onClick:v=>v.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:i,role:"button","aria-label":"Fechar modal",children:t.jsx("i",{className:"flaticon flaticon-close icon-md","aria-hidden":"true"})})]}),t.jsx("div",{className:"modal-content",children:r}),l&&t.jsx("div",{className:"modal-footer",children:l})]})}):null}exports.Attachment=dt;exports.Checkbox=re;exports.DatePicker=nt;exports.Input=te;exports.Modal=ut;exports.RadioBtn=ae;exports.Select=ne;exports.SimpleTable=ot;exports.StatusBadge=it;exports.TextArea=ce;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsxs as x, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
- import { memo as z, useMemo as B, useCallback as C, useState as F, useRef as G, useEffect as E, forwardRef as se, createElement as Z } from "react";
3
- import { useFormContext as H, useController as X, useFormState as de } from "react-hook-form";
1
+ import { jsxs as x, jsx as r, Fragment as de } from "react/jsx-runtime";
2
+ import { memo as z, useMemo as B, useCallback as E, useState as F, useRef as G, useEffect as j, forwardRef as se, createElement as Z } from "react";
3
+ import { useFormContext as H, useController as X, useFormState as ce } from "react-hook-form";
4
4
  import { IMaskInput as le } from "react-imask";
5
5
  import { useSection as I, useFluigRuntime as L } from "@fluig-kit/ecm";
6
6
  import { parse as ue, isValid as me, eachDayOfInterval as he, endOfWeek as fe, endOfMonth as pe, startOfWeek as ye, startOfMonth as ve, subMonths as ge, format as K, addMonths as be, isSameMonth as we, isSameDay as Ne, isToday as ke } from "date-fns";
@@ -16,7 +16,7 @@ function Se({
16
16
  placeholder: n = "",
17
17
  type: i = "text",
18
18
  mask: s,
19
- className: d = "",
19
+ className: c = "",
20
20
  forceReadOnly: l = !1,
21
21
  forceHidden: o = !1,
22
22
  valueManual: g,
@@ -24,51 +24,51 @@ function Se({
24
24
  errorManual: N
25
25
  }) {
26
26
  var S, $;
27
- const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A } = L();
28
- let p = null;
27
+ const p = g !== void 0 && !!a, { isReadOnly: V, isHidden: W } = I(), _ = l || !!V(e), P = o || !!W(e), { isView: A } = L();
28
+ let y = null;
29
29
  try {
30
- p = H();
30
+ y = H();
31
31
  } catch {
32
32
  }
33
- const u = !y && p ? X({ name: e, control: p.control }) : null, m = !y && p ? de({ name: e }) : null, f = y ? g : u == null ? void 0 : u.field.value, c = y ? N : ($ = (S = m == null ? void 0 : m.errors) == null ? void 0 : S[e]) == null ? void 0 : $.message, h = B(
33
+ const u = !p && y ? X({ name: e, control: y.control }) : null, m = !p && y ? ce({ name: e }) : null, h = p ? g : u == null ? void 0 : u.field.value, d = p ? N : ($ = (S = m == null ? void 0 : m.errors) == null ? void 0 : S[e]) == null ? void 0 : $.message, f = B(
34
34
  () => s ? xe[s] ?? s : null,
35
35
  [s]
36
- ), b = C((w) => {
36
+ ), b = E((w) => {
37
37
  if (!w) return "";
38
- const j = w.replace(/\D/g, "");
39
- return (Number(j) / 100).toLocaleString("pt-BR", {
38
+ const C = w.replace(/\D/g, "");
39
+ return (Number(C) / 100).toLocaleString("pt-BR", {
40
40
  style: "currency",
41
41
  currency: "BRL"
42
42
  });
43
- }, []), D = C(
43
+ }, []), D = E(
44
44
  (w) => i === "monetary" ? b(w) : w,
45
45
  [i, b]
46
46
  ), O = (w) => {
47
- const j = D(w);
48
- y ? a == null || a(j) : u == null || u.field.onChange(j);
47
+ const C = D(w);
48
+ p ? a == null || a(C) : u == null || u.field.onChange(C);
49
49
  }, k = () => {
50
- y || u == null || u.field.onBlur();
50
+ p || u == null || u.field.onBlur();
51
51
  };
52
52
  if (A)
53
53
  return /* @__PURE__ */ x("div", { className: "form-group", children: [
54
54
  /* @__PURE__ */ r("label", { children: t }),
55
- /* @__PURE__ */ r("span", { className: "form-control", children: f || "-" })
55
+ /* @__PURE__ */ r("span", { className: "form-control", children: h || "-" })
56
56
  ] });
57
- const v = `form-control ${_ ? "readOnly" : ""} ${c ? "border-red" : ""} ${d}`;
57
+ const v = `form-control ${_ ? "readOnly" : ""} ${d ? "border-red" : ""} ${c}`;
58
58
  return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
59
59
  t && /* @__PURE__ */ r("label", { children: t }),
60
- h ? /* @__PURE__ */ r(
60
+ f ? /* @__PURE__ */ r(
61
61
  le,
62
62
  {
63
63
  name: e,
64
- mask: h,
65
- value: String(f ?? ""),
64
+ mask: f,
65
+ value: String(h ?? ""),
66
66
  unmask: !1,
67
67
  onAccept: (w) => O(w),
68
68
  placeholder: n,
69
69
  readOnly: _,
70
70
  className: v,
71
- inputRef: y || u == null ? void 0 : u.field.ref,
71
+ inputRef: p || u == null ? void 0 : u.field.ref,
72
72
  onBlur: k
73
73
  }
74
74
  ) : /* @__PURE__ */ r(
@@ -76,7 +76,7 @@ function Se({
76
76
  {
77
77
  type: "text",
78
78
  name: e,
79
- value: f ?? "",
79
+ value: h ?? "",
80
80
  onChange: (w) => O(w.target.value),
81
81
  onBlur: k,
82
82
  placeholder: n,
@@ -84,35 +84,35 @@ function Se({
84
84
  className: v
85
85
  }
86
86
  ),
87
- c && /* @__PURE__ */ r("p", { className: "text-danger", children: String(c) })
87
+ d && /* @__PURE__ */ r("p", { className: "text-danger", children: String(d) })
88
88
  ] });
89
89
  }
90
- const Vt = z(Se);
90
+ const Wt = z(Se);
91
91
  function Re({
92
92
  name: e,
93
93
  label: t = "",
94
94
  options: n = [],
95
95
  placeholder: i = "",
96
96
  labelKey: s = "label",
97
- valueKey: d = "value",
97
+ valueKey: c = "value",
98
98
  enableSearch: l = !1,
99
99
  searchPlaceholder: o = "Buscar...",
100
100
  loading: g = !1,
101
101
  onSearchChange: a,
102
102
  debounceTime: N = 300,
103
- onSelect: y,
104
- forceReadOnly: W = !1,
105
- forceHidden: V = !1,
103
+ onSelect: p,
104
+ forceReadOnly: V = !1,
105
+ forceHidden: W = !1,
106
106
  valueManual: _,
107
107
  onChangeManual: P,
108
108
  errorManual: A
109
109
  }) {
110
110
  var ne;
111
- const p = _ !== void 0 && !!P, { isReadOnly: u, isHidden: m } = I(), f = W || !!u(e), c = V || !!m(e), { isView: h } = L();
111
+ const y = _ !== void 0 && !!P, { isReadOnly: u, isHidden: m } = I(), h = V || !!u(e), d = W || !!m(e), { isView: f } = L();
112
112
  let b = "", D = () => {
113
113
  }, O, k = null, v = () => {
114
114
  };
115
- if (p)
115
+ if (y)
116
116
  b = _;
117
117
  else
118
118
  try {
@@ -120,17 +120,17 @@ function Re({
120
120
  b = T.field.value, D = T.field.onChange, O = T.field.ref, k = (ne = T.fieldState) == null ? void 0 : ne.error, v = R.clearErrors;
121
121
  } catch {
122
122
  }
123
- const [S, $] = F(!1), [w, j] = F(""), q = G(null), U = G(a);
124
- E(() => {
123
+ const [S, $] = F(!1), [w, C] = F(""), q = G(null), U = G(a);
124
+ j(() => {
125
125
  U.current = a;
126
- }, [a]), E(() => {
126
+ }, [a]), j(() => {
127
127
  const R = (T) => {
128
128
  q.current && !q.current.contains(T.target) && $(!1);
129
129
  };
130
130
  return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
131
- }, []), E(() => {
132
- S || j("");
133
- }, [S]), E(() => {
131
+ }, []), j(() => {
132
+ S || C("");
133
+ }, [S]), j(() => {
134
134
  if (!l) return;
135
135
  const R = setTimeout(() => {
136
136
  var T;
@@ -143,42 +143,42 @@ function Re({
143
143
  ) : n ?? [], [n, l, a, w, s]), te = B(() => {
144
144
  if (b == null) return "";
145
145
  if (typeof b == "object")
146
- return String(b[d] ?? "");
146
+ return String(b[c] ?? "");
147
147
  const R = (n || []).find(
148
- (T) => String(T == null ? void 0 : T[d]) === String(b)
148
+ (T) => String(T == null ? void 0 : T[c]) === String(b)
149
149
  );
150
150
  return String(R ? (R == null ? void 0 : R[s]) ?? "" : b);
151
- }, [b, n, d, s]), oe = (R) => {
152
- f || (p ? P == null || P(R[d]) : (D(R[d]), v == null || v(e)), y == null || y(R), $(!1));
151
+ }, [b, n, c, s]), oe = (R) => {
152
+ h || (y ? P == null || P(R[c]) : (D(R[c]), v == null || v(e)), p == null || p(R), $(!1));
153
153
  };
154
154
  return /* @__PURE__ */ x(
155
155
  "div",
156
156
  {
157
- className: `select-wrapper form-group ${c ? "hidden" : ""}`,
157
+ className: `select-wrapper form-group ${d ? "hidden" : ""}`,
158
158
  ref: q,
159
159
  children: [
160
160
  /* @__PURE__ */ r("label", { className: "control-label", children: t }),
161
- h ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ x(ce, { children: [
161
+ f ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ x(de, { children: [
162
162
  /* @__PURE__ */ x(
163
163
  "div",
164
164
  {
165
- className: `select-control ${k ? "border-red" : ""} ${f ? "readOnly" : ""}`,
166
- onClick: () => !f && $((R) => !R),
165
+ className: `select-control ${k ? "border-red" : ""} ${h ? "readOnly" : ""}`,
166
+ onClick: () => !h && $((R) => !R),
167
167
  ref: O,
168
168
  children: [
169
- /* @__PURE__ */ r("span", { className: `select-display ${f ? "readOnly" : ""}`, children: te || i }),
169
+ /* @__PURE__ */ r("span", { className: `select-display ${h ? "readOnly" : ""}`, children: te || i }),
170
170
  /* @__PURE__ */ r("i", { className: "flaticon flaticon-chevron-down select-icon" })
171
171
  ]
172
172
  }
173
173
  ),
174
- S && !f && /* @__PURE__ */ x("div", { className: "select-dropdown", children: [
174
+ S && !h && /* @__PURE__ */ x("div", { className: "select-dropdown", children: [
175
175
  l && /* @__PURE__ */ r("div", { className: "select-search", children: /* @__PURE__ */ r(
176
176
  "input",
177
177
  {
178
178
  type: "text",
179
179
  className: "select-search-input",
180
180
  value: w,
181
- onChange: (R) => j(R.target.value),
181
+ onChange: (R) => C(R.target.value),
182
182
  placeholder: g ? "Carregando..." : o,
183
183
  autoFocus: !0,
184
184
  onClick: (R) => R.stopPropagation()
@@ -191,11 +191,11 @@ function Re({
191
191
  className: "select-option handleHover",
192
192
  children: R[s]
193
193
  },
194
- R[d]
194
+ R[c]
195
195
  )) : /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Sem resultados" }) })
196
196
  ] })
197
197
  ] }),
198
- !p && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: b || "" }),
198
+ !y && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: b || "" }),
199
199
  (k || A) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? A) })
200
200
  ]
201
201
  }
@@ -208,7 +208,7 @@ function Tt({
208
208
  label: n = "",
209
209
  valueKey: i = "value",
210
210
  labelKey: s = "label",
211
- forceReadOnly: d = !1,
211
+ forceReadOnly: c = !1,
212
212
  forceHidden: l = !1,
213
213
  valueManual: o,
214
214
  onChangeManual: g
@@ -219,7 +219,7 @@ function Tt({
219
219
  a = H();
220
220
  } catch {
221
221
  }
222
- const N = o !== void 0 && !!g, { isView: y, isReadOnly: W } = L(), { isReadOnly: V, isHidden: _ } = I(), P = V ? V(e) : !1, A = _ ? _(e) : !1, p = d || P, u = l || A, m = p || W || y, f = () => t ? t.reduce(
222
+ const N = o !== void 0 && !!g, { isView: p, isReadOnly: V } = L(), { isReadOnly: W, isHidden: _ } = I(), P = W ? W(e) : !1, A = _ ? _(e) : !1, y = c || P, u = l || A, m = y || V || p, h = () => t ? t.reduce(
223
223
  (v, S) => {
224
224
  const $ = String(S[i]);
225
225
  if (N)
@@ -232,18 +232,18 @@ function Tt({
232
232
  return v;
233
233
  },
234
234
  {}
235
- ) : {}, c = !N && a ? a.watch(e) : void 0, h = B(() => N && o ? o : c && typeof c == "object" ? c : f(), [c, o, t]);
236
- E(() => {
235
+ ) : {}, d = !N && a ? a.watch(e) : void 0, f = B(() => N && o ? o : d && typeof d == "object" ? d : h(), [d, o, t]);
236
+ j(() => {
237
237
  if (N || !a) return;
238
238
  const v = a.getValues(e);
239
- (!v || typeof v != "object") && a.setValue(e, h, {
239
+ (!v || typeof v != "object") && a.setValue(e, f, {
240
240
  shouldDirty: !1,
241
241
  shouldValidate: !1
242
242
  });
243
- }, [h, e, a, N]);
243
+ }, [f, e, a, N]);
244
244
  const b = (v, S) => {
245
245
  if (m) return;
246
- const $ = { ...h, [v]: S };
246
+ const $ = { ...f, [v]: S };
247
247
  if (N) {
248
248
  g && g($);
249
249
  return;
@@ -260,7 +260,7 @@ function Tt({
260
260
  {
261
261
  className: `checkbox-group-custom ${m ? "readOnly" : ""}`,
262
262
  children: t.map((v) => {
263
- const S = String(v[i]), $ = h[S] === !0;
263
+ const S = String(v[i]), $ = f[S] === !0;
264
264
  return /* @__PURE__ */ x("div", { children: [
265
265
  !N && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register(S) }),
266
266
  /* @__PURE__ */ x(
@@ -295,7 +295,7 @@ function Pe({
295
295
  options: n = [],
296
296
  valueKey: i = "value",
297
297
  labelKey: s = "label",
298
- iconKey: d = "icon",
298
+ iconKey: c = "icon",
299
299
  forceReadOnly: l = !1,
300
300
  forceHidden: o = !1,
301
301
  valueManual: g,
@@ -303,23 +303,29 @@ function Pe({
303
303
  errorManual: N
304
304
  }) {
305
305
  var O;
306
- const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A, isReadOnly: p } = L();
307
- let u = null, m = null, f = null;
306
+ const p = g !== void 0 && !!a, { isReadOnly: V, isHidden: W } = I(), _ = l || !!V(e), P = o || !!W(e), { isView: A, isReadOnly: y } = L();
307
+ let u = null, m = null, h = null;
308
308
  try {
309
- f = H();
309
+ h = H();
310
310
  } catch {
311
311
  }
312
- const c = !y && f ? X({ name: e, control: f.control }) : null;
313
- !y && c && (u = c.field, m = (O = c.fieldState) == null ? void 0 : O.error);
314
- const h = _ || p || A, b = y ? g : (u == null ? void 0 : u.value) ?? "", D = C(
312
+ const d = !p && h ? X({ name: e, control: h.control }) : null;
313
+ !p && d && (u = d.field, m = (O = d.fieldState) == null ? void 0 : O.error);
314
+ const f = _ || y || A, b = p ? g : (u == null ? void 0 : u.value) ?? "", D = E(
315
315
  (k) => {
316
- h || (y ? a == null || a(k) : u == null || u.onChange(k));
316
+ f || (p ? a == null || a(k) : u == null || u.onChange(k));
317
317
  },
318
- [h, y, a, u]
318
+ [f, p, a, u]
319
319
  );
320
- return /* @__PURE__ */ x("div", { className: `form-group column ${P ? "hidden" : ""}`, children: [
320
+ return j(() => {
321
+ if (p || !h) return;
322
+ h.getValues(e) === void 0 && h.setValue(e, "", {
323
+ shouldDirty: !1,
324
+ shouldValidate: !1
325
+ });
326
+ }, [e, h, p]), /* @__PURE__ */ x("div", { className: `form-group column ${P ? "hidden" : ""}`, children: [
321
327
  t && /* @__PURE__ */ r("label", { className: "control-label", children: t }),
322
- /* @__PURE__ */ r("div", { className: `btn-group ${h ? "view-mode" : ""}`, "data-field-name": e, children: n.map((k) => {
328
+ /* @__PURE__ */ r("div", { className: `btn-group ${f ? "view-mode" : ""}`, "data-field-name": e, children: n.map((k) => {
323
329
  const v = k[i], S = b === v, $ = k.color ? { "--customColor": k.color } : void 0;
324
330
  return /* @__PURE__ */ x(
325
331
  "label",
@@ -340,10 +346,10 @@ function Pe({
340
346
  onChange: () => D(v),
341
347
  onBlur: u == null ? void 0 : u.onBlur,
342
348
  ref: u == null ? void 0 : u.ref,
343
- disabled: h
349
+ disabled: f
344
350
  }
345
351
  ),
346
- k[d] && /* @__PURE__ */ r("i", { className: `${k[d]} icon-sm` }),
352
+ k[c] && /* @__PURE__ */ r("i", { className: `${k[c]} icon-sm` }),
347
353
  " ",
348
354
  k[s]
349
355
  ]
@@ -360,57 +366,57 @@ const jt = z(Pe), $e = ({
360
366
  placeholder: n = "",
361
367
  className: i = "",
362
368
  rows: s = 4,
363
- maxLength: d,
369
+ maxLength: c,
364
370
  forceReadOnly: l = !1,
365
371
  forceHidden: o = !1,
366
372
  valueManual: g,
367
373
  onChangeManual: a,
368
374
  errorManual: N
369
375
  }) => {
370
- var h;
371
- const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A } = L(), p = G(null);
376
+ var f;
377
+ const p = g !== void 0 && !!a, { isReadOnly: V, isHidden: W } = I(), _ = l || !!V(e), P = o || !!W(e), { isView: A } = L(), y = G(null);
372
378
  let u = {
373
379
  value: g ?? "",
374
380
  onChange: (b) => a == null ? void 0 : a(b)
375
381
  }, m = null;
376
- if (!y)
382
+ if (!p)
377
383
  try {
378
384
  const { control: b } = H(), D = X({ name: e, control: b });
379
- u = D.field, m = (h = D.fieldState) == null ? void 0 : h.error;
385
+ u = D.field, m = (f = D.fieldState) == null ? void 0 : f.error;
380
386
  } catch {
381
387
  }
382
- const f = () => {
383
- p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
388
+ const h = () => {
389
+ y.current && (y.current.style.height = "auto", y.current.style.height = `${y.current.scrollHeight}px`);
384
390
  };
385
- if (E(() => {
386
- f();
391
+ if (j(() => {
392
+ h();
387
393
  }, [u.value]), A)
388
394
  return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
389
395
  /* @__PURE__ */ r("label", { children: t }),
390
396
  /* @__PURE__ */ r("span", { className: "form-control", children: u.value || "-" })
391
397
  ] });
392
- const c = `form-control ${_ ? "readOnly" : ""} ${m || N ? "border-red" : ""} ${i}`;
398
+ const d = `form-control ${_ ? "readOnly" : ""} ${m || N ? "border-red" : ""} ${i}`;
393
399
  return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
394
400
  t && /* @__PURE__ */ r("label", { children: t }),
395
401
  /* @__PURE__ */ r(
396
402
  "textarea",
397
403
  {
398
- ref: p,
404
+ ref: y,
399
405
  rows: s,
400
- maxLength: d,
406
+ maxLength: c,
401
407
  value: u.value || "",
402
408
  placeholder: n,
403
409
  readOnly: _,
404
- className: c,
410
+ className: d,
405
411
  style: {
406
412
  resize: "none",
407
413
  maxHeight: "400px",
408
414
  overflowY: "auto"
409
415
  },
410
416
  onChange: (b) => {
411
- y ? a == null || a(b.target.value) : u.onChange(b);
417
+ p ? a == null || a(b.target.value) : u.onChange(b);
412
418
  },
413
- onInput: f
419
+ onInput: h
414
420
  }
415
421
  ),
416
422
  (m || N) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((m == null ? void 0 : m.message) ?? N) })
@@ -433,18 +439,18 @@ function Q(e) {
433
439
  const l = e.defaultWidth, o = n != null && n.width ? String(n.width) : e.defaultWidth;
434
440
  s = e.values[o] || e.values[l];
435
441
  }
436
- const d = e.argumentCallback ? e.argumentCallback(t) : t;
437
- return s[d];
442
+ const c = e.argumentCallback ? e.argumentCallback(t) : t;
443
+ return s[c];
438
444
  };
439
445
  }
440
446
  function Y(e) {
441
447
  return (t, n = {}) => {
442
- const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], d = t.match(s);
443
- if (!d)
448
+ const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], c = t.match(s);
449
+ if (!c)
444
450
  return null;
445
- const l = d[0], o = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], g = Array.isArray(o) ? Oe(o, (y) => y.test(l)) : (
451
+ const l = c[0], o = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], g = Array.isArray(o) ? Oe(o, (p) => p.test(l)) : (
446
452
  // [TODO] -- I challenge you to fix the type
447
- _e(o, (y) => y.test(l))
453
+ _e(o, (p) => p.test(l))
448
454
  );
449
455
  let a;
450
456
  a = e.valueCallback ? e.valueCallback(g) : g, a = n.valueCallback ? (
@@ -469,15 +475,15 @@ function Ae(e) {
469
475
  return (t, n = {}) => {
470
476
  const i = t.match(e.matchPattern);
471
477
  if (!i) return null;
472
- const s = i[0], d = t.match(e.parsePattern);
473
- if (!d) return null;
474
- let l = e.valueCallback ? e.valueCallback(d[0]) : d[0];
478
+ const s = i[0], c = t.match(e.parsePattern);
479
+ if (!c) return null;
480
+ let l = e.valueCallback ? e.valueCallback(c[0]) : c[0];
475
481
  l = n.valueCallback ? n.valueCallback(l) : l;
476
482
  const o = t.slice(s.length);
477
483
  return { value: l, rest: o };
478
484
  };
479
485
  }
480
- const We = {
486
+ const Ve = {
481
487
  lessThanXSeconds: {
482
488
  one: "menos de um segundo",
483
489
  other: "menos de {{count}} segundos"
@@ -539,9 +545,9 @@ const We = {
539
545
  one: "quase 1 ano",
540
546
  other: "quase {{count}} anos"
541
547
  }
542
- }, Ve = (e, t, n) => {
548
+ }, We = (e, t, n) => {
543
549
  let i;
544
- const s = We[e];
550
+ const s = Ve[e];
545
551
  return typeof s == "string" ? i = s : t === 1 ? i = s.one : i = s.other.replace("{{count}}", String(t)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "em " + i : "há " + i : i;
546
552
  }, De = {
547
553
  full: "EEEE, d 'de' MMMM 'de' y",
@@ -841,7 +847,7 @@ const We = {
841
847
  })
842
848
  }, at = {
843
849
  code: "pt-BR",
844
- formatDistance: Ve,
850
+ formatDistance: We,
845
851
  formatLong: Ce,
846
852
  formatRelative: He,
847
853
  localize: Ue,
@@ -871,7 +877,7 @@ const ot = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
871
877
  * This source code is licensed under the ISC license.
872
878
  * See the LICENSE file in the root directory of this source tree.
873
879
  */
874
- const ct = (e) => e.replace(
880
+ const dt = (e) => e.replace(
875
881
  /^([A-Z])|[\s-_]+(\w)/g,
876
882
  (t, n, i) => i ? i.toUpperCase() : n.toLowerCase()
877
883
  );
@@ -882,7 +888,7 @@ const ct = (e) => e.replace(
882
888
  * See the LICENSE file in the root directory of this source tree.
883
889
  */
884
890
  const re = (e) => {
885
- const t = ct(e);
891
+ const t = dt(e);
886
892
  return t.charAt(0).toUpperCase() + t.slice(1);
887
893
  };
888
894
  /**
@@ -891,7 +897,7 @@ const re = (e) => {
891
897
  * This source code is licensed under the ISC license.
892
898
  * See the LICENSE file in the root directory of this source tree.
893
899
  */
894
- var dt = {
900
+ var ct = {
895
901
  xmlns: "http://www.w3.org/2000/svg",
896
902
  width: 24,
897
903
  height: 24,
@@ -927,25 +933,25 @@ const ut = se(
927
933
  strokeWidth: n = 2,
928
934
  absoluteStrokeWidth: i,
929
935
  className: s = "",
930
- children: d,
936
+ children: c,
931
937
  iconNode: l,
932
938
  ...o
933
939
  }, g) => Z(
934
940
  "svg",
935
941
  {
936
942
  ref: g,
937
- ...dt,
943
+ ...ct,
938
944
  width: t,
939
945
  height: t,
940
946
  stroke: e,
941
947
  strokeWidth: i ? Number(n) * 24 / Number(t) : n,
942
948
  className: ie("lucide", s),
943
- ...!d && !lt(o) && { "aria-hidden": "true" },
949
+ ...!c && !lt(o) && { "aria-hidden": "true" },
944
950
  ...o
945
951
  },
946
952
  [
947
953
  ...l.map(([a, N]) => Z(a, N)),
948
- ...Array.isArray(d) ? d : [d]
954
+ ...Array.isArray(c) ? c : [c]
949
955
  ]
950
956
  )
951
957
  );
@@ -957,8 +963,8 @@ const ut = se(
957
963
  */
958
964
  const M = (e, t) => {
959
965
  const n = se(
960
- ({ className: i, ...s }, d) => Z(ut, {
961
- ref: d,
966
+ ({ className: i, ...s }, c) => Z(ut, {
967
+ ref: c,
962
968
  iconNode: t,
963
969
  className: ie(
964
970
  `lucide-${ot(re(e))}`,
@@ -998,7 +1004,7 @@ const ft = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], pt = M("chevron-l
998
1004
  const yt = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], vt = M("chevron-right", yt);
999
1005
  function gt(e) {
1000
1006
  const t = G(null);
1001
- return E(() => {
1007
+ return j(() => {
1002
1008
  function n(i) {
1003
1009
  t.current && !t.current.contains(i.target) && e();
1004
1010
  }
@@ -1017,22 +1023,22 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1017
1023
  placeholder: n = "dd/mm/aaaa",
1018
1024
  className: i = "",
1019
1025
  forceReadOnly: s = !1,
1020
- forceHidden: d = !1,
1026
+ forceHidden: c = !1,
1021
1027
  valueManual: l,
1022
1028
  onChangeManual: o,
1023
1029
  errorManual: g
1024
1030
  }) => {
1025
1031
  var v;
1026
- const [a, N] = F(!1), [y, W] = F(/* @__PURE__ */ new Date()), V = gt(() => N(!1)), _ = l !== void 0 && !!o;
1032
+ const [a, N] = F(!1), [p, V] = F(/* @__PURE__ */ new Date()), W = gt(() => N(!1)), _ = l !== void 0 && !!o;
1027
1033
  let P = null;
1028
1034
  try {
1029
1035
  P = H();
1030
1036
  } catch {
1031
1037
  }
1032
- const { isView: A } = L(), { isReadOnly: p, isHidden: u } = I(), m = s || !!p(e), f = d || !!u(e), c = !_ && P ? X({ name: e, control: P.control }) : null, h = _ ? l : c == null ? void 0 : c.field.value, b = _ ? g : (v = c == null ? void 0 : c.fieldState.error) == null ? void 0 : v.message, D = B(() => bt(h), [h]), O = (S) => {
1038
+ const { isView: A } = L(), { isReadOnly: y, isHidden: u } = I(), m = s || !!y(e), h = c || !!u(e), d = !_ && P ? X({ name: e, control: P.control }) : null, f = _ ? l : d == null ? void 0 : d.field.value, b = _ ? g : (v = d == null ? void 0 : d.fieldState.error) == null ? void 0 : v.message, D = B(() => bt(f), [f]), O = (S) => {
1033
1039
  if (m) return;
1034
1040
  const $ = wt(S);
1035
- _ ? o == null || o($) : c == null || c.field.onChange($), N(!1);
1041
+ _ ? o == null || o($) : d == null || d.field.onChange($), N(!1);
1036
1042
  }, k = (S) => {
1037
1043
  const $ = he({
1038
1044
  start: ye(ve(S)),
@@ -1045,7 +1051,7 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1045
1051
  {
1046
1052
  type: "button",
1047
1053
  onClick: (w) => {
1048
- w.stopPropagation(), W(ge(y, 1));
1054
+ w.stopPropagation(), V(ge(p, 1));
1049
1055
  },
1050
1056
  className: "dfe-nav-btn",
1051
1057
  children: /* @__PURE__ */ r(pt, { size: 16 })
@@ -1057,15 +1063,15 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1057
1063
  {
1058
1064
  type: "button",
1059
1065
  onClick: (w) => {
1060
- w.stopPropagation(), W(be(y, 1));
1066
+ w.stopPropagation(), V(be(p, 1));
1061
1067
  },
1062
1068
  className: "dfe-nav-btn",
1063
1069
  children: /* @__PURE__ */ r(vt, { size: 16 })
1064
1070
  }
1065
1071
  )
1066
1072
  ] }),
1067
- /* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((w, j) => /* @__PURE__ */ r("span", { children: w }, j)) }),
1068
- /* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: $.map((w, j) => {
1073
+ /* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((w, C) => /* @__PURE__ */ r("span", { children: w }, C)) }),
1074
+ /* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: $.map((w, C) => {
1069
1075
  const q = !we(w, S), U = D && Ne(w, D);
1070
1076
  return /* @__PURE__ */ r(
1071
1077
  "div",
@@ -1077,18 +1083,18 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1077
1083
  ${ke(w) ? "today" : ""}`,
1078
1084
  children: K(w, "d")
1079
1085
  },
1080
- j
1086
+ C
1081
1087
  );
1082
1088
  }) })
1083
1089
  ] });
1084
1090
  };
1085
- return f ? null : A ? /* @__PURE__ */ x("div", { className: `form-group ${i}`, children: [
1091
+ return h ? null : A ? /* @__PURE__ */ x("div", { className: `form-group ${i}`, children: [
1086
1092
  t && /* @__PURE__ */ r("label", { children: t }),
1087
- /* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children: h || "-" })
1093
+ /* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children: f || "-" })
1088
1094
  ] }) : /* @__PURE__ */ x(
1089
1095
  "div",
1090
1096
  {
1091
- ref: V,
1097
+ ref: W,
1092
1098
  className: `form-group dfe-datepicker-container ${i}`,
1093
1099
  style: { position: "relative" },
1094
1100
  children: [
@@ -1105,11 +1111,11 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1105
1111
  },
1106
1112
  children: [
1107
1113
  /* @__PURE__ */ r(ht, { size: 16, className: "dfe-calendar-icon", style: { marginRight: "8px", opacity: 0.5 } }),
1108
- /* @__PURE__ */ r("span", { children: h || n })
1114
+ /* @__PURE__ */ r("span", { children: f || n })
1109
1115
  ]
1110
1116
  }
1111
1117
  ),
1112
- a && !m && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: k(y) }) }),
1118
+ a && !m && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: k(p) }) }),
1113
1119
  b && /* @__PURE__ */ r("p", { className: "text-danger", children: String(b) })
1114
1120
  ]
1115
1121
  }
@@ -1122,7 +1128,7 @@ function kt({
1122
1128
  hidden: i = !1,
1123
1129
  label: s
1124
1130
  }) {
1125
- const { activityId: d } = L(), l = B(() => !e || d === null || d === void 0 ? null : e[d], [d, e]);
1131
+ const { activityId: c } = L(), l = B(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
1126
1132
  if (!l)
1127
1133
  return /* @__PURE__ */ x("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
1128
1134
  s && /* @__PURE__ */ r("label", { children: s }),
@@ -1146,68 +1152,68 @@ function xt({
1146
1152
  defaultRowValue: n,
1147
1153
  isView: i,
1148
1154
  isReadOnly: s,
1149
- filters: d = []
1155
+ filters: c = []
1150
1156
  }) {
1151
- const { field: l } = X({ name: e, control: t }), [o, g] = F([]), [a, N] = F([]), y = () => Date.now() + Math.random(), W = (f) => {
1157
+ const { field: l } = X({ name: e, control: t }), [o, g] = F([]), [a, N] = F([]), p = () => Date.now() + Math.random(), V = (h) => {
1152
1158
  try {
1153
- const c = JSON.parse(f);
1154
- return Array.isArray(c) ? c.map((h) => ({
1155
- ...h,
1156
- _uid: h._uid || y()
1159
+ const d = JSON.parse(h);
1160
+ return Array.isArray(d) ? d.map((f) => ({
1161
+ ...f,
1162
+ _uid: f._uid || p()
1157
1163
  })) : [];
1158
- } catch (c) {
1159
- return console.error(`Erro ao ler dados da tabela "${e}":`, c), [];
1164
+ } catch (d) {
1165
+ return console.error(`Erro ao ler dados da tabela "${e}":`, d), [];
1160
1166
  }
1161
1167
  };
1162
- E(() => {
1168
+ j(() => {
1163
1169
  if (!(o.length > 0 && !i) && l.value && typeof l.value == "string") {
1164
- const f = JSON.stringify(o);
1165
- if (l.value === f) return;
1166
- const c = W(l.value);
1167
- g(c);
1170
+ const h = JSON.stringify(o);
1171
+ if (l.value === h) return;
1172
+ const d = V(l.value);
1173
+ g(d);
1168
1174
  }
1169
- }, [l.value, i]), E(() => {
1175
+ }, [l.value, i]), j(() => {
1170
1176
  if (s) return;
1171
- const f = JSON.stringify(o);
1172
- l.value !== f && l.onChange(f);
1177
+ const h = JSON.stringify(o);
1178
+ l.value !== h && l.onChange(h);
1173
1179
  }, [o, l, s]);
1174
- const V = C(() => {
1175
- const f = { _uid: y(), ...n };
1176
- g((c) => [...c, f]);
1177
- }, [n]), _ = C(() => {
1178
- g((f) => f.filter((c) => !a.includes(c._uid))), N([]);
1179
- }, [a]), P = C((f, c, h) => {
1180
- g((b) => b.map((D) => D._uid === f ? { ...D, [c]: h } : D));
1181
- }, []), A = C((f) => {
1182
- N((c) => c.includes(f) ? c.filter((h) => h !== f) : [...c, f]);
1183
- }, []), p = C(
1184
- (f) => {
1185
- N(f ? o.map((c) => c._uid) : []);
1180
+ const W = E(() => {
1181
+ const h = { _uid: p(), ...n };
1182
+ g((d) => [...d, h]);
1183
+ }, [n]), _ = E(() => {
1184
+ g((h) => h.filter((d) => !a.includes(d._uid))), N([]);
1185
+ }, [a]), P = E((h, d, f) => {
1186
+ g((b) => b.map((D) => D._uid === h ? { ...D, [d]: f } : D));
1187
+ }, []), A = E((h) => {
1188
+ N((d) => d.includes(h) ? d.filter((f) => f !== h) : [...d, h]);
1189
+ }, []), y = E(
1190
+ (h) => {
1191
+ N(h ? o.map((d) => d._uid) : []);
1186
1192
  },
1187
1193
  [o]
1188
- ), u = o.length > 0 && a.length === o.length, m = B(() => !d || d.length === 0 ? o : o.filter(
1189
- (f) => d.every((c) => {
1190
- if ("custom" in c)
1191
- return c.custom(f);
1192
- const h = f[c.field];
1193
- switch (c.operator) {
1194
+ ), u = o.length > 0 && a.length === o.length, m = B(() => !c || c.length === 0 ? o : o.filter(
1195
+ (h) => c.every((d) => {
1196
+ if ("custom" in d)
1197
+ return d.custom(h);
1198
+ const f = h[d.field];
1199
+ switch (d.operator) {
1194
1200
  case "===":
1195
- return h === c.value;
1201
+ return f === d.value;
1196
1202
  case "!==":
1197
- return h !== c.value;
1203
+ return f !== d.value;
1198
1204
  case ">":
1199
- return h > c.value;
1205
+ return f > d.value;
1200
1206
  case "<":
1201
- return h < c.value;
1207
+ return f < d.value;
1202
1208
  case ">=":
1203
- return h >= c.value;
1209
+ return f >= d.value;
1204
1210
  case "<=":
1205
- return h <= c.value;
1211
+ return f <= d.value;
1206
1212
  default:
1207
1213
  return !0;
1208
1214
  }
1209
1215
  })
1210
- ), [o, d]);
1216
+ ), [o, c]);
1211
1217
  return {
1212
1218
  field: l,
1213
1219
  tableRows: o,
@@ -1215,11 +1221,11 @@ function xt({
1215
1221
  selectedRowIds: a,
1216
1222
  isAllSelected: u,
1217
1223
  handle: {
1218
- addRow: V,
1224
+ addRow: W,
1219
1225
  removeRows: _,
1220
1226
  updateCellValue: P,
1221
1227
  toggleSelection: A,
1222
- toggleSelectAll: p
1228
+ toggleSelectAll: y
1223
1229
  }
1224
1230
  };
1225
1231
  }
@@ -1229,30 +1235,30 @@ const Lt = ({
1229
1235
  columns: n,
1230
1236
  defaultRowValue: i = {},
1231
1237
  forceReadOnly: s = !1,
1232
- layout: d = "fluid",
1238
+ layout: c = "fluid",
1233
1239
  actions: l = !0,
1234
1240
  filters: o = []
1235
1241
  }) => {
1236
- const { control: g } = H(), { isView: a, isReadOnly: N } = L(), { isReadOnly: y } = I(), W = s || a || N || y && y(e), { field: V, visibleRows: _, selectedRowIds: P, isAllSelected: A, handle: p } = xt({
1242
+ const { control: g } = H(), { isView: a, isReadOnly: N } = L(), { isReadOnly: p } = I(), V = s || a || N || p && p(e), { field: W, visibleRows: _, selectedRowIds: P, isAllSelected: A, handle: y } = xt({
1237
1243
  name: e,
1238
1244
  control: g,
1239
1245
  defaultRowValue: i,
1240
1246
  isView: a,
1241
- isReadOnly: !!W,
1247
+ isReadOnly: !!V,
1242
1248
  filters: o
1243
- }), u = d === "fixed";
1249
+ }), u = c === "fixed";
1244
1250
  return /* @__PURE__ */ x("div", { className: `table-wrapper ${u ? "table-fixed" : "table-fluid"}`, children: [
1245
- /* @__PURE__ */ r("input", { type: "hidden", ...V }),
1251
+ /* @__PURE__ */ r("input", { type: "hidden", ...W }),
1246
1252
  /* @__PURE__ */ x("div", { className: "header-handle", children: [
1247
1253
  /* @__PURE__ */ r("h3", { children: t }),
1248
- !W && l && /* @__PURE__ */ x("div", { className: "handle-actions", children: [
1254
+ !V && l && /* @__PURE__ */ x("div", { className: "handle-actions", children: [
1249
1255
  /* @__PURE__ */ x(
1250
1256
  "button",
1251
1257
  {
1252
1258
  type: "button",
1253
1259
  className: `btn ${P.length > 0 ? "btn-danger" : "btn-primary"}`,
1254
1260
  disabled: P.length === 0,
1255
- onClick: p.removeRows,
1261
+ onClick: y.removeRows,
1256
1262
  children: [
1257
1263
  "Remover (",
1258
1264
  P.length,
@@ -1260,17 +1266,17 @@ const Lt = ({
1260
1266
  ]
1261
1267
  }
1262
1268
  ),
1263
- /* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: p.addRow, children: "Adicionar" })
1269
+ /* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: y.addRow, children: "Adicionar" })
1264
1270
  ] })
1265
1271
  ] }),
1266
1272
  /* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */ x("table", { className: "table-custom", children: [
1267
1273
  /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ x("tr", { children: [
1268
- !W && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
1274
+ !V && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
1269
1275
  "input",
1270
1276
  {
1271
1277
  type: "checkbox",
1272
1278
  checked: A,
1273
- onChange: (m) => p.toggleSelectAll(m.target.checked)
1279
+ onChange: (m) => y.toggleSelectAll(m.target.checked)
1274
1280
  }
1275
1281
  ) }),
1276
1282
  n.map((m) => /* @__PURE__ */ r(
@@ -1283,30 +1289,30 @@ const Lt = ({
1283
1289
  ))
1284
1290
  ] }) }),
1285
1291
  /* @__PURE__ */ x("tbody", { children: [
1286
- _.map((m, f) => /* @__PURE__ */ x("tr", { children: [
1287
- !W && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
1292
+ _.map((m, h) => /* @__PURE__ */ x("tr", { children: [
1293
+ !V && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
1288
1294
  "input",
1289
1295
  {
1290
1296
  type: "checkbox",
1291
1297
  checked: P.includes(m._uid),
1292
- onChange: () => p.toggleSelection(m._uid)
1298
+ onChange: () => y.toggleSelection(m._uid)
1293
1299
  }
1294
1300
  ) }),
1295
- n.map((c) => /* @__PURE__ */ r("td", { children: c.render ? c.render.length <= 1 ? c.render({
1301
+ n.map((d) => /* @__PURE__ */ r("td", { children: d.render ? d.render.length <= 1 ? d.render({
1296
1302
  row: m,
1297
- index: f,
1298
- updateRow: (h, b) => p.updateCellValue(m._uid, String(h), b),
1299
- isLocked: !!W,
1303
+ index: h,
1304
+ updateRow: (f, b) => y.updateCellValue(m._uid, String(f), b),
1305
+ isLocked: !!V,
1300
1306
  isView: !!a
1301
- }) : c.render(
1307
+ }) : d.render(
1302
1308
  m,
1303
- f,
1304
- (h, b) => p.updateCellValue(m._uid, h, b),
1305
- !!W,
1309
+ h,
1310
+ (f, b) => y.updateCellValue(m._uid, f, b),
1311
+ !!V,
1306
1312
  !!a
1307
- ) : m[c.key] }, `${m._uid}-${String(c.key)}`))
1313
+ ) : m[d.key] }, `${m._uid}-${String(d.key)}`))
1308
1314
  ] }, m._uid)),
1309
- _.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: W ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1315
+ _.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: V ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1310
1316
  ] })
1311
1317
  ] }) })
1312
1318
  ] });
@@ -1317,19 +1323,19 @@ const Lt = ({
1317
1323
  s = H().watch;
1318
1324
  } catch {
1319
1325
  }
1320
- const d = t !== void 0 ? t : s ? s(e) : void 0, l = C(() => {
1326
+ const c = t !== void 0 ? t : s ? s(e) : void 0, l = E(() => {
1321
1327
  try {
1322
1328
  const g = window.top.__REACT_ATTACHMENT_BRIDGE__;
1323
1329
  if (g) {
1324
- const a = g.getAttachment(e, d);
1325
- i(a || (d ? { name: d, documentId: 0 } : null));
1330
+ const a = g.getAttachment(e, c);
1331
+ i(a || (c ? { name: c, documentId: 0 } : null));
1326
1332
  } else
1327
- i(d ? { name: d, documentId: 0 } : null);
1333
+ i(c ? { name: c, documentId: 0 } : null);
1328
1334
  } catch {
1329
- i(d ? { name: d, documentId: 0 } : null);
1335
+ i(c ? { name: c, documentId: 0 } : null);
1330
1336
  }
1331
- }, [e, d, t]);
1332
- return E(() => {
1337
+ }, [e, c, t]);
1338
+ return j(() => {
1333
1339
  l();
1334
1340
  const o = setInterval(l, 2e3);
1335
1341
  return () => clearInterval(o);
@@ -1340,10 +1346,10 @@ const Lt = ({
1340
1346
  help: n,
1341
1347
  valueManual: i,
1342
1348
  onChangeManual: s,
1343
- forceReadOnly: d = !1,
1349
+ forceReadOnly: c = !1,
1344
1350
  forceHidden: l = !1
1345
1351
  }) => {
1346
- const o = !!s, { isReadOnly: g, isHidden: a } = I(), { isView: N } = L(), y = d || N || !!g(e), W = l || !!a(e), [V, _] = F(!1);
1352
+ const o = !!s, { isReadOnly: g, isHidden: a } = I(), { isView: N } = L(), p = c || N || !!g(e), V = l || !!a(e), [W, _] = F(!1);
1347
1353
  let P = null;
1348
1354
  try {
1349
1355
  P = H().control;
@@ -1352,7 +1358,7 @@ const Lt = ({
1352
1358
  const A = P && !o ? X({ name: e, control: P }).field : {
1353
1359
  value: i,
1354
1360
  onChange: (O) => s == null ? void 0 : s(O)
1355
- }, { attachment: p, sync: u } = St(e, i), m = () => {
1361
+ }, { attachment: y, sync: u } = St(e, i), m = () => {
1356
1362
  var O;
1357
1363
  try {
1358
1364
  const k = window.top;
@@ -1363,8 +1369,8 @@ const Lt = ({
1363
1369
  } catch {
1364
1370
  return { bridge: null, toast: null };
1365
1371
  }
1366
- }, f = C(() => {
1367
- if (y) return;
1372
+ }, h = E(() => {
1373
+ if (p) return;
1368
1374
  const O = document.createElement("input");
1369
1375
  O.type = "file", O.onchange = (k) => {
1370
1376
  const v = k.target.files[0];
@@ -1380,9 +1386,9 @@ const Lt = ({
1380
1386
  });
1381
1387
  }) : (o ? s == null || s(v.name) : A.onChange(v.name), _(!1));
1382
1388
  }, O.click();
1383
- }, [e, A, u, s, y, o]), c = (O) => {
1384
- if (O.stopPropagation(), y) return;
1385
- const k = (p == null ? void 0 : p.name) || i || A.value;
1389
+ }, [e, A, u, s, p, o]), d = (O) => {
1390
+ if (O.stopPropagation(), p) return;
1391
+ const k = (y == null ? void 0 : y.name) || i || A.value;
1386
1392
  if (!k) return;
1387
1393
  const { bridge: v, toast: S } = m();
1388
1394
  v ? v.removeByFileName(k) ? (o ? s == null || s("") : A.onChange(""), u()) : S && S({
@@ -1390,42 +1396,42 @@ const Lt = ({
1390
1396
  message: "Erro ao remover anexo",
1391
1397
  type: "danger"
1392
1398
  }) : (o ? s == null || s("") : A.onChange(""), u());
1393
- }, h = !!p && !V, b = (p == null ? void 0 : p.name) || i || A.value, D = [
1399
+ }, f = !!y && !W, b = (y == null ? void 0 : y.name) || i || A.value, D = [
1394
1400
  "fluig-attachment__box",
1395
- h ? "fluig-attachment__box--has-file" : "",
1396
- V ? "fluig-attachment__box--uploading" : "",
1397
- y && !h ? "readOnly" : "",
1398
- y && h ? "fluig-attachment__box--readonly-view" : ""
1401
+ f ? "fluig-attachment__box--has-file" : "",
1402
+ W ? "fluig-attachment__box--uploading" : "",
1403
+ p && !f ? "readOnly" : "",
1404
+ p && f ? "fluig-attachment__box--readonly-view" : ""
1399
1405
  ].join(" ");
1400
- return W ? null : /* @__PURE__ */ x("div", { className: "form-group fluig-attachment", children: [
1406
+ return V ? null : /* @__PURE__ */ x("div", { className: "form-group fluig-attachment", children: [
1401
1407
  t && /* @__PURE__ */ r("label", { className: "fluig-attachment__label", children: t }),
1402
1408
  /* @__PURE__ */ x(
1403
1409
  "div",
1404
1410
  {
1405
1411
  className: D,
1406
1412
  onClick: () => {
1407
- if (h) {
1408
- const O = m(), k = (p == null ? void 0 : p.physicalFileName) || (p == null ? void 0 : p.description) || (p == null ? void 0 : p.name) || b;
1413
+ if (f) {
1414
+ const O = m(), k = (y == null ? void 0 : y.physicalFileName) || (y == null ? void 0 : y.description) || (y == null ? void 0 : y.name) || b;
1409
1415
  O.bridge && k && O.bridge.view(k);
1410
1416
  } else
1411
- f();
1417
+ h();
1412
1418
  },
1413
1419
  children: [
1414
1420
  /* @__PURE__ */ x("span", { className: "fluig-attachment__content", children: [
1415
1421
  /* @__PURE__ */ r(
1416
1422
  "i",
1417
1423
  {
1418
- className: `flaticon icon-sm ${V ? "flaticon-loading" : h ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1424
+ className: `flaticon icon-sm ${W ? "flaticon-loading" : f ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1419
1425
  }
1420
1426
  ),
1421
- /* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: V ? " Enviando..." : h ? b : y ? "Nenhum arquivo" : n || "Anexar" })
1427
+ /* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: W ? " Enviando..." : f ? b : p ? "Nenhum arquivo" : n || "Anexar" })
1422
1428
  ] }),
1423
- h && !y && /* @__PURE__ */ r(
1429
+ f && !p && /* @__PURE__ */ r(
1424
1430
  "button",
1425
1431
  {
1426
1432
  type: "button",
1427
1433
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1428
- onClick: c,
1434
+ onClick: d,
1429
1435
  children: /* @__PURE__ */ r("i", { className: "flaticon flaticon-trash icon-sm" })
1430
1436
  }
1431
1437
  )
@@ -1441,16 +1447,16 @@ function It({
1441
1447
  onOpen: n,
1442
1448
  onClose: i,
1443
1449
  content: s,
1444
- footer: d,
1450
+ footer: c,
1445
1451
  width: l
1446
1452
  }) {
1447
- const o = C(
1453
+ const o = E(
1448
1454
  (g) => {
1449
1455
  g.key === "Escape" && i();
1450
1456
  },
1451
1457
  [i]
1452
1458
  );
1453
- return E(() => (t && (document.addEventListener("keydown", o), n == null || n(), document.body.style.overflow = "hidden"), () => {
1459
+ return j(() => (t && (document.addEventListener("keydown", o), n == null || n(), document.body.style.overflow = "hidden"), () => {
1454
1460
  document.removeEventListener("keydown", o), document.body.style.overflow = "auto";
1455
1461
  }), [t, o, n]), t ? /* @__PURE__ */ r(
1456
1462
  "div",
@@ -1486,7 +1492,7 @@ function It({
1486
1492
  )
1487
1493
  ] }),
1488
1494
  /* @__PURE__ */ r("div", { className: "modal-content", children: s }),
1489
- d && /* @__PURE__ */ r("div", { className: "modal-footer", children: d })
1495
+ c && /* @__PURE__ */ r("div", { className: "modal-footer", children: c })
1490
1496
  ]
1491
1497
  }
1492
1498
  )
@@ -1497,7 +1503,7 @@ export {
1497
1503
  Ft as Attachment,
1498
1504
  Tt as Checkbox,
1499
1505
  Et as DatePicker,
1500
- Vt as Input,
1506
+ Wt as Input,
1501
1507
  It as Modal,
1502
1508
  jt as RadioBtn,
1503
1509
  Dt as Select,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diefra_ecm_ui",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },