@wrrdev/fenix-ui 1.0.14 → 1.0.15
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/README.md +332 -332
- package/dist/components/accordion/accordion.d.ts +1 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +18 -13
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +2 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +3 -0
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +28 -4
- package/dist/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/datepicker/datepicker.d.ts.map +1 -1
- package/dist/components/datepicker/datepicker.js +7 -6
- package/dist/components/datepicker/datepicker.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +4 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +42 -4
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +5 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +49 -15
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown/dropdown.d.ts +5 -0
- package/dist/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/dropdown.js +34 -10
- package/dist/components/dropdown/dropdown.js.map +1 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +4 -3
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/knob/index.js.map +1 -1
- package/dist/components/knob/knob.d.ts +2 -0
- package/dist/components/knob/knob.d.ts.map +1 -1
- package/dist/components/knob/knob.js +15 -3
- package/dist/components/knob/knob.js.map +1 -1
- package/dist/components/multiselect/multiselect.d.ts +2 -0
- package/dist/components/multiselect/multiselect.d.ts.map +1 -1
- package/dist/components/multiselect/multiselect.js +38 -8
- package/dist/components/multiselect/multiselect.js.map +1 -1
- package/dist/components/orderlist/orderlist.d.ts.map +1 -1
- package/dist/components/orderlist/orderlist.js +1 -3
- package/dist/components/orderlist/orderlist.js.map +1 -1
- package/dist/components/pagination/index.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +1 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +19 -8
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/picklist/picklist.d.ts.map +1 -1
- package/dist/components/picklist/picklist.js +1 -3
- package/dist/components/picklist/picklist.js.map +1 -1
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/progress/progress.js +2 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/select/select.d.ts +2 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +36 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/skeleton/index.js.map +1 -1
- package/dist/components/skeleton/skeleton.d.ts +2 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +7 -2
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/table/expr.d.ts +38 -0
- package/dist/components/table/expr.d.ts.map +1 -0
- package/dist/components/table/expr.js +429 -0
- package/dist/components/table/expr.js.map +1 -0
- package/dist/components/table/table.d.ts +26 -8
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +402 -140
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +4 -3
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip/directive.js.map +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +2 -1
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/core/jsx.js.map +1 -1
- package/dist/core/presets.js.map +1 -1
- package/dist/core/sanitize.d.ts +36 -0
- package/dist/core/sanitize.d.ts.map +1 -0
- package/dist/core/sanitize.js +37 -0
- package/dist/core/sanitize.js.map +1 -0
- package/dist/core/tokens.js.map +1 -1
- package/dist/core/vue.js.map +1 -1
- package/dist/docs/app.d.ts.map +1 -1
- package/dist/docs/componentes/table.doc.d.ts.map +1 -1
- package/dist/fenix-ui.esm.js.map +1 -1
- package/dist/fenix-ui.umd.min.js +339 -208
- package/dist/fenix-ui2.esm.js +1156 -243
- package/dist/fenix-ui2.esm.js.map +1 -1
- package/dist/fenix-ui3.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/auto-import.js.map +1 -1
- package/package.json +212 -212
package/dist/fenix-ui.umd.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S){typeof define=="function"&&define.amd?define(S):S()})(function(){"use strict";var Yt=S=>{throw TypeError(S)};var Re=(S,A,v)=>A.has(S)||Yt("Cannot "+v);var Ut=(S,A,v)=>A.has(S)?Yt("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(S):A.set(S,v);var Xt=(S,A,v)=>(Re(S,A,"access private method"),v);var T,Jt;const S=new Map;function A(l){return S.set(l.name,l),l}A({name:"fenix",label:"Fenix (padrão)",tokens:{}}),A({name:"seiya",label:"Seiya",tokens:{color:{primary:"#e11d48",secondary:"#fb7185",info:"#f43f5e",danger:"#be123c"},radius:{sm:"6px",md:"10px",lg:"16px"},effect:{"focus-ring":"none"}}}),A({name:"shiryu",label:"Shiryu",tokens:{color:{primary:"#0d9488",secondary:"#2dd4bf",success:"#059669",info:"#14b8a6"},radius:{sm:"4px",md:"8px",lg:"14px"},effect:{"focus-ring":"none"}}}),A({name:"hyoga",label:"Hyoga",tokens:{color:{primary:"#0284c7",secondary:"#38bdf8",info:"#06b6d4",danger:"#e11d48"},surface:{surface:"#f0f9ff","surface-hover":"#e0f2fe"},radius:{sm:"8px",md:"12px",lg:"18px"}}}),A({name:"shun",label:"Shun",tokens:{color:{primary:"#db2777",secondary:"#f472b6",info:"#ec4899",warning:"#c026d3"},radius:{sm:"10px",md:"14px",lg:"20px"}}}),A({name:"ikki",label:"Ikki",tokens:{color:{primary:"#ea580c",secondary:"#fb923c",danger:"#dc2626",warning:"#f59e0b"},radius:{sm:"2px",md:"4px",lg:"6px"}}}),A({name:"aiolia",label:"Aiolia",tokens:{color:{primary:"#b45309",secondary:"#f59e0b",warning:"#eab308",info:"#84cc16"},radius:{sm:"6px",md:"12px",lg:"20px"},effect:{"focus-ring":"none"}}});function v(l,...t){return l.reduce((e,r,s)=>e+r+(s<t.length?String(t[s]):""),"")}const dt=class dt extends HTMLElement{static get observedAttributes(){return[]}constructor(){super(),this.root=this.attachShadow({mode:"open"})}attributeChangedCallback(){this.isConnected&&this.render()}connectedCallback(){this.render()}disconnectedCallback(){}hasAttr(t){return this.hasAttribute(t)}getAttr(t,e=""){var r;return(r=this.getAttribute(t))!=null?r:e}toggleAttr(t,e){e?this.setAttribute(t,""):this.removeAttribute(t)}setTemplate(t){const e=this.constructor.styles;this.root.innerHTML=`<style>${e}</style>${t}`}};dt.styles="";let y=dt;function k(l,t){var e;return typeof customElements!="undefined"&&!customElements.get(l)&&customElements.define(l,t),(e=customElements.get(l))!=null?e:t}const Wt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},Zt=/[&<>"'`=/]/g;function u(l){return l==null?"":String(l).replace(Zt,t=>Wt[t]||t)}const ht=class ht extends y{constructor(){super(...arguments),this.spawnRipple=t=>{if(this.hasAttr("disabled")||this.hasAttr("loading"))return;const e=getComputedStyle(this).getPropertyValue("--fx-effect-ripple").trim();if(e==="0"||e==="false")return;const r=this.root.querySelector(".btn");if(!r)return;const s=r.getBoundingClientRect(),i=Math.max(s.width,s.height),a=document.createElement("span");a.className="btn__ripple",a.style.width=a.style.height=`${i}px`,a.style.left=`${t.clientX-s.left-i/2}px`,a.style.top=`${t.clientY-s.top-i/2}px`,r.appendChild(a),a.addEventListener("animationend",()=>a.remove())}}static get observedAttributes(){return["variant","size","disabled","loading","type","full"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get loading(){return this.hasAttr("loading")}set loading(t){this.toggleAttr("loading",!!t)}render(){const t=this.hasAttr("loading"),e=this.hasAttr("disabled")||t,r=this.getAttr("type","button");this.setTemplate(`
|
|
2
2
|
<button class="btn" part="button" type="${r}">
|
|
3
3
|
<span class="btn__icon" part="icon"><slot name="icon"></slot></span>
|
|
4
4
|
<span class="btn__label" part="label"><slot></slot></span>
|
|
5
5
|
${t?'<span class="btn__spinner" aria-hidden="true"></span>':""}
|
|
6
6
|
</button>
|
|
7
|
-
`);const s=this.root.querySelector(".btn");if(!s)return;const i=s.querySelector(".btn__icon slot"),a=this.root.querySelector(".btn__icon"),o=!!(i!=null&&i.assignedNodes({flatten:!0}).some(n=>{var c;return n.nodeType===Node.ELEMENT_NODE||((c=n.textContent)!=null?c:"").trim()!==""}));a==null||a.toggleAttribute("hidden",!o),e?(s.setAttribute("disabled",""),s.setAttribute("aria-disabled","true")):(s.removeAttribute("disabled"),s.removeAttribute("aria-disabled")),t?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy")}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerdown",this.spawnRipple)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointerdown",this.spawnRipple)}};
|
|
7
|
+
`);const s=this.root.querySelector(".btn");if(!s)return;const i=s.querySelector(".btn__icon slot"),a=this.root.querySelector(".btn__icon"),o=!!(i!=null&&i.assignedNodes({flatten:!0}).some(n=>{var c;return n.nodeType===Node.ELEMENT_NODE||((c=n.textContent)!=null?c:"").trim()!==""}));a==null||a.toggleAttribute("hidden",!o),e?(s.setAttribute("disabled",""),s.setAttribute("aria-disabled","true")):(s.removeAttribute("disabled"),s.removeAttribute("aria-disabled")),t?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy")}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerdown",this.spawnRipple)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointerdown",this.spawnRipple)}};ht.styles=v`
|
|
8
8
|
:host {
|
|
9
9
|
display: inline-block;
|
|
10
10
|
vertical-align: middle;
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
@media (prefers-reduced-motion: reduce) {
|
|
106
106
|
.btn__ripple { display: none; }
|
|
107
107
|
}
|
|
108
|
-
`;let
|
|
108
|
+
`;let D=ht;function Gt(){return k("fx-button",D)}Gt();const ut=class ut extends y{static get observedAttributes(){return["variant","round"]}render(){this.setTemplate('<span class="badge" part="badge"><slot></slot></span>')}};ut.styles=v`
|
|
109
109
|
:host {
|
|
110
110
|
display: inline-flex;
|
|
111
111
|
vertical-align: middle;
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
:host([variant='danger']) .badge { background: var(--fx-color-danger); color: #fff; border-color: transparent; }
|
|
131
131
|
:host([variant='info']) .badge { background: var(--fx-color-info); color: #fff; border-color: transparent; }
|
|
132
132
|
:host(:not([round])) .badge { border-radius: var(--fx-radius-sm); }
|
|
133
|
-
`;let
|
|
133
|
+
`;let q=ut;function Qt(){return k("fx-badge",q)}Qt();const pt=class pt extends y{static get observedAttributes(){return["size"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){this.setTemplate('<span class="spinner" part="spinner" role="status" aria-label="Carregando"></span>')}};pt.styles=v`
|
|
134
134
|
:host {
|
|
135
135
|
display: inline-block;
|
|
136
136
|
vertical-align: middle;
|
|
@@ -151,22 +151,22 @@
|
|
|
151
151
|
@media (prefers-reduced-motion: reduce) {
|
|
152
152
|
.spinner { animation-duration: 2.5s; }
|
|
153
153
|
}
|
|
154
|
-
`;let M=
|
|
154
|
+
`;let M=pt;function te(){return k("fx-spinner",M)}te();const ft=class ft extends y{static get observedAttributes(){return["size","disabled","placeholder","searchable","clearable","error","success"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get options(){return[...this.querySelectorAll("option")].map(t=>{var e,r,s,i,a;return{value:(s=(r=t.getAttribute("value"))!=null?r:(e=t.textContent)==null?void 0:e.trim())!=null?s:"",label:(a=(i=t.textContent)==null?void 0:i.trim())!=null?a:""}})}connectedCallback(){super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}select(t){this.value=t,this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}}))}_navigateOptions(t){var i;t.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const e=Array.from(this.root.querySelectorAll(".opt"));if(!e.length)return;const r=e.indexOf(this.root.activeElement);let s=0;t.key==="ArrowDown"?s=r===-1?0:Math.min(r+1,e.length-1):t.key==="ArrowUp"?s=r===-1?e.length-1:Math.max(r-1,0):t.key==="Home"?s=0:t.key==="End"&&(s=e.length-1),(i=e[s])==null||i.focus()}render(){var d,m,p,b,w,z,_;const t=this.hasAttr("open"),e=this.root.querySelector(".search"),r=(d=e==null?void 0:e.value)!=null?d:"",s=e!=null&&this.root.activeElement===e,i=s?e.selectionStart:null,a=this.options;let o=this.getAttr("value");if(!o){const x=this.querySelector("option[selected]");o=(b=(p=x==null?void 0:x.getAttribute("value"))!=null?p:(m=x==null?void 0:x.textContent)==null?void 0:m.trim())!=null?b:""}const n=(z=(w=a.find(x=>x.value===o))==null?void 0:w.label)!=null?z:"",c=this.getAttr("placeholder","Selecione…"),h=r?a.filter(x=>x.label.toLowerCase().includes(r.toLowerCase())):a;this.setTemplate(`
|
|
155
155
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${t}">
|
|
156
|
-
<span class="${n?"label":"placeholder"}">${n||c}</span>
|
|
156
|
+
<span class="${n?"label":"placeholder"}">${u(n)||u(c)}</span>
|
|
157
157
|
<span class="actions">
|
|
158
158
|
${this.hasAttr("clearable")&&o?'<button type="button" class="clear" part="clear" aria-label="Limpar">×</button>':""}
|
|
159
159
|
<span class="caret">▼</span>
|
|
160
160
|
</span>
|
|
161
161
|
</span>
|
|
162
162
|
<div class="panel" part="panel" role="listbox">
|
|
163
|
-
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${this.getAttr("search-placeholder","Pesquisar…")}">`:""}
|
|
164
|
-
${
|
|
165
|
-
<button type="button" class="opt" role="option" data-value="${x.value}"
|
|
166
|
-
aria-selected="${x.value===o}">${x.label}</button>`).join("")}
|
|
167
|
-
${
|
|
163
|
+
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${u(this.getAttr("search-placeholder","Pesquisar…"))}">`:""}
|
|
164
|
+
${h.map(x=>`
|
|
165
|
+
<button type="button" class="opt" role="option" data-value="${u(x.value)}"
|
|
166
|
+
aria-selected="${x.value===o}">${u(x.label)}</button>`).join("")}
|
|
167
|
+
${h.length===0?`<div class="empty">${u(this.getAttr("no-results","Nenhum resultado"))}</div>`:""}
|
|
168
168
|
</div>
|
|
169
|
-
`),t&&this.setAttribute("open","");const
|
|
169
|
+
`),t&&this.setAttribute("open","");const g=this.root.querySelector(".search");if(g&&(g.value=r,g.addEventListener("input",()=>this.render()),g.addEventListener("click",x=>x.stopPropagation()),s)){g.focus();try{g.setSelectionRange(i,i)}catch(x){}}const f=this.root.querySelector(".trigger");f&&(this.disabled&&f.setAttribute("aria-disabled","true"),f.addEventListener("click",x=>{var L;this.disabled||x.target.closest(".clear")||(this.toggleAttribute("open"),this.render(),(L=this.root.querySelector(".search"))==null||L.focus())}),f.addEventListener("keydown",x=>{var L;if(!this.disabled){if(x.key==="Enter"||x.key===" "){x.preventDefault(),f.click();return}if(x.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(L=this.root.querySelector(".trigger"))==null||L.focus());return}(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Home"||x.key==="End")&&this._navigateOptions(x)}}),(_=this.root.querySelector(".clear"))==null||_.addEventListener("click",x=>{x.stopPropagation(),this.value="",this.removeAttribute("open"),this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:""}}))}),this.root.querySelectorAll(".opt").forEach(x=>{x.addEventListener("click",()=>this.select(x.dataset.value))}))}};ft.styles=v`
|
|
170
170
|
:host {
|
|
171
171
|
display: inline-block;
|
|
172
172
|
vertical-align: middle;
|
|
@@ -308,14 +308,14 @@
|
|
|
308
308
|
}
|
|
309
309
|
.clear:hover { color: var(--fx-color-danger); }
|
|
310
310
|
.clear[hidden] { display: none; }
|
|
311
|
-
`;let
|
|
311
|
+
`;let I=ft;function ee(){return k("fx-select",I)}ee();const gt=class gt extends y{static get observedAttributes(){return["type","size","placeholder","disabled","readonly","min","max","step"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}render(){const t=this.getAttr("type","text"),e=this.getAttr("placeholder"),r=this.hasAttr("readonly"),s=this.hasAttr("disabled"),i=this.getAttr("min"),a=this.getAttr("max"),o=this.getAttr("step");this.setTemplate(`
|
|
312
312
|
${this.hasAttr("clearable")?'<div class="wrap">':""}
|
|
313
|
-
<input class="field" part="input" type="${t}"
|
|
314
|
-
${e?`placeholder="${e}"`:""}
|
|
315
|
-
${i?`min="${i}"`:""} ${a?`max="${a}"`:""} ${o?`step="${o}"`:""}
|
|
313
|
+
<input class="field" part="input" type="${u(t)}"
|
|
314
|
+
${e?`placeholder="${u(e)}"`:""}
|
|
315
|
+
${i?`min="${u(i)}"`:""} ${a?`max="${u(a)}"`:""} ${o?`step="${u(o)}"`:""}
|
|
316
316
|
/>
|
|
317
317
|
${this.hasAttr("clearable")?'<button type="button" class="clear" part="clear" aria-label="Limpar" tabindex="-1">×</button></div>':""}
|
|
318
|
-
`);const n=this.root.querySelector(".field");if(!n)return;n.value=this.getAttr("value"),s&&n.setAttribute("disabled",""),r&&n.setAttribute("readonly","");const c=
|
|
318
|
+
`);const n=this.root.querySelector(".field");if(!n)return;n.value=this.getAttr("value"),s&&n.setAttribute("disabled",""),r&&n.setAttribute("readonly","");const c=f=>{this.value=n.value,this.dispatchEvent(new CustomEvent(f,{bubbles:!0,composed:!0,detail:{value:n.value}}))};n.addEventListener("input",f=>{f.stopPropagation(),c("input")}),n.addEventListener("change",f=>{f.stopPropagation(),c("change")});const h=this.root.querySelector(".clear"),g=()=>{h==null||h.toggleAttribute("hidden",n.value==="")};g(),h==null||h.addEventListener("click",()=>{n.value="",g(),c("input"),c("change"),n.focus()}),n.addEventListener("input",g)}};gt.styles=v`
|
|
319
319
|
:host {
|
|
320
320
|
display: inline-block;
|
|
321
321
|
vertical-align: middle;
|
|
@@ -386,13 +386,13 @@
|
|
|
386
386
|
}
|
|
387
387
|
.clear:hover { color: var(--fx-color-danger); }
|
|
388
388
|
.clear[hidden] { display: none; }
|
|
389
|
-
`;let
|
|
389
|
+
`;let N=gt;function re(){return k("fx-input",N)}re();const bt=class bt extends y{static get observedAttributes(){return["checked","disabled","size"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}render(){this.setTemplate(`
|
|
390
390
|
<button class="switch" part="switch" type="button" role="switch"
|
|
391
391
|
aria-checked="${this.checked}" ${this.hasAttr("disabled")?"disabled":""}>
|
|
392
392
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
393
393
|
<span class="label" part="label"><slot></slot></span>
|
|
394
394
|
</button>
|
|
395
|
-
`);const t=this.root.querySelector(".switch");t&&t.addEventListener("click",()=>{this.hasAttr("disabled")||(this.checked=!this.checked,t.setAttribute("aria-checked",String(this.checked)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked}})))})}};
|
|
395
|
+
`);const t=this.root.querySelector(".switch");t&&t.addEventListener("click",()=>{this.hasAttr("disabled")||(this.checked=!this.checked,t.setAttribute("aria-checked",String(this.checked)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked}})))})}};bt.styles=v`
|
|
396
396
|
:host {
|
|
397
397
|
display: inline-flex;
|
|
398
398
|
vertical-align: middle;
|
|
@@ -446,14 +446,14 @@
|
|
|
446
446
|
:host([size='lg']) .track { width: 48px; height: 26px; }
|
|
447
447
|
:host([size='lg']) .thumb { top: 4px; left: 4px; width: 18px; height: 18px; }
|
|
448
448
|
:host([size='lg'][checked]) .thumb { transform: translateX(22px); }
|
|
449
|
-
`;let
|
|
449
|
+
`;let j=bt;function se(){return k("fx-switch",j)}se();const vt=class vt extends y{constructor(){super(...arguments),this.selected=new Set}static get observedAttributes(){return["disabled","placeholder"]}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get options(){return[...this.querySelectorAll("option")].map(t=>{var e,r,s,i,a;return{value:(s=(r=t.getAttribute("value"))!=null?r:(e=t.textContent)==null?void 0:e.trim())!=null?s:"",label:(a=(i=t.textContent)==null?void 0:i.trim())!=null?a:""}})}connectedCallback(){this.selected=new Set(this.values),super.connectedCallback(),this.observer=new MutationObserver(()=>this.render()),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0}),this.docListener=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||(this.removeAttribute("open"),this.render()))},document.addEventListener("click",this.docListener)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect(),this.docListener&&document.removeEventListener("click",this.docListener)}commit(){this.values=[...this.selected],this.render(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:[...this.selected]}}))}toggleValue(t){this.selected.has(t)?this.selected.delete(t):this.selected.add(t),this.commit()}_navigateOptions(t){var i;t.preventDefault(),this.hasAttr("open")||(this.toggleAttribute("open"),this.render());const e=Array.from(this.root.querySelectorAll(".opt"));if(!e.length)return;const r=e.indexOf(this.root.activeElement);let s=0;t.key==="ArrowDown"?s=r===-1?0:Math.min(r+1,e.length-1):t.key==="ArrowUp"?s=r===-1?e.length-1:Math.max(r-1,0):t.key==="Home"?s=0:t.key==="End"&&(s=e.length-1),(i=e[s])==null||i.focus()}render(){var c,h,g,f;const t=this.hasAttr("open"),e=(h=(c=this.root.querySelector(".search"))==null?void 0:c.value)!=null?h:"",r=this.options;for(const d of[...this.selected])r.some(m=>m.value===d)||this.selected.delete(d);const s=r.filter(d=>this.selected.has(d.value)),i=this.getAttr("placeholder","Selecione…"),a=e?r.filter(d=>d.label.toLowerCase().includes(e.toLowerCase())):r;this.setTemplate(`
|
|
450
450
|
<span class="trigger" part="trigger" role="button" tabindex="${this.disabled?-1:0}" aria-haspopup="listbox" aria-expanded="${t}" aria-disabled="${this.disabled}">
|
|
451
451
|
<span class="lead">
|
|
452
452
|
${s.length?s.map(d=>`
|
|
453
|
-
<span class="chip" data-value="${d.value}">
|
|
454
|
-
${d.label}
|
|
455
|
-
<span class="chip__x" role="button" aria-label="Remover ${d.label}">×</span>
|
|
456
|
-
</span>`).join(""):`<span class="placeholder">${i}</span>`}
|
|
453
|
+
<span class="chip" data-value="${u(d.value)}">
|
|
454
|
+
${u(d.label)}
|
|
455
|
+
<span class="chip__x" role="button" aria-label="Remover ${u(d.label)}">×</span>
|
|
456
|
+
</span>`).join(""):`<span class="placeholder">${u(i)}</span>`}
|
|
457
457
|
</span>
|
|
458
458
|
<span class="trigger-right">
|
|
459
459
|
${this.hasAttr("clearable")&&s.length?'<button type="button" class="icon-btn clear" part="clear" aria-label="Limpar seleção">×</button>':""}
|
|
@@ -465,17 +465,17 @@
|
|
|
465
465
|
<span class="count">${s.length} selecionado${s.length===1?"":"s"}</span>
|
|
466
466
|
${this.hasAttr("clearable")&&s.length?'<button type="button" class="clear-all">Limpar tudo</button>':""}
|
|
467
467
|
</div>
|
|
468
|
-
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${this.getAttr("search-placeholder","Pesquisar…")}">`:""}
|
|
468
|
+
${this.hasAttr("searchable")?`<input class="search" part="search" type="text" placeholder="${u(this.getAttr("search-placeholder","Pesquisar…"))}">`:""}
|
|
469
469
|
<ul class="list">
|
|
470
470
|
${a.map(d=>`
|
|
471
|
-
<li><button type="button" class="opt" role="option" data-value="${d.value}"
|
|
471
|
+
<li><button type="button" class="opt" role="option" data-value="${u(d.value)}"
|
|
472
472
|
aria-selected="${this.selected.has(d.value)}">
|
|
473
|
-
<span class="box" aria-hidden="true"></span>${d.label}
|
|
473
|
+
<span class="box" aria-hidden="true"></span>${u(d.label)}
|
|
474
474
|
</button></li>`).join("")}
|
|
475
|
-
${a.length===0?`<li class="empty">${this.getAttr("no-results","Nenhum resultado")}</li>`:""}
|
|
475
|
+
${a.length===0?`<li class="empty">${u(this.getAttr("no-results","Nenhum resultado"))}</li>`:""}
|
|
476
476
|
</ul>
|
|
477
477
|
</div>
|
|
478
|
-
`),t&&this.setAttribute("open","");const o=this.root.querySelector(".search");o&&(o.value=e,o.addEventListener("input",()=>{var
|
|
478
|
+
`),t&&this.setAttribute("open","");const o=this.root.querySelector(".search");o&&(o.value=e,o.addEventListener("input",()=>{var p;const d=(p=o.selectionStart)!=null?p:o.value.length;this.render();const m=this.root.querySelector(".search");m&&(m.focus(),m.setSelectionRange(d,d))}),o.addEventListener("click",d=>d.stopPropagation()));const n=this.root.querySelector(".trigger");n&&(n.addEventListener("click",d=>{if(!this.disabled&&!d.target.closest(".clear")&&!d.target.closest(".chip__x")){if(this.toggleAttribute("open"),this.hasAttr("open")){const m=this.getBoundingClientRect();this.toggleAttribute("up",m.bottom+300>window.innerHeight&&m.top>300)}else this.removeAttribute("up");this.render()}}),n.addEventListener("keydown",d=>{var m;if(!this.disabled){if(d.key==="Enter"||d.key===" "){d.preventDefault(),n.dispatchEvent(new MouseEvent("click",{bubbles:!0}));return}if(d.key==="Escape"){this.hasAttr("open")&&(this.removeAttribute("open"),this.render(),(m=this.root.querySelector(".trigger"))==null||m.focus());return}(d.key==="ArrowDown"||d.key==="ArrowUp"||d.key==="Home"||d.key==="End")&&this._navigateOptions(d)}}),(g=this.root.querySelector(".clear"))==null||g.addEventListener("click",d=>{d.stopPropagation(),this.selected.clear(),this.commit()}),(f=this.root.querySelector(".clear-all"))==null||f.addEventListener("click",d=>{d.stopPropagation(),this.selected.clear(),this.commit()}),this.root.querySelectorAll(".chip").forEach(d=>{var m;(m=d.querySelector(".chip__x"))==null||m.addEventListener("click",p=>{p.stopPropagation(),this.toggleValue(d.dataset.value)})}),this.root.querySelectorAll(".opt").forEach(d=>{d.addEventListener("click",()=>this.toggleValue(d.dataset.value))}))}};vt.styles=v`
|
|
479
479
|
:host {
|
|
480
480
|
display: inline-block;
|
|
481
481
|
vertical-align: middle;
|
|
@@ -690,14 +690,14 @@
|
|
|
690
690
|
.opt[aria-selected='true'] .box::after { content: '✓'; }
|
|
691
691
|
.empty { padding: var(--fx-space-md); color: var(--fx-text-muted); text-align: center; }
|
|
692
692
|
:host([disabled]) .trigger { opacity: 0.55; cursor: not-allowed; background: var(--fx-surface-surface-hover); }
|
|
693
|
-
`;let
|
|
693
|
+
`;let P=vt;function ie(){return k("fx-multiselect",P)}ie();const $=(l,t,e)=>l*1e4+t*100+e;function E(l){const t=/^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?$/.exec(l.trim());if(!t)return null;const e=+t[1],r=t[2]?+t[2]:1,s=t[3]?+t[3]:null;return s!==null?{lo:$(e,r,s),hi:$(e,r,s)}:t[2]?{lo:$(e,r,1),hi:$(e,r,31)}:{lo:$(e,1,1),hi:$(e,12,31)}}const mt=class mt extends y{constructor(){super(...arguments),this.view="days",this.cursor={y:new Date().getFullYear(),m:new Date().getMonth()},this.pickStart=null,this.pickEnd=null}static get observedAttributes(){return["value","start","end","min","max","range","mode","values","locale","disabled"]}get mode(){const t=this.getAttr("mode");return t==="range"||t==="multiple"?t:this.hasAttr("range")?"range":"single"}set mode(t){this.setAttribute("mode",t)}get range(){return this.mode==="range"}set range(t){this.toggleAttr("range",!!t)}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}bounds(){return{min:E(this.getAttr("min","")),max:E(this.getAttr("max",""))}}locale(){return this.getAttr("locale","pt-BR")}fmt(t,e){try{return new Intl.DateTimeFormat(this.locale(),t).format(e)}catch(r){return new Intl.DateTimeFormat("pt-BR",t).format(e)}}dayDisabled(t,e,r){const{min:s,max:i}=this.bounds(),a=$(t,e+1,r);return s!==null&&a<s.lo||i!==null&&a>i.hi}monthDisabled(t,e){const{min:r,max:s}=this.bounds(),i=$(t,e,1),a=$(t,e,31);return r!==null&&a<r.lo||s!==null&&i>s.hi}yearDisabled(t){const{min:e,max:r}=this.bounds(),s=$(t,1,1),i=$(t,12,31);return e!==null&&i<e.lo||r!==null&&s>r.hi}dayKeyOf(t){return $(t.getFullYear(),t.getMonth()+1,t.getDate())}keyToDate(t){return new Date(Math.floor(t/1e4),Math.floor(t/100)%100-1,t%100)}iso(t){const e=this.keyToDate(t),r=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${r(e.getMonth()+1)}-${r(e.getDate())}`}selection(){const t=new Set(this.values.map(r=>{var s,i;return(i=(s=E(r))==null?void 0:s.lo)!=null?i:0}).filter(Boolean));if(this.mode==="range"){let r=this.pickStart,s=this.pickEnd;const i=E(this.getAttr("start","")),a=E(this.getAttr("end",""));return r===null&&i&&(r=i.lo),s===null&&a&&(s=a.lo),{start:r,end:s,single:null,multi:t}}if(this.mode==="multiple")return{start:null,end:null,single:null,multi:t};const e=E(this.getAttr("value",""));return{start:null,end:null,single:e?e.lo:null,multi:t}}emit(){if(this.mode==="range"){const t={start:this.pickStart!==null?this.iso(this.pickStart):this.getAttr("start",""),end:this.pickEnd!==null?this.iso(this.pickEnd):this.getAttr("end","")};this.setAttribute("start",t.start),this.setAttribute("end",t.end),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t}))}else if(this.mode==="multiple"){const t=this.values;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{values:t}}))}else{const t=this.getAttr("value");this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:t}}))}}pickDay(t){if(this.mode==="range"){if(this.pickStart===null||this.pickEnd!==null){this.pickStart=t,this.pickEnd=null,this.setAttribute("start",this.iso(t)),this.removeAttribute("end"),this.render();return}t<this.pickStart?[this.pickStart,this.pickEnd]=[t,this.pickStart]:this.pickEnd=t,this.emit()}else if(this.mode==="multiple"){const e=new Set(this.values),r=this.iso(t);e.has(r)?e.delete(r):e.add(r),this.values=[...e].sort(),this.emit()}else this.value=this.iso(t),this.emit();this.render()}navigate(t){if(this.view==="days"){const e=new Date(this.cursor.y,this.cursor.m+t,1);this.cursor={y:e.getFullYear(),m:e.getMonth()}}else this.view==="months"?this.cursor.y+=t:this.cursor.y+=t*12;this.render()}render(){const t=this.dayKeyOf(new Date),e=this.selection(),r=this.locale(),s={days:this.fmt({month:"long",year:"numeric"},new Date(this.cursor.y,this.cursor.m,1)),months:String(this.cursor.y),years:`${Math.floor(this.cursor.y/12)*12} – ${Math.floor(this.cursor.y/12)*12+11}`};let i="";if(this.view==="days")i=[...Array(7)].map((c,h)=>this.fmt({weekday:"short"},new Date(2024,8,1+h))).map(c=>`<span class="wd">${c}</span>`).join("")+this.daysHtml(t,e,r);else if(this.view==="months")i=[...Array(12)].map((n,c)=>{const h=this.monthDisabled(this.cursor.y,c+1);return`<button type="button" class="cell" data-month="${c}" ${h?"disabled":""}>${this.fmt({month:"short"},new Date(this.cursor.y,c,1))}</button>`}).join("");else{const n=Math.floor(this.cursor.y/12)*12;i=[...Array(12)].map((c,h)=>{const g=n+h,f=this.yearDisabled(g);return`<button type="button" class="cell" data-year="${g}" ${f?"disabled":""}>${g}</button>`}).join("")}const a=this.view==="days"?'data-goto="months"':this.view==="months"?'data-goto="years"':"";this.setTemplate(`
|
|
694
694
|
<div class="head">
|
|
695
695
|
<button type="button" class="nav" data-nav="-1" aria-label="Anterior">‹</button>
|
|
696
696
|
<button type="button" class="title" part="title" ${a}>${s[this.view]}</button>
|
|
697
697
|
<button type="button" class="nav" data-nav="1" aria-label="Próximo">›</button>
|
|
698
698
|
</div>
|
|
699
699
|
<div class="grid ${this.view}">${i}</div>
|
|
700
|
-
`),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const o=this.root.querySelector("[data-goto]");o==null||o.addEventListener("click",()=>{this.view=o.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(t,e,r){const{y:s,m:i}=this.cursor,a=new Date(s,i,1).getDay(),o=new Date(s,i+1,0).getDate(),n=new Date(s,i,0).getDate();let c="";for(let
|
|
700
|
+
`),this.root.querySelectorAll("[data-nav]").forEach(n=>n.addEventListener("click",()=>this.navigate(Number(n.dataset.nav))));const o=this.root.querySelector("[data-goto]");o==null||o.addEventListener("click",()=>{this.view=o.dataset.goto,this.render()}),this.root.querySelectorAll("[data-day]").forEach(n=>n.addEventListener("click",()=>this.pickDay(Number(n.dataset.day)))),this.root.querySelectorAll("[data-month]").forEach(n=>n.addEventListener("click",()=>{this.cursor.m=Number(n.dataset.month),this.view="days",this.render()})),this.root.querySelectorAll("[data-year]").forEach(n=>n.addEventListener("click",()=>{this.cursor.y=Number(n.dataset.year),this.view="months",this.render()}))}daysHtml(t,e,r){const{y:s,m:i}=this.cursor,a=new Date(s,i,1).getDay(),o=new Date(s,i+1,0).getDate(),n=new Date(s,i,0).getDate();let c="";for(let h=a-1;h>=0;h--)c+=`<span class="cell muted">${n-h}</span>`;for(let h=1;h<=o;h++){const g=$(s,i+1,h),f=e.single===g||e.start===g||e.end===g||e.multi.has(g),d=e.start!==null&&e.end!==null&&g>e.start&&g<e.end,m=["cell",f?"sel":"",d?"in-range":"",g===t?"today":""].filter(Boolean).join(" ");c+=`<button type="button" class="${m}" data-day="${g}" ${this.dayDisabled(s,i,h)?"disabled":""}>${h}</button>`}return c}};mt.styles=v`
|
|
701
701
|
:host {
|
|
702
702
|
display: inline-block;
|
|
703
703
|
font-family: var(--fx-font-family);
|
|
@@ -827,11 +827,11 @@
|
|
|
827
827
|
cursor: not-allowed;
|
|
828
828
|
pointer-events: none;
|
|
829
829
|
}
|
|
830
|
-
`;let
|
|
830
|
+
`;let F=mt;function ae(){return k("fx-calendar",F)}ae();const xt=class xt extends y{constructor(){super(...arguments),this.time={h:0,m:0,s:0}}static get observedAttributes(){return["value","start","end","values","mode","min","max","placeholder","disabled","format","show-time","free-text"]}get mode(){const t=this.getAttr("mode","single");return["single","range","multiple"].includes(t)?t:"single"}set mode(t){this.setAttribute("mode",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get values(){const t=this.getAttr("values");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}set values(t){this.setAttribute("values",t.join(","))}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}connectedCallback(){super.connectedCallback(),this.docListener=t=>{this.hasAttr("open")&&(t.composedPath().includes(this)||this.removeAttribute("open"))},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener)}formatDate(t){if(!t)return"";const e=this.getAttr("format");if(!e)return t.split("T")[0];const[r,s]=t.split("T"),[i="",a="",o=""]=r.split("-"),[n="00",c="00",h="00"]=(s!=null?s:"").split(":");return e.replace(/yyyy/gi,"").replace(/MM/g,"").replace(/mm/g,"").replace(/dd/gi,"").replace(/HH/g,"").replace(/SS/gi,"").replace(/\u0001/g,i).replace(/\u0002/g,a).replace(/\u0003/g,o).replace(/\u0004/g,n).replace(/\u0005/g,c).replace(/\u0006/g,h)}displayText(){if(this.mode==="range"){const e=this.getAttr("start"),r=this.getAttr("end");if(this.hasAttr("show-time"),!e&&!r)return"";if(this.hasAttr("show-time")){const s=i=>i?`${this.formatDate(i)} ${this.timeText()}`:i?`${this.formatDate(i)} …`:"";return e&&r?`${s(e)} → ${s(r)}`:s(e)}return e&&r?`${this.formatDate(e)} → ${this.formatDate(r)}`:e?`${this.formatDate(e)} → …`:""}if(this.mode==="multiple")return this.values.map(e=>this.formatDate(e)).join(", ");const t=this.formatDate(this.value);return t&&this.hasAttr("show-time")?`${t} ${this.timeText()}`:t}timeText(){const t=e=>String(e).padStart(2,"0");return`${t(this.time.h)}:${t(this.time.m)}:${t(this.time.s)}`}loadTimeFromValue(){const e=(this.value||this.getAttr("start")||"").split("T")[1];if(!e)return;const[r,s,i]=e.split(":").map(a=>parseInt(a,10));this.time={h:r||0,m:s||0,s:i||0}}withTime(t){return t&&(this.hasAttr("show-time")?`${t}T${this.timeText()}`:t)}render(){var h,g;const t=this.disabled,e=this.hasAttr("clearable"),r=this.displayText(),s=r.length>0,i=this.hasAttr("show-time");this.loadTimeFromValue();let a=`min="${u(this.getAttr("min"))}" max="${u(this.getAttr("max"))}"`;if(this.mode==="range")a+=` range start="${u(this.getAttr("start"))}" end="${u(this.getAttr("end"))}"`;else if(this.mode==="multiple"){const f=this.values.map(d=>d.split("T")[0]).join(",");a+=` mode="multiple" values="${u(f)}"`}else{const f=(h=this.value.split("T")[0])!=null?h:"";a+=` value="${u(f)}"`}this.setTemplate(`
|
|
831
831
|
<div class="field" part="field">
|
|
832
832
|
<input class="display" part="display" type="text" ${this.hasAttr("free-text")&&!t?"":"readonly"}
|
|
833
|
-
placeholder="${this.getAttr("placeholder","dd/mm/aaaa")}"
|
|
834
|
-
value="${r}" ${t?"disabled":""}>
|
|
833
|
+
placeholder="${u(this.getAttr("placeholder","dd/mm/aaaa"))}"
|
|
834
|
+
value="${u(r)}" ${t?"disabled":""}>
|
|
835
835
|
<button type="button" class="clear" part="clear" aria-label="Limpar"
|
|
836
836
|
${e&&s?"":"hidden"}>
|
|
837
837
|
×
|
|
@@ -852,7 +852,7 @@
|
|
|
852
852
|
<input class="t-s" type="number" min="0" max="59" value="${this.time.s}" aria-label="Segundo">
|
|
853
853
|
</div>`:""}
|
|
854
854
|
</div>
|
|
855
|
-
`);const o=this.root.querySelector(".field");if(!o||t)return;o.addEventListener("click",
|
|
855
|
+
`);const o=this.root.querySelector(".field");if(!o||t)return;o.addEventListener("click",f=>{if(!f.target.closest(".clear")&&!(this.hasAttr("free-text")&&f.target.classList.contains("display")))if(this.toggleAttribute("open"),this.hasAttr("open")){const d=this.getBoundingClientRect();this.toggleAttribute("up",d.bottom+340>window.innerHeight&&d.top>340)}else this.removeAttribute("up")}),(g=this.root.querySelector(".clear"))==null||g.addEventListener("click",f=>{f.stopPropagation(),this.removeAttribute("value"),this.removeAttribute("start"),this.removeAttribute("end"),this.removeAttribute("values"),this.removeAttribute("open"),this.render(),this.emitChange({})});const n=this.root.querySelector(".pop fx-calendar");n==null||n.addEventListener("change",f=>{var m;const d=(m=f.detail)!=null?m:{};(d.start!==void 0||d.end!==void 0)&&(d.start?this.setAttribute("start",this.withTime(d.start)):this.removeAttribute("start"),d.end?this.setAttribute("end",this.withTime(d.end)):this.removeAttribute("end")),d.values!==void 0&&(this.values=d.values.map(p=>this.withTime(p))),d.value!==void 0&&(d.value?this.setAttribute("value",this.withTime(d.value)):this.removeAttribute("value"),this.mode==="single"&&this.removeAttribute("open")),this.render(),this.emitChange(d)});const c=this.root.querySelector(".display");if(c&&this.hasAttr("free-text")&&!t&&(c.addEventListener("keydown",f=>{f.key==="Enter"&&(f.preventDefault(),this.commitTyped(c))}),c.addEventListener("blur",()=>this.commitTyped(c))),i){const f=()=>{const d=this.root.querySelector(".t-h"),m=this.root.querySelector(".t-m"),p=this.root.querySelector(".t-s"),b=(_,x)=>Math.min(x,Math.max(0,parseInt(_!=null?_:"0",10)||0));this.time={h:b(d==null?void 0:d.value,23),m:b(m==null?void 0:m.value,59),s:b(p==null?void 0:p.value,59)};const w=_=>_.split("T")[0]?`${_.split("T")[0]}T${this.timeText()}`:_;this.value&&this.setAttribute("value",w(this.value)),this.getAttr("start")&&this.setAttribute("start",w(this.getAttr("start"))),this.getAttr("end")&&this.setAttribute("end",w(this.getAttr("end"))),this.values.length&&(this.values=this.values.map(_=>w(_)));const z=this.root.querySelector(".display");z&&(z.value=this.displayText()),this.emitChange({value:this.value})};[".t-h",".t-m",".t-s"].forEach(d=>{var m;(m=this.root.querySelector(d))==null||m.addEventListener("input",f)})}}emitChange(t){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:t}))}parseTyped(t){var p,b;const e=t.trim();if(!e)return null;const r=this.getAttr("format","dd/mm/yyyy").toLowerCase(),s=["dd","mm","yyyy"].filter(w=>r.includes(w));if(s.length<3)return null;const i=e.split(new RegExp("[^0-9]+")).filter(Boolean);if(i.length!==3)return null;const a={};s.forEach((w,z)=>a[w]=i[z]);const o=`${a.yyyy}-${((p=a.mm)!=null?p:"").padStart(2,"0")}-${((b=a.dd)!=null?b:"").padStart(2,"0")}`,n=new Date(`${o}T12:00:00`);if(Number.isNaN(n.getTime()))return null;const[c,h,g]=o.split("-").map(w=>parseInt(w,10));if(n.getFullYear()!==c||n.getMonth()+1!==h||n.getDate()!==g)return null;const f=(w,z)=>w.split("T")[0].localeCompare(z.split("T")[0]),d=this.getAttr("min"),m=this.getAttr("max");return d&&f(o,d)<0||m&&f(o,m)>0?null:o}commitTyped(t){const e=this.parseTyped(t.value);if(!e){t.classList.add("invalid"),this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{text:t.value}})),t.value=this.displayText(),setTimeout(()=>t.classList.remove("invalid"),1500);return}if(this.mode==="single")this.setAttribute("value",this.withTime(e)),this.emitChange({value:this.value});else if(this.mode==="range"){if(!this.getAttr("start")||this.getAttr("start")&&this.getAttr("end"))this.setAttribute("start",this.withTime(e)),this.removeAttribute("end");else{const[r,s]=[this.getAttr("start").split("T")[0],e].sort();this.setAttribute("start",this.withTime(r)),this.setAttribute("end",this.withTime(s))}this.emitChange({start:this.getAttr("start"),end:this.getAttr("end")})}else{const r=this.values.filter(s=>s.split("T")[0]!==e);r.push(this.withTime(e)),this.values=r,this.emitChange({values:this.values})}this.render()}};xt.styles=v`
|
|
856
856
|
:host {
|
|
857
857
|
display: inline-block;
|
|
858
858
|
vertical-align: middle;
|
|
@@ -995,7 +995,7 @@
|
|
|
995
995
|
:host([disabled]) .display { cursor: not-allowed; }
|
|
996
996
|
:host([free-text]) .display { cursor: text; }
|
|
997
997
|
:host([free-text]) .display.invalid { border-bottom: 2px solid var(--fx-color-danger); }
|
|
998
|
-
`;let
|
|
998
|
+
`;let V=xt;function oe(){return k("fx-datepicker",V)}oe();const yt=class yt extends y{static get observedAttributes(){return["checked","disabled","indeterminate"]}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get indeterminate(){return this.hasAttr("indeterminate")}set indeterminate(t){this.toggleAttr("indeterminate",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){const t=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-checkbox")||this.style.setProperty("--fx-size-checkbox",t),this.setTemplate(`
|
|
999
999
|
<span class="box" part="box" role="checkbox" tabindex="0"
|
|
1000
1000
|
aria-checked="${this.indeterminate?"mixed":this.checked}"
|
|
1001
1001
|
aria-disabled="${this.disabled}">
|
|
@@ -1004,7 +1004,7 @@
|
|
|
1004
1004
|
</span>
|
|
1005
1005
|
<span class="label" part="label"><slot></slot></span>
|
|
1006
1006
|
</span>
|
|
1007
|
-
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.toggle()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.toggle())}))}toggle(){this.disabled||(this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.getAttr("value")}})))}};
|
|
1007
|
+
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.toggle()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.toggle())}))}toggle(){this.disabled||(this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:this.checked,value:this.getAttr("value")}})))}};yt.styles=v`
|
|
1008
1008
|
:host {
|
|
1009
1009
|
display: inline-flex;
|
|
1010
1010
|
vertical-align: middle;
|
|
@@ -1065,13 +1065,13 @@
|
|
|
1065
1065
|
cursor: not-allowed;
|
|
1066
1066
|
pointer-events: none;
|
|
1067
1067
|
}
|
|
1068
|
-
`;let B=
|
|
1068
|
+
`;let B=yt;function ne(){return k("fx-checkbox",B)}ne();const kt=class kt extends y{static get observedAttributes(){return["checked","disabled"]}get checked(){return this.hasAttr("checked")}set checked(t){this.toggleAttr("checked",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}render(){const t=this.size==="sm"?"14px":this.size==="lg"?"22px":"18px";this.style.getPropertyValue("--fx-size-radio")||this.style.setProperty("--fx-size-radio",t),this.setTemplate(`
|
|
1069
1069
|
<span class="box" part="box" role="radio" tabindex="0"
|
|
1070
1070
|
aria-checked="${this.checked}" aria-disabled="${this.disabled}">
|
|
1071
1071
|
<span class="control" part="control"><span class="dot" part="dot"></span></span>
|
|
1072
1072
|
<span class="label" part="label"><slot></slot></span>
|
|
1073
1073
|
</span>
|
|
1074
|
-
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.select()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const t=this.getAttr("name");t&&document.querySelectorAll(`fx-radio[name="${t}"]`).forEach(e=>{e.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};
|
|
1074
|
+
`);const e=this.root.querySelector(".box");e&&(e.addEventListener("click",()=>this.select()),e.addEventListener("keydown",r=>{(r.key===" "||r.key==="Enter")&&(r.preventDefault(),this.select())}))}select(){if(this.disabled||this.checked)return;const t=this.getAttr("name");t&&document.querySelectorAll(`fx-radio[name="${CSS.escape(t)}"]`).forEach(e=>{e.checked=!1}),this.checked=!0,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{checked:!0,value:this.getAttr("value")}}))}};kt.styles=v`
|
|
1075
1075
|
:host {
|
|
1076
1076
|
display: inline-flex;
|
|
1077
1077
|
vertical-align: middle;
|
|
@@ -1127,108 +1127,232 @@
|
|
|
1127
1127
|
cursor: not-allowed;
|
|
1128
1128
|
pointer-events: none;
|
|
1129
1129
|
}
|
|
1130
|
-
`;let K=mt;function se(){return b("fx-radio",K)}se();const yt=class yt extends f{constructor(){super(...arguments),this.data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={}}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position"]}get rowsPerPage(){const t=Number(this.getAttr("rows","10"));return t>0?t:10}set rowsPerPage(t){this.setAttribute("rows",String(t))}get columns(){return[...this.querySelectorAll("fx-column")].map(t=>{var e,r,s,i,a;return{field:(e=t.getAttribute("field"))!=null?e:"",header:(s=(r=t.getAttribute("header"))!=null?r:t.getAttribute("field"))!=null?s:"",sortable:t.hasAttribute("sortable"),filterable:t.hasAttribute("filterable"),align:(i=t.getAttribute("align"))!=null?i:"left",template:(a=t.querySelector("template"))!=null?a:void 0}})}connectedCallback(){if(super.connectedCallback(),!this.data.length)try{const t=this.getAttr("data");t&&(this.data=JSON.parse(t))}catch(t){}new MutationObserver(()=>this.render()).observe(this,{childList:!0,subtree:!0})}computeRows(){let t=[...this.data];for(const[r,s]of Object.entries(this.filters)){if(!s)continue;const i=s.toLowerCase();t=t.filter(a=>{var o;return String((o=a[r])!=null?o:"").toLowerCase().includes(i)})}const e=t.length;if(this.sortField&&t.sort((r,s)=>{const i=r[this.sortField],a=s[this.sortField];return typeof i=="number"&&typeof a=="number"?(i-a)*this.sortDir:String(i!=null?i:"").localeCompare(String(a!=null?a:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")){const r=this.page*this.rowsPerPage;t=t.slice(r,r+this.rowsPerPage)}return{rows:t,total:e}}cellHtml(t,e){const r=e[t.field];return t.template?t.template.innerHTML.replace(/\{\{(\w+)\}\}/g,(s,i)=>{var a;return i==="value"?String(r!=null?r:""):i==="row"?"":String((a=e[i])!=null?a:"")}):String(r!=null?r:"")}render(){var u;const t=this.columns.filter(l=>l.field),{rows:e,total:r}=this.computeRows(),s=this.hasAttr("pagination"),i=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=i&&(this.page=i-1);const a=t.map(l=>{const h=this.sortField===l.field?this.sortDir===1?"▲":"▼":"";return`<th part="header" class="${l.sortable?"sortable":""}" style="text-align:${l.align}" data-field="${l.field}">${l.header}${h?`<span class="sort-ind">${h}</span>`:""}</th>`}).join(""),o=t.some(l=>l.filterable)?`<tr class="filter-row">${t.map(l=>{var h;return`<th style="text-align:${l.align}">${l.filterable?`<input class="filter" data-field="${l.field}" placeholder="Filtrar…" value="${(h=this.filters[l.field])!=null?h:""}">`:""}</th>`}).join("")}</tr>`:"",n=e.length?e.map((l,h)=>`<tr part="row" data-index="${h}">${t.map(d=>`<td part="cell" style="text-align:${d.align}">${this.cellHtml(d,l)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${t.length||1}">${this.getAttr("empty-message","Nenhum registro encontrado")}</td></tr>`,c=s?`
|
|
1130
|
+
`;let K=kt;function le(){return k("fx-radio",K)}le();const C="pt-BR",ce={currency:l=>{if(l==null||l==="")return"";try{return new Intl.NumberFormat(C,{style:"currency",currency:"BRL"}).format(Number(l))}catch(t){return String(l)}},date:(l,t)=>{const e=Kt(l);if(!e)return String(l!=null?l:"");const r={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"}},s=t&&r[t]?r[t]:r.medium;try{return new Intl.DateTimeFormat(C,s).format(e)}catch(i){return e.toLocaleDateString(C)}},dateTime:l=>{const t=Kt(l);if(!t)return String(l!=null?l:"");try{return new Intl.DateTimeFormat(C,{dateStyle:"medium",timeStyle:"short"}).format(t)}catch(e){return t.toLocaleString(C)}},number:(l,t)=>{if(l==null||l==="")return"";try{const e={};if(t!==void 0){const r=Number(t);e.minimumFractionDigits=r,e.maximumFractionDigits=r}return new Intl.NumberFormat(C,e).format(Number(l))}catch(e){return String(l)}}};function Kt(l){if(l==null||l==="")return null;if(l instanceof Date)return isNaN(l.getTime())?null:l;if(typeof l=="number"){const t=new Date(l);return isNaN(t.getTime())?null:t}if(typeof l=="string"){const t=new Date(l);return isNaN(t.getTime())?null:t}return null}const de=l=>/[a-z_$]/i.test(l),he=l=>/[a-z0-9_$]/i.test(l);function ue(l){const t=[];let e=0;for(;e<l.length;){const r=l[e];if(/\s/.test(r)){e++;continue}if(r==="'"||r==='"'){const i=r;let a="";for(e++;e<l.length&&l[e]!==i;)l[e]==="\\"&&e+1<l.length?(a+=l[e+1],e+=2):(a+=l[e],e++);e++,t.push({type:"str",value:a});continue}if(r>="0"&&r<="9"){let i="";for(;e<l.length&&(l[e]>="0"&&l[e]<="9"||l[e]===".");)i+=l[e],e++;t.push({type:"num",value:i});continue}if(de(r)){let i="";for(;e<l.length&&he(l[e]);)i+=l[e],e++;i==="true"||i==="false"||i==="null"?t.push({type:"kw",value:i}):t.push({type:"id",value:i});continue}const s=l.slice(e,e+2);if(s==="=="||s==="!="||s===">="||s==="<="){t.push({type:"cmp",value:s}),e+=2;continue}if(r==="+"){t.push({type:"op",value:"+"}),e++;continue}if(r==="-"){t.push({type:"op",value:"-"}),e++;continue}if(r==="*"){t.push({type:"op",value:"*"}),e++;continue}if(r==="/"){t.push({type:"op",value:"/"}),e++;continue}if(r===">"){t.push({type:"cmp",value:">"}),e++;continue}if(r==="<"){t.push({type:"cmp",value:"<"}),e++;continue}if(r==="!"){t.push({type:"op",value:"!"}),e++;continue}if(r==="?"){t.push({type:"qm",value:"?"}),e++;continue}if(r===":"){t.push({type:"colon",value:":"}),e++;continue}if(r==="|"){t.push({type:"pipe",value:"|"}),e++;continue}if(r==="("){t.push({type:"lparen",value:"("}),e++;continue}if(r===")"){t.push({type:"rparen",value:")"}),e++;continue}if(r==="."){t.push({type:"dot",value:"."}),e++;continue}e++}return t}class pe{constructor(t,e){this.tokens=t,this.ctx=e,this.pos=0}peek(){return this.pos<this.tokens.length?this.tokens[this.pos]:null}next(){return this.pos<this.tokens.length?this.tokens[this.pos++]:null}matchType(t){var e;return((e=this.peek())==null?void 0:e.type)===t?this.next():null}parse(){return this.parsePipe()}parsePipe(){var e,r;let t=this.parseTernary();for(;((e=this.peek())==null?void 0:e.type)==="pipe";){this.next();const s=this.matchType("id");if(!s)break;let i;if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const a=this.peek();a&&(a.type==="str"||a.type==="num"||a.type==="id")&&(i=a.type==="str"?a.value:String(a.value),this.next())}t=this.applyPipe(s.value,i,t)}return t}parseTernary(){var e,r;const t=this.parseComparison();if(((e=this.peek())==null?void 0:e.type)==="qm"){this.next();const s=this.parsePipe();if(((r=this.peek())==null?void 0:r.type)==="colon"){this.next();const i=this.parsePipe();return t?s:i}return s}return t}parseComparison(){const t=this.parseAdditive(),e=this.peek();if((e==null?void 0:e.type)==="cmp"){this.next();const r=this.parseAdditive();return this.compare(t,e.value,r)}return t}compare(t,e,r){const s=Rt(t),i=Rt(r);switch(e){case"==":return s==i;case"!=":return s!=i;case">":return s>i;case"<":return s<i;case">=":return s>=i;case"<=":return s<=i}return!1}parseAdditive(){let t=this.parseMultiplicative();for(;;){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="+"||e.value==="-")){this.next();const r=this.parseMultiplicative();t=e.value==="+"?this.add(t,r):this.subtract(t,r)}else break}return t}add(t,e){return typeof t=="string"||typeof e=="string"?String(t!=null?t:"")+String(e!=null?e:""):Number(t)+Number(e)}subtract(t,e){return Number(t)-Number(e)}parseMultiplicative(){let t=this.parseUnary();for(;;){const e=this.peek();if((e==null?void 0:e.type)==="op"&&(e.value==="*"||e.value==="/")){this.next();const r=this.parseUnary();t=e.value==="*"?Number(t)*Number(r):Number(t)/Number(r)}else break}return t}parseUnary(){const t=this.peek();if((t==null?void 0:t.type)==="op"&&(t.value==="+"||t.value==="-")){this.next();const e=Number(this.parseUnary());return t.value==="-"?-e:e}return(t==null?void 0:t.type)==="op"&&t.value==="!"?(this.next(),!this.parseUnary()):this.parsePrimary()}parsePrimary(){var e;const t=this.peek();if(t){if(t.type==="lparen"){this.next();const r=this.parsePipe();return this.matchType("rparen"),r}if(t.type==="str")return this.next(),t.value;if(t.type==="num")return this.next(),Number(t.value);if(t.type==="kw")return this.next(),t.value==="true"?!0:t.value==="false"?!1:null;if(t.type==="id"){this.next();let r=this.resolveId(t.value);for(;((e=this.peek())==null?void 0:e.type)==="dot";){this.next();const s=this.peek();if((s==null?void 0:s.type)==="id")this.next(),r=r==null?void 0:r[s.value];else break}return r}this.next()}}resolveId(t){switch(t){case"value":return this.ctx.value;case"row":return this.ctx.row;case"true":return!0;case"false":return!1;case"null":return null;default:return this.ctx.row[t]}}applyPipe(t,e,r){const s=ce[t];if(!s)return R(r);try{return s(r,e)}catch(i){return R(r)}}}function Rt(l){return typeof l=="number"?l:typeof l=="boolean"?l?1:0:String(l!=null?l:"")}function R(l){return l==null?"":typeof l=="object"?"[object Object]":String(l)}function fe(l,t){try{const e=ue(l),s=new pe(e,t).parse();return R(s)}catch(e){return""}}function ge(l,t,e){const r={value:t[e],row:t};return l.replace(/\{\{([^}]+)\}\}/g,(s,i)=>u(fe(be(i.trim()),r)))}function be(l){return l.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/'/g,"'")}const wt=class wt extends y{constructor(){super(...arguments),this._data=[],this.page=0,this.sortField="",this.sortDir=1,this.filters={},this.globalSearch=""}static get observedAttributes(){return["pagination","rows","rows-options","striped","empty-message","pagination-position","lazy","total","loading","loading-message"]}get data(){return this._data}set data(t){this._data=Array.isArray(t)?t:[],this.render()}get total(){var t;return(t=this._total)!=null?t:this._data.length}set total(t){this._total=t,this.setAttribute("total",String(t))}get rowsPerPage(){const t=Number(this.getAttr("rows","10"));return t>0?t:10}set rowsPerPage(t){this.setAttribute("rows",String(t))}get lazy(){return this.hasAttr("lazy")}get columns(){return[...this.querySelectorAll("fx-column")].map(t=>{var i,a,o,n;const e=t.querySelector("template"),r=e?void 0:t.innerHTML.trim(),s=(i=t.getAttribute("align"))!=null?i:"left";return{field:(a=t.getAttribute("field"))!=null?a:"",header:(n=(o=t.getAttribute("header"))!=null?o:t.getAttribute("field"))!=null?n:"",sortable:t.hasAttribute("sortable"),filterable:t.hasAttribute("filterable"),align:["left","center","right","justify","start","end"].includes(s)?s:"left",template:e!=null?e:void 0,directTemplate:r||void 0}})}get toolbarTemplate(){return this.querySelector('template[slot="toolbar"]')}connectedCallback(){this._parseDataAttribute(),super.connectedCallback(),this._columnObserver=new MutationObserver(()=>this.render()),this._columnObserver.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){var t;(t=this._columnObserver)==null||t.disconnect(),super.disconnectedCallback()}_parseDataAttribute(){if(!this._data.length)try{const e=this.getAttr("data");e&&(this._data=JSON.parse(e))}catch(e){}const t=this.getAttr("total");if(t){const e=Number(t);isNaN(e)||(this._total=e)}}computeRows(){let t=[...this._data];for(const[r,s]of Object.entries(this.filters)){if(!s)continue;const i=s.toLowerCase();t=t.filter(a=>{var o;return String((o=a[r])!=null?o:"").toLowerCase().includes(i)})}if(this.globalSearch){const r=this.globalSearch.toLowerCase(),s=this._getSearchFields();t=t.filter(i=>(s.length?s:Object.keys(i)).some(o=>{var n;return String((n=i[o])!=null?n:"").toLowerCase().includes(r)}))}const e=this.lazy?this.total:t.length;if(this.sortField&&t.sort((r,s)=>{const i=r[this.sortField],a=s[this.sortField];return typeof i=="number"&&typeof a=="number"?(i-a)*this.sortDir:String(i!=null?i:"").localeCompare(String(a!=null?a:""),"pt-BR")*this.sortDir}),this.hasAttr("pagination")&&!this.lazy){const r=this.page*this.rowsPerPage;t=t.slice(r,r+this.rowsPerPage)}return{rows:t,total:e}}_getSearchFields(){const t=this.root.querySelector("[data-search-fields]");if(!t)return[];const e=t.getAttribute("data-search-fields");return e===null?[]:e.split(",").map(r=>r.trim()).filter(Boolean)}cellHtml(t,e){var s,i,a;const r=(i=(s=t.template)==null?void 0:s.innerHTML)!=null?i:t.directTemplate;return r?ge(r,e,t.field):u(String((a=e[t.field])!=null?a:""))}render(){var m;const t=this.columns.filter(p=>p.field),{rows:e,total:r}=this.computeRows(),s=this.hasAttr("pagination"),i=Math.max(1,Math.ceil(r/this.rowsPerPage));this.page>=i&&(this.page=i-1);const a=this.toolbarTemplate,o=a?`<div class="toolbar" part="toolbar">${a.innerHTML}</div>`:"",n=t.map(p=>{const b=this.sortField===p.field,w=b?this.sortDir===1?"▲":"▼":p.sortable?"⇅":"",z=b?"active":"";return`<th part="header" class="${p.sortable?"sortable":""}" style="text-align:${p.align}" data-field="${u(p.field)}">${u(p.header)}${w?`<span class="sort-ind ${z}">${w}</span>`:""}</th>`}).join(""),c=t.some(p=>p.filterable)?`<tr class="filter-row">${t.map(p=>{var b;return`<th style="text-align:${p.align}">${p.filterable?`<input class="filter" data-field="${u(p.field)}" placeholder="${u("Filtrar…")}" value="${u((b=this.filters[p.field])!=null?b:"")}">`:""}</th>`}).join("")}</tr>`:"",h=e.length?e.map((p,b)=>`<tr part="row" data-index="${b}">${t.map(w=>`<td part="cell" style="text-align:${w.align}">${this.cellHtml(w,p)}</td>`).join("")}</tr>`).join(""):`<tr><td class="empty" colspan="${t.length||1}">${u(this.getAttr("empty-message","Nenhum registro encontrado"))}</td></tr>`,g=s?`
|
|
1131
1131
|
<div class="pager" part="pager">
|
|
1132
1132
|
<span class="info">Página ${this.page+1} de ${i} · ${r} registros</span>
|
|
1133
1133
|
<button type="button" class="pg-btn" data-pg="first" ${this.page===0?"disabled":""}>«</button>
|
|
1134
1134
|
<button type="button" class="pg-btn" data-pg="prev" ${this.page===0?"disabled":""}>‹</button>
|
|
1135
|
-
${Array.from({length:i},(
|
|
1135
|
+
${Array.from({length:i},(p,b)=>`<button type="button" class="pg-btn" data-pg="${b}" aria-current="${b===this.page}">${b+1}</button>`).join("")}
|
|
1136
1136
|
<button type="button" class="pg-btn" data-pg="next" ${this.page>=i-1?"disabled":""}>›</button>
|
|
1137
1137
|
<button type="button" class="pg-btn" data-pg="last" ${this.page>=i-1?"disabled":""}>»</button>
|
|
1138
|
-
<label class="info"
|
|
1139
|
-
<select class="rows-sel">${this.getAttr("rows-options","5,10,20,50").split(",").map(
|
|
1138
|
+
<label class="info">${u("Por página:")}
|
|
1139
|
+
<fx-select class="rows-sel" size="sm" value="${this.rowsPerPage}" aria-label="Itens por página">${this.getAttr("rows-options","5,10,20,50").split(",").map(p=>p.trim()).map(p=>`<option value="${u(p)}">${u(p)}</option>`).join("")}</fx-select>
|
|
1140
1140
|
</label>
|
|
1141
|
-
</div>`:"";this.setTemplate(`
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
<
|
|
1146
|
-
|
|
1141
|
+
</div>`:"",d=this.hasAttr("loading")?`<div class="loading-overlay" part="loading-overlay"><div class="tbl-spinner" part="spinner"></div><span class="loading-text">${u(this.getAttr("loading-message","Carregando…"))}</span></div>`:"";this.setTemplate(`
|
|
1142
|
+
${o}
|
|
1143
|
+
<div class="table-wrap">
|
|
1144
|
+
<div class="scroll">
|
|
1145
|
+
<table part="table">
|
|
1146
|
+
<thead><tr>${n}</tr>${c}</thead>
|
|
1147
|
+
<tbody>${h}</tbody>
|
|
1148
|
+
</table>
|
|
1149
|
+
</div>
|
|
1150
|
+
${d}
|
|
1147
1151
|
</div>
|
|
1148
|
-
${
|
|
1149
|
-
`),this.root.querySelectorAll("th.sortable").forEach(
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1152
|
+
${g}
|
|
1153
|
+
`),this.root.querySelectorAll("th.sortable").forEach(p=>{p.addEventListener("click",()=>{const b=p.dataset.field;this.sortField===b?this.sortDir=this.sortDir===1?-1:1:(this.sortField=b,this.sortDir=1),this.render(),this.dispatchEvent(new CustomEvent("sort-change",{bubbles:!0,composed:!0,detail:{field:this.sortField,direction:this.sortDir===1?"asc":"desc",lazy:this.lazy}}))})}),this.root.querySelectorAll(".filter").forEach(p=>{p.addEventListener("input",()=>{const b=p.dataset.field,w=p.value,z=p.selectionStart;this.filters[b]=w,this.page=0,this.render(),this.dispatchEvent(new CustomEvent("filter-change",{bubbles:!0,composed:!0,detail:{field:b,value:w,lazy:this.lazy}}));const _=this.root.querySelector(`.filter[data-field="${u(b)}"]`);_&&(_.focus(),_.setSelectionRange(z,z))}),p.addEventListener("click",b=>b.stopPropagation())}),this.root.querySelectorAll("[data-search-fields]").forEach(p=>{p.addEventListener("input",()=>{this.globalSearch=p.value,this.page=0;const b=p.selectionStart;this.render();const w=this.root.querySelector("[data-search-fields]");w&&(w.focus(),w.setSelectionRange(b,b))})}),this.root.querySelectorAll(".pg-btn").forEach(p=>{p.addEventListener("click",()=>{const b=p.dataset.pg;this.page=b==="first"?0:b==="prev"?Math.max(0,this.page-1):b==="next"?Math.min(i-1,this.page+1):b==="last"?i-1:Number(b),this.render(),this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page+1,pages:i,rowsPerPage:this.rowsPerPage,total:r,lazy:this.lazy}}))})}),(m=this.root.querySelector("fx-select.rows-sel"))==null||m.addEventListener("change",p=>{var w;const b=Number((w=p.detail)==null?void 0:w.value);!b||b===this.rowsPerPage||(this.rowsPerPage=b,this.page=0,this.render())}),this.root.querySelectorAll("tbody tr[data-index]").forEach(p=>{p.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("row-click",{bubbles:!0,composed:!0,detail:{row:e[Number(p.dataset.index)],index:Number(p.dataset.index)}}))})}),this._restoreToolbarSearch()}_restoreToolbarSearch(){const t=this.root.querySelector("[data-search-fields]");t&&this.globalSearch&&(t.value=this.globalSearch)}};wt.styles=v`
|
|
1154
|
+
:host {
|
|
1155
|
+
display: block;
|
|
1156
|
+
font-family: var(--fx-font-family);
|
|
1157
|
+
font-size: var(--fx-font-size);
|
|
1158
|
+
color: var(--fx-text-default);
|
|
1159
|
+
background: var(--fx-surface-background);
|
|
1160
|
+
}
|
|
1161
|
+
.table-wrap {
|
|
1162
|
+
position: relative;
|
|
1163
|
+
}
|
|
1164
|
+
.scroll {
|
|
1165
|
+
overflow-x: auto;
|
|
1166
|
+
border: 1px solid var(--fx-border-default);
|
|
1167
|
+
border-radius: var(--fx-radius-md);
|
|
1168
|
+
}
|
|
1169
|
+
table {
|
|
1170
|
+
width: 100%;
|
|
1171
|
+
border-collapse: collapse;
|
|
1172
|
+
}
|
|
1173
|
+
th {
|
|
1174
|
+
text-align: left;
|
|
1175
|
+
padding: var(--fx-space-sm) var(--fx-space-md);
|
|
1176
|
+
background: var(--fx-surface-surface);
|
|
1177
|
+
border-bottom: 2px solid var(--fx-border-default);
|
|
1178
|
+
white-space: nowrap;
|
|
1179
|
+
user-select: none;
|
|
1180
|
+
}
|
|
1181
|
+
th.sortable {
|
|
1182
|
+
cursor: pointer;
|
|
1183
|
+
}
|
|
1184
|
+
th.sortable:hover {
|
|
1185
|
+
color: var(--fx-color-primary);
|
|
1186
|
+
}
|
|
1187
|
+
.sort-ind {
|
|
1188
|
+
font-size: calc(var(--fx-font-size) - 4px);
|
|
1189
|
+
margin-left: var(--fx-space-3xs, 2px);
|
|
1190
|
+
opacity: 0.45;
|
|
1191
|
+
transition: opacity var(--fx-motion-duration-fast)
|
|
1192
|
+
var(--fx-motion-easing);
|
|
1193
|
+
}
|
|
1194
|
+
th.sortable:hover .sort-ind {
|
|
1195
|
+
opacity: 0.85;
|
|
1196
|
+
}
|
|
1197
|
+
.sort-ind.active {
|
|
1198
|
+
opacity: 1;
|
|
1199
|
+
color: var(--fx-color-primary);
|
|
1200
|
+
}
|
|
1201
|
+
.filter-row th {
|
|
1202
|
+
padding: var(--fx-space-3xs, 4px) var(--fx-space-md) var(--fx-space-sm);
|
|
1203
|
+
border-bottom-width: 1px;
|
|
1204
|
+
}
|
|
1205
|
+
.filter {
|
|
1206
|
+
width: 100%;
|
|
1207
|
+
box-sizing: border-box;
|
|
1208
|
+
font: inherit;
|
|
1209
|
+
font-size: calc(var(--fx-font-size) - 2px);
|
|
1210
|
+
color: var(--fx-text-default);
|
|
1211
|
+
background: var(--fx-surface-background);
|
|
1212
|
+
border: 1px solid var(--fx-border-default);
|
|
1213
|
+
border-radius: var(--fx-radius-sm);
|
|
1214
|
+
padding: var(--fx-space-3xs, 4px) var(--fx-space-xs);
|
|
1215
|
+
outline: none;
|
|
1216
|
+
}
|
|
1217
|
+
.filter:focus {
|
|
1218
|
+
border-color: var(--fx-color-primary);
|
|
1219
|
+
box-shadow: var(--fx-effect-focus-ring, none);
|
|
1220
|
+
}
|
|
1221
|
+
td {
|
|
1222
|
+
padding: var(--fx-space-sm) var(--fx-space-md);
|
|
1223
|
+
border-bottom: 1px solid var(--fx-border-default);
|
|
1224
|
+
}
|
|
1225
|
+
tbody tr {
|
|
1226
|
+
cursor: pointer;
|
|
1227
|
+
transition: background-color var(--fx-motion-duration-fast)
|
|
1228
|
+
var(--fx-motion-easing);
|
|
1229
|
+
}
|
|
1230
|
+
tbody tr:hover {
|
|
1231
|
+
background: color-mix(
|
|
1232
|
+
in srgb,
|
|
1233
|
+
var(--fx-color-primary) 8%,
|
|
1234
|
+
transparent
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
:host([striped]) tbody tr:nth-child(even) {
|
|
1238
|
+
background: var(--fx-surface-background);
|
|
1239
|
+
}
|
|
1240
|
+
:host([striped]) tbody tr:hover {
|
|
1241
|
+
background: color-mix(
|
|
1242
|
+
in srgb,
|
|
1243
|
+
var(--fx-color-primary) 8%,
|
|
1244
|
+
transparent
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
.empty {
|
|
1248
|
+
text-align: center;
|
|
1249
|
+
padding: var(--fx-space-xl);
|
|
1250
|
+
color: var(--fx-text-muted);
|
|
1251
|
+
}
|
|
1252
|
+
.pager {
|
|
1253
|
+
display: flex;
|
|
1254
|
+
align-items: center;
|
|
1255
|
+
gap: var(--fx-space-sm);
|
|
1256
|
+
flex-wrap: wrap;
|
|
1257
|
+
padding: var(--fx-space-sm) 0;
|
|
1258
|
+
}
|
|
1259
|
+
:host([pagination-position="center"]) .pager {
|
|
1260
|
+
justify-content: center;
|
|
1261
|
+
}
|
|
1262
|
+
:host([pagination-position="right"]) .pager {
|
|
1263
|
+
justify-content: flex-end;
|
|
1264
|
+
}
|
|
1265
|
+
.pager .info {
|
|
1266
|
+
color: var(--fx-text-muted);
|
|
1267
|
+
font-size: calc(var(--fx-font-size) - 2px);
|
|
1268
|
+
}
|
|
1269
|
+
.pg-btn {
|
|
1270
|
+
min-width: var(--fx-size-sm);
|
|
1271
|
+
height: var(--fx-size-sm);
|
|
1272
|
+
font: inherit;
|
|
1273
|
+
font-size: calc(var(--fx-font-size) - 2px);
|
|
1274
|
+
color: var(--fx-text-default);
|
|
1275
|
+
background: var(--fx-surface-background);
|
|
1276
|
+
border: 1px solid var(--fx-border-default);
|
|
1277
|
+
border-radius: var(--fx-radius-sm);
|
|
1278
|
+
padding: var(--fx-space-3xs, 4px) var(--fx-space-sm);
|
|
1279
|
+
cursor: pointer;
|
|
1280
|
+
transition: border-color var(--fx-motion-duration-fast)
|
|
1281
|
+
var(--fx-motion-easing);
|
|
1282
|
+
}
|
|
1283
|
+
.pg-btn:hover:not(:disabled):not([aria-current="true"]) {
|
|
1284
|
+
border-color: var(--fx-color-primary);
|
|
1285
|
+
color: var(--fx-color-primary);
|
|
1286
|
+
}
|
|
1287
|
+
.pg-btn:disabled {
|
|
1288
|
+
opacity: 0.5;
|
|
1289
|
+
cursor: not-allowed;
|
|
1290
|
+
}
|
|
1291
|
+
.pg-btn[aria-current="true"] {
|
|
1292
|
+
background: var(--fx-color-primary);
|
|
1293
|
+
border-color: var(--fx-color-primary);
|
|
1294
|
+
color: #fff;
|
|
1295
|
+
font-weight: var(--fx-font-weight);
|
|
1296
|
+
}
|
|
1297
|
+
fx-select {
|
|
1298
|
+
vertical-align: middle;
|
|
1299
|
+
}
|
|
1300
|
+
fx-select::part(trigger) {
|
|
1301
|
+
min-width: 64px !important;
|
|
1302
|
+
min-height: var(--fx-size-sm) !important;
|
|
1303
|
+
padding: 0 var(--fx-space-sm) !important;
|
|
1304
|
+
border-radius: var(--fx-radius-sm) !important;
|
|
1305
|
+
font-size: calc(var(--fx-font-size) - 2px) !important;
|
|
1306
|
+
}
|
|
1307
|
+
.toolbar {
|
|
1308
|
+
display: flex;
|
|
1309
|
+
align-items: center;
|
|
1310
|
+
gap: var(--fx-space-sm);
|
|
1311
|
+
flex-wrap: wrap;
|
|
1312
|
+
padding: var(--fx-space-sm) var(--fx-space-md);
|
|
1313
|
+
border: 1px solid var(--fx-border-default);
|
|
1314
|
+
border-bottom: none;
|
|
1315
|
+
border-radius: var(--fx-radius-md) var(--fx-radius-md) 0 0;
|
|
1316
|
+
background: var(--fx-surface-background);
|
|
1317
|
+
}
|
|
1318
|
+
.toolbar:empty {
|
|
1319
|
+
display: none;
|
|
1320
|
+
}
|
|
1321
|
+
.loading-overlay {
|
|
1322
|
+
position: absolute;
|
|
1323
|
+
inset: 0;
|
|
1324
|
+
display: flex;
|
|
1325
|
+
flex-direction: column;
|
|
1326
|
+
align-items: center;
|
|
1327
|
+
justify-content: center;
|
|
1328
|
+
gap: var(--fx-space-sm);
|
|
1329
|
+
background: color-mix(
|
|
1330
|
+
in srgb,
|
|
1331
|
+
var(--fx-surface-background) 85%,
|
|
1332
|
+
transparent
|
|
1333
|
+
);
|
|
1334
|
+
backdrop-filter: blur(2px);
|
|
1335
|
+
z-index: 10;
|
|
1336
|
+
border-radius: var(--fx-radius-md);
|
|
1337
|
+
}
|
|
1338
|
+
.tbl-spinner {
|
|
1339
|
+
width: 32px;
|
|
1340
|
+
height: 32px;
|
|
1341
|
+
border: 3px solid var(--fx-border-default);
|
|
1342
|
+
border-top-color: var(--fx-color-primary);
|
|
1343
|
+
border-radius: 50%;
|
|
1344
|
+
animation: tbl-spin 1s linear infinite;
|
|
1345
|
+
}
|
|
1346
|
+
@keyframes tbl-spin {
|
|
1347
|
+
to {
|
|
1348
|
+
transform: rotate(360deg);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
.loading-text {
|
|
1352
|
+
color: var(--fx-text-muted);
|
|
1353
|
+
font-size: calc(var(--fx-font-size) - 1px);
|
|
1354
|
+
}
|
|
1355
|
+
`;let H=wt;function ve(){return k("fx-table",H)}ve();const At=class At extends y{constructor(){super(...arguments),this.targetControl=null,this.observer=null,this.listenersReady=!1}static get observedAttributes(){return["variant","error","invalid","success","valid"]}render(){var o;const t=this.findControl(),r=this.findLabel(),s=r?(o=r.textContent)==null?void 0:o.replace(/\s+/g," ").trim():"",i=r&&r.getAttribute("for")||"",a=this.getAttribute("variant")==="over";this.setTemplate(`
|
|
1232
1356
|
<div class="wrapper" part="wrapper">
|
|
1233
1357
|
${a?`<label class="flabel" part="label" for="${i}">${s}</label>`:""}
|
|
1234
1358
|
<div class="field-box" part="field">
|
|
@@ -1237,7 +1361,7 @@
|
|
|
1237
1361
|
</div>
|
|
1238
1362
|
<div class="error-message" part="error"></div>
|
|
1239
1363
|
</div>
|
|
1240
|
-
`),r&&r.setAttribute("hidden",""),this.attachEvents(),this.syncControlReference(t),this.syncState(),this.applyError()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect()}findControl(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()!=="label"))!=null?t:null}findLabel(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()==="label"))!=null?t:null}attachEvents(){const t=this.root.querySelector("slot");t&&t.addEventListener("slotchange",()=>{const e=this.findControl();this.syncControlReference(e),this.syncState(),this.applyError()}),!this.listenersReady&&(this.listenersReady=!0,this.addEventListener("focusin",()=>this.syncState()),this.addEventListener("focusout",()=>setTimeout(()=>this.syncState(),60)),this.addEventListener("input",()=>this.syncState()),this.addEventListener("change",()=>this.syncState()))}syncControlReference(t=this.targetControl){var e;t!==this.targetControl&&((e=this.observer)==null||e.disconnect(),this.observer=null,this.targetControl=t,t&&(this.observer=new MutationObserver(()=>this.syncState()),this.observer.observe(t,{attributes:!0,attributeFilter:["value","values","start","end","open"]})))}syncState(){var a,o,n;if(this.targetControl&&!this.targetControl.isConnected&&(this.targetControl=null,(a=this.observer)==null||a.disconnect(),this.observer=null),!this.targetControl){this.removeAttribute("active"),this.removeAttribute("focus");return}const t=this.targetControl,e=t.getAttribute?((o=t.getAttribute("value"))!=null?o:"").trim():"",r=t.getAttribute?((n=t.getAttribute("values"))!=null?n:"").trim():"",s=!!(typeof t.value=="string"&&t.value.trim()!==""||Array.isArray(t.values)&&t.values.length>0||e!==""||r!==""||t.hasAttribute&&(t.hasAttribute("open")||t.hasAttribute("start"))),i=this.isFocusedInside();s||i?(this.setAttribute("active",""),i?this.setAttribute("focus",""):this.removeAttribute("focus")):(this.removeAttribute("active"),this.removeAttribute("focus"))}applyError(){var r;const t=this.hasAttr("error")||this.hasAttr("invalid"),e=this.root.querySelector(".error-message");if(e&&(e.textContent=t?((r=this.getAttribute("error-text"))==null?void 0:r.trim())||"Valor inválido":""),this.targetControl&&typeof this.targetControl.setAttribute=="function"){const s=this.targetControl;t?(s.setAttribute("error",""),s.removeAttribute("success")):this.hasAttr("success")||this.hasAttr("valid")?(s.setAttribute("success",""),s.removeAttribute("error")):(s.removeAttribute("error"),s.removeAttribute("success"))}}isWithin(t){let e=t;for(;e&&e!==this;)e=e.parentElement;return e===this}isFocusedInside(){const t=document.activeElement;return!!(t&&this.isWithin(t))}};
|
|
1364
|
+
`),r&&r.setAttribute("hidden",""),this.attachEvents(),this.syncControlReference(t),this.syncState(),this.applyError()}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.observer)==null||t.disconnect()}findControl(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()!=="label"))!=null?t:null}findLabel(){var t;return(t=Array.from(this.children).find(e=>e.tagName.toLowerCase()==="label"))!=null?t:null}attachEvents(){const t=this.root.querySelector("slot");t&&t.addEventListener("slotchange",()=>{const e=this.findControl();this.syncControlReference(e),this.syncState(),this.applyError()}),!this.listenersReady&&(this.listenersReady=!0,this.addEventListener("focusin",()=>this.syncState()),this.addEventListener("focusout",()=>setTimeout(()=>this.syncState(),60)),this.addEventListener("input",()=>this.syncState()),this.addEventListener("change",()=>this.syncState()))}syncControlReference(t=this.targetControl){var e;t!==this.targetControl&&((e=this.observer)==null||e.disconnect(),this.observer=null,this.targetControl=t,t&&(this.observer=new MutationObserver(()=>this.syncState()),this.observer.observe(t,{attributes:!0,attributeFilter:["value","values","start","end","open"]})))}syncState(){var a,o,n;if(this.targetControl&&!this.targetControl.isConnected&&(this.targetControl=null,(a=this.observer)==null||a.disconnect(),this.observer=null),!this.targetControl){this.removeAttribute("active"),this.removeAttribute("focus");return}const t=this.targetControl,e=t.getAttribute?((o=t.getAttribute("value"))!=null?o:"").trim():"",r=t.getAttribute?((n=t.getAttribute("values"))!=null?n:"").trim():"",s=!!(typeof t.value=="string"&&t.value.trim()!==""||Array.isArray(t.values)&&t.values.length>0||e!==""||r!==""||t.hasAttribute&&(t.hasAttribute("open")||t.hasAttribute("start"))),i=this.isFocusedInside();s||i?(this.setAttribute("active",""),i?this.setAttribute("focus",""):this.removeAttribute("focus")):(this.removeAttribute("active"),this.removeAttribute("focus"))}applyError(){var r;const t=this.hasAttr("error")||this.hasAttr("invalid"),e=this.root.querySelector(".error-message");if(e&&(e.textContent=t?((r=this.getAttribute("error-text"))==null?void 0:r.trim())||"Valor inválido":""),this.targetControl&&typeof this.targetControl.setAttribute=="function"){const s=this.targetControl;t?(s.setAttribute("error",""),s.removeAttribute("success")):this.hasAttr("success")||this.hasAttr("valid")?(s.setAttribute("success",""),s.removeAttribute("error")):(s.removeAttribute("error"),s.removeAttribute("success"))}}isWithin(t){let e=t;for(;e&&e!==this;)e=e.parentElement;return e===this}isFocusedInside(){const t=document.activeElement;return!!(t&&this.isWithin(t))}};At.styles=v`
|
|
1241
1365
|
:host {
|
|
1242
1366
|
display: inline-block;
|
|
1243
1367
|
position: relative;
|
|
@@ -1349,11 +1473,11 @@
|
|
|
1349
1473
|
:host([invalid]) .error-message {
|
|
1350
1474
|
display: block;
|
|
1351
1475
|
}
|
|
1352
|
-
`;let
|
|
1353
|
-
${t?`placeholder="${t}"`:""}
|
|
1354
|
-
${s?`rows="${s}"`:""}
|
|
1355
|
-
${i?`maxlength="${i}"`:""}
|
|
1356
|
-
></textarea>`);const a=this.root.querySelector(".field");if(!a)return;a.value=this.getAttr("value"),r&&a.setAttribute("disabled",""),e&&a.setAttribute("readonly","");const o=n=>{this.value=a.value,this.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0,detail:{value:a.value}}))};a.addEventListener("input",n=>{n.stopPropagation(),o("input")}),a.addEventListener("change",n=>{n.stopPropagation(),o("change")})}};
|
|
1476
|
+
`;let O=At;function me(){return k("fx-floatlabel",O)}me();const _t=class _t extends y{static get observedAttributes(){return["size","placeholder","disabled","readonly","rows","maxlength"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){const t=this.getAttr("placeholder"),e=this.hasAttr("readonly"),r=this.hasAttr("disabled"),s=this.getAttr("rows"),i=this.getAttr("maxlength");this.setTemplate(`<textarea class="field" part="textarea"
|
|
1477
|
+
${t?`placeholder="${u(t)}"`:""}
|
|
1478
|
+
${s?`rows="${u(s)}"`:""}
|
|
1479
|
+
${i?`maxlength="${u(i)}"`:""}
|
|
1480
|
+
></textarea>`);const a=this.root.querySelector(".field");if(!a)return;a.value=this.getAttr("value"),r&&a.setAttribute("disabled",""),e&&a.setAttribute("readonly","");const o=n=>{this.value=a.value,this.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0,detail:{value:a.value}}))};a.addEventListener("input",n=>{n.stopPropagation(),o("input")}),a.addEventListener("change",n=>{n.stopPropagation(),o("change")})}};_t.styles=v`
|
|
1357
1481
|
:host {
|
|
1358
1482
|
display: inline-block;
|
|
1359
1483
|
vertical-align: middle;
|
|
@@ -1400,18 +1524,18 @@
|
|
|
1400
1524
|
}
|
|
1401
1525
|
:host([size='sm']) .field { width: 220px; min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
1402
1526
|
:host([size='lg']) .field { width: 300px; min-height: calc(var(--fx-size-lg) + 80px); }
|
|
1403
|
-
`;let Y=
|
|
1527
|
+
`;let Y=_t;function xe(){return k("fx-textarea",Y)}xe();const St=class St extends y{constructor(){super(...arguments),this._previouslyFocused=null}static get observedAttributes(){return["open","size","heading"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}render(){const t=this.open,e=this.getAttr("heading");if(this.setTemplate(`
|
|
1404
1528
|
<div class="overlay" part="overlay" ${t?"":"hidden"}>
|
|
1405
|
-
<div class="dialog" role="dialog" aria-modal="true" aria-label="${e}">
|
|
1529
|
+
<div class="dialog" role="dialog" aria-modal="true" aria-label="${u(e)}" tabindex="-1">
|
|
1406
1530
|
<header>
|
|
1407
|
-
<h2>${e}</h2>
|
|
1531
|
+
<h2>${u(e)}</h2>
|
|
1408
1532
|
<button type="button" class="close" part="close" aria-label="Fechar">×</button>
|
|
1409
1533
|
</header>
|
|
1410
1534
|
<div class="body"><slot></slot></div>
|
|
1411
1535
|
<footer part="footer"><slot name="footer"></slot></footer>
|
|
1412
1536
|
</div>
|
|
1413
1537
|
</div>
|
|
1414
|
-
`),!t)return;const r=this.root.querySelector(".overlay"),s=this.root.querySelector(".close"),i=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))};r==null||r.addEventListener("click",o=>{o.target===r&&i()}),s==null||s.addEventListener("click",i);const a=o=>{o.key==="Escape"
|
|
1538
|
+
`),!t)return;const r=this.root.querySelector(".overlay"),s=this.root.querySelector(".close"),i=()=>{var o;this.open=!1,(o=this._cleanup)==null||o.call(this),this._cleanup=void 0,this._restoreFocus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))};r==null||r.addEventListener("click",o=>{o.target===r&&i()}),s==null||s.addEventListener("click",i);const a=o=>{if(o.key==="Escape"){o.stopPropagation(),i();return}o.key==="Tab"&&this._trapFocus(o)};document.addEventListener("keydown",a),this._cleanup=()=>document.removeEventListener("keydown",a),requestAnimationFrame(()=>{var o;this._previouslyFocused=document.activeElement,(o=this.root.querySelector(".dialog"))==null||o.focus()}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0}))}_trapFocus(t){const e=this.root.querySelector(".dialog");if(!e)return;const r=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r.length)return;const s=r[0],i=r[r.length-1],a=this.root.activeElement;t.shiftKey&&(a===s||a===e)?(t.preventDefault(),i.focus()):!t.shiftKey&&a===i&&(t.preventDefault(),s.focus())}_restoreFocus(){var t;(t=this._previouslyFocused)!=null&&t.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._cleanup)==null||t.call(this),this._cleanup=void 0,this._restoreFocus()}};St.styles=v`
|
|
1415
1539
|
:host { display: contents; }
|
|
1416
1540
|
.overlay {
|
|
1417
1541
|
position: fixed;
|
|
@@ -1480,7 +1604,7 @@
|
|
|
1480
1604
|
gap: var(--fx-space-sm);
|
|
1481
1605
|
}
|
|
1482
1606
|
footer[hidden] { display: none; }
|
|
1483
|
-
`;let
|
|
1607
|
+
`;let U=St;function ye(){return k("fx-dialog",U)}ye();const Ht={success:"var(--fx-color-success, #10b981)",error:"var(--fx-color-danger, #f43f5e)",info:"var(--fx-color-info, #0ea5e9)",warning:"var(--fx-color-warning, #f59e0b)"},Ot={success:"✓",error:"✕",warning:"!",info:"i"},ke=`
|
|
1484
1608
|
:host { display: contents; }
|
|
1485
1609
|
.card {
|
|
1486
1610
|
display: flex; align-items: flex-start; gap: 10px;
|
|
@@ -1514,19 +1638,19 @@
|
|
|
1514
1638
|
color: var(--fx-text-muted, #64748b); font-size: 15px; padding: 2px 4px; border-radius: 4px;
|
|
1515
1639
|
}
|
|
1516
1640
|
.close:hover { color: var(--fx-color-danger, #f43f5e); background: var(--fx-surface-surface-hover, rgba(0,0,0,.05)); }
|
|
1517
|
-
`;class
|
|
1518
|
-
<style>${
|
|
1641
|
+
`;class we extends HTMLElement{constructor(){super();Ut(this,T);this.timer=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["kind","title","message","duration"]}connectedCallback(){var s;this.shadowRoot.firstChild||Xt(this,T,Jt).call(this);const e=Number((s=this.getAttribute("duration"))!=null?s:"4000"),r=e===0?0:Math.max(Number.isNaN(e)?4e3:e,1e3);!Number.isNaN(r)&&r>0&&!this.timer&&(this.timer=setTimeout(()=>this.dismiss(),r))}disconnectedCallback(){this.timer&&clearTimeout(this.timer),this.timer=null}dismiss(){this.timer&&clearTimeout(this.timer),this.timer=null;const e=this.shadowRoot.querySelector(".card");e?(e.classList.add("leaving"),setTimeout(()=>this.remove(),200)):this.remove()}}T=new WeakSet,Jt=function(){var n,c,h,g;const e=this.getAttribute("kind")||"info",r=(n=this.getAttribute("title"))!=null?n:"",s=(c=this.getAttribute("message"))!=null?c:"",i=(h=Ht[e])!=null?h:Ht.info;this.shadowRoot.innerHTML=`
|
|
1642
|
+
<style>${ke}</style>
|
|
1519
1643
|
<div class="card" style="--kind:${i}" role="status" part="card">
|
|
1520
|
-
<span class="icon">${(
|
|
1644
|
+
<span class="icon">${(g=Ot[e])!=null?g:Ot.info}</span>
|
|
1521
1645
|
<div class="body">
|
|
1522
1646
|
${r?'<div class="title"></div>':""}
|
|
1523
1647
|
${s?'<div class="msg"></div>':""}
|
|
1524
1648
|
</div>
|
|
1525
1649
|
<button class="close" aria-label="Fechar">✕</button>
|
|
1526
|
-
</div>`;const a=this.shadowRoot.querySelector(".title"),o=this.shadowRoot.querySelector(".msg");a&&(a.textContent=r),o&&(o.textContent=s),this.shadowRoot.querySelector(".close").addEventListener("click",()=>this.dismiss())};function
|
|
1650
|
+
</div>`;const a=this.shadowRoot.querySelector(".title"),o=this.shadowRoot.querySelector(".msg");a&&(a.textContent=r),o&&(o.textContent=s),this.shadowRoot.querySelector(".close").addEventListener("click",()=>this.dismiss())};function Ae(l){let t=document.querySelector(`[data-fx-toast-region="${l}"]`);if(!t){t=document.createElement("div"),t.setAttribute("data-fx-toast-region",l);const[e,r]=l.split("-"),s=t.style;s.position="fixed",s[e]="16px",r==="center"?(s.left="50%",s.transform="translateX(-50%)"):s[r]="16px",s.display="flex",s.flexDirection="column",s.gap="8px",s.zIndex="1100",s.pointerEvents="none",new MutationObserver(()=>{t.querySelectorAll("*").forEach(i=>i.style.pointerEvents="auto")}).observe(t,{childList:!0}),document.body.appendChild(t)}return t}class _e{constructor(){this.seq=0,this.map=new Map,this.success=(t,e,r)=>this.push("success",t,e,r),this.error=(t,e,r)=>this.push("error",t,e,r),this.info=(t,e,r)=>this.push("info",t,e,r),this.warning=(t,e,r)=>this.push("warning",t,e,r)}push(t,e,r,s){var c,h,g;const i=++this.seq,a=typeof r=="string"?r:r==null?void 0:r.message,o={...typeof r=="object"&&r?r:void 0,...s},n=document.createElement("fx-toast");return n.setAttribute("kind",t),n.setAttribute("title",e),a&&n.setAttribute("message",a),n.setAttribute("position",(c=o.position)!=null?c:"top-right"),n.setAttribute("duration",String((h=o.duration)!=null?h:4e3)),Ae((g=o.position)!=null?g:"top-right").appendChild(n),this.map.set(i,n),i}close(t){var e;(e=this.map.get(t))==null||e.dismiss(),this.map.delete(t)}}const Se=new _e;globalThis.FenixToast=Se;function ze(){customElements.get("fx-toast")||customElements.define("fx-toast",we)}ze();const zt=class zt extends y{static get observedAttributes(){return["content","position"]}render(){const t=this.getAttr("content");this.setTemplate(`
|
|
1527
1651
|
<slot></slot>
|
|
1528
|
-
<span class="bubble" part="bubble" role="tooltip">${t}</span>
|
|
1529
|
-
`)}};
|
|
1652
|
+
<span class="bubble" part="bubble" role="tooltip">${u(t)}</span>
|
|
1653
|
+
`)}};zt.styles=v`
|
|
1530
1654
|
:host {
|
|
1531
1655
|
position: relative;
|
|
1532
1656
|
display: inline-flex;
|
|
@@ -1587,14 +1711,14 @@
|
|
|
1587
1711
|
top: 50%; left: auto; right: 100%; transform: translateY(-50%);
|
|
1588
1712
|
border: 5px solid transparent; border-right-color: var(--fx-text-default, #1e293b);
|
|
1589
1713
|
}
|
|
1590
|
-
`;let
|
|
1714
|
+
`;let X=zt;function $e(){return k("fx-tooltip",X)}$e();const $t=class $t extends y{static get observedAttributes(){return["value"]}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){var r;const t=Array.from(this.querySelectorAll("fx-tab")),e=this.value||((r=t[0])==null?void 0:r.getAttribute("tab"))||"";this.setTemplate(`
|
|
1591
1715
|
<div class="list" role="tablist">
|
|
1592
|
-
${t.map(s=>{var o,n;const i=(o=s.getAttribute("tab"))!=null?o:"",a=s.hasAttribute("disabled");return`<button type="button" class="tab" role="tab" part="tab"
|
|
1593
|
-
data-tab="${i}" aria-selected="${i===e}"
|
|
1594
|
-
${a?'aria-disabled="true" data-disabled="true"':""}>${(n=s.textContent)==null?void 0:n.trim()}</button>`}).join("")}
|
|
1716
|
+
${t.map(s=>{var o,n,c;const i=(o=s.getAttribute("tab"))!=null?o:"",a=s.hasAttribute("disabled");return`<button type="button" class="tab" role="tab" part="tab"
|
|
1717
|
+
data-tab="${u(i)}" aria-selected="${i===e}"
|
|
1718
|
+
${a?'aria-disabled="true" data-disabled="true"':""}>${u((c=(n=s.textContent)==null?void 0:n.trim())!=null?c:"")}</button>`}).join("")}
|
|
1595
1719
|
</div>
|
|
1596
1720
|
<slot></slot>
|
|
1597
|
-
`),this.panels.forEach(s=>{s.getAttribute("tab")===e?s.removeAttribute("hidden"):s.setAttribute("hidden","")}),this.root.querySelectorAll(".tab").forEach(s=>{s.addEventListener("click",()=>{var i;s.hasAttribute("data-disabled")||(this.value=(i=s.dataset.tab)!=null?i:"",this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}})))})})}get panels(){const t=Array.from(this.querySelectorAll("fx-tab-panel"));if(t.length)return t;const e=[];let r=this.nextElementSibling;for(;r&&!r.matches("fx-tabs");)r.matches("fx-tab-panel")?e.push(r):e.push(...Array.from(r.querySelectorAll(":scope > fx-tab-panel"))),r=r.nextElementSibling;return e}}
|
|
1721
|
+
`),this.panels.forEach(s=>{s.getAttribute("tab")===e?s.removeAttribute("hidden"):s.setAttribute("hidden","")}),this.root.querySelectorAll(".tab").forEach(s=>{s.addEventListener("click",()=>{var i;s.hasAttribute("data-disabled")||(this.value=(i=s.dataset.tab)!=null?i:"",this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}})))})})}get panels(){const t=Array.from(this.querySelectorAll("fx-tab-panel"));if(t.length)return t;const e=[];let r=this.nextElementSibling;for(;r&&!r.matches("fx-tabs");)r.matches("fx-tab-panel")?e.push(r):e.push(...Array.from(r.querySelectorAll(":scope > fx-tab-panel"))),r=r.nextElementSibling;return e}};$t.styles=v`
|
|
1598
1722
|
:host {
|
|
1599
1723
|
display: block;
|
|
1600
1724
|
font-family: var(--fx-font-family);
|
|
@@ -1645,11 +1769,11 @@
|
|
|
1645
1769
|
::slotted(fx-tab) {
|
|
1646
1770
|
display: none !important;
|
|
1647
1771
|
}
|
|
1648
|
-
`;let
|
|
1772
|
+
`;let J=$t;const Et=class Et extends y{constructor(){super(...arguments),this._initialized=!1}static get observedAttributes(){return["tab"]}get tab(){return this.getAttr("tab")}set tab(t){this.setAttribute("tab",t)}get visible(){return!this.hasAttr("hidden")}set visible(t){this.toggleAttr("hidden",!t)}render(){var t;if(this.setTemplate("<slot></slot>"),!this._initialized){const e=(t=this.closest("fx-tabs"))!=null?t:(()=>{let s=this.previousElementSibling;for(;s;){if(s.matches("fx-tabs"))return s;s=s.previousElementSibling}return null})(),r=e&&e.getAttribute("value")||"";this.getAttribute("tab")!==r&&this.setAttribute("hidden",""),this._initialized=!0}}};Et.styles=v`
|
|
1649
1773
|
:host { display: block; padding: var(--fx-space-lg) 0; font-family: var(--fx-font-family); color: var(--fx-text-default); }
|
|
1650
1774
|
:host([hidden]) { display: none; }
|
|
1651
|
-
`;let
|
|
1652
|
-
${r?`<div class="caption" part="caption">${r}</div>`:""}
|
|
1775
|
+
`;let W=Et;function Ee(){return k("fx-tabs",J)}function Ce(){return k("fx-tab-panel",W)}Ee(),Ce();const Ct=class Ct extends y{constructor(){super(...arguments),this._done=!1}static get observedAttributes(){return["value","indeterminate","variant","label","hide-label","size"]}get value(){return Number(this.getAttr("value","0"))||0}set value(t){this.setAttribute("value",String(Math.min(100,Math.max(0,t))))}render(){const t=Math.min(100,Math.max(0,this.value)),e=this.hasAttr("indeterminate"),r=this.getAttr("label"),s=!e&&!this.hasAttr("hide-label");this.setTemplate(`
|
|
1776
|
+
${r?`<div class="caption" part="caption">${u(r)}</div>`:""}
|
|
1653
1777
|
<div class="row">
|
|
1654
1778
|
<div class="track" part="track" role="progressbar"
|
|
1655
1779
|
aria-valuenow="${t}" aria-valuemin="0" aria-valuemax="100">
|
|
@@ -1657,7 +1781,7 @@
|
|
|
1657
1781
|
</div>
|
|
1658
1782
|
${s?`<span class="pct">${t}%</span>`:""}
|
|
1659
1783
|
</div>
|
|
1660
|
-
`),!this._done&&!this.hasAttr("indeterminate")&&t>=100&&(this._done=!0,this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0}))),t<100&&(this._done=!1)}}
|
|
1784
|
+
`),!this._done&&!this.hasAttr("indeterminate")&&t>=100&&(this._done=!0,this.dispatchEvent(new CustomEvent("complete",{bubbles:!0,composed:!0}))),t<100&&(this._done=!1)}};Ct.styles=v`
|
|
1661
1785
|
:host {
|
|
1662
1786
|
display: block;
|
|
1663
1787
|
font-family: var(--fx-font-family);
|
|
@@ -1707,9 +1831,9 @@
|
|
|
1707
1831
|
color: var(--fx-text-muted);
|
|
1708
1832
|
margin-bottom: var(--fx-space-xs);
|
|
1709
1833
|
}
|
|
1710
|
-
`;let
|
|
1834
|
+
`;let Z=Ct;function Le(){return k("fx-progress",Z)}Le();const Lt=class Lt extends y{static get observedAttributes(){return["variant","width","height","lines"]}safeSize(t){const e=t.trim();return/^-?\d*\.?\d+(px|em|rem|%|vw|vh|vmin|vmax|ch|ex|cm|mm|in|pt|pc)$/.test(e)?e:""}render(){const t=this.getAttr("variant","text"),e=this.safeSize(this.getAttr("width")),r=this.safeSize(this.getAttr("height")),s=`${e?`width:${e};`:""}${r?`height:${r};`:""}`;if(t==="circle"){const a=r||e||"40px",o=s.includes("height")?s:`width:${a};height:${a};`;this.setTemplate(`<div class="bone circle" part="bone" style="${o}"></div>`);return}if(t==="rect"){const a=s||"width:100%;height:80px;";this.setTemplate(`<div class="bone" part="bone" style="${a}"></div>`);return}const i=Number(this.getAttr("lines","3"))||3;this.setTemplate(`
|
|
1711
1835
|
${Array.from({length:i},()=>'<div class="bone text"></div>').join("")}
|
|
1712
|
-
`)}};
|
|
1836
|
+
`)}};Lt.styles=v`
|
|
1713
1837
|
:host { display: block; width: 100%; min-width: 80px; font-family: var(--fx-font-family); }
|
|
1714
1838
|
.bone {
|
|
1715
1839
|
background: linear-gradient(
|
|
@@ -1727,16 +1851,16 @@
|
|
|
1727
1851
|
.text { height: 12px; width: 100%; margin-bottom: var(--fx-space-sm); }
|
|
1728
1852
|
.text:last-of-type { width: 60%; margin-bottom: 0; }
|
|
1729
1853
|
.circle { border-radius: var(--fx-radius-full); }
|
|
1730
|
-
`;let
|
|
1854
|
+
`;let G=Lt;function Te(){return k("fx-skeleton",G)}Te();const Tt=class Tt extends y{static get observedAttributes(){return["variant","title","dismissible"]}render(){var s,i;const t=this.getAttr("variant","info"),e=this.getAttr("title"),r={info:"ℹ",success:"✓",warning:"⚠",danger:"✕"};this.setTemplate(`
|
|
1731
1855
|
<div class="alert" part="alert" role="alert">
|
|
1732
1856
|
<span class="icon">${(s=r[t])!=null?s:"ℹ"}</span>
|
|
1733
1857
|
<div class="content">
|
|
1734
|
-
${e?`<div class="title">${e}</div>`:""}
|
|
1858
|
+
${e?`<div class="title">${u(e)}</div>`:""}
|
|
1735
1859
|
<div class="body"><slot></slot></div>
|
|
1736
1860
|
</div>
|
|
1737
1861
|
${this.hasAttr("dismissible")?'<button type="button" class="close" aria-label="Fechar">×</button>':""}
|
|
1738
1862
|
</div>
|
|
1739
|
-
`),(i=this.root.querySelector(".close"))==null||i.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))})}};
|
|
1863
|
+
`),(i=this.root.querySelector(".close"))==null||i.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))})}};Tt.styles=v`
|
|
1740
1864
|
:host {
|
|
1741
1865
|
display: block;
|
|
1742
1866
|
font-family: var(--fx-font-family);
|
|
@@ -1769,16 +1893,16 @@
|
|
|
1769
1893
|
line-height: 1; padding: 0; border-radius: var(--fx-radius-full);
|
|
1770
1894
|
}
|
|
1771
1895
|
.close:hover { color: var(--_color); }
|
|
1772
|
-
`;let
|
|
1896
|
+
`;let Q=Tt;function De(){return k("fx-alert",Q)}De();const Dt=class Dt extends y{constructor(){super(...arguments),this._listenersAttached=!1}static get observedAttributes(){return["label","position","open"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}render(){const t=this.getAttr("label","Ações"),e=Array.from(this.querySelectorAll("fx-dropdown-item"));this.setTemplate(`
|
|
1773
1897
|
<span class="trigger" role="button" tabindex="0" part="trigger"
|
|
1774
1898
|
aria-haspopup="menu" aria-expanded="${this.open}">
|
|
1775
|
-
${t} ▾
|
|
1899
|
+
${u(t)} ▾
|
|
1776
1900
|
</span>
|
|
1777
1901
|
<div class="panel" role="menu" part="panel">
|
|
1778
1902
|
${e.length?"":'<div class="empty">Nenhuma ação</div>'}
|
|
1779
1903
|
<slot></slot>
|
|
1780
1904
|
</div>
|
|
1781
|
-
`);const r=this.root.querySelector(".trigger");r==null||r.addEventListener("click",s=>{s.stopPropagation(),document.querySelectorAll("fx-dropdown[open]").forEach(i=>{i!==this&&(i.open=!1)}),this.open=!this.open}),r==null||r.addEventListener("keydown",s=>{
|
|
1905
|
+
`);const r=this.root.querySelector(".trigger");r==null||r.addEventListener("click",s=>{s.stopPropagation(),document.querySelectorAll("fx-dropdown[open]").forEach(i=>{i!==this&&(i.open=!1)}),this.open=!this.open}),r==null||r.addEventListener("keydown",s=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),this.open=!this.open):s.key==="Escape"&&(this.open=!1)}),this._attachDelegatedListeners()}_attachDelegatedListeners(){this._listenersAttached||(this._listenersAttached=!0,this.addEventListener("click",t=>{var r;const e=t.composedPath().find(s=>{var i;return((i=s.tagName)==null?void 0:i.toLowerCase())==="fx-dropdown-item"});e&&(this.open=!1,this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:(r=e.getAttribute("value"))!=null?r:""}})))}),this.docListener=t=>{this.contains(t.target)||(this.open=!1)},document.addEventListener("click",this.docListener))}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener),this.docListener=void 0}};Dt.styles=v`
|
|
1782
1906
|
:host {
|
|
1783
1907
|
position: relative;
|
|
1784
1908
|
display: inline-block;
|
|
@@ -1811,7 +1935,7 @@
|
|
|
1811
1935
|
:host(:not([position])) .panel { left: 0; right: auto; }
|
|
1812
1936
|
::slotted(fx-dropdown-item) { display: block; }
|
|
1813
1937
|
.empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm); }
|
|
1814
|
-
`;let
|
|
1938
|
+
`;let tt=Dt;const qt=class qt extends y{static get observedAttributes(){return["value"]}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}render(){this.setTemplate('<button type="button" class="item" part="item" role="menuitem"><slot></slot></button>')}};qt.styles=v`
|
|
1815
1939
|
:host {
|
|
1816
1940
|
display: block;
|
|
1817
1941
|
font-family: var(--fx-font-family);
|
|
@@ -1832,13 +1956,13 @@
|
|
|
1832
1956
|
transition: background var(--fx-motion-duration-fast) var(--fx-motion-easing);
|
|
1833
1957
|
}
|
|
1834
1958
|
.item:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
1835
|
-
`;let
|
|
1959
|
+
`;let et=qt;function qe(){return k("fx-dropdown",tt)}function Me(){return k("fx-dropdown-item",et)}qe(),Me();const Mt=class Mt extends y{constructor(){super(...arguments),this._onKeydown=()=>{},this._previouslyFocused=null,this._close=()=>{this.open&&(this.open=!1,this._restoreFocus(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["open","title","position"]}get open(){return this.hasAttr("open")}set open(t){this.toggleAttr("open",t)}get title(){return this.getAttr("title")}set title(t){this.setAttribute("title",t)}get position(){const t=this.getAttr("position");return["left","right","top","bottom"].includes(t)?t:"right"}set position(t){this.setAttribute("position",t)}render(){var e,r;const t=this.getAttr("title");this.setTemplate(`
|
|
1836
1960
|
<div class="overlay" part="overlay"></div>
|
|
1837
|
-
<div class="panel" part="panel" role="dialog" aria-modal="true" aria-label="${t||"Drawer"}">
|
|
1838
|
-
${t!==""?`<div class="header" part="header"><span class="title">${t}</span><button type="button" class="close" part="close" aria-label="Fechar">✕</button></div>`:""}
|
|
1961
|
+
<div class="panel" part="panel" role="dialog" aria-modal="true" aria-label="${u(t||"Drawer")}" tabindex="-1">
|
|
1962
|
+
${t!==""?`<div class="header" part="header"><span class="title">${u(t)}</span><button type="button" class="close" part="close" aria-label="Fechar">✕</button></div>`:""}
|
|
1839
1963
|
<div class="body" part="body"><slot></slot></div>
|
|
1840
1964
|
</div>
|
|
1841
|
-
`)
|
|
1965
|
+
`),(e=this.root.querySelector(".overlay"))==null||e.addEventListener("click",this._close),(r=this.root.querySelector(".close"))==null||r.addEventListener("click",this._close),this.open&&requestAnimationFrame(()=>{var s;this._previouslyFocused===null&&(this._previouslyFocused=document.activeElement),(s=this.root.querySelector(".panel"))==null||s.focus()})}connectedCallback(){var t;(t=super.connectedCallback)==null||t.call(this),this._onKeydown=e=>{e.key==="Escape"&&this.open?this._close():e.key==="Tab"&&this.open&&this._trapFocus(e)},document.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){var t;document.removeEventListener("keydown",this._onKeydown),this._restoreFocus(),(t=super.disconnectedCallback)==null||t.call(this)}_trapFocus(t){const e=this.root.querySelector(".panel");if(!e)return;const r=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r.length)return;const s=r[0],i=r[r.length-1],a=this.root.activeElement;t.shiftKey&&(a===s||a===e)?(t.preventDefault(),i.focus()):!t.shiftKey&&a===i&&(t.preventDefault(),s.focus())}_restoreFocus(){var t;(t=this._previouslyFocused)!=null&&t.isConnected&&this._previouslyFocused.focus(),this._previouslyFocused=null}};Mt.styles=v`
|
|
1842
1966
|
:host {
|
|
1843
1967
|
display: contents;
|
|
1844
1968
|
font-family: var(--fx-font-family);
|
|
@@ -1956,7 +2080,7 @@
|
|
|
1956
2080
|
padding: var(--fx-space-md);
|
|
1957
2081
|
flex: 1;
|
|
1958
2082
|
}
|
|
1959
|
-
`;let
|
|
2083
|
+
`;let rt=Mt;function Ie(){return k("fx-drawer",rt)}Ie();const It=class It extends y{static get observedAttributes(){return["page","total","rows","rows-options","position"]}get page(){return Number(this.getAttr("page","1"))||1}set page(t){this.setAttribute("page",String(t))}get total(){return Number(this.getAttr("total","0"))||0}set total(t){this.setAttribute("total",String(t))}get rows(){return Number(this.getAttr("rows","10"))||10}set rows(t){this.setAttribute("rows",String(t))}get pages(){return Math.max(1,Math.ceil(this.total/this.rows))}render(){const t=this.pages,e=Math.min(Math.max(1,this.page),t),r=(this.getAttr("rows-options","5,10,20,50")||"").split(",").map(c=>c.trim()).filter(Boolean),s=[];for(let c=Math.max(1,e-2);c<=Math.min(t,e+2);c++)s.push(c);const i=o(e,this.rows),a=Math.min(e*this.rows,this.total);this.setTemplate(`
|
|
1960
2084
|
<span class="info">${this.total?`${i}-${a} de ${this.total}`:"0 itens"}</span>
|
|
1961
2085
|
<button type="button" class="nav" part="prev" data-go="${e-1}" ${e<=1?"disabled":""}>‹</button>
|
|
1962
2086
|
${s[0]!==1&&t>5?'<button type="button" class="nav" data-go="1">1</button>':""}
|
|
@@ -1964,10 +2088,10 @@
|
|
|
1964
2088
|
${s[s.length-1]!==t&&t>5?`<button type="button" class="nav" data-go="${t}">${t}</button>`:""}
|
|
1965
2089
|
<button type="button" class="nav" part="next" data-go="${e+1}" ${e>=t?"disabled":""}>›</button>
|
|
1966
2090
|
${r.length?`
|
|
1967
|
-
<select class="
|
|
1968
|
-
${r.map(c=>`<option value="${c}"
|
|
1969
|
-
</select>`:""}
|
|
1970
|
-
`);function o(c,
|
|
2091
|
+
<fx-select class="rows-sel" part="rows" size="sm" value="${this.rows}" aria-label="Itens por página">
|
|
2092
|
+
${r.map(c=>`<option value="${u(c)}">${u(c)}</option>`).join("")}
|
|
2093
|
+
</fx-select>`:""}
|
|
2094
|
+
`);function o(c,h){return(c-1)*h+1}this.root.querySelectorAll(".nav[data-go]").forEach(c=>{c.addEventListener("click",()=>{const h=Number(c.dataset.go);h>=1&&h<=t&&h!==e&&(this.page=h,this.emit())})});const n=this.root.querySelector("fx-select.rows-sel");n==null||n.addEventListener("change",c=>{var g;const h=Number((g=c.detail)==null?void 0:g.value);!h||h===this.rows||(this.rows=h,this.page=1,this.emit())})}emit(){this.dispatchEvent(new CustomEvent("page-change",{bubbles:!0,composed:!0,detail:{page:this.page,rows:this.rows}}))}};It.styles=v`
|
|
1971
2095
|
:host {
|
|
1972
2096
|
display: flex;
|
|
1973
2097
|
align-items: center;
|
|
@@ -1993,7 +2117,7 @@
|
|
|
1993
2117
|
border-color var(--fx-motion-duration-fast) var(--fx-motion-easing),
|
|
1994
2118
|
background var(--fx-motion-duration-fast) var(--fx-motion-easing);
|
|
1995
2119
|
}
|
|
1996
|
-
.nav:hover:not([disabled]) { border-color: var(--fx-color-primary); color: var(--fx-color-primary); }
|
|
2120
|
+
.nav:hover:not([disabled]):not(.active) { border-color: var(--fx-color-primary); color: var(--fx-color-primary); }
|
|
1997
2121
|
.nav[disabled] { opacity: 0.5; cursor: not-allowed; }
|
|
1998
2122
|
.nav.active {
|
|
1999
2123
|
background: var(--fx-color-primary);
|
|
@@ -2002,12 +2126,19 @@
|
|
|
2002
2126
|
font-weight: 600;
|
|
2003
2127
|
}
|
|
2004
2128
|
.info { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); }
|
|
2005
|
-
select
|
|
2006
|
-
|
|
2129
|
+
fx-select { vertical-align: middle; }
|
|
2130
|
+
fx-select::part(trigger) {
|
|
2131
|
+
min-width: 64px !important;
|
|
2132
|
+
min-height: var(--fx-size-sm) !important;
|
|
2133
|
+
padding: 0 var(--fx-space-sm) !important;
|
|
2134
|
+
border-radius: var(--fx-radius-sm) !important;
|
|
2135
|
+
font-size: calc(var(--fx-font-size) - 2px) !important;
|
|
2136
|
+
}
|
|
2137
|
+
`;let st=It;function Ne(){return k("fx-pagination",st)}Ne();const Nt=class Nt extends y{static get observedAttributes(){return["size","placeholder","source","disabled","min-chars"]}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get value(){return this.getAttr("value")}set value(t){this.setAttribute("value",t)}get source(){try{const t=JSON.parse(this.getAttr("source","[]"));return Array.isArray(t)?t.map(String):[]}catch(t){return[]}}set source(t){this.setAttribute("source",typeof t=="string"?t:JSON.stringify(t))}connectedCallback(){super.connectedCallback(),this.docListener=t=>{this.contains(t.target)||this.toggleAttr("open",!1)},document.addEventListener("click",this.docListener)}disconnectedCallback(){super.disconnectedCallback(),this.docListener&&document.removeEventListener("click",this.docListener),this.docListener=void 0}render(){const t=this.getAttr("placeholder");this.setTemplate(`
|
|
2007
2138
|
<input class="field" part="input" type="text"
|
|
2008
|
-
${t?`placeholder="${t}"`:""} autocomplete="off"/>
|
|
2139
|
+
${t?`placeholder="${u(t)}"`:""} autocomplete="off"/>
|
|
2009
2140
|
<div class="list" part="list" role="listbox"></div>
|
|
2010
|
-
`);const e=this.root.querySelector(".field");if(!e)return;e.value=this.value,this.hasAttr("disabled")&&e.setAttribute("disabled","");const r=this.root.querySelector(".list"),s=Number(this.getAttr("min-chars","1"))||1,i=()=>{if(!r)return;const a=e.value.toLowerCase(),o=this.source.filter(n=>n.toLowerCase().includes(a)).slice(0,8);r.innerHTML=o.length?o.map(n=>`<button type="button" class="opt" role="option" data-v="${n}">${n}</button>`).join(""):'<div class="empty">Nenhum resultado</div>',r.querySelectorAll(".opt").forEach(n=>{n.addEventListener("click",()=>{var c;e.value=(c=n.dataset.v)!=null?c:"",this.value=e.value,this.toggleAttr("open",!1),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:this.value}}))})}),this.toggleAttr("open",!0)};e.addEventListener("input",()=>{this.value=e.value,i()}),e.addEventListener("focus",()=>{e.value.length>=s&&i()}),
|
|
2141
|
+
`);const e=this.root.querySelector(".field");if(!e)return;e.value=this.value,this.hasAttr("disabled")&&e.setAttribute("disabled","");const r=this.root.querySelector(".list"),s=Number(this.getAttr("min-chars","1"))||1,i=()=>{if(!r)return;const a=e.value.toLowerCase(),o=this.source.filter(n=>n.toLowerCase().includes(a)).slice(0,8);r.innerHTML=o.length?o.map(n=>`<button type="button" class="opt" role="option" data-v="${u(n)}">${u(n)}</button>`).join(""):'<div class="empty">Nenhum resultado</div>',r.querySelectorAll(".opt").forEach(n=>{n.addEventListener("click",()=>{var c;e.value=(c=n.dataset.v)!=null?c:"",this.value=e.value,this.toggleAttr("open",!1),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{value:this.value}}))})}),this.toggleAttr("open",!0)};e.addEventListener("input",()=>{this.value=e.value,i()}),e.addEventListener("focus",()=>{e.value.length>=s&&i()}),e.addEventListener("keydown",a=>{var h;if(a.key==="Escape"){this.toggleAttr("open",!1);return}if(a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;a.preventDefault(),this.hasAttr("open")||i();const o=Array.from(this.root.querySelectorAll(".opt"));if(!o.length)return;const n=o.indexOf(this.root.activeElement),c=a.key==="ArrowDown"?n===-1?0:Math.min(n+1,o.length-1):n===-1?o.length-1:Math.max(n-1,0);(h=o[c])==null||h.focus()})}};Nt.styles=v`
|
|
2011
2142
|
:host {
|
|
2012
2143
|
position: relative;
|
|
2013
2144
|
display: inline-block;
|
|
@@ -2069,22 +2200,22 @@
|
|
|
2069
2200
|
}
|
|
2070
2201
|
.opt:hover { background: color-mix(in srgb, var(--fx-color-primary) 12%, var(--fx-surface-background)); color: var(--fx-color-primary); }
|
|
2071
2202
|
.empty { color: var(--fx-text-muted); font-size: calc(var(--fx-font-size) - 2px); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
2072
|
-
`;let
|
|
2203
|
+
`;let it=Nt;function je(){return k("fx-autocomplete",it)}je();const jt=class jt extends y{constructor(){super(...arguments),this._isDragging=!1,this._startY=0,this._startValue=0,this._onMouseMove=t=>{if(!this._isDragging)return;const e=this._startY-t.clientY,r=(this.max-this.min)/100;this.emitChange(this._startValue+e*r)},this._onMouseUp=()=>{this._isDragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp)}}static get observedAttributes(){return["value","min","max","step","size","stroke-width","value-color","range-color","readonly","disabled","value-template"]}get value(){return this.clampValue(Number(this.getAttr("value","0"))||0)}set value(t){if(this.readonly||this.disabled)return;const e=this.clampValue(t),r=this.clampValue(Number(this.getAttr("value","0"))||0);e!==r&&(this.setAttribute("value",String(e)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}})))}get min(){return Number(this.getAttr("min","0"))||0}set min(t){this.setAttribute("min",String(t))}get max(){return Number(this.getAttr("max","100"))||100}set max(t){this.setAttribute("max",String(t))}get step(){return Number(this.getAttr("step","1"))||1}set step(t){this.setAttribute("step",String(t))}get size(){const t=this.getAttr("size","md");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get strokeWidth(){return Number(this.getAttr("stroke-width","8"))||8}set strokeWidth(t){this.setAttribute("stroke-width",String(t))}get valueColor(){return this.getAttr("value-color","")}set valueColor(t){this.setAttribute("value-color",t)}get rangeColor(){return this.getAttr("range-color","")}set rangeColor(t){this.setAttribute("range-color",t)}get readonly(){return this.hasAttr("readonly")}set readonly(t){this.toggleAttr("readonly",!!t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",!!t)}get valueTemplate(){return this.getAttr("value-template","{value}")}set valueTemplate(t){this.setAttribute("value-template",t)}render(){const t=this.min,e=this.max,r=this.clampValue(this.value),s=e-t,i=s>0?(r-t)/s:0,a=this.getSizeNum(),o=this.strokeWidth,n=(a-o)/2,c=2*Math.PI*n,h=c*(1-i),g=this.valueColor?this.safeColor(this.valueColor):"",f=this.rangeColor?this.safeColor(this.rangeColor):"",d=g?`--_value-color: ${g};`:"",m=f?`--_range-color: ${f};`:"",p=this.valueTemplate.replace("{value}",String(Math.round(r)));this.setTemplate(`
|
|
2073
2204
|
<div class="knob" part="knob" tabindex="${this.disabled?"-1":"0"}"
|
|
2074
2205
|
role="slider" aria-valuenow="${r}" aria-valuemin="${t}" aria-valuemax="${e}"
|
|
2075
2206
|
aria-readonly="${this.readonly}" aria-disabled="${this.disabled}"
|
|
2076
|
-
style="${
|
|
2207
|
+
style="${d}${m}">
|
|
2077
2208
|
<svg viewBox="0 0 ${a} ${a}" part="svg">
|
|
2078
2209
|
<circle class="track" part="track"
|
|
2079
2210
|
cx="${a/2}" cy="${a/2}" r="${n}" />
|
|
2080
2211
|
<circle class="value" part="value"
|
|
2081
2212
|
cx="${a/2}" cy="${a/2}" r="${n}"
|
|
2082
2213
|
stroke-dasharray="${c}"
|
|
2083
|
-
stroke-dashoffset="${
|
|
2214
|
+
stroke-dashoffset="${h}" />
|
|
2084
2215
|
</svg>
|
|
2085
|
-
<div class="label" part="label">${
|
|
2216
|
+
<div class="label" part="label">${u(p)}</div>
|
|
2086
2217
|
</div>
|
|
2087
|
-
`),this.attachListeners()}getSizeNum(){const t=this.size;return t==="sm"?60:t==="lg"?140:100}clampValue(t){const e=this.min,r=this.max,s=this.step;let i=Math.min(r,Math.max(e,t));return s>0&&(i=Math.round((i-e)/s)*s+e,i=Math.min(r,Math.max(e,i))),i}emitChange(t){const e=this.clampValue(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}})))}attachListeners(){const t=this.root.querySelector(".knob");t&&(t.addEventListener("mousedown",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.clientY,this._startValue=this.value,t.focus(),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}),t.addEventListener("touchstart",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.touches[0].clientY,this._startValue=this.value,t.focus())},{passive:!1}),t.addEventListener("touchmove",e=>{if(!this._isDragging||this.readonly||this.disabled)return;e.preventDefault();const r=this._startY-e.touches[0].clientY,s=(this.max-this.min)/100;this.emitChange(this._startValue+r*s)},{passive:!1}),t.addEventListener("touchend",()=>{this._isDragging=!1}),t.addEventListener("keydown",e=>{if(this.readonly||this.disabled)return;const r=this.step;switch(e.key){case"ArrowUp":case"ArrowRight":e.preventDefault(),this.emitChange(this.value+r);break;case"ArrowDown":case"ArrowLeft":e.preventDefault(),this.emitChange(this.value-r);break;case"Home":e.preventDefault(),this.emitChange(this.min);break;case"End":e.preventDefault(),this.emitChange(this.max);break;case"PageUp":e.preventDefault(),this.emitChange(this.value+r*10);break;case"PageDown":e.preventDefault(),this.emitChange(this.value-r*10);break}}))}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),super.disconnectedCallback()}};
|
|
2218
|
+
`),this.attachListeners()}getSizeNum(){const t=this.size;return t==="sm"?60:t==="lg"?140:100}safeColor(t){const e=t.trim();return/^#[0-9a-fA-F]{3,8}$/.test(e)||/^(rgb|rgba|hsl|hsla)\([\d\s.,%()]+\)$/i.test(e)||/^var\(--[\w-]+(,\s*[^)]*)?\)$/.test(e)||/^[a-zA-Z]+$/.test(e)?e:""}clampValue(t){const e=this.min,r=this.max,s=this.step;let i=Math.min(r,Math.max(e,t));return s>0&&(i=Math.round((i-e)/s)*s+e,i=Math.min(r,Math.max(e,i))),i}emitChange(t){const e=this.clampValue(t);e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}})))}attachListeners(){const t=this.root.querySelector(".knob");t&&(t.addEventListener("mousedown",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.clientY,this._startValue=this.value,t.focus(),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}),t.addEventListener("touchstart",e=>{this.readonly||this.disabled||(e.preventDefault(),this._isDragging=!0,this._startY=e.touches[0].clientY,this._startValue=this.value,t.focus())},{passive:!1}),t.addEventListener("touchmove",e=>{if(!this._isDragging||this.readonly||this.disabled)return;e.preventDefault();const r=this._startY-e.touches[0].clientY,s=(this.max-this.min)/100;this.emitChange(this._startValue+r*s)},{passive:!1}),t.addEventListener("touchend",()=>{this._isDragging=!1}),t.addEventListener("keydown",e=>{if(this.readonly||this.disabled)return;const r=this.step;switch(e.key){case"ArrowUp":case"ArrowRight":e.preventDefault(),this.emitChange(this.value+r);break;case"ArrowDown":case"ArrowLeft":e.preventDefault(),this.emitChange(this.value-r);break;case"Home":e.preventDefault(),this.emitChange(this.min);break;case"End":e.preventDefault(),this.emitChange(this.max);break;case"PageUp":e.preventDefault(),this.emitChange(this.value+r*10);break;case"PageDown":e.preventDefault(),this.emitChange(this.value-r*10);break}}))}disconnectedCallback(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),super.disconnectedCallback()}};jt.styles=v`
|
|
2088
2219
|
:host {
|
|
2089
2220
|
display: inline-flex;
|
|
2090
2221
|
align-items: center;
|
|
@@ -2150,13 +2281,13 @@
|
|
|
2150
2281
|
.knob:focus-visible svg {
|
|
2151
2282
|
filter: drop-shadow(var(--fx-effect-focus-ring, 0 0 0 3px color-mix(in srgb, var(--fx-color-primary) 22%, transparent)));
|
|
2152
2283
|
}
|
|
2153
|
-
`;let
|
|
2284
|
+
`;let at=jt;function Pe(){return k("fx-knob",at)}Pe();const Pt=class Pt extends y{constructor(){super(...arguments),this._data=[],this._filteredData=null,this._selection=[],this._filterValue="",this._draggedIndex=null,this._listenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["data","data-key","filter","filter-by","filter-placeholder","breakpoint","controls-location","dragdrop","striped","selection-mode","show-select-all"]}set data(t){this._data=t,this._filteredData=null,this.render()}get data(){return this._data}set selection(t){this._selection=t,this.render()}get selection(){return this._selection}get dataKey(){return this.getAttr("data-key","")}set dataKey(t){this.setAttribute("data-key",t)}get filter(){return this.hasAttr("filter")}set filter(t){this.toggleAttr("filter",t)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(t){this.setAttribute("filter-by",t)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(t){this.setAttribute("filter-placeholder",t)}get breakpoint(){return this.getAttr("breakpoint","960px")}set breakpoint(t){this.setAttribute("breakpoint",t)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(t){this.toggleAttr("dragdrop",t)}get striped(){return this.hasAttr("striped")}set striped(t){this.toggleAttr("striped",t)}get selectionMode(){const t=this.getAttr("selection-mode","");return t==="single"||t==="multiple"?t:""}set selectionMode(t){this.setAttribute("selection-mode",t)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(t){this.toggleAttr("show-select-all",t)}get filterValue(){return this._filterValue}set filterValue(t){this._filterValue=t,this._applyFilter(),this._updateListDisplay()}setOptionTemplate(t){this._optionTemplate=t,this.render()}connectedCallback(){this._parseDataAttribute(),super.connectedCallback()}attributeChangedCallback(){this.getAttr("data","")!==""&&this._parseDataAttribute(),super.attributeChangedCallback()}_parseDataAttribute(){const t=this.getAttr("data","");if(t)try{this._data=JSON.parse(t),this._filteredData=null}catch(e){this._data=[]}}_applyFilter(){if(!this._filterValue){this._filteredData=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredData=this._data.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._filterValue.toLowerCase())}))}_getDisplayData(){return this._filteredData||this._data}_getItemKey(t,e){return this.dataKey&&t[this.dataKey]!=null?String(t[this.dataKey]):t.id!=null?String(t.id):t.key!=null?String(t.key):t.label!=null?String(t.label):t.name!=null?String(t.name):t.value!=null?String(t.value):String(e)}_getItemLabel(t){const e=["label","name","title","text","value"];for(const r of e)if(t[r]!=null)return String(t[r]);return JSON.stringify(t)}_isSelected(t){return this._selection.some(e=>this._getItemKey(e,-1)===this._getItemKey(t,-1))}_moveItem(t,e){const r=this._getActualIndex(t),s=this._getActualIndex(e);if(r===-1||s===-1)return;const i=this._data.splice(r,1)[0];this._data.splice(s,0,i),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_getActualIndex(t){if(this._filteredData){const e=this._filteredData[t];return this._data.findIndex(r=>this._getItemKey(r,-1)===this._getItemKey(e,-1))}return t}_emitReorder(){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,composed:!0,detail:{items:[...this._data]}}))}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{selection:[...this._selection]}}))}_toggleSelection(t){const e=this._getItemKey(t,-1),r=this._selection.findIndex(s=>this._getItemKey(s,-1)===e);r>=0?this._selection.splice(r,1):this.selectionMode==="multiple"?this._selection.push(t):this._selection=[t],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_selectAll(){const t=this._getDisplayData();this._selection=[...t],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_deselectAll(){this._selection=[],this._emitSelectionChange(),this._updateListDisplay(),this._updateControlsState()}_toggleSelectAll(){const t=this._getDisplayData();this._selection.length===t.length?this._deselectAll():this._selectAll()}render(){const t=this._getDisplayData(),e=this.selectionMode,r=this.selectionMode==="multiple",s=r&&t.length>0&&this._selection.length===t.length;this.setTemplate(`
|
|
2154
2285
|
<div class="container" part="container">
|
|
2155
2286
|
${this.filter?`
|
|
2156
2287
|
<div class="filter-wrapper" part="filter-wrapper">
|
|
2157
2288
|
<input type="text" class="filter-input" part="filter-input"
|
|
2158
2289
|
placeholder="${this.filterPlaceholder}"
|
|
2159
|
-
value="${
|
|
2290
|
+
value="${u(this._filterValue)}"
|
|
2160
2291
|
aria-label="Filtrar lista" />
|
|
2161
2292
|
</div>
|
|
2162
2293
|
`:""}
|
|
@@ -2198,9 +2329,9 @@
|
|
|
2198
2329
|
<li class="empty-message" part="empty-message">
|
|
2199
2330
|
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
2200
2331
|
</li>
|
|
2201
|
-
`:t.map((i,a)=>{const o=this._getItemKey(i,a),n=this._getItemLabel(i),c=this._isSelected(i),
|
|
2332
|
+
`:t.map((i,a)=>{const o=this._getItemKey(i,a),n=this._getItemLabel(i),c=this._isSelected(i),h=this._optionTemplate?this._optionTemplate(i):u(n);return`
|
|
2202
2333
|
<li class="list-item${c?" selected":""}" part="list-item"
|
|
2203
|
-
data-index="${a}" data-key="${
|
|
2334
|
+
data-index="${a}" data-key="${u(o)}"
|
|
2204
2335
|
role="option" aria-selected="${c}"
|
|
2205
2336
|
${this.dragdrop?'draggable="true"':""}
|
|
2206
2337
|
tabindex="0">
|
|
@@ -2208,9 +2339,9 @@
|
|
|
2208
2339
|
${e?`
|
|
2209
2340
|
<input type="checkbox" class="checkbox" part="checkbox"
|
|
2210
2341
|
${c?"checked":""}
|
|
2211
|
-
aria-label="Selecionar ${
|
|
2342
|
+
aria-label="Selecionar ${u(n)}" />
|
|
2212
2343
|
`:""}
|
|
2213
|
-
<span class="item-content" part="item-content">${
|
|
2344
|
+
<span class="item-content" part="item-content">${h}</span>
|
|
2214
2345
|
</li>
|
|
2215
2346
|
`}).join("")}
|
|
2216
2347
|
</ul>
|
|
@@ -2236,23 +2367,23 @@
|
|
|
2236
2367
|
<li class="empty-message" part="empty-message">
|
|
2237
2368
|
${this.filter?"Nenhum resultado encontrado":"Nenhum item disponivel"}
|
|
2238
2369
|
</li>
|
|
2239
|
-
`:e.map((a,o)=>{const n=this._getItemKey(a,o),c=this._getItemLabel(a),
|
|
2240
|
-
<li class="list-item${
|
|
2241
|
-
data-index="${o}" data-key="${
|
|
2242
|
-
role="option" aria-selected="${
|
|
2370
|
+
`:e.map((a,o)=>{const n=this._getItemKey(a,o),c=this._getItemLabel(a),h=this._isSelected(a),g=this._optionTemplate?this._optionTemplate(a):u(c);return`
|
|
2371
|
+
<li class="list-item${h?" selected":""}" part="list-item"
|
|
2372
|
+
data-index="${o}" data-key="${u(n)}"
|
|
2373
|
+
role="option" aria-selected="${h}"
|
|
2243
2374
|
${this.dragdrop?'draggable="true"':""}
|
|
2244
2375
|
tabindex="0">
|
|
2245
2376
|
${this.dragdrop?'<span class="drag-handle" part="drag-handle" aria-label="Arrastar">⋮⋮</span>':""}
|
|
2246
2377
|
${r?`
|
|
2247
2378
|
<input type="checkbox" class="checkbox" part="checkbox"
|
|
2248
|
-
${
|
|
2249
|
-
aria-label="Selecionar ${
|
|
2379
|
+
${h?"checked":""}
|
|
2380
|
+
aria-label="Selecionar ${u(c)}" />
|
|
2250
2381
|
`:""}
|
|
2251
|
-
<span class="item-content" part="item-content">${
|
|
2382
|
+
<span class="item-content" part="item-content">${g}</span>
|
|
2252
2383
|
</li>
|
|
2253
2384
|
`}).join("")}
|
|
2254
2385
|
</ul>
|
|
2255
|
-
`,this._attachListeners(),this._attachItemListeners(this.root.querySelector(".list"))}_handleMoveAction(t){if(!this._selection.length)return;const e=this._getDisplayData(),r=this._selection.map(s=>e.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0).sort((s,i)=>s-i);if(r.length!==0)switch(t){case"top":this._moveSelectedToStart(r);break;case"up":this._moveSelectedByOne(r,-1);break;case"down":this._moveSelectedByOne(r,1);break;case"bottom":this._moveSelectedToEnd(r);break}}_moveSelectedToStart(t){const e=[],r=[];for(const i of t){const a=this._getActualIndex(i);e.push(this._data[a]),r.push(a)}r.sort((i,a)=>a-i).forEach(i=>this._data.splice(i,1));const s=this._getActualIndex(0);this._data.splice(s,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedToEnd(t){const e=[],r=[];for(const a of t){const o=this._getActualIndex(a);e.push(this._data[o]),r.push(o)}r.sort((a,o)=>o-a).forEach(a=>this._data.splice(a,1));const s=this._getDisplayData(),i=this._getActualIndex(s.length-1);this._data.splice(i+1,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedByOne(t,e){if(this._getDisplayData().length===0)return;const s=t.map(o=>this._getActualIndex(o)).filter(o=>o>=0).sort((o,n)=>o-n);if(s.length===0||e<0&&s[0]<=0||e>0&&s[s.length-1]>=this._data.length-1)return;const i=s.map(o=>this._data[o]);for(let o=s.length-1;o>=0;o--)this._data.splice(s[o],1);let a;e<0?a=s[0]-1:a=s[s.length-1]-s.length+1+1,a=Math.max(0,Math.min(a,this._data.length)),this._data.splice(a,0,...i),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_updateControlsState(){const t=this._getDisplayData(),e=this._selection.map(s=>t.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0);this.root.querySelectorAll(".control-btn").forEach(s=>{const i=s.dataset.action;let a=e.length===0;if(!a)switch(i){case"top":case"up":a=e[0]===0;break;case"bottom":case"down":a=e[e.length-1]===t.length-1;break}s.disabled=a})}};
|
|
2386
|
+
`,this._attachListeners(),this._attachItemListeners(this.root.querySelector(".list"))}_handleMoveAction(t){if(!this._selection.length)return;const e=this._getDisplayData(),r=this._selection.map(s=>e.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0).sort((s,i)=>s-i);if(r.length!==0)switch(t){case"top":this._moveSelectedToStart(r);break;case"up":this._moveSelectedByOne(r,-1);break;case"down":this._moveSelectedByOne(r,1);break;case"bottom":this._moveSelectedToEnd(r);break}}_moveSelectedToStart(t){const e=[],r=[];for(const i of t){const a=this._getActualIndex(i);e.push(this._data[a]),r.push(a)}r.sort((i,a)=>a-i).forEach(i=>this._data.splice(i,1));const s=this._getActualIndex(0);this._data.splice(s,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedToEnd(t){const e=[],r=[];for(const a of t){const o=this._getActualIndex(a);e.push(this._data[o]),r.push(o)}r.sort((a,o)=>o-a).forEach(a=>this._data.splice(a,1));const s=this._getDisplayData(),i=this._getActualIndex(s.length-1);this._data.splice(i+1,0,...e),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_moveSelectedByOne(t,e){if(this._getDisplayData().length===0)return;const s=t.map(o=>this._getActualIndex(o)).filter(o=>o>=0).sort((o,n)=>o-n);if(s.length===0||e<0&&s[0]<=0||e>0&&s[s.length-1]>=this._data.length-1)return;const i=s.map(o=>this._data[o]);for(let o=s.length-1;o>=0;o--)this._data.splice(s[o],1);let a;e<0?a=s[0]-1:a=s[s.length-1]-s.length+1+1,a=Math.max(0,Math.min(a,this._data.length)),this._data.splice(a,0,...i),this._applyFilter(),this._updateListDisplay(),this._updateControlsState(),this._emitReorder()}_updateControlsState(){const t=this._getDisplayData(),e=this._selection.map(s=>t.findIndex(i=>this._getItemKey(i,-1)===this._getItemKey(s,-1))).filter(s=>s>=0);this.root.querySelectorAll(".control-btn").forEach(s=>{const i=s.dataset.action;let a=e.length===0;if(!a)switch(i){case"top":case"up":a=e[0]===0;break;case"bottom":case"down":a=e[e.length-1]===t.length-1;break}s.disabled=a})}};Pt.styles=v`
|
|
2256
2387
|
|
|
2257
2388
|
:host {
|
|
2258
2389
|
display: block;
|
|
@@ -2327,7 +2458,7 @@
|
|
|
2327
2458
|
@media (max-width: 640px) { .main-row { flex-direction: column; } .controls-bar { flex-direction: row; flex-wrap: wrap; justify-content: center; position: relative; } .control-group { flex-direction: row; } .control-group + .control-group { margin-top: 0; margin-left: 4px; padding-top: 0; padding-left: 4px; border-top: none; border-left: 1px solid var(--orderlist-border); } button.control-btn { width: 44px; height: 40px; } button.control-btn::after { display: none; } .list { max-height: 300px; } }
|
|
2328
2459
|
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
|
|
2329
2460
|
.list-item { animation: slideIn 0.2s ease-out; }
|
|
2330
|
-
`;let it=Nt;function E(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ze(){return b("fx-orderlist",it)}ze();const jt=class jt extends f{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(t){this._source=t,this._filteredSource=null,this.render()}get source(){return this._source}set target(t){this._target=t,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(t){this._sourceSelection=t,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(t){this._targetSelection=t,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(t){this.setAttribute("source-key",t)}get targetKey(){return this.getAttr("target-key","")}set targetKey(t){this.setAttribute("target-key",t)}get filter(){return this.hasAttr("filter")}set filter(t){this.toggleAttr("filter",t)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(t){this.setAttribute("filter-by",t)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(t){this.setAttribute("filter-placeholder",t)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(t){this.toggleAttr("dragdrop",t)}get striped(){return this.hasAttr("striped")}set striped(t){this.toggleAttr("striped",t)}get selectionMode(){const t=this.getAttr("selection-mode","");return t==="single"||t==="multiple"?t:""}set selectionMode(t){this.setAttribute("selection-mode",t)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(t){this.toggleAttr("show-select-all",t)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(t){this.setAttribute("source-label",t)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(t){this.setAttribute("target-label",t)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(t){this._sourceFilterValue=t,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(t){this._targetFilterValue=t,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(t){this._optionTemplate=t,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback()}_parseSourceAttribute(){const t=this.getAttr("source","");if(t)try{this._source=JSON.parse(t),this._filteredSource=null}catch(e){this._source=[]}}_parseTargetAttribute(){const t=this.getAttr("target","");if(t)try{this._target=JSON.parse(t),this._filteredTarget=null}catch(e){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredSource=this._source.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredTarget=this._target.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(t,e,r){const s=r?this.sourceKey:this.targetKey;return s&&t[s]!=null?String(t[s]):t.id!=null?String(t.id):t.key!=null?String(t.key):t.label!=null?String(t.label):t.name!=null?String(t.name):t.value!=null?String(t.value):String(e)}_getItemLabel(t){const e=["label","name","title","text","value"];for(const r of e)if(t[r]!=null)return String(t[r]);return JSON.stringify(t)}_isSourceSelected(t,e){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,e,!0))}_isTargetSelected(t,e){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,e,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const t=this._getDisplaySource(),e=this._getDisplayTarget(),r=this.selectionMode,s=r==="multiple"&&this.showSelectAll,i=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:t.map((c,u)=>`<li class="list-item${this._isSourceSelected(c,u)?" selected":""}" data-index="${u}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(c,u)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):$(this._getItemLabel(c))}</span></li>`).join(""),a=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:e.map((c,u)=>`<li class="list-item${this._isTargetSelected(c,u)?" selected":""}" data-index="${u}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(c,u)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):$(this._getItemLabel(c))}</span></li>`).join(""),o=s?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=s?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${$(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+$(this._sourceFilterValue)+'" /></div>':""}${o}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${i}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${$(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+$(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${a}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",t=>{const e=t.target;if(e.classList.contains("select-all-checkbox")){this._handleSelectAll(e);return}e.classList.contains("source-filter")?this.sourceFilterValue=e.value:e.classList.contains("target-filter")&&(this.targetFilterValue=e.value)}),this.root.addEventListener("click",t=>{const e=t.target,r=e.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const s=e.closest(".list-item");if(!s)return;const i=s.dataset.list==="source",a=Number(s.dataset.index),o=(i?this._getDisplaySource():this._getDisplayTarget())[a];i?this._toggleSourceSelection(o,a):this._toggleTargetSelection(o,a)})),this._updateControlsState()}_handleSelectAll(t){t.dataset.list==="source"?(this._sourceSelection=t.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=t.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const t=(e,r,s)=>{e&&e.querySelectorAll(".list-item").forEach(i=>{const a=Number(i.dataset.index),o=r(s()[a],a);i.classList.toggle("selected",o),i.setAttribute("aria-selected",String(o));const n=i.querySelector(".checkbox");n&&(n.checked=o)})};t(this.root.querySelector(".source-list"),(e,r)=>this._isSourceSelected(e,r),()=>this._getDisplaySource()),t(this.root.querySelector(".target-list"),(e,r)=>this._isTargetSelected(e,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:e,total:r,sel:s})=>{var a;if(!e)return;e.checked=r>0&&s===r;const i=(a=e.closest(".select-all-bar"))==null?void 0:a.querySelector(".selection-count");i&&(i.textContent=`${s} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(t=>{const e=t.dataset.action;t.disabled=e==="move-target"&&this._sourceSelection.length===0||e==="move-all-target"&&this._source.length===0||e==="move-source"&&this._targetSelection.length===0||e==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const t=[...this._sourceSelection];this._source=this._source.filter(e=>!t.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,-1,!0))),this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const t=[...this._targetSelection];this._target=this._target.filter(e=>!t.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,-1,!1))),this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const t=[...this._source];this._source=[],this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const t=[...this._target];this._target=[],this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!0),i=this._sourceSelection.findIndex(a=>this._getItemKey(a,-1,!0)===s);i>=0?this._sourceSelection.splice(i,1):r==="multiple"?this._sourceSelection.push(t):this._sourceSelection=[t],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!1),i=this._targetSelection.findIndex(a=>this._getItemKey(a,-1,!1)===s);i>=0?this._targetSelection.splice(i,1):r==="multiple"?this._targetSelection.push(t):this._targetSelection=[t],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var u,l;const t=(u=this.root.querySelector(".source-list"))==null?void 0:u.parentElement,e=(l=this.root.querySelector(".target-list"))==null?void 0:l.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),s=this.root.querySelector(".list-container:last-of-type .list-label");if(!t||!e){this.render();return}const i=this._getDisplaySource(),a=this._getDisplayTarget(),o=this.selectionMode,n=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:i.map((h,d)=>`<li class="list-item${this._isSourceSelected(h,d)?" selected":""}" part="list-item" data-index="${d}" data-list="source" role="option" aria-selected="${this._isSourceSelected(h,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(h,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(h):$(this._getItemLabel(h))}</span></li>`).join(""),c=a.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:a.map((h,d)=>`<li class="list-item${this._isTargetSelected(h,d)?" selected":""}" part="list-item" data-index="${d}" data-list="target" role="option" aria-selected="${this._isTargetSelected(h,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(h,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(h):$(this._getItemLabel(h))}</span></li>`).join("");t.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,e.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${c}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),s&&(s.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};jt.styles=p`
|
|
2461
|
+
`;let ot=Pt;function Fe(){return k("fx-orderlist",ot)}Fe();const Ft=class Ft extends y{constructor(){super(...arguments),this._source=[],this._filteredSource=null,this._target=[],this._filteredTarget=null,this._sourceSelection=[],this._targetSelection=[],this._sourceFilterValue="",this._targetFilterValue="",this._filterListenersAttached=!1,this._optionTemplate=null}static get observedAttributes(){return["source","target","source-key","target-key","filter","filter-by","filter-placeholder","dragdrop","striped","selection-mode","show-select-all","source-label","target-label"]}set source(t){this._source=t,this._filteredSource=null,this.render()}get source(){return this._source}set target(t){this._target=t,this._filteredTarget=null,this.render()}get target(){return this._target}set sourceSelection(t){this._sourceSelection=t,this.render()}get sourceSelection(){return this._sourceSelection}set targetSelection(t){this._targetSelection=t,this.render()}get targetSelection(){return this._targetSelection}get sourceKey(){return this.getAttr("source-key","")}set sourceKey(t){this.setAttribute("source-key",t)}get targetKey(){return this.getAttr("target-key","")}set targetKey(t){this.setAttribute("target-key",t)}get filter(){return this.hasAttr("filter")}set filter(t){this.toggleAttr("filter",t)}get filterBy(){return this.getAttr("filter-by","label")}set filterBy(t){this.setAttribute("filter-by",t)}get filterPlaceholder(){return this.getAttr("filter-placeholder","Buscar...")}set filterPlaceholder(t){this.setAttribute("filter-placeholder",t)}get dragdrop(){return this.hasAttr("dragdrop")}set dragdrop(t){this.toggleAttr("dragdrop",t)}get striped(){return this.hasAttr("striped")}set striped(t){this.toggleAttr("striped",t)}get selectionMode(){const t=this.getAttr("selection-mode","");return t==="single"||t==="multiple"?t:""}set selectionMode(t){this.setAttribute("selection-mode",t)}get showSelectAll(){return this.hasAttr("show-select-all")}set showSelectAll(t){this.toggleAttr("show-select-all",t)}get sourceLabel(){return this.getAttr("source-label","Disponíveis")}set sourceLabel(t){this.setAttribute("source-label",t)}get targetLabel(){return this.getAttr("target-label","Selecionados")}set targetLabel(t){this.setAttribute("target-label",t)}get sourceFilterValue(){return this._sourceFilterValue}set sourceFilterValue(t){this._sourceFilterValue=t,this._applySourceFilter(),this._updateListDisplay()}get targetFilterValue(){return this._targetFilterValue}set targetFilterValue(t){this._targetFilterValue=t,this._applyTargetFilter(),this._updateListDisplay()}setOptionTemplate(t){this._optionTemplate=t,this.render()}connectedCallback(){this._parseSourceAttribute(),this._parseTargetAttribute(),super.connectedCallback()}attributeChangedCallback(){this.getAttr("source","")!==""&&this._parseSourceAttribute(),this.getAttr("target","")!==""&&this._parseTargetAttribute(),super.attributeChangedCallback()}_parseSourceAttribute(){const t=this.getAttr("source","");if(t)try{this._source=JSON.parse(t),this._filteredSource=null}catch(e){this._source=[]}}_parseTargetAttribute(){const t=this.getAttr("target","");if(t)try{this._target=JSON.parse(t),this._filteredTarget=null}catch(e){this._target=[]}}_applySourceFilter(){if(!this._sourceFilterValue){this._filteredSource=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredSource=this._source.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._sourceFilterValue.toLowerCase())}))}_applyTargetFilter(){if(!this._targetFilterValue){this._filteredTarget=null;return}const t=this.filterBy.split(",").map(e=>e.trim());this._filteredTarget=this._target.filter(e=>t.some(r=>{const s=e[r];return s==null?!1:String(s).toLowerCase().includes(this._targetFilterValue.toLowerCase())}))}_getDisplaySource(){return this._filteredSource||this._source}_getDisplayTarget(){return this._filteredTarget||this._target}_getItemKey(t,e,r){const s=r?this.sourceKey:this.targetKey;return s&&t[s]!=null?String(t[s]):t.id!=null?String(t.id):t.key!=null?String(t.key):t.label!=null?String(t.label):t.name!=null?String(t.name):t.value!=null?String(t.value):String(e)}_getItemLabel(t){const e=["label","name","title","text","value"];for(const r of e)if(t[r]!=null)return String(t[r]);return JSON.stringify(t)}_isSourceSelected(t,e){return this._sourceSelection.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(t,e,!0))}_isTargetSelected(t,e){return this._targetSelection.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(t,e,!1))}_emitMoveToTarget(){this.dispatchEvent(new CustomEvent("move-to-target",{bubbles:!0,composed:!0,detail:{items:[...this._sourceSelection],source:[...this._source],target:[...this._target]}}))}_emitMoveToSource(){this.dispatchEvent(new CustomEvent("move-to-source",{bubbles:!0,composed:!0,detail:{items:[...this._targetSelection],source:[...this._source],target:[...this._target]}}))}_emitSelectionChangeSource(){this.dispatchEvent(new CustomEvent("selection-change-source",{bubbles:!0,composed:!0,detail:{selection:[...this._sourceSelection]}}))}_emitSelectionChangeTarget(){this.dispatchEvent(new CustomEvent("selection-change-target",{bubbles:!0,composed:!0,detail:{selection:[...this._targetSelection]}}))}render(){const t=this._getDisplaySource(),e=this._getDisplayTarget(),r=this.selectionMode,s=r==="multiple"&&this.showSelectAll,i=t.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:t.map((c,h)=>`<li class="list-item${this._isSourceSelected(c,h)?" selected":""}" data-index="${h}" data-list="source" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isSourceSelected(c,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):u(this._getItemLabel(c))}</span></li>`).join(""),a=e.length===0?`<li class="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:e.map((c,h)=>`<li class="list-item${this._isTargetSelected(c,h)?" selected":""}" data-index="${h}" data-list="target" tabindex="0">${r?'<input type="checkbox" class="checkbox"'+(this._isTargetSelected(c,h)?" checked":"")+" />":""}<span class="item-content">${this._optionTemplate?this._optionTemplate(c):u(this._getItemLabel(c))}</span></li>`).join(""),o=s?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="source" ${this._sourceSelection.length>0&&this._sourceSelection.length===this._source.length?"checked":""} aria-label="Selecionar todos da origem" /> Selecionar Todos</label><span class="selection-count">${this._sourceSelection.length} selecionado(s)</span></div>`:"",n=s?`<div class="select-all-bar" part="select-all-bar"><label><input type="checkbox" class="select-all-checkbox" data-list="target" ${this._targetSelection.length>0&&this._targetSelection.length===this._target.length?"checked":""} aria-label="Selecionar todos do destino" /> Selecionar Todos</label><span class="selection-count">${this._targetSelection.length} selecionado(s)</span></div>`:"";this.setTemplate(`<div class="container"><div class="list-container"><div class="list-label">${u(this.sourceLabel)} (${this._source.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input source-filter" placeholder="'+this.filterPlaceholder+'" value="'+u(this._sourceFilterValue)+'" /></div>':""}${o}<div class="list-wrapper"><ul class="list source-list" role="listbox" tabindex="0">${i}</ul></div></div><div class="controls"><div class="control-group"><button class="control-btn" data-action="move-all-target" part="control-btn" aria-label="Mover todos para destino"><span class="control-btn-icon">»</span></button><button class="control-btn" data-action="move-target" part="control-btn" aria-label="Mover para destino"><span class="control-btn-icon">→</span></button></div><div class="control-group"><button class="control-btn" data-action="move-source" part="control-btn" aria-label="Mover para origem"><span class="control-btn-icon">←</span></button><button class="control-btn" data-action="move-all-source" part="control-btn" aria-label="Mover todos para origem"><span class="control-btn-icon">«</span></button></div></div><div class="list-container"><div class="list-label">${u(this.targetLabel)} (${this._target.length})</div>${this.filter?'<div class="filter-wrapper"><input type="text" class="filter-input target-filter" placeholder="'+this.filterPlaceholder+'" value="'+u(this._targetFilterValue)+'" /></div>':""}${n}<div class="list-wrapper"><ul class="list target-list" role="listbox" tabindex="0">${a}</ul></div></div></div>`),this._attachListeners()}_attachListeners(){this._filterListenersAttached||(this._filterListenersAttached=!0,this.root.addEventListener("input",t=>{const e=t.target;if(e.classList.contains("select-all-checkbox")){this._handleSelectAll(e);return}e.classList.contains("source-filter")?this.sourceFilterValue=e.value:e.classList.contains("target-filter")&&(this.targetFilterValue=e.value)}),this.root.addEventListener("click",t=>{const e=t.target,r=e.closest(".control-btn");if(r){switch(r.dataset.action){case"move-target":this._moveToTarget();break;case"move-all-target":this._moveAllToTarget();break;case"move-source":this._moveToSource();break;case"move-all-source":this._moveAllToSource();break}return}const s=e.closest(".list-item");if(!s)return;const i=s.dataset.list==="source",a=Number(s.dataset.index),o=(i?this._getDisplaySource():this._getDisplayTarget())[a];i?this._toggleSourceSelection(o,a):this._toggleTargetSelection(o,a)})),this._updateControlsState()}_handleSelectAll(t){t.dataset.list==="source"?(this._sourceSelection=t.checked?[...this._getDisplaySource()]:[],this._emitSelectionChangeSource()):(this._targetSelection=t.checked?[...this._getDisplayTarget()]:[],this._emitSelectionChangeTarget()),this._updateSelectionDisplay(),this._updateControlsState()}_updateSelectionDisplay(){const t=(e,r,s)=>{e&&e.querySelectorAll(".list-item").forEach(i=>{const a=Number(i.dataset.index),o=r(s()[a],a);i.classList.toggle("selected",o),i.setAttribute("aria-selected",String(o));const n=i.querySelector(".checkbox");n&&(n.checked=o)})};t(this.root.querySelector(".source-list"),(e,r)=>this._isSourceSelected(e,r),()=>this._getDisplaySource()),t(this.root.querySelector(".target-list"),(e,r)=>this._isTargetSelected(e,r),()=>this._getDisplayTarget()),this._updateSelectAllBars()}_updateSelectAllBars(){if(!(this.selectionMode==="multiple"&&this.showSelectAll))return;[{el:this.root.querySelector('.select-all-checkbox[data-list="source"]'),total:this._source.length,sel:this._sourceSelection.length},{el:this.root.querySelector('.select-all-checkbox[data-list="target"]'),total:this._target.length,sel:this._targetSelection.length}].forEach(({el:e,total:r,sel:s})=>{var a;if(!e)return;e.checked=r>0&&s===r;const i=(a=e.closest(".select-all-bar"))==null?void 0:a.querySelector(".selection-count");i&&(i.textContent=`${s} selecionado(s)`)})}_updateControlsState(){this.root.querySelectorAll(".control-btn").forEach(t=>{const e=t.dataset.action;t.disabled=e==="move-target"&&this._sourceSelection.length===0||e==="move-all-target"&&this._source.length===0||e==="move-source"&&this._targetSelection.length===0||e==="move-all-source"&&this._target.length===0})}_moveToTarget(){if(!this._sourceSelection.length)return;const t=[...this._sourceSelection];this._source=this._source.filter(e=>!t.some(r=>this._getItemKey(r,-1,!0)===this._getItemKey(e,-1,!0))),this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveToSource(){if(!this._targetSelection.length)return;const t=[...this._targetSelection];this._target=this._target.filter(e=>!t.some(r=>this._getItemKey(r,-1,!1)===this._getItemKey(e,-1,!1))),this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_moveAllToTarget(){const t=[...this._source];this._source=[],this._target=[...this._target,...t],this._sourceSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToTarget()}_moveAllToSource(){const t=[...this._target];this._target=[],this._source=[...this._source,...t],this._targetSelection=[],this._filteredSource=null,this._filteredTarget=null,this._updateListDisplay(),this._updateControlsState(),this._emitMoveToSource()}_toggleSourceSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!0),i=this._sourceSelection.findIndex(a=>this._getItemKey(a,-1,!0)===s);i>=0?this._sourceSelection.splice(i,1):r==="multiple"?this._sourceSelection.push(t):this._sourceSelection=[t],this._emitSelectionChangeSource(),this._updateSelectionDisplay(),this._updateControlsState()}_toggleTargetSelection(t,e){const r=this.selectionMode||"single",s=this._getItemKey(t,e,!1),i=this._targetSelection.findIndex(a=>this._getItemKey(a,-1,!1)===s);i>=0?this._targetSelection.splice(i,1):r==="multiple"?this._targetSelection.push(t):this._targetSelection=[t],this._emitSelectionChangeTarget(),this._updateSelectionDisplay(),this._updateControlsState()}_updateListDisplay(){var h,g;const t=(h=this.root.querySelector(".source-list"))==null?void 0:h.parentElement,e=(g=this.root.querySelector(".target-list"))==null?void 0:g.parentElement,r=this.root.querySelector(".list-container:first-of-type .list-label"),s=this.root.querySelector(".list-container:last-of-type .list-label");if(!t||!e){this.render();return}const i=this._getDisplaySource(),a=this._getDisplayTarget(),o=this.selectionMode,n=i.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum item"}</li>`:i.map((f,d)=>`<li class="list-item${this._isSourceSelected(f,d)?" selected":""}" part="list-item" data-index="${d}" data-list="source" role="option" aria-selected="${this._isSourceSelected(f,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isSourceSelected(f,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(f):u(this._getItemLabel(f))}</span></li>`).join(""),c=a.length===0?`<li class="empty-message" part="empty-message">${this.filter?"Nenhum resultado":"Nenhum selecionado"}</li>`:a.map((f,d)=>`<li class="list-item${this._isTargetSelected(f,d)?" selected":""}" part="list-item" data-index="${d}" data-list="target" role="option" aria-selected="${this._isTargetSelected(f,d)}" tabindex="0">${o?'<input type="checkbox" class="checkbox" part="checkbox"'+(this._isTargetSelected(f,d)?" checked":"")+" />":""}<span class="item-content" part="item-content">${this._optionTemplate?this._optionTemplate(f):u(this._getItemLabel(f))}</span></li>`).join("");t.innerHTML=`<ul class="list source-list" role="listbox" tabindex="0">${n}</ul>`,e.innerHTML=`<ul class="list target-list" role="listbox" tabindex="0">${c}</ul>`,r&&(r.textContent=`${this.sourceLabel} (${this._source.length})`),s&&(s.textContent=`${this.targetLabel} (${this._target.length})`),this._updateSelectAllBars(),this._attachListeners()}};Ft.styles=v`
|
|
2331
2462
|
:host {
|
|
2332
2463
|
display: block;
|
|
2333
2464
|
font-family: var(--fx-font-family);
|
|
@@ -2579,13 +2710,13 @@
|
|
|
2579
2710
|
to { opacity: 1; transform: translateX(0); }
|
|
2580
2711
|
}
|
|
2581
2712
|
.list-item { animation: slideIn 0.2s ease-out; }
|
|
2582
|
-
`;let
|
|
2713
|
+
`;let nt=Ft;function Ve(){return k("fx-picklist",nt)}Ve();const Vt=class Vt extends y{constructor(){super(...arguments),this._mo=null,this._clickListenerAttached=!1}static get observedAttributes(){return["header","expanded","disabled"]}get header(){return this.getAttr("header","")}set header(t){this.setAttribute("header",t)}get value(){return this.getAttr("value","")}set value(t){this.setAttribute("value",t)}get expanded(){return this.hasAttr("expanded")}set expanded(t){this.toggleAttr("expanded",t)}get disabled(){return this.hasAttr("disabled")}set disabled(t){this.toggleAttr("disabled",t)}connectedCallback(){super.connectedCallback(),this._clickListenerAttached||(this._clickListenerAttached=!0,this.addEventListener("click",t=>{t.composedPath().some(r=>{var s;return(s=r.classList)==null?void 0:s.contains("header")})&&(this.disabled||this.dispatchEvent(new CustomEvent("fx-accordion-toggle",{bubbles:!0,composed:!0,detail:{panel:this}})))})),this._mo=new MutationObserver(()=>this.render()),this._mo.observe(this,{attributes:!0,attributeFilter:["expanded","header","disabled"]})}disconnectedCallback(){var t;(t=this._mo)==null||t.disconnect(),this._mo=null}render(){this.setTemplate(`
|
|
2583
2714
|
<div class="panel" part="panel">
|
|
2584
2715
|
<button type="button" class="header" part="header" role="button"
|
|
2585
2716
|
aria-expanded="${this.expanded}"
|
|
2586
2717
|
${this.disabled?'aria-disabled="true"':""}>
|
|
2587
2718
|
<span class="header-text" part="header-text">
|
|
2588
|
-
<slot name="header">${this.header}</slot>
|
|
2719
|
+
<slot name="header">${u(this.header)}</slot>
|
|
2589
2720
|
</span>
|
|
2590
2721
|
<span class="chevron" part="chevron" aria-hidden="true">
|
|
2591
2722
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|
|
@@ -2600,7 +2731,7 @@
|
|
|
2600
2731
|
</div>
|
|
2601
2732
|
</div>
|
|
2602
2733
|
</div>
|
|
2603
|
-
`)}};Vt.styles=
|
|
2734
|
+
`)}};Vt.styles=v`
|
|
2604
2735
|
:host {
|
|
2605
2736
|
display: block;
|
|
2606
2737
|
font-family: var(--fx-font-family);
|
|
@@ -2668,11 +2799,11 @@
|
|
|
2668
2799
|
color: var(--fx-text-muted);
|
|
2669
2800
|
line-height: 1.6;
|
|
2670
2801
|
}
|
|
2671
|
-
`;let
|
|
2802
|
+
`;let lt=Vt;const Bt=class Bt extends y{constructor(){super(...arguments),this._observer=null,this._initialized=!1,this._listenersAttached=!1}static get observedAttributes(){return["value","multiple"]}get multiple(){return this.hasAttr("multiple")}set multiple(t){this.toggleAttr("multiple",t)}get values(){return this.getAttr("value","").split(",").map(t=>t.trim()).filter(Boolean)}set values(t){this.setAttribute("value",t.join(","))}connectedCallback(){this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0,subtree:!0}),super.connectedCallback(),queueMicrotask(()=>this._sync())}disconnectedCallback(){var t;(t=this._observer)==null||t.disconnect(),this._observer=null}render(){this.setTemplate(`
|
|
2672
2803
|
<div class="accordion" part="accordion">
|
|
2673
2804
|
<slot></slot>
|
|
2674
2805
|
</div>
|
|
2675
|
-
`),this._sync(),this._attachListeners()}get panels(){return Array.from(this.querySelectorAll("fx-accordion-panel"))}_sync(){const t=this.values,e=Array.from(this.querySelectorAll("fx-accordion-panel"));if(!this._initialized&&t.length===0&&e.length>0){this._initialized=!0;const r=e.find(s=>!s.hasAttribute("disabled"));if(r){this.values=[r.getAttribute("value")||"0"];return}}this._initialized=!0,e.forEach((r,s)=>{const i=r.getAttribute("value")||String(s);r.hasAttribute("value")||r.setAttribute("value",i),r.toggleAttribute("expanded",t.includes(i))})}_attachListeners(){this._listenersAttached||(this._listenersAttached=!0,this.addEventListener("fx-accordion-toggle",t=>{var r;const e=(r=t.detail)==null?void 0:r.panel;!e||e.disabled||this.toggle(e)}))}toggle(t){const e=t.value;let r=this.values;t.expanded?r=r.filter(s=>s!==e):this.multiple?r=[...r,e]:r=[e],this.values=r,this._sync(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:r}}))}open(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&!e.expanded&&this.toggle(e)}close(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&e.expanded&&this.toggle(e)}};
|
|
2806
|
+
`),this._sync(),this._attachListeners()}get panels(){return Array.from(this.querySelectorAll("fx-accordion-panel"))}_sync(){const t=this.values,e=Array.from(this.querySelectorAll("fx-accordion-panel"));if(!this._initialized&&t.length===0&&e.length>0){this._initialized=!0;const r=e.find(s=>!s.hasAttribute("disabled"));if(r){this.values=[r.getAttribute("value")||"0"];return}}this._initialized=!0,e.forEach((r,s)=>{const i=r.getAttribute("value")||String(s);r.hasAttribute("value")||r.setAttribute("value",i),r.toggleAttribute("expanded",t.includes(i))})}_attachListeners(){this._listenersAttached||(this._listenersAttached=!0,this.addEventListener("fx-accordion-toggle",t=>{var r;const e=(r=t.detail)==null?void 0:r.panel;!e||e.disabled||this.toggle(e)}))}toggle(t){const e=t.value;let r=this.values;t.expanded?r=r.filter(s=>s!==e):this.multiple?r=[...r,e]:r=[e],this.values=r,this._sync(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:r}}))}open(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&!e.expanded&&this.toggle(e)}close(t){const e=this.panels.find((r,s)=>(r.value||String(s))===t);e&&e.expanded&&this.toggle(e)}};Bt.styles=v`
|
|
2676
2807
|
:host {
|
|
2677
2808
|
display: block;
|
|
2678
2809
|
font-family: var(--fx-font-family);
|
|
@@ -2685,4 +2816,4 @@
|
|
|
2685
2816
|
overflow: hidden;
|
|
2686
2817
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
2687
2818
|
}
|
|
2688
|
-
`;let
|
|
2819
|
+
`;let ct=Bt;function Be(){return k("fx-accordion",ct)}function Ke(){return k("fx-accordion-panel",lt)}Be(),Ke()});
|