mapolanski's picture
Onde esta tudo o que eu pedi? So apareceu um botao enviar dados e alguns textos. O sistemas que quero é um gerador de formularios e nao um formulario apenas
b2363b3 verified
Raw History Blame Contribute Delete
6.25 kB
class GeoToolbox extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 280px;
background: white;
border-right: 1px solid #e5e7eb;
height: 100%;
overflow-y: auto;
}
.dark :host {
background: #1f2937;
border-right-color: #374151;
}
.header {
padding: 1rem;
border-bottom: 1px solid #e5e7eb;
}
.dark .header {
border-bottom-color: #374151;
}
h3 {
font-size: 0.875rem;
font-weight: 600;
color: #6b7280;
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 0;
}
.category {
padding: 1rem;
border-bottom: 1px solid #e5e7eb;
}
.dark .category {
border-bottom-color: #374151;
}
.category-title {
font-size: 0.75rem;
font-weight: 600;
color: #9ca3af;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.75rem;
}
.tools-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.5rem;
}
.tool {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
padding: 0.75rem;
border-radius: 0.5rem;
cursor: grab;
transition: all 0.2s;
background: #f9fafb;
border: 1px solid transparent;
}
.tool:hover {
background: #eef2ff;
border-color: #6366f1;
}
.tool:active {
cursor: grabbing;
}
.dark .tool {
background: #374151;
}
.dark .tool:hover {
background: rgba(99, 102, 241, 0.2);
}
.tool-icon {
width: 1.5rem;
height: 1.5rem;
color: #6366f1;
}
.tool-label {
font-size: 0.625rem;
font-weight: 500;
color: #4b5563;
text-align: center;
}
.dark .tool-label {
color: #d1d5db;
}
</style>
<div class="header">
<h3>🧰 Caixa de Ferramentas</h3>
</div>
<div class="category">
<div class="category-title">Campos Básicos</div>
<div class="tools-grid">
<div class="tool" draggable="true" data-type="text">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>
<span class="tool-label">Texto</span>
</div>
<div class="tool" draggable="true" data-type="textarea">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7h16"/><path d="M4 12h16"/><path d="M4 17h10"/></svg>
<span class="tool-label">Texto Longo</span>
</div>
<div class="tool" draggable="true" data-type="number">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 17V9"/><path d="M8 17V5"/><path d="M12 17v-5"/><path d="M16 17V9"/><path d="M20 17V5"/></svg>
<span class="tool-label">Número</span>
</div>
<div class="tool" draggable="true" data-type="select">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>
<span class="tool-label">Seleção</span>
</div>
</div>
</div>
<div class="category">
<div class="category-title">Campos Especiais</div>
<div class="tools-grid">
<div class="tool" draggable="true" data-type="date">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
<span class="tool-label">Data</span>
</div>
<div class="tool" draggable="true" data-type="photo">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
<span class="tool-label">Foto</span>
</div>
<div class="tool" draggable="true" data-type="map">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="1 6 1 22 8 18 16 22 21 18 21 2 16 6 8 2 1 6"/><line x1="8" y1="2" x2="8" y2="18"/><line x1="16" y1="6" x2="16" y2="22"/></svg>
<span class="tool-label">Mapa</span>
</div>
<div class="tool" draggable="true" data-type="signature">
<svg class="tool-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.5 7.5"/><circle cx="11" cy="11" r="2"/></svg>
<span class="tool-label">Assinatura</span>
</div>
</div>
</div>
`;
// Add drag event listeners
this.shadowRoot.querySelectorAll('.tool').forEach(tool => {
tool.addEventListener('dragstart', (e) => {
e.dataTransfer.setData('fieldType', tool.dataset.type);
tool.style.opacity = '0.5';
});
tool.addEventListener('dragend', () => {
tool.style.opacity = '1';
});
});
}
}
customElements.define('geo-toolbox', GeoToolbox);