@thibezer/ui-components-kit 2.11.1 → 2.12.2
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/CHANGELOG.md +96 -21
- package/dist/alvo-digitavel-CzCvNVQ3.js +23 -0
- package/dist/alvo-digitavel-DbH0hYFf.cjs +1 -0
- package/dist/camadas.cjs +89 -106
- package/dist/camadas.js +1030 -935
- package/dist/canvas.cjs +27 -27
- package/dist/canvas.js +801 -819
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-colecao.d.ts +1 -1
- package/dist/components/ui-camadas/camadas-drop-ops.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-eventos-camadas.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-hierarquia.d.ts +12 -2
- package/dist/components/ui-camadas/camadas-host.d.ts +6 -0
- package/dist/components/ui-camadas/camadas-metricas.d.ts +2 -1
- package/dist/components/ui-camadas/camadas-rodape.d.ts +5 -0
- package/dist/components/ui-camadas/camadas-selecao.d.ts +2 -2
- package/dist/components/ui-camadas/tipos.d.ts +1 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +3 -0
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +4 -1
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +2 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +3 -0
- package/dist/components/ui-tabela-propriedades/propriedades-painel-controles.d.ts +1 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +14 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +20 -0
- package/dist/components/ui-texto-editavel/index.d.ts +2 -0
- package/dist/components/ui-texto-editavel/texto-editavel-teclado.d.ts +12 -0
- package/dist/components/ui-texto-editavel/texto-editavel-template.d.ts +2 -0
- package/dist/components/ui-texto-editavel/tipos.d.ts +14 -0
- package/dist/components/ui-texto-editavel/ui-texto-editavel.d.ts +82 -0
- package/dist/custom-elements.json +25342 -21856
- package/dist/data.cjs +1 -1
- package/dist/data.js +79 -72
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +198 -189
- package/dist/register.cjs +1 -1
- package/dist/register.js +2 -2
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +71 -64
- package/dist/tipos-elementos.d.ts +137 -6
- package/dist/tipos-react.d.ts +6 -0
- package/dist/tipos-vue.d.ts +125 -6
- package/dist/ui-linha-BxhEBn27.js +749 -0
- package/dist/ui-linha-CcalUBDw.cjs +38 -0
- package/dist/ui-tabela-propriedades-CyPyKXtB.js +3013 -0
- package/dist/ui-tabela-propriedades-DqvPilK_.cjs +142 -0
- package/package.json +1 -1
|
@@ -0,0 +1,3013 @@
|
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var ze = (t, r, e) => r in t ? ke(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var g = (t, r, e) => ze(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { L as F } from "./listener-bag-DQgv7OON.js";
|
|
5
|
+
import { a as R } from "./parts-CaoQiCfI.js";
|
|
6
|
+
import { d as V, S as fe } from "./ssr-safe-5cWfJP-s.js";
|
|
7
|
+
import { h as Se } from "./svg-seguro-ChVJ2L2z.js";
|
|
8
|
+
class Le {
|
|
9
|
+
constructor(r) {
|
|
10
|
+
g(this, "autoFetchController", null);
|
|
11
|
+
g(this, "emVoo", null);
|
|
12
|
+
this.ctx = r;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Busca os dados. Resolve `true` em sucesso e `false` em falha, cancelamento ou requisição
|
|
16
|
+
* substituída (nunca rejeita; o motivo da falha vai no evento `ui-fetch-erro`).
|
|
17
|
+
* Uma chamada com a mesma URL de uma requisição em andamento reaproveita essa requisição.
|
|
18
|
+
*/
|
|
19
|
+
carregar(r) {
|
|
20
|
+
if (!r) return Promise.resolve(!1);
|
|
21
|
+
if (this.emVoo && this.emVoo.url === r && this.autoFetchController) return this.emVoo.promessa;
|
|
22
|
+
this.cancelarEmVoo();
|
|
23
|
+
const e = new AbortController();
|
|
24
|
+
this.autoFetchController = e;
|
|
25
|
+
const i = this.executar(r, e);
|
|
26
|
+
return this.emVoo = { url: r, promessa: i }, i;
|
|
27
|
+
}
|
|
28
|
+
emitir(r, e) {
|
|
29
|
+
this.ctx.host.dispatchEvent(new CustomEvent(r, { bubbles: !0, composed: !0, detail: e }));
|
|
30
|
+
}
|
|
31
|
+
erro(r, e, i, o) {
|
|
32
|
+
const a = e instanceof Error ? e.message : String(e);
|
|
33
|
+
console.error("[ui-tabela] Erro ao carregar dados remotos:", e);
|
|
34
|
+
const n = { url: r, erro: a, origem: i };
|
|
35
|
+
o !== void 0 && (n.status = o), this.emitir("ui-fetch-erro", n);
|
|
36
|
+
}
|
|
37
|
+
async executar(r, e) {
|
|
38
|
+
var s, u, c, d;
|
|
39
|
+
const i = () => this.autoFetchController === e, o = () => {
|
|
40
|
+
this.autoFetchController === e && (this.autoFetchController = null, this.emVoo = null);
|
|
41
|
+
};
|
|
42
|
+
this.ctx.onCarregandoAlterado(!0), this.emitir("ui-fetch-start", { url: r });
|
|
43
|
+
let a = "rede", n;
|
|
44
|
+
try {
|
|
45
|
+
const p = { ...((u = (s = this.ctx).getOpcoes) == null ? void 0 : u.call(s)) ?? {}, signal: e.signal }, h = await (((d = (c = this.ctx).getFetcher) == null ? void 0 : d.call(c)) ?? ((b, _) => fetch(b, _)))(r, p);
|
|
46
|
+
if (!h.ok)
|
|
47
|
+
throw a = "http", n = h.status, new Error(`HTTP ${h.status}: ${h.statusText}`);
|
|
48
|
+
a = "json";
|
|
49
|
+
const m = await h.json(), v = Array.isArray(m) ? m : (m == null ? void 0 : m.dados) || (m == null ? void 0 : m.items) || (m == null ? void 0 : m.data) || (m == null ? void 0 : m.rows) || [], f = Array.isArray(v) ? v : [];
|
|
50
|
+
return i() ? (a = "render", this.ctx.onDadosRecebidos(f), o(), this.ctx.onCarregandoAlterado(!1), this.emitir("ui-fetch-sucesso", { url: r, total: f.length, dados: f }), !0) : !1;
|
|
51
|
+
} catch (p) {
|
|
52
|
+
return (p == null ? void 0 : p.name) === "AbortError" ? (i() && (o(), this.ctx.onCarregandoAlterado(!1)), this.emitir("ui-fetch-cancelado", { url: r }), !1) : (i() && (o(), this.ctx.onCarregandoAlterado(!1), this.erro(r, p, a, n)), !1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Cancela a requisição em andamento (se houver) e libera o indicador de carregamento. */
|
|
56
|
+
abortar() {
|
|
57
|
+
this.autoFetchController && (this.cancelarEmVoo(), this.ctx.onCarregandoAlterado(!1));
|
|
58
|
+
}
|
|
59
|
+
cancelarEmVoo() {
|
|
60
|
+
if (this.autoFetchController) {
|
|
61
|
+
const r = this.autoFetchController;
|
|
62
|
+
this.autoFetchController = null, this.emVoo = null, r.abort();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const Me = ["id", "_id", "codigo", "key"];
|
|
67
|
+
function Ne(t, r) {
|
|
68
|
+
return t != null && (t === r || String(t) === String(r));
|
|
69
|
+
}
|
|
70
|
+
function ne(t, r) {
|
|
71
|
+
let e = -1;
|
|
72
|
+
return typeof t == "number" && Number.isInteger(t) ? e = t : typeof t == "string" && /^\d+$/.test(t.trim()) && (e = parseInt(t.trim(), 10)), e >= 0 && e < r ? e : -1;
|
|
73
|
+
}
|
|
74
|
+
function Te(t, r, e = "id", i = !1) {
|
|
75
|
+
if (!t || t.length === 0) return -1;
|
|
76
|
+
if (typeof r == "function")
|
|
77
|
+
return t.findIndex(r);
|
|
78
|
+
if (i) return ne(r, t.length);
|
|
79
|
+
const o = [e, ...Me.filter((a) => a !== e)];
|
|
80
|
+
for (const a of o) {
|
|
81
|
+
const n = t.findIndex((s) => !!s && typeof s == "object" && Ne(s[a], r));
|
|
82
|
+
if (n !== -1) return n;
|
|
83
|
+
}
|
|
84
|
+
return ne(r, t.length);
|
|
85
|
+
}
|
|
86
|
+
class De {
|
|
87
|
+
constructor(r) {
|
|
88
|
+
g(this, "itemSelecionado", null);
|
|
89
|
+
g(this, "indiceSelecionado", null);
|
|
90
|
+
this.ctx = r;
|
|
91
|
+
}
|
|
92
|
+
/** Mesmo objeto ou mesmo valor na chave configurada. */
|
|
93
|
+
indiceDoItem(r, e) {
|
|
94
|
+
const i = this.ctx.getChaveId(), o = r.indexOf(e);
|
|
95
|
+
return o >= 0 ? o : e[i] == null ? -1 : r.findIndex((a) => (a == null ? void 0 : a[i]) != null && String(a[i]) === String(e[i]));
|
|
96
|
+
}
|
|
97
|
+
getItemSelecionado() {
|
|
98
|
+
return this.itemSelecionado;
|
|
99
|
+
}
|
|
100
|
+
setItemSelecionado(r) {
|
|
101
|
+
this.itemSelecionado = r;
|
|
102
|
+
const e = r ? this.indiceDoItem(this.ctx.getDadosExibicao(), r) : -1;
|
|
103
|
+
this.indiceSelecionado = e >= 0 ? e : null, this.atualizarLinhasSelecionadas();
|
|
104
|
+
}
|
|
105
|
+
getIndiceSelecionado() {
|
|
106
|
+
return this.indiceSelecionado;
|
|
107
|
+
}
|
|
108
|
+
setIndiceSelecionado(r) {
|
|
109
|
+
const e = this.ctx.getDadosExibicao(), i = r !== null && r >= 0 && r < e.length;
|
|
110
|
+
this.indiceSelecionado = i ? r : null, this.itemSelecionado = i ? e[r] : null, this.atualizarLinhasSelecionadas();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Reaplica a seleção após ordenar, filtrar ou trocar os dados.
|
|
114
|
+
* - Item ainda exibido: atualiza o índice (e a referência, se veio um objeto novo com a mesma chave).
|
|
115
|
+
* - Item só escondido pelo filtro: mantém a seleção (sem índice) para reaparecer ao limpar o filtro.
|
|
116
|
+
* - Item removido dos dados: limpa a seleção e emite `ui-selecao-removida`.
|
|
117
|
+
*/
|
|
118
|
+
reconciliar() {
|
|
119
|
+
const r = this.itemSelecionado;
|
|
120
|
+
if (!r) {
|
|
121
|
+
this.indiceSelecionado = null;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const e = this.ctx.getDadosExibicao(), i = this.indiceDoItem(e, r);
|
|
125
|
+
if (i >= 0) {
|
|
126
|
+
this.indiceSelecionado = i, this.substituirReferencia(r, e[i]);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.indiceSelecionado = null;
|
|
130
|
+
const o = this.ctx.getDadosOriginais(), a = this.indiceDoItem(o, r);
|
|
131
|
+
if (a >= 0) {
|
|
132
|
+
this.substituirReferencia(r, o[a]);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.itemSelecionado = null, this.ctx.host.dispatchEvent(
|
|
136
|
+
new CustomEvent("ui-selecao-removida", { bubbles: !0, composed: !0, detail: { item: r } })
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
/** Mesmo registro com outro objeto (dados recarregados): atualiza a referência e avisa. */
|
|
140
|
+
substituirReferencia(r, e) {
|
|
141
|
+
this.itemSelecionado = e, r !== e && this.ctx.host.dispatchEvent(
|
|
142
|
+
new CustomEvent("ui-selecao-atualizada", { bubbles: !0, composed: !0, detail: { item: e, anterior: r } })
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
limparSelecao() {
|
|
146
|
+
this.itemSelecionado = null, this.indiceSelecionado = null, this.atualizarLinhasSelecionadas();
|
|
147
|
+
}
|
|
148
|
+
isItemSelecionado(r, e) {
|
|
149
|
+
if (this.itemSelecionado) {
|
|
150
|
+
if (this.itemSelecionado === r) return !0;
|
|
151
|
+
const i = this.ctx.getChaveId();
|
|
152
|
+
if (r[i] != null && this.itemSelecionado[i] != null)
|
|
153
|
+
return String(r[i]) === String(this.itemSelecionado[i]);
|
|
154
|
+
if (r.id != null && this.itemSelecionado.id != null)
|
|
155
|
+
return String(r.id) === String(this.itemSelecionado.id);
|
|
156
|
+
}
|
|
157
|
+
return this.indiceSelecionado !== null && this.indiceSelecionado === e;
|
|
158
|
+
}
|
|
159
|
+
atualizarLinhasSelecionadas() {
|
|
160
|
+
const r = this.ctx.getTbody();
|
|
161
|
+
if (!r) return;
|
|
162
|
+
const e = this.ctx.getDadosExibicao();
|
|
163
|
+
r.querySelectorAll("tr:not(.ui-tabela__virtual-spacer)").forEach((o) => {
|
|
164
|
+
const a = o.getAttribute("data-index"), n = a !== null ? parseInt(a, 10) : -1, s = n >= 0 ? e[n] : null, u = s ? this.isItemSelecionado(s, n) : !1;
|
|
165
|
+
o.classList.toggle("ui-tabela__tr--selecionada", u), R(o, "linha-selecionada", u), u ? (o.setAttribute("data-selecionada", "true"), o.setAttribute("aria-current", "true"), o.setAttribute("aria-selected", "true")) : (o.removeAttribute("data-selecionada"), o.removeAttribute("aria-current"), o.setAttribute("aria-selected", "false"));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
rolarPara(r, e) {
|
|
169
|
+
const i = this.ctx.getDadosExibicao(), o = Te(i, r, this.ctx.getChaveId(), (e == null ? void 0 : e.porIndice) === !0);
|
|
170
|
+
if (o === -1)
|
|
171
|
+
return !1;
|
|
172
|
+
if (e != null && e.selecionar) {
|
|
173
|
+
const a = i[o];
|
|
174
|
+
this.itemSelecionado = a, this.indiceSelecionado = o, this.atualizarLinhasSelecionadas(), this.ctx.onLinhaAtiva(o), this.ctx.host.dispatchEvent(
|
|
175
|
+
new CustomEvent("ui-linha-selecionada", {
|
|
176
|
+
bubbles: !0,
|
|
177
|
+
composed: !0,
|
|
178
|
+
detail: { item: a, indice: o }
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return this.ctx.onRolarParaIndice(o, (e == null ? void 0 : e.comportamento) || "smooth");
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function Re(t, r, e) {
|
|
186
|
+
return t !== e ? {
|
|
187
|
+
idColuna: e,
|
|
188
|
+
direcao: "asc"
|
|
189
|
+
} : r === "asc" ? {
|
|
190
|
+
idColuna: e,
|
|
191
|
+
direcao: "desc"
|
|
192
|
+
} : r === "desc" ? {
|
|
193
|
+
idColuna: null,
|
|
194
|
+
direcao: "original"
|
|
195
|
+
} : {
|
|
196
|
+
idColuna: e,
|
|
197
|
+
direcao: "asc"
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const Be = new Intl.Collator("pt-BR", { numeric: !0, sensitivity: "base" });
|
|
201
|
+
function se(t) {
|
|
202
|
+
if (t instanceof Date) return t.getTime();
|
|
203
|
+
if (typeof t == "number") return t;
|
|
204
|
+
const r = String(t).trim(), e = /^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T](\d{1,2}):(\d{2}))?$/.exec(r);
|
|
205
|
+
return e ? new Date(+e[3], +e[2] - 1, +e[1], +(e[4] ?? 0), +(e[5] ?? 0)).getTime() : Date.parse(r);
|
|
206
|
+
}
|
|
207
|
+
function Oe(t, r, e) {
|
|
208
|
+
if (e === "data" || !e && (t instanceof Date || r instanceof Date)) {
|
|
209
|
+
const i = se(t), o = se(r);
|
|
210
|
+
if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
|
|
211
|
+
} else if (e === "numero" || !e && typeof t == "number" && typeof r == "number") {
|
|
212
|
+
const i = Number(t), o = Number(r);
|
|
213
|
+
if (!Number.isNaN(i) && !Number.isNaN(o)) return i - o;
|
|
214
|
+
} else if (e === "booleano" || !e && typeof t == "boolean" && typeof r == "boolean")
|
|
215
|
+
return +!!t - +!!r;
|
|
216
|
+
return Be.compare(String(t), String(r));
|
|
217
|
+
}
|
|
218
|
+
function Ie(t, r, e, i) {
|
|
219
|
+
if (!r || e === "original")
|
|
220
|
+
return [...t];
|
|
221
|
+
const o = e === "desc" ? -1 : 1;
|
|
222
|
+
return [...t].sort((a, n) => {
|
|
223
|
+
const s = a[r], u = n[r], c = s == null, d = u == null;
|
|
224
|
+
return c || d ? c === d ? 0 : c ? 1 : -1 : i != null && i.comparador ? i.comparador(s, u, a, n) * o : s === u ? 0 : Oe(s, u, i == null ? void 0 : i.tipo) * o;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function U(t) {
|
|
228
|
+
return t.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
229
|
+
}
|
|
230
|
+
class Pe {
|
|
231
|
+
constructor() {
|
|
232
|
+
g(this, "dadosOriginais", []);
|
|
233
|
+
g(this, "dadosExibicao", []);
|
|
234
|
+
g(this, "colunaOrdenada", null);
|
|
235
|
+
g(this, "direcaoOrdenacao", "original");
|
|
236
|
+
g(this, "ultimoFiltro", "");
|
|
237
|
+
/** Colunas declaradas: o filtro olha só elas (vazio = todos os campos do registro). */
|
|
238
|
+
g(this, "colunasFiltro", []);
|
|
239
|
+
g(this, "colunas", []);
|
|
240
|
+
/** Ordenação feita pelo servidor: a tabela guarda coluna/direção (indicador) mas não reordena os dados. */
|
|
241
|
+
g(this, "ordenacaoRemota", !1);
|
|
242
|
+
}
|
|
243
|
+
setColunas(r) {
|
|
244
|
+
this.colunas = r, this.colunaOrdenada && this.aplicarOrdenacao();
|
|
245
|
+
}
|
|
246
|
+
setOrdenacaoRemota(r) {
|
|
247
|
+
this.ordenacaoRemota !== r && (this.ordenacaoRemota = r, this.aplicarOrdenacao());
|
|
248
|
+
}
|
|
249
|
+
/** Restaura coluna/direção (ex.: `ui-sort` cancelado) e recalcula. */
|
|
250
|
+
restaurarOrdenacao(r, e) {
|
|
251
|
+
this.colunaOrdenada = r, this.direcaoOrdenacao = e, this.aplicarOrdenacao();
|
|
252
|
+
}
|
|
253
|
+
setColunasFiltro(r) {
|
|
254
|
+
this.colunasFiltro = r, this.ultimoFiltro && this.aplicarOrdenacao();
|
|
255
|
+
}
|
|
256
|
+
getDadosOriginais() {
|
|
257
|
+
return this.dadosOriginais;
|
|
258
|
+
}
|
|
259
|
+
setDadosOriginais(r) {
|
|
260
|
+
this.dadosOriginais = Array.isArray(r) ? r.filter((e) => e != null) : [], this.aplicarOrdenacao();
|
|
261
|
+
}
|
|
262
|
+
getDadosExibicao() {
|
|
263
|
+
return this.dadosExibicao;
|
|
264
|
+
}
|
|
265
|
+
getColunaOrdenada() {
|
|
266
|
+
return this.colunaOrdenada;
|
|
267
|
+
}
|
|
268
|
+
setColunaOrdenada(r) {
|
|
269
|
+
this.colunaOrdenada = r, r ? this.direcaoOrdenacao === "original" && (this.direcaoOrdenacao = "asc") : this.direcaoOrdenacao = "original", this.aplicarOrdenacao();
|
|
270
|
+
}
|
|
271
|
+
getDirecaoOrdenacao() {
|
|
272
|
+
return this.direcaoOrdenacao;
|
|
273
|
+
}
|
|
274
|
+
setDirecaoOrdenacao(r) {
|
|
275
|
+
this.direcaoOrdenacao = r || "original", this.direcaoOrdenacao === "original" && (this.colunaOrdenada = null), this.aplicarOrdenacao();
|
|
276
|
+
}
|
|
277
|
+
alternarOrdenacaoColuna(r) {
|
|
278
|
+
if (!r.ordenavel) return null;
|
|
279
|
+
const e = Re(this.colunaOrdenada, this.direcaoOrdenacao, r.id);
|
|
280
|
+
return this.colunaOrdenada = e.idColuna, this.direcaoOrdenacao = e.direcao, this.aplicarOrdenacao(), e;
|
|
281
|
+
}
|
|
282
|
+
/** Recalcula a lista exibida: filtro vigente e, sobre o resultado, a ordenação da coluna (valem juntos). */
|
|
283
|
+
aplicarOrdenacao() {
|
|
284
|
+
const r = this.ultimoFiltro, e = r ? this.dadosOriginais.filter((o) => this.casaFiltro(o, r)) : this.dadosOriginais, i = this.colunaOrdenada ? this.colunas.find((o) => o.id === this.colunaOrdenada) : null;
|
|
285
|
+
this.dadosExibicao = this.ordenacaoRemota ? [...e] : Ie(e, this.colunaOrdenada, this.direcaoOrdenacao, i);
|
|
286
|
+
}
|
|
287
|
+
casaFiltro(r, e) {
|
|
288
|
+
return (this.colunasFiltro.length > 0 ? this.colunasFiltro : Object.keys(r)).some((o) => {
|
|
289
|
+
const a = r[o], n = this.colunas.find((u) => u.id === o);
|
|
290
|
+
if (n != null && n.textoFiltro)
|
|
291
|
+
try {
|
|
292
|
+
if (U(String(n.textoFiltro(a, r) ?? "")).includes(e)) return !0;
|
|
293
|
+
} catch {
|
|
294
|
+
}
|
|
295
|
+
if (a == null || typeof a == "object" && !(a instanceof Date)) return !1;
|
|
296
|
+
const s = a instanceof Date ? `${a.toISOString()} ${a.toLocaleDateString("pt-BR")}` : String(a);
|
|
297
|
+
return U(s).includes(e);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/** Há um filtro de texto aplicado (o vazio vira "sem resultados"). */
|
|
301
|
+
temFiltro() {
|
|
302
|
+
return this.ultimoFiltro !== "";
|
|
303
|
+
}
|
|
304
|
+
filtrar(r) {
|
|
305
|
+
this.ultimoFiltro = U((r || "").trim()), this.aplicarOrdenacao();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const Fe = ':host{display:block;width:100%;box-sizing:border-box;font-family:inherit;color:var(--ui-cor-texto, #e1e1e6);position:relative}.ui-tabela-container{width:100%;max-width:100%;max-height:var(--ui-tabela-max-height, 500px);overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);background-color:var(--ui-cor-superficie, #141417);box-sizing:border-box;position:relative}.ui-tabela{width:100%;border-collapse:separate;border-spacing:0;text-align:left;font-size:14px;font-family:var(--ui-fonte-base, inherit);font-variant-numeric:tabular-nums}.ui-tabela thead{background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}.ui-tabela th{position:sticky;top:0;z-index:10;padding:10px 16px;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto-secundario, #9696a6);font-size:13px;font-weight:600;letter-spacing:.02em;border-bottom:2px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));white-space:nowrap;-webkit-user-select:none;user-select:none;box-sizing:border-box}.ui-tabela th[aria-sort=ascending],.ui-tabela th[aria-sort=descending]{color:var(--ui-cor-texto, #e1e1e6)}.ui-tabela__resizer{position:absolute;top:0;right:0;width:8px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;touch-action:none;z-index:20;background:linear-gradient(var(--ui-cor-borda, rgba(255, 255, 255, .12)),var(--ui-cor-borda, rgba(255, 255, 255, .12))) center / 1px 60% no-repeat;transition:background-color .15s ease}.ui-tabela__resizer:hover,.ui-tabela__resizer:focus-visible,.ui-tabela__resizer--ativo{background:var(--ui-cor-primaria, #00E08A);outline:none}:host([densidade="compacta"]) th,:host([densidade="compacta"]) td,:host([density="compact"]) th,:host([density="compact"]) td{padding:4px 8px}:host([densidade="normal"]) th,:host([densidade="normal"]) td,:host([density="normal"]) th,:host([density="normal"]) td{padding:10px 16px}:host([densidade="relaxada"]) th,:host([densidade="relaxada"]) td,:host([density="relaxed"]) th,:host([density="relaxed"]) td{padding:16px 20px}:host([altura-linha]) td,:host([row-height]) td{height:var(--ui-tabela-altura-linha);box-sizing:border-box;padding-top:0;padding-bottom:0;overflow:hidden;white-space:nowrap}.ui-tabela__header-content{display:inline-flex;align-items:center;vertical-align:middle;width:100%;box-sizing:border-box}.ui-tabela__header-text{margin-right:var(--ui-tabela-th-gap, 6px);display:inline-block;min-width:0;overflow:hidden;text-overflow:ellipsis}.ui-tabela__sort-icon{width:var(--ui-tabela-th-icone, 16px);min-width:var(--ui-tabela-th-icone, 16px);flex:none;display:inline-flex;justify-content:center;align-items:center}.ui-tabela th.ui-tabela__th--ordenavel{cursor:pointer}@media (hover: hover){.ui-tabela th.ui-tabela__th--ordenavel:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,var(--ui-cor-fundo-elevado, #1a1a1e));color:var(--ui-cor-texto, #e1e1e6)}}.ui-tabela__ordenar{all:unset;display:flex;width:100%;box-sizing:border-box;cursor:pointer;font:inherit;color:inherit;text-align:inherit}.ui-tabela__ordenar:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-radius:var(--ui-raio-sm, 4px)}.ui-tabela tbody tr:focus{outline:none}.ui-tabela tbody tr:focus-visible{outline:2px solid var(--ui-tabela-cor-foco, var(--ui-cor-texto, #e1e1e6));outline-offset:-2px;background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}.ui-tabela__sort-arrow{display:inline-block;width:14px;height:14px;vertical-align:middle;shape-rendering:geometricPrecision;fill:var(--ui-cor-primaria, #00E08A)}.ui-tabela__sort-arrow path{transition:opacity .15s ease;opacity:.35}.ui-tabela__sort-arrow--asc .seta-cima,.ui-tabela__sort-arrow--desc .seta-baixo{opacity:1}.ui-tabela__sort-arrow--inativo{fill:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__sort-arrow--inativo path{opacity:.6}.ui-tabela td{padding:10px 16px;border-bottom:1px solid color-mix(in srgb,var(--ui-cor-borda, rgba(255, 255, 255, .12)) 60%,transparent);white-space:nowrap;vertical-align:middle;color:var(--ui-cor-texto, #e1e1e6);box-sizing:border-box}.ui-tabela__cell-content{display:inline-flex;align-items:center;vertical-align:middle}.ui-tabela__cell-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.ui-tabela--alinhar-esquerda{text-align:left}.ui-tabela--alinhar-esquerda .ui-tabela__header-content,.ui-tabela--alinhar-esquerda .ui-tabela__cell-content{justify-content:flex-start}.ui-tabela--alinhar-centro{text-align:center}.ui-tabela--alinhar-centro .ui-tabela__header-content,.ui-tabela--alinhar-centro .ui-tabela__cell-content{justify-content:center}.ui-tabela--alinhar-direita{text-align:right}.ui-tabela--alinhar-direita .ui-tabela__header-content,.ui-tabela--alinhar-direita .ui-tabela__cell-content{justify-content:flex-end}.ui-tabela tbody tr[data-index]{cursor:pointer}.ui-tabela tbody tr.ui-tabela__tr--par{background-color:var(--ui-tabela-zebra, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 4%, transparent))}@media (hover: hover){.ui-tabela tbody tr[data-index]:hover{background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 8%, transparent))}}.ui-tabela tbody tr[data-index]:active{background-color:var(--ui-tabela-hover, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 12%, transparent))}:host(:not([selecionar-texto])) .ui-tabela tbody td{-webkit-user-select:none;user-select:none}.ui-tabela tbody tr.ui-tabela__tr--selecionada,.ui-tabela tbody tr[data-selecionada=true]{background-color:var(--ui-tabela-selecionada, var(--ui-cor-linha-selecionada, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 14%, transparent)))}.ui-tabela tbody tr.ui-tabela__tr--selecionada td:first-child,.ui-tabela tbody tr[data-selecionada=true] td:first-child{box-shadow:inset 3px 0 0 var(--ui-cor-primaria, #00E08A)}@media (hover: hover){.ui-tabela tbody tr.ui-tabela__tr--selecionada:hover,.ui-tabela tbody tr[data-selecionada=true]:hover{background-color:var(--ui-tabela-selecionada-hover, var(--ui-cor-linha-selecionada-hover, color-mix(in srgb, var(--ui-cor-primaria, #00E08A) 22%, transparent)))}}.ui-tabela__virtual-spacer td{padding:0!important;border:none!important;height:inherit;background:transparent!important}.ui-tabela__empty{padding:40px 24px;text-align:center;color:var(--ui-cor-texto-secundario, #9696a6);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;box-sizing:border-box}.ui-tabela__empty-icon{width:32px;height:32px;opacity:.5;fill:currentColor}.ui-tabela__empty-text{font-size:14px;font-weight:500;color:var(--ui-cor-texto-secundario, #9696a6)}.ui-tabela__erro{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px;padding:10px 14px;border:1px solid var(--ui-cor-texto-erro, #ff5555);border-left-width:4px;border-radius:var(--ui-raio-borda, 6px);background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 10%,transparent);color:var(--ui-cor-texto, #e1e1e6);font-size:14px;box-sizing:border-box}.ui-tabela__erro-texto{flex:1 1 200px;min-width:0}.ui-tabela__erro-detalhe{display:block;margin-top:2px;font-size:12px;color:var(--ui-cor-texto-secundario, #9696a6);overflow-wrap:anywhere}.ui-tabela__erro-acao,.ui-tabela__prompt-actions button{background:var(--ui-cor-botao-secundario-fundo, rgba(255, 255, 255, .12));color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));padding:6px 12px;border-radius:var(--ui-raio-sm, 4px);font:inherit;cursor:pointer}.ui-tabela__erro-acao:hover,.ui-tabela__prompt-actions button:hover{background:var(--ui-cor-botao-secundario-hover, rgba(255, 255, 255, .2))}.ui-tabela__erro-acao:focus-visible,.ui-tabela__prompt-actions button:focus-visible,.ui-tabela__prompt-dialog input:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px}.ui-tabela__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-tabela__loading{position:absolute;top:0;left:0;right:0;bottom:0;background-color:color-mix(in srgb,var(--ui-cor-superficie, #141417) 72%,transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:50;color:var(--ui-cor-texto, #e1e1e6);font-size:14px}.ui-tabela__spinner{width:32px;height:32px;border:3px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent);border-top-color:var(--ui-cor-primaria, #00E08A);border-radius:50%;animation:ui-tabela-spin .8s linear infinite}@keyframes ui-tabela-spin{to{transform:rotate(360deg)}}.ui-tabela__prompt-dialog{margin:0;max-width:calc(100vw - 16px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));border-radius:var(--ui-raio-borda, 6px);background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto, #e1e1e6);padding:12px;box-shadow:var(--ui-sombra-lg, 0 8px 32px rgba(0, 0, 0, .8));font-family:inherit;font-size:14px}.ui-tabela__prompt-dialog::backdrop{background:#0000004d}.ui-tabela__prompt-title{display:block;margin-bottom:8px;font-weight:500}.ui-tabela__prompt-dialog input{width:100%;padding:6px 8px;border-radius:var(--ui-raio-sm, 4px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .2));background:var(--ui-cor-superficie, #141417);color:var(--ui-cor-texto, #e1e1e6);margin-bottom:8px;box-sizing:border-box;font:inherit}.ui-tabela__prompt-dialog input[aria-invalid=true]{border-color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-erro{min-height:1.2em;margin-bottom:8px;font-size:12px;color:var(--ui-cor-texto-erro, #ff5555)}.ui-tabela__prompt-actions{display:flex;justify-content:flex-end;gap:8px}.ui-tabela__prompt-actions button:last-child{background:var(--ui-cor-primaria, #00E08A);border-color:transparent;color:var(--ui-cor-texto-sobre-primaria, #000000);font-weight:600}.ui-tabela__prompt-actions button:last-child:hover{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 85%,var(--ui-cor-texto, #e1e1e6))}@media (pointer: coarse){.ui-tabela__resizer{width:16px}:host(:not([altura-linha]):not([row-height])) .ui-tabela tbody tr[data-index]{height:44px}}@media (max-width: 640px){.ui-tabela th{padding:8px 10px;font-size:12px}.ui-tabela td{padding:8px 10px;font-size:13px}}@media (prefers-reduced-motion: reduce){.ui-tabela__resizer,.ui-tabela__sort-arrow path{transition:none}.ui-tabela__spinner{animation-duration:2.4s}}';
|
|
309
|
+
function be(t) {
|
|
310
|
+
return t == null || t === "" ? "" : typeof t == "number" ? `${t}px` : t;
|
|
311
|
+
}
|
|
312
|
+
function ge(t) {
|
|
313
|
+
return t === "centro" || t === "center" ? "ui-tabela--alinhar-centro" : t === "direita" || t === "right" ? "ui-tabela--alinhar-direita" : "ui-tabela--alinhar-esquerda";
|
|
314
|
+
}
|
|
315
|
+
function ve(t) {
|
|
316
|
+
return t === "centro" || t === "center" ? "center" : t === "direita" || t === "right" ? "right" : "left";
|
|
317
|
+
}
|
|
318
|
+
function le(t) {
|
|
319
|
+
return t === "compacta" ? 30 : t === "relaxada" ? 56 : 42;
|
|
320
|
+
}
|
|
321
|
+
function Ve(t, r, e, i) {
|
|
322
|
+
t.innerHTML = `<style>${Fe}</style>`;
|
|
323
|
+
const o = document.createElement("div");
|
|
324
|
+
o.className = "ui-tabela-container", o.setAttribute("part", "base"), e && (o.style.maxHeight = e);
|
|
325
|
+
const a = document.createElement("div");
|
|
326
|
+
a.className = "ui-tabela__empty", a.setAttribute("part", "vazio"), a.style.display = "none", a.setAttribute("role", "status");
|
|
327
|
+
const n = document.createElement("div");
|
|
328
|
+
n.innerHTML = `
|
|
329
|
+
<svg class="ui-tabela__empty-icon" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
330
|
+
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"/>
|
|
331
|
+
</svg>`;
|
|
332
|
+
const s = document.createElement("span");
|
|
333
|
+
s.className = "ui-tabela__empty-text", s.textContent = r, a.appendChild(n), a.appendChild(s);
|
|
334
|
+
const u = document.createElement("table");
|
|
335
|
+
u.className = "ui-tabela", u.setAttribute("part", "tabela"), u.setAttribute("role", "grid");
|
|
336
|
+
const c = document.createElement("colgroup"), d = document.createElement("thead"), p = document.createElement("tbody");
|
|
337
|
+
u.appendChild(c), u.appendChild(d), u.appendChild(p);
|
|
338
|
+
const l = document.createElement("div");
|
|
339
|
+
l.className = "ui-tabela__erro", l.setAttribute("part", "erro"), l.setAttribute("role", "alert"), l.style.display = "none";
|
|
340
|
+
const h = document.createElement("div");
|
|
341
|
+
h.className = "ui-tabela__erro-texto";
|
|
342
|
+
const m = document.createElement("span");
|
|
343
|
+
m.className = "ui-tabela__erro-mensagem";
|
|
344
|
+
const v = document.createElement("span");
|
|
345
|
+
v.className = "ui-tabela__erro-detalhe", h.appendChild(m), h.appendChild(v);
|
|
346
|
+
const f = document.createElement("button");
|
|
347
|
+
f.type = "button", f.className = "ui-tabela__erro-acao", f.setAttribute("part", "erro-acao"), f.textContent = "Tentar novamente", l.appendChild(h), l.appendChild(f);
|
|
348
|
+
const b = document.createElement("div");
|
|
349
|
+
b.className = "ui-tabela__sr", b.setAttribute("role", "status"), b.setAttribute("aria-live", "polite"), o.appendChild(l), o.appendChild(u), o.appendChild(a), o.appendChild(b);
|
|
350
|
+
const _ = document.createElement("div");
|
|
351
|
+
return _.className = "ui-tabela__loading", _.setAttribute("part", "carregando"), _.setAttribute("role", "status"), _.setAttribute("aria-live", "polite"), _.style.display = i ? "flex" : "none", _.innerHTML = `
|
|
352
|
+
<div class="ui-tabela__spinner" aria-hidden="true"></div>
|
|
353
|
+
<span class="ui-tabela__loading-texto">Carregando dados...</span>
|
|
354
|
+
`, o.appendChild(_), t.appendChild(o), {
|
|
355
|
+
containerElement: o,
|
|
356
|
+
tableElement: u,
|
|
357
|
+
theadElement: d,
|
|
358
|
+
tbodyElement: p,
|
|
359
|
+
colgroupElement: c,
|
|
360
|
+
emptyElement: a,
|
|
361
|
+
loadingElement: _,
|
|
362
|
+
erroElement: l,
|
|
363
|
+
anuncioElement: b
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function He(t) {
|
|
367
|
+
var a, n;
|
|
368
|
+
if (!t.theadElement || !t.colgroupElement) return;
|
|
369
|
+
t.headerListeners.cleanup();
|
|
370
|
+
const e = t.theadElement.getRootNode().activeElement, i = e && t.theadElement.contains(e) ? ((a = e.closest("th")) == null ? void 0 : a.getAttribute("data-coluna")) ?? null : null;
|
|
371
|
+
t.theadElement.innerHTML = "", t.colgroupElement.innerHTML = "";
|
|
372
|
+
const o = document.createElement("tr");
|
|
373
|
+
if (o.setAttribute("aria-rowindex", "1"), t.colunas.forEach((s, u) => {
|
|
374
|
+
const c = document.createElement("col");
|
|
375
|
+
s.largura !== void 0 && (c.style.width = t.formatWidth(s.largura)), t.colgroupElement.appendChild(c);
|
|
376
|
+
const d = document.createElement("th"), p = t.getAlignmentClass(s.alinhamento);
|
|
377
|
+
if (d.className = p, d.setAttribute("part", "celula-cabecalho"), d.scope = "col", d.setAttribute("data-coluna", s.id), d.style.textAlign = t.getTextAlign(s.alinhamento), s.largura !== void 0 && (d.style.width = t.formatWidth(s.largura)), s.larguraMinima !== void 0 && (d.style.minWidth = t.formatWidth(s.larguraMinima)), s.larguraMaxima !== void 0) {
|
|
378
|
+
const E = t.formatWidth(s.larguraMaxima);
|
|
379
|
+
d.style.maxWidth = E, d.style.overflow = "hidden", d.style.textOverflow = "ellipsis", d.style.whiteSpace = "nowrap";
|
|
380
|
+
}
|
|
381
|
+
s.tooltip && (d.title = s.tooltip);
|
|
382
|
+
const l = !!s.ordenavel && t.colunaOrdenada === s.id && t.direcaoOrdenacao !== "original", h = l && t.direcaoOrdenacao === "desc";
|
|
383
|
+
if (s.ordenavel) {
|
|
384
|
+
d.classList.add("ui-tabela__th--ordenavel");
|
|
385
|
+
const E = () => t.onHeaderClick(s);
|
|
386
|
+
t.headerListeners.add(d, "click", E), d.setAttribute("aria-sort", l ? h ? "descending" : "ascending" : "none");
|
|
387
|
+
}
|
|
388
|
+
const m = (E) => t.onHeaderContextMenu(E, s, u, d);
|
|
389
|
+
t.headerListeners.add(d, "contextmenu", m);
|
|
390
|
+
const v = document.createElement("div");
|
|
391
|
+
v.className = "ui-tabela__header-content";
|
|
392
|
+
const f = document.createElement("span");
|
|
393
|
+
if (f.className = "ui-tabela__header-text", f.textContent = s.rotulo, v.appendChild(f), s.ordenavel) {
|
|
394
|
+
const E = document.createElement("span");
|
|
395
|
+
E.className = "ui-tabela__sort-icon";
|
|
396
|
+
const x = l ? h ? "ui-tabela__sort-arrow--desc" : "ui-tabela__sort-arrow--asc" : "ui-tabela__sort-arrow--inativo";
|
|
397
|
+
E.setAttribute("aria-hidden", "true"), E.innerHTML = `<svg class="ui-tabela__sort-arrow ${x}" viewBox="0 0 24 24" focusable="false"><path class="seta-cima" d="M7 11l5-5 5 5H7z"/><path class="seta-baixo" d="M7 13l5 5 5-5H7z"/></svg>`, v.appendChild(E);
|
|
398
|
+
}
|
|
399
|
+
if (s.ordenavel) {
|
|
400
|
+
const E = document.createElement("button");
|
|
401
|
+
E.type = "button", E.className = "ui-tabela__ordenar", E.setAttribute("part", "ordenar"), E.appendChild(v), d.appendChild(E);
|
|
402
|
+
} else
|
|
403
|
+
d.appendChild(v);
|
|
404
|
+
const b = document.createElement("div");
|
|
405
|
+
b.className = "ui-tabela__resizer", b.setAttribute("part", "redimensionador"), b.title = "Arrastar para redimensionar largura (duplo-clique para auto-ajuste)", b.tabIndex = 0, b.setAttribute("role", "separator"), b.setAttribute("aria-orientation", "vertical"), b.setAttribute("aria-label", `Redimensionar coluna ${s.rotulo}`);
|
|
406
|
+
const _ = (E) => t.onInitColumnResize(E, s, u, d, b);
|
|
407
|
+
t.headerListeners.add(b, "mousedown", _);
|
|
408
|
+
const y = (E) => {
|
|
409
|
+
const x = E;
|
|
410
|
+
x.pointerType === "mouse" || !x.pointerType || t.onInitColumnResize(x, s, u, d, b);
|
|
411
|
+
};
|
|
412
|
+
t.headerListeners.add(b, "pointerdown", y);
|
|
413
|
+
const A = (E) => {
|
|
414
|
+
var w, L;
|
|
415
|
+
const x = E, k = x.shiftKey ? 50 : 10;
|
|
416
|
+
if (x.key === "ArrowRight")
|
|
417
|
+
x.preventDefault(), (w = t.onResizeTeclado) == null || w.call(t, k, s, u, d, c);
|
|
418
|
+
else if (x.key === "ArrowLeft")
|
|
419
|
+
x.preventDefault(), (L = t.onResizeTeclado) == null || L.call(t, -k, s, u, d, c);
|
|
420
|
+
else if (x.key === "Enter" || x.key === "F2") {
|
|
421
|
+
x.preventDefault();
|
|
422
|
+
const z = d.getBoundingClientRect();
|
|
423
|
+
t.onHeaderContextMenu(new MouseEvent("contextmenu", { clientX: z.left, clientY: z.bottom }), s, u, d);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
t.headerListeners.add(b, "keydown", A);
|
|
427
|
+
const C = (E) => {
|
|
428
|
+
E.stopPropagation(), t.onColumnAutoFit(s, d, c);
|
|
429
|
+
};
|
|
430
|
+
t.headerListeners.add(b, "dblclick", C), t.headerListeners.add(b, "click", (E) => E.stopPropagation()), d.appendChild(b), o.appendChild(d);
|
|
431
|
+
}), t.theadElement.appendChild(o), i !== null) {
|
|
432
|
+
const s = Array.from(o.children).find((u) => u.getAttribute("data-coluna") === i);
|
|
433
|
+
(n = s == null ? void 0 : s.querySelector(".ui-tabela__ordenar")) == null || n.focus();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
const qe = 'button, input, select, textarea, a, summary, [role="button"], [data-prevent-select]';
|
|
437
|
+
function $e(t, r) {
|
|
438
|
+
for (const e of t.composedPath()) {
|
|
439
|
+
if (e === r) return !1;
|
|
440
|
+
if (e instanceof Element && e.matches(qe)) return !0;
|
|
441
|
+
}
|
|
442
|
+
return !1;
|
|
443
|
+
}
|
|
444
|
+
function je(t) {
|
|
445
|
+
if (!t.tbodyElement || !t.tableElement || !t.emptyElement || !t.containerElement) return;
|
|
446
|
+
if (t.tableElement.setAttribute("aria-colcount", String(t.colunas.length)), !t.dadosExibicao || t.dadosExibicao.length === 0) {
|
|
447
|
+
t.tbodyElement.innerHTML = "", t.tableElement.setAttribute("aria-rowcount", "1"), t.tableElement.style.display = t.colunas.length > 0 ? "table" : "none", t.emptyElement.style.display = "flex";
|
|
448
|
+
const l = t.emptyElement.querySelector(".ui-tabela__empty-text"), h = t.filtroAtivo ? t.textoSemResultados : t.textoVazio;
|
|
449
|
+
l && h !== void 0 && (l.textContent = h);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
t.emptyElement.style.display = "none", t.tableElement.style.display = "table", t.tableElement.setAttribute("aria-rowcount", String(t.dadosExibicao.length + 1));
|
|
453
|
+
const r = t.dadosExibicao.length, e = t.rowHeight, i = t.virtualizar && r > 30;
|
|
454
|
+
let o = 0, a = r;
|
|
455
|
+
if (i) {
|
|
456
|
+
const l = t.containerElement.scrollTop, h = t.containerElement.clientHeight || 400, m = 5;
|
|
457
|
+
o = Math.max(0, Math.floor(l / e) - m), a = Math.min(r, Math.ceil((l + h) / e) + m);
|
|
458
|
+
}
|
|
459
|
+
const s = t.tbodyElement.getRootNode().activeElement, u = s && s.parentElement === t.tbodyElement ? s.getAttribute("data-index") : null, c = t.indiceAtivo ?? null, d = c !== null && c >= o && c < a ? c : o;
|
|
460
|
+
t.tbodyElement.innerHTML = "";
|
|
461
|
+
const p = document.createDocumentFragment();
|
|
462
|
+
if (i && o > 0) {
|
|
463
|
+
const l = document.createElement("tr");
|
|
464
|
+
l.className = "ui-tabela__virtual-spacer", l.setAttribute("aria-hidden", "true"), l.style.height = `${o * e}px`;
|
|
465
|
+
const h = document.createElement("td");
|
|
466
|
+
h.colSpan = t.colunas.length || 1, l.appendChild(h), p.appendChild(l);
|
|
467
|
+
}
|
|
468
|
+
for (let l = o; l < a; l++) {
|
|
469
|
+
const h = t.dadosExibicao[l], m = document.createElement("tr");
|
|
470
|
+
m.setAttribute("data-index", String(l)), m.setAttribute("part", "linha"), m.setAttribute("aria-rowindex", String(l + 2)), m.setAttribute("aria-selected", "false"), m.tabIndex = l === d ? 0 : -1, l % 2 === 1 && m.classList.add("ui-tabela__tr--par");
|
|
471
|
+
const v = t.chaveId;
|
|
472
|
+
h[v] !== void 0 ? m.setAttribute("data-id", String(h[v])) : h.id !== void 0 ? m.setAttribute("data-id", String(h.id)) : h._id !== void 0 && m.setAttribute("data-id", String(h._id)), t.isItemSelecionado(h, l) && (m.classList.add("ui-tabela__tr--selecionada"), m.setAttribute("part", "linha linha-selecionada"), m.setAttribute("aria-current", "true"), m.setAttribute("aria-selected", "true"), m.setAttribute("data-selecionada", "true")), m.addEventListener("click", (f) => {
|
|
473
|
+
$e(f, m) || t.onLinhaClique(h, l);
|
|
474
|
+
}), t.colunas.forEach((f) => {
|
|
475
|
+
const b = document.createElement("td"), _ = t.getAlignmentClass(f.alinhamento);
|
|
476
|
+
if (b.className = _, b.setAttribute("part", "celula"), b.style.textAlign = t.getTextAlign(f.alinhamento), f.larguraMaxima !== void 0) {
|
|
477
|
+
const C = t.formatWidth(f.larguraMaxima);
|
|
478
|
+
b.style.maxWidth = C, b.style.overflow = "hidden", b.style.textOverflow = "ellipsis", b.style.whiteSpace = "nowrap";
|
|
479
|
+
}
|
|
480
|
+
const y = document.createElement("div");
|
|
481
|
+
y.className = "ui-tabela__cell-content", f.larguraMaxima !== void 0 && y.classList.add("ui-tabela__cell-truncate");
|
|
482
|
+
const A = h[f.id];
|
|
483
|
+
if (typeof f.render == "function")
|
|
484
|
+
try {
|
|
485
|
+
const C = f.render(A, h, l);
|
|
486
|
+
C instanceof Node ? y.appendChild(C) : y.textContent = String(C ?? "");
|
|
487
|
+
} catch (C) {
|
|
488
|
+
console.error(`[ui-tabela] Erro no render da coluna "${f.id}" (linha ${l}):`, C), y.textContent = "";
|
|
489
|
+
}
|
|
490
|
+
else if (A instanceof Node)
|
|
491
|
+
y.appendChild(A);
|
|
492
|
+
else {
|
|
493
|
+
const C = A != null ? String(A) : "";
|
|
494
|
+
y.textContent = C, f.larguraMaxima !== void 0 && !f.tooltip && (b.title = C);
|
|
495
|
+
}
|
|
496
|
+
b.appendChild(y), m.appendChild(b);
|
|
497
|
+
}), p.appendChild(m);
|
|
498
|
+
}
|
|
499
|
+
if (i && a < r) {
|
|
500
|
+
const l = document.createElement("tr");
|
|
501
|
+
l.className = "ui-tabela__virtual-spacer", l.setAttribute("aria-hidden", "true"), l.style.height = `${(r - a) * e}px`;
|
|
502
|
+
const h = document.createElement("td");
|
|
503
|
+
h.colSpan = t.colunas.length || 1, l.appendChild(h), p.appendChild(l);
|
|
504
|
+
}
|
|
505
|
+
if (t.tbodyElement.appendChild(p), u !== null) {
|
|
506
|
+
const l = t.tbodyElement.querySelector(`tr[data-index="${u}"]`);
|
|
507
|
+
l == null || l.focus({ preventScroll: !0 });
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function de(t) {
|
|
511
|
+
if (t === void 0) return null;
|
|
512
|
+
const r = typeof t == "number" ? t : parseInt(t, 10);
|
|
513
|
+
return isNaN(r) ? null : r;
|
|
514
|
+
}
|
|
515
|
+
function G(t, r) {
|
|
516
|
+
const e = de(t.larguraMinima);
|
|
517
|
+
let i = Math.max(e ?? 60, r);
|
|
518
|
+
const o = de(t.larguraMaxima);
|
|
519
|
+
return o !== null && (i = Math.min(o, i)), i;
|
|
520
|
+
}
|
|
521
|
+
function Ue(t, r, e, i) {
|
|
522
|
+
const o = G(t, r.offsetWidth + i);
|
|
523
|
+
return t.largura = `${o}px`, r.style.width = `${o}px`, e && (e.style.width = `${o}px`), `${o}px`;
|
|
524
|
+
}
|
|
525
|
+
function We(t) {
|
|
526
|
+
const {
|
|
527
|
+
evento: r,
|
|
528
|
+
coluna: e,
|
|
529
|
+
colIndex: i,
|
|
530
|
+
thElement: o,
|
|
531
|
+
resizer: a,
|
|
532
|
+
colgroupElement: n,
|
|
533
|
+
onResizeStart: s,
|
|
534
|
+
onResizeEnd: u,
|
|
535
|
+
onResizeCancel: c
|
|
536
|
+
} = t;
|
|
537
|
+
r.stopPropagation(), r.preventDefault(), s(), a.classList.add("ui-tabela__resizer--ativo");
|
|
538
|
+
const d = r.pageX, p = o.offsetWidth, l = n == null ? void 0 : n.children[i], h = r.type === "pointerdown", m = h ? r.pointerId : null, v = h ? "pointermove" : "mousemove", f = h ? "pointerup" : "mouseup";
|
|
539
|
+
let b = !1;
|
|
540
|
+
const _ = (C) => {
|
|
541
|
+
const E = C;
|
|
542
|
+
if (m !== null && E.pointerId !== m) return;
|
|
543
|
+
b = !0;
|
|
544
|
+
const x = G(e, p + (E.pageX - d));
|
|
545
|
+
e.largura = `${x}px`, o.style.width = `${x}px`, l && (l.style.width = `${x}px`);
|
|
546
|
+
}, y = () => {
|
|
547
|
+
A(), b ? u(String(e.largura)) : c == null || c();
|
|
548
|
+
}, A = () => {
|
|
549
|
+
a.classList.remove("ui-tabela__resizer--ativo"), window.removeEventListener(v, _), window.removeEventListener(f, y), h && window.removeEventListener("pointercancel", y);
|
|
550
|
+
};
|
|
551
|
+
return window.addEventListener(v, _), window.addEventListener(f, y), h && window.addEventListener("pointercancel", y), A;
|
|
552
|
+
}
|
|
553
|
+
const I = 20;
|
|
554
|
+
let Xe = 0;
|
|
555
|
+
function Ke(t) {
|
|
556
|
+
var L;
|
|
557
|
+
const {
|
|
558
|
+
evento: r,
|
|
559
|
+
coluna: e,
|
|
560
|
+
colIndex: i,
|
|
561
|
+
thElement: o,
|
|
562
|
+
colgroupElement: a,
|
|
563
|
+
shadow: n,
|
|
564
|
+
onResizeEnd: s
|
|
565
|
+
} = t, u = `ui-tabela-dlg-${++Xe}`, c = document.createElement("dialog");
|
|
566
|
+
c.className = "ui-tabela__prompt-dialog", c.setAttribute("part", "dialogo"), c.setAttribute("aria-labelledby", `${u}-titulo`);
|
|
567
|
+
const d = document.createElement("label");
|
|
568
|
+
d.className = "ui-tabela__prompt-title", d.id = `${u}-titulo`, d.htmlFor = `${u}-campo`, d.textContent = `Largura de "${e.rotulo}" (px; vazio = automática)`;
|
|
569
|
+
const p = document.createElement("input");
|
|
570
|
+
p.id = `${u}-campo`, p.type = "number", p.min = String(I), p.step = "1", p.setAttribute("inputmode", "numeric"), p.placeholder = "auto";
|
|
571
|
+
const l = e.largura ? parseInt(String(e.largura), 10) : NaN;
|
|
572
|
+
p.value = Number.isFinite(l) ? String(l) : "";
|
|
573
|
+
const h = document.createElement("div");
|
|
574
|
+
h.className = "ui-tabela__prompt-erro", h.id = `${u}-erro`, h.setAttribute("role", "alert");
|
|
575
|
+
const m = document.createElement("div");
|
|
576
|
+
m.className = "ui-tabela__prompt-actions";
|
|
577
|
+
const v = document.createElement("button");
|
|
578
|
+
v.type = "button", v.textContent = "Aplicar";
|
|
579
|
+
const f = document.createElement("button");
|
|
580
|
+
f.type = "button", f.textContent = "Cancelar", m.appendChild(f), m.appendChild(v), c.appendChild(d), c.appendChild(p), c.appendChild(h), c.appendChild(m), n.appendChild(c), typeof c.showModal == "function" ? c.showModal() : c.setAttribute("open", ""), c.style.position = "fixed";
|
|
581
|
+
const b = c.getBoundingClientRect(), _ = b.width || 240, y = b.height || 140, A = Math.max(8, Math.min(r.clientX || 0, window.innerWidth - _ - 8)), C = Math.max(8, Math.min(r.clientY || 0, window.innerHeight - y - 8));
|
|
582
|
+
c.style.left = `${A}px`, c.style.top = `${C}px`;
|
|
583
|
+
let E = !1;
|
|
584
|
+
const x = () => {
|
|
585
|
+
var z;
|
|
586
|
+
E || (E = !0, c.open && typeof c.close == "function" && c.close(), c.remove(), (z = o.querySelector(".ui-tabela__ordenar, .ui-tabela__resizer")) == null || z.focus());
|
|
587
|
+
}, k = (z) => {
|
|
588
|
+
h.textContent = z, p.setAttribute("aria-invalid", "true"), p.setAttribute("aria-describedby", h.id), p.focus();
|
|
589
|
+
}, w = () => {
|
|
590
|
+
const z = e.largura, ae = p.value.trim();
|
|
591
|
+
if (ae === "")
|
|
592
|
+
e.largura = void 0, o.style.width = "", a != null && a.children[i] && (a.children[i].style.width = "");
|
|
593
|
+
else {
|
|
594
|
+
const $ = Number(ae);
|
|
595
|
+
if (!Number.isFinite($) || $ < I) {
|
|
596
|
+
k(`Informe um valor de pelo menos ${I} px, ou deixe vazio para automática.`);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const j = Math.round(G({ ...e, larguraMinima: e.larguraMinima ?? I }, $));
|
|
600
|
+
e.largura = `${j}px`, o.style.width = `${j}px`, a != null && a.children[i] && (a.children[i].style.width = `${j}px`);
|
|
601
|
+
}
|
|
602
|
+
x(), e.largura !== z && s(e.largura ? String(e.largura) : "auto");
|
|
603
|
+
};
|
|
604
|
+
v.addEventListener("click", (z) => {
|
|
605
|
+
z.stopPropagation(), w();
|
|
606
|
+
}), f.addEventListener("click", (z) => {
|
|
607
|
+
z.stopPropagation(), x();
|
|
608
|
+
}), c.addEventListener("close", x), p.addEventListener("input", () => {
|
|
609
|
+
h.textContent = "", p.removeAttribute("aria-invalid"), p.removeAttribute("aria-describedby");
|
|
610
|
+
}), p.addEventListener("keydown", (z) => {
|
|
611
|
+
z.key === "Enter" ? (z.preventDefault(), w()) : z.key === "Escape" && (z.preventDefault(), x());
|
|
612
|
+
}), p.focus(), (L = p.select) == null || L.call(p);
|
|
613
|
+
}
|
|
614
|
+
function Ye(t, r, e, i, o, a) {
|
|
615
|
+
return We({
|
|
616
|
+
evento: t,
|
|
617
|
+
coluna: r,
|
|
618
|
+
colIndex: e,
|
|
619
|
+
thElement: i,
|
|
620
|
+
resizer: o,
|
|
621
|
+
colgroupElement: a.colgroupElement,
|
|
622
|
+
onResizeStart: () => a.onSetIsResizing(!0),
|
|
623
|
+
onResizeCancel: () => {
|
|
624
|
+
setTimeout(() => a.onSetIsResizing(!1), 50);
|
|
625
|
+
},
|
|
626
|
+
onResizeEnd: (n) => {
|
|
627
|
+
setTimeout(() => a.onSetIsResizing(!1), 50), a.host.dispatchEvent(
|
|
628
|
+
new CustomEvent("ui-column-resize", {
|
|
629
|
+
detail: { idColuna: r.id, largura: n },
|
|
630
|
+
bubbles: !0,
|
|
631
|
+
composed: !0
|
|
632
|
+
})
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
function Ge(t, r, e, i, o) {
|
|
638
|
+
t.preventDefault(), t.stopPropagation(), Ke({
|
|
639
|
+
evento: t,
|
|
640
|
+
coluna: r,
|
|
641
|
+
colIndex: e,
|
|
642
|
+
thElement: i,
|
|
643
|
+
colgroupElement: o.colgroupElement,
|
|
644
|
+
shadow: o.shadow,
|
|
645
|
+
onResizeEnd: (a) => {
|
|
646
|
+
o.host.dispatchEvent(
|
|
647
|
+
new CustomEvent("ui-column-resize", {
|
|
648
|
+
detail: { idColuna: r.id, largura: a },
|
|
649
|
+
bubbles: !0,
|
|
650
|
+
composed: !0
|
|
651
|
+
})
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function Qe(t, r, e, i, o) {
|
|
657
|
+
const a = Ue(r, e, i, t);
|
|
658
|
+
o.host.dispatchEvent(
|
|
659
|
+
new CustomEvent("ui-column-resize", {
|
|
660
|
+
detail: { idColuna: r.id, largura: a },
|
|
661
|
+
bubbles: !0,
|
|
662
|
+
composed: !0
|
|
663
|
+
})
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
function Ze(t) {
|
|
667
|
+
He({
|
|
668
|
+
theadElement: t.theadElement,
|
|
669
|
+
colgroupElement: t.colgroupElement,
|
|
670
|
+
colunas: t.colunas,
|
|
671
|
+
colunaOrdenada: t.dadosController.getColunaOrdenada(),
|
|
672
|
+
direcaoOrdenacao: t.dadosController.getDirecaoOrdenacao(),
|
|
673
|
+
headerListeners: t.headerListeners,
|
|
674
|
+
formatWidth: be,
|
|
675
|
+
getAlignmentClass: ge,
|
|
676
|
+
getTextAlign: ve,
|
|
677
|
+
onHeaderClick: (r) => t.onHeaderClick(r),
|
|
678
|
+
onHeaderContextMenu: (r, e, i, o) => {
|
|
679
|
+
Ge(r, e, i, o, {
|
|
680
|
+
host: t.host,
|
|
681
|
+
colgroupElement: t.colgroupElement,
|
|
682
|
+
shadow: t.shadow,
|
|
683
|
+
onSetIsResizing: t.onSetIsResizing
|
|
684
|
+
});
|
|
685
|
+
},
|
|
686
|
+
onInitColumnResize: (r, e, i, o, a) => {
|
|
687
|
+
const n = Ye(r, e, i, o, a, {
|
|
688
|
+
host: t.host,
|
|
689
|
+
colgroupElement: t.colgroupElement,
|
|
690
|
+
shadow: t.shadow,
|
|
691
|
+
onSetIsResizing: t.onSetIsResizing
|
|
692
|
+
});
|
|
693
|
+
t.onActiveResizeCleanup(n);
|
|
694
|
+
},
|
|
695
|
+
onResizeTeclado: (r, e, i, o, a) => {
|
|
696
|
+
Qe(r, e, o, a, {
|
|
697
|
+
host: t.host,
|
|
698
|
+
colgroupElement: t.colgroupElement,
|
|
699
|
+
shadow: t.shadow,
|
|
700
|
+
onSetIsResizing: t.onSetIsResizing
|
|
701
|
+
});
|
|
702
|
+
},
|
|
703
|
+
onColumnAutoFit: (r, e, i) => {
|
|
704
|
+
r.largura = void 0, e.style.width = "", i.style.width = "", t.host.dispatchEvent(
|
|
705
|
+
new CustomEvent("ui-column-resize", {
|
|
706
|
+
bubbles: !0,
|
|
707
|
+
composed: !0,
|
|
708
|
+
detail: { idColuna: r.id, largura: "auto" }
|
|
709
|
+
})
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
function Je(t) {
|
|
715
|
+
je({
|
|
716
|
+
tbodyElement: t.tbodyElement,
|
|
717
|
+
tableElement: t.tableElement,
|
|
718
|
+
emptyElement: t.emptyElement,
|
|
719
|
+
containerElement: t.containerElement,
|
|
720
|
+
dadosExibicao: t.dadosController.getDadosExibicao(),
|
|
721
|
+
colunas: t.colunas,
|
|
722
|
+
chaveId: t.chaveId,
|
|
723
|
+
virtualizar: t.virtualizar,
|
|
724
|
+
rowHeight: t.rowHeight,
|
|
725
|
+
indiceAtivo: t.indiceAtivo,
|
|
726
|
+
filtroAtivo: t.dadosController.temFiltro(),
|
|
727
|
+
textoVazio: t.textoVazio,
|
|
728
|
+
textoSemResultados: t.textoSemResultados,
|
|
729
|
+
isItemSelecionado: (r, e) => t.selecaoController.isItemSelecionado(r, e),
|
|
730
|
+
onLinhaClique: (r, e) => {
|
|
731
|
+
t.selecaoController.setItemSelecionado(r), t.host.dispatchEvent(
|
|
732
|
+
new CustomEvent("ui-linha-clique", {
|
|
733
|
+
bubbles: !0,
|
|
734
|
+
composed: !0,
|
|
735
|
+
detail: { item: r, indice: e }
|
|
736
|
+
})
|
|
737
|
+
);
|
|
738
|
+
},
|
|
739
|
+
formatWidth: be,
|
|
740
|
+
getAlignmentClass: ge,
|
|
741
|
+
getTextAlign: ve
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function et(t, r) {
|
|
745
|
+
let e = !1;
|
|
746
|
+
const i = () => {
|
|
747
|
+
e || (window.requestAnimationFrame(() => {
|
|
748
|
+
try {
|
|
749
|
+
r();
|
|
750
|
+
} finally {
|
|
751
|
+
e = !1;
|
|
752
|
+
}
|
|
753
|
+
}), e = !0);
|
|
754
|
+
};
|
|
755
|
+
return t.addEventListener("scroll", i), i;
|
|
756
|
+
}
|
|
757
|
+
function tt(t, r, e, i) {
|
|
758
|
+
return Ve(t, r, e, i);
|
|
759
|
+
}
|
|
760
|
+
function xe(t) {
|
|
761
|
+
const r = t.host.getAttribute("texto-vazio") || t.host.getAttribute("empty-text");
|
|
762
|
+
r && t.onTextoVazioAlterado(r);
|
|
763
|
+
const e = t.host.getAttribute("virtualizar") || t.host.getAttribute("virtualize");
|
|
764
|
+
e !== null && t.onVirtualizarAlterado(e !== "false"), t.onSrcLido(t.host.getAttribute("src"));
|
|
765
|
+
const i = t.host.hasAttribute("carregando") || t.host.hasAttribute("loading");
|
|
766
|
+
t.onCarregandoAlterado(i), t.loadingElement && (t.loadingElement.style.display = i ? "flex" : "none");
|
|
767
|
+
}
|
|
768
|
+
function rt(t, r, e) {
|
|
769
|
+
if (xe(e), t === "src") {
|
|
770
|
+
r && e.host.isConnected && e.onCarregarSrc(r);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
if (t === "max-height" && e.containerElement) {
|
|
774
|
+
e.containerElement.style.maxHeight = r || "";
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
if ((t === "texto-vazio" || t === "empty-text") && e.emptyElement) {
|
|
778
|
+
const i = e.emptyElement.querySelector(".ui-tabela__empty-text");
|
|
779
|
+
i && r && (i.textContent = r), e.onRenderBody();
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (t === "carregando" || t === "loading") {
|
|
783
|
+
e.loadingElement && (e.loadingElement.style.display = r !== null ? "flex" : "none");
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (t === "densidade" || t === "density") {
|
|
787
|
+
e.onRenderBody();
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
e.onRenderTotal();
|
|
791
|
+
}
|
|
792
|
+
function it(t, r, e, i) {
|
|
793
|
+
if (t === "Enter" || t === " ") return { tipo: "ativar" };
|
|
794
|
+
if (!Number.isInteger(r) || !Number.isInteger(e) || e < 0) return null;
|
|
795
|
+
const o = Math.max(1, Math.floor(Number.isFinite(i) ? i : 1)), a = (n) => Math.min(e, Math.max(0, n));
|
|
796
|
+
switch (t) {
|
|
797
|
+
case "ArrowDown":
|
|
798
|
+
return { tipo: "mover", indice: a(r + 1) };
|
|
799
|
+
case "ArrowUp":
|
|
800
|
+
return { tipo: "mover", indice: a(r - 1) };
|
|
801
|
+
case "Home":
|
|
802
|
+
return { tipo: "mover", indice: 0 };
|
|
803
|
+
case "End":
|
|
804
|
+
return { tipo: "mover", indice: e };
|
|
805
|
+
case "PageDown":
|
|
806
|
+
return { tipo: "mover", indice: a(r + o) };
|
|
807
|
+
case "PageUp":
|
|
808
|
+
return { tipo: "mover", indice: a(r - o) };
|
|
809
|
+
default:
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
const ot = "Não foi possível carregar os dados.", at = "Nenhum resultado para o filtro";
|
|
814
|
+
function nt(t, r, e, i) {
|
|
815
|
+
if (!t) return;
|
|
816
|
+
if (!r) {
|
|
817
|
+
t.style.display = "none";
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
const o = t.querySelector(".ui-tabela__erro-mensagem"), a = t.querySelector(".ui-tabela__erro-detalhe");
|
|
821
|
+
o && (o.textContent = e || ot), a && (a.textContent = r.erro || "");
|
|
822
|
+
const n = t.querySelector(".ui-tabela__erro-acao");
|
|
823
|
+
n && (n.style.display = i ? "" : "none"), t.style.display = "flex";
|
|
824
|
+
}
|
|
825
|
+
function st(t, r, e, i) {
|
|
826
|
+
t && (t.textContent = e ? r === 0 ? i : `${r} ${r === 1 ? "registro encontrado" : "registros encontrados"}` : "");
|
|
827
|
+
}
|
|
828
|
+
function lt({ tabela: t, container: r }, e, i) {
|
|
829
|
+
t && (e ? t.setAttribute("aria-label", e) : t.removeAttribute("aria-label"), t.setAttribute("aria-busy", String(i)), r && (e ? (r.setAttribute("role", "region"), r.setAttribute("aria-label", e)) : (r.removeAttribute("role"), r.removeAttribute("aria-label"))));
|
|
830
|
+
}
|
|
831
|
+
const dt = 800;
|
|
832
|
+
function ce(t, r, e) {
|
|
833
|
+
const i = t.getBoundingClientRect(), o = r.getBoundingClientRect(), a = i.top + t.clientTop + e, n = i.top + t.clientTop + t.clientHeight;
|
|
834
|
+
return o.top < a ? o.top - a : o.bottom > n ? Math.min(o.bottom - n, o.top - a) : 0;
|
|
835
|
+
}
|
|
836
|
+
function ue(t, r, e) {
|
|
837
|
+
e === "smooth" && typeof t.scrollTo == "function" ? t.scrollTo({ top: r, behavior: "smooth" }) : t.scrollTop = r;
|
|
838
|
+
}
|
|
839
|
+
class ct {
|
|
840
|
+
constructor(r) {
|
|
841
|
+
g(this, "cancelarCorrecao", null);
|
|
842
|
+
this.p = r;
|
|
843
|
+
}
|
|
844
|
+
alturaCabecalho() {
|
|
845
|
+
var r;
|
|
846
|
+
return ((r = this.p.cabecalho()) == null ? void 0 : r.offsetHeight) ?? 0;
|
|
847
|
+
}
|
|
848
|
+
/** Linhas inteiras que cabem na área visível (mínimo 1). */
|
|
849
|
+
linhasPorPagina() {
|
|
850
|
+
var e;
|
|
851
|
+
const r = (((e = this.p.container()) == null ? void 0 : e.clientHeight) ?? 0) - this.alturaCabecalho();
|
|
852
|
+
return Math.max(1, Math.floor(r / this.p.alturaLinha()));
|
|
853
|
+
}
|
|
854
|
+
/** Foca a linha, renderizando a janela virtual se necessário, e a mantém visível abaixo do cabeçalho fixo. */
|
|
855
|
+
focar(r) {
|
|
856
|
+
const e = this.p.container(), i = this.p.tbody();
|
|
857
|
+
if (!e || !i) return;
|
|
858
|
+
this.p.aoLinhaAtiva(r);
|
|
859
|
+
const o = `tr[data-index="${r}"]`;
|
|
860
|
+
let a = i.querySelector(o);
|
|
861
|
+
if (a || (e.scrollTop = Math.max(0, r * this.p.alturaLinha() - e.clientHeight / 2), this.p.renderizarCorpo(), a = i.querySelector(o)), !a) return;
|
|
862
|
+
a.focus({ preventScroll: !0 });
|
|
863
|
+
const n = ce(e, a, this.alturaCabecalho());
|
|
864
|
+
n && (e.scrollTop += n);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Posiciona a linha exibida `indice` na área visível.
|
|
868
|
+
* Fora da janela virtual, rola até a posição estimada, renderiza a janela e corrige pela posição
|
|
869
|
+
* real da linha. No modo suave a correção ocorre ao fim da animação (`scrollend`, com timeout de
|
|
870
|
+
* segurança para navegadores sem o evento ou quando não há rolagem a fazer).
|
|
871
|
+
*/
|
|
872
|
+
posicionar(r, e) {
|
|
873
|
+
const i = this.p.container(), o = this.p.tbody();
|
|
874
|
+
if (!i || !o) return !1;
|
|
875
|
+
this.cancelar();
|
|
876
|
+
const a = () => o.querySelector(`tr[data-index="${r}"]`), n = (p) => {
|
|
877
|
+
const l = a();
|
|
878
|
+
if (!l) return;
|
|
879
|
+
const h = ce(i, l, this.alturaCabecalho());
|
|
880
|
+
h && ue(i, i.scrollTop + h, p);
|
|
881
|
+
};
|
|
882
|
+
if (a())
|
|
883
|
+
return n(e), !0;
|
|
884
|
+
const s = () => {
|
|
885
|
+
i.scrollTop = Math.max(0, r * this.p.alturaLinha()), this.p.renderizarCorpo(), n("auto"), this.p.renderizarCorpo();
|
|
886
|
+
};
|
|
887
|
+
if (e === "auto")
|
|
888
|
+
return s(), !0;
|
|
889
|
+
ue(i, Math.max(0, r * this.p.alturaLinha()), "smooth");
|
|
890
|
+
let u = !0;
|
|
891
|
+
const c = () => {
|
|
892
|
+
u && (this.cancelar(), this.p.renderizarCorpo(), a() ? n("smooth") : s());
|
|
893
|
+
}, d = window.setTimeout(c, dt);
|
|
894
|
+
return i.addEventListener("scrollend", c, { once: !0 }), this.cancelarCorrecao = () => {
|
|
895
|
+
u = !1, window.clearTimeout(d), i.removeEventListener("scrollend", c), this.cancelarCorrecao = null;
|
|
896
|
+
}, !0;
|
|
897
|
+
}
|
|
898
|
+
/** Cancela a correção pendente de uma rolagem suave (nova rolagem, desconexão). */
|
|
899
|
+
cancelar() {
|
|
900
|
+
var r;
|
|
901
|
+
(r = this.cancelarCorrecao) == null || r.call(this);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
class ut extends fe {
|
|
905
|
+
constructor() {
|
|
906
|
+
super();
|
|
907
|
+
g(this, "shadow");
|
|
908
|
+
g(this, "_colunas", []);
|
|
909
|
+
g(this, "_textoVazio", "Nenhum registro encontrado");
|
|
910
|
+
g(this, "_virtualizar", !0);
|
|
911
|
+
g(this, "_isResizing", !1);
|
|
912
|
+
g(this, "_carregando", !1);
|
|
913
|
+
g(this, "_src", null);
|
|
914
|
+
g(this, "_fetchOpcoes", null);
|
|
915
|
+
g(this, "_fetcher", null);
|
|
916
|
+
g(this, "_containerElement", null);
|
|
917
|
+
g(this, "_tableElement", null);
|
|
918
|
+
g(this, "_theadElement", null);
|
|
919
|
+
g(this, "_tbodyElement", null);
|
|
920
|
+
g(this, "_colgroupElement", null);
|
|
921
|
+
g(this, "_emptyElement", null);
|
|
922
|
+
g(this, "_loadingElement", null);
|
|
923
|
+
g(this, "_erroElement", null);
|
|
924
|
+
g(this, "_anuncioElement", null);
|
|
925
|
+
/** Último erro de carregamento remoto (null = sem erro). */
|
|
926
|
+
g(this, "_erro", null);
|
|
927
|
+
g(this, "_scrollHandler", null);
|
|
928
|
+
g(this, "_activeResizeCleanup", null);
|
|
929
|
+
g(this, "_headerListeners", new F());
|
|
930
|
+
g(this, "_corpoListeners", new F());
|
|
931
|
+
/** Linha com o foco móvel (navegação por teclado); null = primeira linha visível. */
|
|
932
|
+
g(this, "_indiceAtivo", null);
|
|
933
|
+
/** Altura real das linhas medida no DOM; null = usa a estimativa da densidade. */
|
|
934
|
+
g(this, "_alturaLinhaMedida", null);
|
|
935
|
+
g(this, "rolagem", new ct({
|
|
936
|
+
container: () => this._containerElement,
|
|
937
|
+
tbody: () => this._tbodyElement,
|
|
938
|
+
cabecalho: () => this._theadElement,
|
|
939
|
+
alturaLinha: () => this.getRowHeight(),
|
|
940
|
+
renderizarCorpo: () => this.renderBody(),
|
|
941
|
+
aoLinhaAtiva: (e) => {
|
|
942
|
+
this._indiceAtivo = e;
|
|
943
|
+
}
|
|
944
|
+
}));
|
|
945
|
+
g(this, "remotaController");
|
|
946
|
+
g(this, "selecaoController");
|
|
947
|
+
g(this, "dadosController", new Pe());
|
|
948
|
+
/** Mantém um único tabindex=0 (foco móvel): Tab entra na tabela pela última linha ativa. */
|
|
949
|
+
g(this, "handleFocoLinha", (e) => {
|
|
950
|
+
const i = e.target;
|
|
951
|
+
i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index") || this.definirLinhaAtiva(Number(i.getAttribute("data-index")));
|
|
952
|
+
});
|
|
953
|
+
/**
|
|
954
|
+
* Teclado nas linhas: setas, Home/End e PageUp/PageDown movem o foco;
|
|
955
|
+
* Enter/Espaço selecionam a linha (mesmo caminho do clique, emite `ui-linha-clique`).
|
|
956
|
+
*/
|
|
957
|
+
g(this, "handleTecladoCorpo", (e) => {
|
|
958
|
+
const i = e.target;
|
|
959
|
+
if (i.parentElement !== this._tbodyElement || !i.hasAttribute("data-index")) return;
|
|
960
|
+
const o = this.dadosController.getDadosExibicao().length - 1, a = it(e.key, Number(i.getAttribute("data-index")), o, this.rolagem.linhasPorPagina());
|
|
961
|
+
a && (e.preventDefault(), a.tipo === "ativar" ? i.click() : this.rolagem.focar(a.indice));
|
|
962
|
+
});
|
|
963
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.remotaController = new Le({
|
|
964
|
+
host: this,
|
|
965
|
+
onCarregandoAlterado: (e) => {
|
|
966
|
+
this.carregando = e;
|
|
967
|
+
},
|
|
968
|
+
onDadosRecebidos: (e) => {
|
|
969
|
+
this.dados = e;
|
|
970
|
+
},
|
|
971
|
+
getOpcoes: () => this._fetchOpcoes,
|
|
972
|
+
getFetcher: () => this._fetcher
|
|
973
|
+
}), this.selecaoController = new De({
|
|
974
|
+
host: this,
|
|
975
|
+
getTbody: () => this._tbodyElement,
|
|
976
|
+
getDadosExibicao: () => this.dadosController.getDadosExibicao(),
|
|
977
|
+
getDadosOriginais: () => this.dadosController.getDadosOriginais(),
|
|
978
|
+
getChaveId: () => this.chaveId,
|
|
979
|
+
onRolarParaIndice: (e, i) => this.rolagem.posicionar(e, i),
|
|
980
|
+
onLinhaAtiva: (e) => this.definirLinhaAtiva(e)
|
|
981
|
+
}), this.addEventListener("ui-fetch-erro", (e) => this.mostrarErro(e.detail)), this.addEventListener("ui-fetch-start", () => this.mostrarErro(null)), this.addEventListener("ui-fetch-sucesso", () => this.mostrarErro(null));
|
|
982
|
+
}
|
|
983
|
+
static get observedAttributes() {
|
|
984
|
+
return ["texto-vazio", "empty-text", "max-height", "densidade", "density", "altura-linha", "row-height", "virtualizar", "virtualize", "src", "carregando", "loading", "chave-id", "id-key", "aria-label", "ordenacao-remota", "texto-erro", "texto-sem-resultados", "texto-carregando"];
|
|
985
|
+
}
|
|
986
|
+
connectedCallback() {
|
|
987
|
+
this.syncAttributes(), this.alturaLinha && this.style.setProperty("--ui-tabela-altura-linha", `${this.alturaLinha}px`), !this.hasAttribute("densidade") && !this.hasAttribute("density") && this.setAttribute("densidade", "normal"), this.renderTotal(), this._src && this.remotaController.carregar(this._src);
|
|
988
|
+
}
|
|
989
|
+
disconnectedCallback() {
|
|
990
|
+
this.cleanupEventListeners();
|
|
991
|
+
}
|
|
992
|
+
attributeChangedCallback(e, i, o) {
|
|
993
|
+
e === "ordenacao-remota" && (this.dadosController.setOrdenacaoRemota(o !== null), this.atualizarContextoSelecao()), (e === "densidade" || e === "density" || e === "altura-linha" || e === "row-height") && (this._alturaLinhaMedida = null), (e === "altura-linha" || e === "row-height") && this.aplicarAlturaLinha(), (e === "chave-id" || e === "id-key") && this.atualizarContextoSelecao(), rt(e, o, this.obterContextoAtributos()), this.sincronizarAria();
|
|
994
|
+
}
|
|
995
|
+
/** Nome acessível vem do host (`aria-label`); `aria-busy` acompanha o carregamento remoto. */
|
|
996
|
+
sincronizarAria() {
|
|
997
|
+
this._tableElement && (lt({ tabela: this._tableElement, container: this._containerElement }, this.getAttribute("aria-label"), this._carregando), this.atualizarTextosEstado());
|
|
998
|
+
}
|
|
999
|
+
/** Textos de estado configuráveis por atributo (carregando, sem resultados, erro). */
|
|
1000
|
+
atualizarTextosEstado() {
|
|
1001
|
+
var i;
|
|
1002
|
+
const e = (i = this._loadingElement) == null ? void 0 : i.querySelector(".ui-tabela__loading-texto");
|
|
1003
|
+
e && (e.textContent = this.getAttribute("texto-carregando") || "Carregando dados..."), this.renderizarErro();
|
|
1004
|
+
}
|
|
1005
|
+
/** Mostra (ou oculta, com null) o aviso de erro de carregamento com a ação "Tentar novamente". */
|
|
1006
|
+
mostrarErro(e) {
|
|
1007
|
+
this._erro = e, this.renderizarErro();
|
|
1008
|
+
}
|
|
1009
|
+
renderizarErro() {
|
|
1010
|
+
nt(this._erroElement, this._erro, this.getAttribute("texto-erro"), !!this._src);
|
|
1011
|
+
}
|
|
1012
|
+
/** Anuncia ao leitor de tela o resultado do filtro (a região é limpa sem filtro ativo). */
|
|
1013
|
+
anunciarResultado() {
|
|
1014
|
+
st(
|
|
1015
|
+
this._anuncioElement,
|
|
1016
|
+
this.dadosController.getDadosExibicao().length,
|
|
1017
|
+
this.dadosController.temFiltro(),
|
|
1018
|
+
this._textoSemResultados()
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
_textoSemResultados() {
|
|
1022
|
+
return this.getAttribute("texto-sem-resultados") || at;
|
|
1023
|
+
}
|
|
1024
|
+
syncAttributes() {
|
|
1025
|
+
xe(this.obterContextoAtributos());
|
|
1026
|
+
}
|
|
1027
|
+
obterContextoAtributos() {
|
|
1028
|
+
return {
|
|
1029
|
+
host: this,
|
|
1030
|
+
containerElement: this._containerElement,
|
|
1031
|
+
emptyElement: this._emptyElement,
|
|
1032
|
+
loadingElement: this._loadingElement,
|
|
1033
|
+
onTextoVazioAlterado: (e) => {
|
|
1034
|
+
this._textoVazio = e;
|
|
1035
|
+
},
|
|
1036
|
+
onVirtualizarAlterado: (e) => {
|
|
1037
|
+
this._virtualizar = e;
|
|
1038
|
+
},
|
|
1039
|
+
onSrcLido: (e) => {
|
|
1040
|
+
this._src = e;
|
|
1041
|
+
},
|
|
1042
|
+
onCarregarSrc: (e) => {
|
|
1043
|
+
this.remotaController.carregar(e);
|
|
1044
|
+
},
|
|
1045
|
+
onCarregandoAlterado: (e) => {
|
|
1046
|
+
this._carregando = e;
|
|
1047
|
+
},
|
|
1048
|
+
onRenderBody: () => this.renderBody(),
|
|
1049
|
+
onRenderTotal: () => this.renderTotal()
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
get src() {
|
|
1053
|
+
return this._src;
|
|
1054
|
+
}
|
|
1055
|
+
set src(e) {
|
|
1056
|
+
this._src = e, e ? this.setAttribute("src", e) : this.removeAttribute("src");
|
|
1057
|
+
}
|
|
1058
|
+
get carregando() {
|
|
1059
|
+
return this._carregando;
|
|
1060
|
+
}
|
|
1061
|
+
set carregando(e) {
|
|
1062
|
+
this._carregando = !!e, this._carregando ? this.setAttribute("carregando", "") : (this.removeAttribute("carregando"), this.removeAttribute("loading")), this._loadingElement && (this._loadingElement.style.display = this._carregando ? "flex" : "none"), this.sincronizarAria();
|
|
1063
|
+
}
|
|
1064
|
+
/** Opções do `fetch` do modo remoto (headers, credentials, method, body...); o `signal` é da tabela. */
|
|
1065
|
+
get fetchOpcoes() {
|
|
1066
|
+
return this._fetchOpcoes;
|
|
1067
|
+
}
|
|
1068
|
+
set fetchOpcoes(e) {
|
|
1069
|
+
this._fetchOpcoes = e ?? null;
|
|
1070
|
+
}
|
|
1071
|
+
/** Função de busca alternativa ao `fetch` (autenticação, renovação de token, mocks). */
|
|
1072
|
+
get fetcher() {
|
|
1073
|
+
return this._fetcher;
|
|
1074
|
+
}
|
|
1075
|
+
set fetcher(e) {
|
|
1076
|
+
this._fetcher = typeof e == "function" ? e : null;
|
|
1077
|
+
}
|
|
1078
|
+
/** Ordenação feita pelo servidor: o clique no cabeçalho atualiza o indicador e emite `ui-sort`, mas não reordena. */
|
|
1079
|
+
get ordenacaoRemota() {
|
|
1080
|
+
return this.hasAttribute("ordenacao-remota");
|
|
1081
|
+
}
|
|
1082
|
+
set ordenacaoRemota(e) {
|
|
1083
|
+
this.toggleAttribute("ordenacao-remota", !!e);
|
|
1084
|
+
}
|
|
1085
|
+
/** Busca a URL (guardada como `src`, para `recarregar()`). Resolve `true` em sucesso; falhas vão em `ui-fetch-erro`. */
|
|
1086
|
+
async carregarDoEndpoint(e) {
|
|
1087
|
+
return e && e !== this._src && (this.src = e), this.remotaController.carregar(e || this._src || "");
|
|
1088
|
+
}
|
|
1089
|
+
async recarregar() {
|
|
1090
|
+
return this._src ? this.remotaController.carregar(this._src) : (this.dadosController.aplicarOrdenacao(), this.atualizarContextoSelecao(), this.renderBody(), !0);
|
|
1091
|
+
}
|
|
1092
|
+
filtrar(e) {
|
|
1093
|
+
this.dadosController.filtrar(e), this.atualizarContextoSelecao(), this.renderBody();
|
|
1094
|
+
}
|
|
1095
|
+
cleanupEventListeners() {
|
|
1096
|
+
this._containerElement && this._scrollHandler && (this._containerElement.removeEventListener("scroll", this._scrollHandler), this._scrollHandler = null), this._activeResizeCleanup && (this._activeResizeCleanup(), this._activeResizeCleanup = null, this._isResizing = !1), this.rolagem.cancelar(), this.remotaController.abortar(), this._headerListeners.cleanup(), this._corpoListeners.cleanup();
|
|
1097
|
+
}
|
|
1098
|
+
get colunas() {
|
|
1099
|
+
return this._colunas;
|
|
1100
|
+
}
|
|
1101
|
+
set colunas(e) {
|
|
1102
|
+
this._colunas = Array.isArray(e) ? e.filter((i) => i != null).map((i) => ({ ...i })) : [], this.dadosController.setColunas(this._colunas), this.dadosController.setColunasFiltro(this._colunas.map((i) => i.id)), this._alturaLinhaMedida = null, this.renderTotal();
|
|
1103
|
+
}
|
|
1104
|
+
get dados() {
|
|
1105
|
+
return this.dadosController.getDadosOriginais();
|
|
1106
|
+
}
|
|
1107
|
+
set dados(e) {
|
|
1108
|
+
this.dadosController.setDadosOriginais(e), this.atualizarContextoSelecao(), this.renderBody();
|
|
1109
|
+
}
|
|
1110
|
+
get itens() {
|
|
1111
|
+
return this.dados;
|
|
1112
|
+
}
|
|
1113
|
+
set itens(e) {
|
|
1114
|
+
this.dados = e;
|
|
1115
|
+
}
|
|
1116
|
+
get chaveId() {
|
|
1117
|
+
return this.getAttribute("chave-id") || this.getAttribute("id-key") || "id";
|
|
1118
|
+
}
|
|
1119
|
+
set chaveId(e) {
|
|
1120
|
+
e ? this.setAttribute("chave-id", e) : (this.removeAttribute("chave-id"), this.removeAttribute("id-key")), this.atualizarContextoSelecao();
|
|
1121
|
+
}
|
|
1122
|
+
get itemSelecionado() {
|
|
1123
|
+
return this.selecaoController.getItemSelecionado();
|
|
1124
|
+
}
|
|
1125
|
+
set itemSelecionado(e) {
|
|
1126
|
+
this.selecaoController.setItemSelecionado(e);
|
|
1127
|
+
}
|
|
1128
|
+
get indiceSelecionado() {
|
|
1129
|
+
return this.selecaoController.getIndiceSelecionado();
|
|
1130
|
+
}
|
|
1131
|
+
set indiceSelecionado(e) {
|
|
1132
|
+
this.selecaoController.setIndiceSelecionado(e);
|
|
1133
|
+
}
|
|
1134
|
+
limparSelecao() {
|
|
1135
|
+
this.selecaoController.limparSelecao();
|
|
1136
|
+
}
|
|
1137
|
+
get densidade() {
|
|
1138
|
+
const e = this.getAttribute("densidade") || this.getAttribute("density");
|
|
1139
|
+
return e === "compacta" || e === "compact" ? "compacta" : e === "relaxada" || e === "relaxed" ? "relaxada" : "normal";
|
|
1140
|
+
}
|
|
1141
|
+
set densidade(e) {
|
|
1142
|
+
e ? this.setAttribute("densidade", e) : (this.removeAttribute("densidade"), this.removeAttribute("density")), this.renderBody();
|
|
1143
|
+
}
|
|
1144
|
+
get virtualizar() {
|
|
1145
|
+
return this._virtualizar;
|
|
1146
|
+
}
|
|
1147
|
+
set virtualizar(e) {
|
|
1148
|
+
this._virtualizar = !!e, e ? this.setAttribute("virtualizar", "true") : this.removeAttribute("virtualizar"), this.renderTotal();
|
|
1149
|
+
}
|
|
1150
|
+
get colunaOrdenada() {
|
|
1151
|
+
return this.dadosController.getColunaOrdenada();
|
|
1152
|
+
}
|
|
1153
|
+
set colunaOrdenada(e) {
|
|
1154
|
+
this.dadosController.setColunaOrdenada(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
|
|
1155
|
+
}
|
|
1156
|
+
get direcaoOrdenacao() {
|
|
1157
|
+
return this.dadosController.getDirecaoOrdenacao();
|
|
1158
|
+
}
|
|
1159
|
+
set direcaoOrdenacao(e) {
|
|
1160
|
+
this.dadosController.setDirecaoOrdenacao(e), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
|
|
1161
|
+
}
|
|
1162
|
+
get textoVazio() {
|
|
1163
|
+
return this._textoVazio;
|
|
1164
|
+
}
|
|
1165
|
+
set textoVazio(e) {
|
|
1166
|
+
this._textoVazio = e || "Nenhum registro encontrado", this.renderTotal();
|
|
1167
|
+
}
|
|
1168
|
+
handleHeaderClick(e) {
|
|
1169
|
+
if (!e.ordenavel || this._isResizing) return;
|
|
1170
|
+
const i = this.dadosController.getColunaOrdenada(), o = this.dadosController.getDirecaoOrdenacao(), a = this.dadosController.alternarOrdenacaoColuna(e);
|
|
1171
|
+
if (!a) return;
|
|
1172
|
+
this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody();
|
|
1173
|
+
const n = new CustomEvent("ui-sort", { detail: a, bubbles: !0, composed: !0, cancelable: !0 });
|
|
1174
|
+
this.dispatchEvent(n), n.defaultPrevented && (this.dadosController.restaurarOrdenacao(i, o), this.atualizarContextoSelecao(), this.renderHeader(), this.renderBody());
|
|
1175
|
+
}
|
|
1176
|
+
/** Altura fixa das linhas em px (`altura-linha`), sobrepõe a densidade; null = vale a densidade. */
|
|
1177
|
+
get alturaLinha() {
|
|
1178
|
+
const e = this.getAttribute("altura-linha") ?? this.getAttribute("row-height"), i = e === null ? NaN : parseFloat(e);
|
|
1179
|
+
return Number.isFinite(i) && i > 0 ? i : null;
|
|
1180
|
+
}
|
|
1181
|
+
set alturaLinha(e) {
|
|
1182
|
+
e && e > 0 ? this.setAttribute("altura-linha", String(e)) : (this.removeAttribute("altura-linha"), this.removeAttribute("row-height"));
|
|
1183
|
+
}
|
|
1184
|
+
/** Publica a altura fixa como variável CSS (usada pelo estilo `:host([altura-linha])`). */
|
|
1185
|
+
aplicarAlturaLinha() {
|
|
1186
|
+
const e = this.alturaLinha;
|
|
1187
|
+
e ? this.style.setProperty("--ui-tabela-altura-linha", `${e}px`) : this.style.removeProperty("--ui-tabela-altura-linha"), this.renderBody();
|
|
1188
|
+
}
|
|
1189
|
+
/** Altura usada na virtualização: a fixa (`altura-linha`), a medida no DOM ou a estimativa da densidade. */
|
|
1190
|
+
getRowHeight() {
|
|
1191
|
+
return this.alturaLinha ?? this._alturaLinhaMedida ?? le(this.densidade);
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Mede a altura real das linhas uma vez por configuração (densidade/colunas): padding, fonte e
|
|
1195
|
+
* renderizadores customizados mudam a altura, e a estimativa fixa desalinharia a janela virtual.
|
|
1196
|
+
* Não remede a cada rolagem para os espaçadores não "pularem" com linhas de alturas diferentes.
|
|
1197
|
+
*/
|
|
1198
|
+
medirAlturaLinha() {
|
|
1199
|
+
if (this._alturaLinhaMedida !== null || !this._tbodyElement) return;
|
|
1200
|
+
const e = this._tbodyElement.querySelectorAll("tr[data-index]");
|
|
1201
|
+
if (e.length === 0) return;
|
|
1202
|
+
let i = 0;
|
|
1203
|
+
e.forEach((a) => {
|
|
1204
|
+
i += a.getBoundingClientRect().height;
|
|
1205
|
+
});
|
|
1206
|
+
const o = i / e.length;
|
|
1207
|
+
o <= 0 || (this._alturaLinhaMedida = o, Math.abs(o - le(this.densidade)) > 0.5 && this.renderBody());
|
|
1208
|
+
}
|
|
1209
|
+
/** Ordenar, filtrar, trocar os dados ou a chave mantém a linha selecionada (se ainda existir). */
|
|
1210
|
+
atualizarContextoSelecao() {
|
|
1211
|
+
this.selecaoController.reconciliar(), this._indiceAtivo = this.selecaoController.getIndiceSelecionado();
|
|
1212
|
+
}
|
|
1213
|
+
renderTotal() {
|
|
1214
|
+
var e;
|
|
1215
|
+
if (this.shadow) {
|
|
1216
|
+
if (this._containerElement) {
|
|
1217
|
+
if (this._containerElement.style.maxHeight = this.getAttribute("max-height") || "", this._emptyElement) {
|
|
1218
|
+
const i = this._emptyElement.querySelector(".ui-tabela__empty-text");
|
|
1219
|
+
i && (i.textContent = this._textoVazio);
|
|
1220
|
+
}
|
|
1221
|
+
} else {
|
|
1222
|
+
this.cleanupEventListeners();
|
|
1223
|
+
const i = tt(this.shadow, this._textoVazio, this.getAttribute("max-height"), this._carregando);
|
|
1224
|
+
this._containerElement = i.containerElement, this._tableElement = i.tableElement, this._colgroupElement = i.colgroupElement, this._theadElement = i.theadElement, this._tbodyElement = i.tbodyElement, this._emptyElement = i.emptyElement, this._loadingElement = i.loadingElement, this._erroElement = i.erroElement, this._anuncioElement = i.anuncioElement, (e = i.erroElement.querySelector(".ui-tabela__erro-acao")) == null || e.addEventListener("click", () => {
|
|
1225
|
+
this.recarregar();
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
this.renderHeader(), this.renderBody(), this._virtualizar && this._containerElement && !this._scrollHandler && (this._scrollHandler = et(this._containerElement, () => this.renderBody())), this._tbodyElement && this._corpoListeners.size === 0 && (this._corpoListeners.add(this._tbodyElement, "keydown", this.handleTecladoCorpo), this._corpoListeners.add(this._tbodyElement, "focusin", this.handleFocoLinha)), this.sincronizarAria();
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
definirLinhaAtiva(e) {
|
|
1232
|
+
this._indiceAtivo = e;
|
|
1233
|
+
const i = this._tbodyElement, o = i == null ? void 0 : i.querySelector(`tr[data-index="${e}"]`);
|
|
1234
|
+
!i || !o || (i.querySelectorAll('tr[tabindex="0"]').forEach((a) => {
|
|
1235
|
+
a !== o && (a.tabIndex = -1);
|
|
1236
|
+
}), o.tabIndex = 0);
|
|
1237
|
+
}
|
|
1238
|
+
obterContextoRenderizador() {
|
|
1239
|
+
return {
|
|
1240
|
+
host: this,
|
|
1241
|
+
shadow: this.shadow,
|
|
1242
|
+
theadElement: this._theadElement,
|
|
1243
|
+
colgroupElement: this._colgroupElement,
|
|
1244
|
+
tbodyElement: this._tbodyElement,
|
|
1245
|
+
tableElement: this._tableElement,
|
|
1246
|
+
emptyElement: this._emptyElement,
|
|
1247
|
+
containerElement: this._containerElement,
|
|
1248
|
+
colunas: this._colunas,
|
|
1249
|
+
dadosController: this.dadosController,
|
|
1250
|
+
selecaoController: this.selecaoController,
|
|
1251
|
+
chaveId: this.chaveId,
|
|
1252
|
+
virtualizar: this._virtualizar,
|
|
1253
|
+
rowHeight: this.getRowHeight(),
|
|
1254
|
+
indiceAtivo: this._indiceAtivo,
|
|
1255
|
+
textoVazio: this._textoVazio,
|
|
1256
|
+
textoSemResultados: this._textoSemResultados(),
|
|
1257
|
+
headerListeners: this._headerListeners,
|
|
1258
|
+
onSetIsResizing: (e) => {
|
|
1259
|
+
this._isResizing = e;
|
|
1260
|
+
},
|
|
1261
|
+
onActiveResizeCleanup: (e) => {
|
|
1262
|
+
this._activeResizeCleanup = e;
|
|
1263
|
+
},
|
|
1264
|
+
onHeaderClick: (e) => this.handleHeaderClick(e)
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
renderHeader() {
|
|
1268
|
+
Ze(this.obterContextoRenderizador());
|
|
1269
|
+
}
|
|
1270
|
+
renderBody() {
|
|
1271
|
+
Je(this.obterContextoRenderizador()), this.anunciarResultado(), this.medirAlturaLinha();
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Rola até um item e opcionalmente o seleciona. Aceita ID (pela `chave-id`, depois `id`, `_id`,
|
|
1275
|
+
* `codigo`, `key`), predicado ou índice. Um número é procurado primeiro como ID; use
|
|
1276
|
+
* `{ porIndice: true }` ou `rolarParaIndice()` para tratá-lo só como índice da linha exibida.
|
|
1277
|
+
*/
|
|
1278
|
+
rolarPara(e, i) {
|
|
1279
|
+
return this.selecaoController.rolarPara(e, i);
|
|
1280
|
+
}
|
|
1281
|
+
/** Rola até a linha exibida de índice `indice` (posição após ordenação/filtro, base 0). */
|
|
1282
|
+
rolarParaIndice(e, i) {
|
|
1283
|
+
return this.selecaoController.rolarPara(e, { ...i, porIndice: !0 });
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
V("ui-tabela", ut);
|
|
1287
|
+
const M = Math.PI / 180, pe = 64;
|
|
1288
|
+
function N(t) {
|
|
1289
|
+
return Math.abs(t) < 1e-12 ? 0 : Number(t.toPrecision(15));
|
|
1290
|
+
}
|
|
1291
|
+
const pt = {
|
|
1292
|
+
sqrt: Math.sqrt,
|
|
1293
|
+
abs: Math.abs,
|
|
1294
|
+
round: Math.round,
|
|
1295
|
+
floor: Math.floor,
|
|
1296
|
+
ceil: Math.ceil,
|
|
1297
|
+
trunc: Math.trunc,
|
|
1298
|
+
sign: Math.sign,
|
|
1299
|
+
log: Math.log10,
|
|
1300
|
+
ln: Math.log,
|
|
1301
|
+
deg: (t) => N(t / M),
|
|
1302
|
+
rad: (t) => N(t * M),
|
|
1303
|
+
sin: (t) => N(Math.sin(t * M)),
|
|
1304
|
+
cos: (t) => N(Math.cos(t * M)),
|
|
1305
|
+
tan: (t) => N(Math.tan(t * M)),
|
|
1306
|
+
asin: (t) => N(Math.asin(t) / M),
|
|
1307
|
+
acos: (t) => N(Math.acos(t) / M),
|
|
1308
|
+
atan: (t) => N(Math.atan(t) / M)
|
|
1309
|
+
}, ht = {
|
|
1310
|
+
min: (t) => t.length > 0 ? Math.min(...t) : NaN,
|
|
1311
|
+
max: (t) => t.length > 0 ? Math.max(...t) : NaN,
|
|
1312
|
+
pow: (t) => t.length === 2 ? Math.pow(t[0], t[1]) : NaN,
|
|
1313
|
+
hypot: (t) => t.length >= 2 ? Math.hypot(...t) : NaN,
|
|
1314
|
+
atan2: (t) => t.length === 2 ? N(Math.atan2(t[0], t[1]) / M) : NaN,
|
|
1315
|
+
mod: (t) => t.length === 2 && t[1] !== 0 ? t[0] % t[1] : NaN
|
|
1316
|
+
};
|
|
1317
|
+
function W(t) {
|
|
1318
|
+
if (!t || typeof t != "string") return null;
|
|
1319
|
+
let r = t.trim();
|
|
1320
|
+
if (r.startsWith("=") && (r = r.slice(1).trim()), !r) return null;
|
|
1321
|
+
r = r.replace(/(\d),(\d)/g, "$1.$2");
|
|
1322
|
+
let e = 0, i = 0, o = !1;
|
|
1323
|
+
function a() {
|
|
1324
|
+
return r[e] || "";
|
|
1325
|
+
}
|
|
1326
|
+
function n() {
|
|
1327
|
+
return r[e++] || "";
|
|
1328
|
+
}
|
|
1329
|
+
function s() {
|
|
1330
|
+
for (; e < r.length && /\s/.test(r[e]); )
|
|
1331
|
+
e++;
|
|
1332
|
+
}
|
|
1333
|
+
function u() {
|
|
1334
|
+
if (++i > pe)
|
|
1335
|
+
throw new Error("Profundidade máxima excedida");
|
|
1336
|
+
try {
|
|
1337
|
+
s();
|
|
1338
|
+
let l = c();
|
|
1339
|
+
for (s(); e < r.length; ) {
|
|
1340
|
+
const h = a();
|
|
1341
|
+
if (h === "+" || h === "-") {
|
|
1342
|
+
n(), s();
|
|
1343
|
+
const m = c(), v = o;
|
|
1344
|
+
s(), v ? l = h === "+" ? l + l * m : l - l * m : l = h === "+" ? l + m : l - m, o = !1;
|
|
1345
|
+
} else
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
return l;
|
|
1349
|
+
} finally {
|
|
1350
|
+
i--;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
function c() {
|
|
1354
|
+
s();
|
|
1355
|
+
let l = d(), h = o;
|
|
1356
|
+
for (s(); e < r.length; ) {
|
|
1357
|
+
const m = a();
|
|
1358
|
+
if (m === "*" || m === "/" || m === "x" || m === "X") {
|
|
1359
|
+
n(), s();
|
|
1360
|
+
const v = d();
|
|
1361
|
+
if (h = !1, m === "/" && v === 0)
|
|
1362
|
+
throw new Error("Divisão por zero");
|
|
1363
|
+
l = m === "/" ? l / v : l * v, s();
|
|
1364
|
+
} else
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
return o = h, l;
|
|
1368
|
+
}
|
|
1369
|
+
function d() {
|
|
1370
|
+
if (++i > pe)
|
|
1371
|
+
throw new Error("Profundidade máxima excedida");
|
|
1372
|
+
try {
|
|
1373
|
+
s();
|
|
1374
|
+
const l = a();
|
|
1375
|
+
if (l === "+" || l === "-") {
|
|
1376
|
+
n();
|
|
1377
|
+
const v = d();
|
|
1378
|
+
return l === "-" ? -v : v;
|
|
1379
|
+
}
|
|
1380
|
+
let h = p();
|
|
1381
|
+
const m = o;
|
|
1382
|
+
if (s(), a() === "^") {
|
|
1383
|
+
n();
|
|
1384
|
+
const v = d();
|
|
1385
|
+
h = Math.pow(h, v), o = !1;
|
|
1386
|
+
} else if (r.slice(e, e + 2) === "**") {
|
|
1387
|
+
e += 2;
|
|
1388
|
+
const v = d();
|
|
1389
|
+
h = Math.pow(h, v), o = !1;
|
|
1390
|
+
} else
|
|
1391
|
+
o = m;
|
|
1392
|
+
return h;
|
|
1393
|
+
} finally {
|
|
1394
|
+
i--;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
function p() {
|
|
1398
|
+
s(), o = !1;
|
|
1399
|
+
const l = a();
|
|
1400
|
+
if (l === "+" || l === "-") {
|
|
1401
|
+
n();
|
|
1402
|
+
const f = p();
|
|
1403
|
+
return l === "-" ? -f : f;
|
|
1404
|
+
}
|
|
1405
|
+
if (l === "(") {
|
|
1406
|
+
n();
|
|
1407
|
+
const f = u();
|
|
1408
|
+
if (s(), n() !== ")") throw new Error("Parêntese sem fechamento");
|
|
1409
|
+
return s(), a() === "%" ? (n(), o = !0, f / 100) : (o = !1, f);
|
|
1410
|
+
}
|
|
1411
|
+
const h = r.slice(e).match(/^([a-zA-Z_]\w*)\s*\(/);
|
|
1412
|
+
if (h) {
|
|
1413
|
+
const f = h[1].toLowerCase(), b = pt[f], _ = ht[f];
|
|
1414
|
+
if (!b && !_)
|
|
1415
|
+
throw new Error("Função desconhecida: " + h[1]);
|
|
1416
|
+
e += h[0].length;
|
|
1417
|
+
const y = [u()];
|
|
1418
|
+
for (s(); a() === ";" || a() === ","; )
|
|
1419
|
+
n(), s(), y.push(u()), s();
|
|
1420
|
+
if (n() !== ")") throw new Error("Parêntese sem fechamento");
|
|
1421
|
+
const A = _ ? _(y) : y.length === 1 && b ? b(y[0]) : NaN;
|
|
1422
|
+
if (isNaN(A)) throw new Error("Resultado inválido de função");
|
|
1423
|
+
return s(), a() === "%" ? (n(), o = !0, A / 100) : (o = !1, A);
|
|
1424
|
+
}
|
|
1425
|
+
const m = r.slice(e).match(/^(pi|π|e)\b/i);
|
|
1426
|
+
if (m) {
|
|
1427
|
+
e += m[0].length;
|
|
1428
|
+
let b = m[1].toLowerCase() === "e" ? Math.E : Math.PI;
|
|
1429
|
+
return s(), a() === "%" && (n(), o = !0, b = b / 100), b;
|
|
1430
|
+
}
|
|
1431
|
+
const v = r.slice(e).match(/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+|,[0-9]+)(?:[eE][+-]?[0-9]+)?/);
|
|
1432
|
+
if (v) {
|
|
1433
|
+
e += v[0].length;
|
|
1434
|
+
let f = parseFloat(v[0].replace(",", "."));
|
|
1435
|
+
return s(), a() === "%" && (n(), o = !0, f = f / 100), f;
|
|
1436
|
+
}
|
|
1437
|
+
throw new Error("Caractere inválido: " + l);
|
|
1438
|
+
}
|
|
1439
|
+
try {
|
|
1440
|
+
const l = u();
|
|
1441
|
+
return s(), e < r.length ? null : typeof l == "number" && isFinite(l) ? l : null;
|
|
1442
|
+
} catch {
|
|
1443
|
+
return null;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
const Q = '.ui-prop__categoria--aberta .ui-prop__linha input:not([disabled]):not([type="color"]):not(.ui-prop__cor-picker-oculto), .ui-prop__categoria--aberta .ui-prop__linha select:not([disabled]), .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__btn-acao-inline:not([disabled]), .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__editor-booleano, .ui-prop__categoria--aberta .ui-prop__linha .ui-prop__editor-cor-container';
|
|
1447
|
+
function _e(t, r) {
|
|
1448
|
+
if (!t) return null;
|
|
1449
|
+
const e = String(r);
|
|
1450
|
+
return Array.from(t.querySelectorAll("[data-prop-id]")).find((i) => i.getAttribute("data-prop-id") === e) ?? null;
|
|
1451
|
+
}
|
|
1452
|
+
const ye = /* @__PURE__ */ new WeakMap();
|
|
1453
|
+
function T(t, r) {
|
|
1454
|
+
ye.set(t, r);
|
|
1455
|
+
}
|
|
1456
|
+
function he(t, r, e) {
|
|
1457
|
+
var a, n;
|
|
1458
|
+
const i = _e(t, r), o = (a = i == null ? void 0 : i.querySelector(".ui-prop__col-valor")) == null ? void 0 : a.firstElementChild;
|
|
1459
|
+
o && ((n = ye.get(o)) == null || n(e));
|
|
1460
|
+
}
|
|
1461
|
+
function H(t, r, e = (o, a) => o === String(a), i = (o) => o == null || o === "" ? "—" : String(o)) {
|
|
1462
|
+
var n;
|
|
1463
|
+
(n = t.querySelector("option[data-externa]")) == null || n.remove();
|
|
1464
|
+
const o = Array.from(t.options).find((s) => !s.hasAttribute("data-acao") && e(s.value, r));
|
|
1465
|
+
if (o) {
|
|
1466
|
+
o.selected = !0;
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
const a = document.createElement("option");
|
|
1470
|
+
a.value = r == null ? "" : String(r), a.textContent = i(r), a.setAttribute("data-externa", ""), a.hidden = !0, t.insertBefore(a, t.firstChild), a.selected = !0;
|
|
1471
|
+
}
|
|
1472
|
+
function q(t, r) {
|
|
1473
|
+
var i;
|
|
1474
|
+
(i = t.querySelector("option[data-externa]")) == null || i.remove();
|
|
1475
|
+
const e = document.createElement("option");
|
|
1476
|
+
e.value = "", e.textContent = r, e.setAttribute("data-externa", ""), e.setAttribute("data-misto", ""), e.hidden = !0, e.disabled = !0, t.insertBefore(e, t.firstChild), e.selected = !0;
|
|
1477
|
+
}
|
|
1478
|
+
function mt(t, r) {
|
|
1479
|
+
const e = Array.from(t.querySelectorAll(Q)), i = e.indexOf(r);
|
|
1480
|
+
if (i !== -1 && i + 1 < e.length) {
|
|
1481
|
+
const o = e[i + 1];
|
|
1482
|
+
o.focus(), o instanceof HTMLInputElement && o.select();
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
function ft(t, r) {
|
|
1486
|
+
const e = Array.from(t.querySelectorAll(Q)), i = e.indexOf(r);
|
|
1487
|
+
if (i > 0) {
|
|
1488
|
+
const o = e[i - 1];
|
|
1489
|
+
o.focus(), o instanceof HTMLInputElement && o.select();
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
function bt(t) {
|
|
1493
|
+
const r = t.querySelector(Q);
|
|
1494
|
+
r && (r.focus(), r instanceof HTMLInputElement && r.select());
|
|
1495
|
+
}
|
|
1496
|
+
function Z(t, r) {
|
|
1497
|
+
var e;
|
|
1498
|
+
t.classList.toggle("ui-prop__categoria--aberta", r), R(t, "categoria-aberta", r), (e = t.querySelector(".ui-prop__categoria-header")) == null || e.setAttribute("aria-expanded", String(r));
|
|
1499
|
+
}
|
|
1500
|
+
function gt(t, r) {
|
|
1501
|
+
r.forEach((e) => {
|
|
1502
|
+
!e || typeof e != "object" || (e.aberto = !0, "aberta" in e && (e.aberta = !0));
|
|
1503
|
+
}), t.querySelectorAll(".ui-prop__categoria").forEach((e) => Z(e, !0));
|
|
1504
|
+
}
|
|
1505
|
+
function vt(t, r) {
|
|
1506
|
+
r.forEach((e) => {
|
|
1507
|
+
!e || typeof e != "object" || (e.aberto = !1, "aberta" in e && (e.aberta = !1));
|
|
1508
|
+
}), t.querySelectorAll(".ui-prop__categoria").forEach((e) => Z(e, !1));
|
|
1509
|
+
}
|
|
1510
|
+
function xt(t, r, e, i) {
|
|
1511
|
+
const o = e.find((a) => a && String(a.id) === String(i));
|
|
1512
|
+
if (o) {
|
|
1513
|
+
const a = Array.from(t.querySelectorAll("[data-cat-id]")).find((u) => u.getAttribute("data-cat-id") === String(i)), s = !(a ? a.classList.contains("ui-prop__categoria--aberta") : o.aberto !== void 0 ? o.aberto !== !1 : o.aberta !== !1);
|
|
1514
|
+
o.aberto = s, "aberta" in o && (o.aberta = s), a && Z(a, s), r.dispatchEvent(
|
|
1515
|
+
new CustomEvent("ui-categoria-toggle", {
|
|
1516
|
+
bubbles: !0,
|
|
1517
|
+
composed: !0,
|
|
1518
|
+
detail: { id: i, aberto: s }
|
|
1519
|
+
})
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
const J = Symbol.for("ui-tabela-propriedades:misto"), ee = "Varia";
|
|
1524
|
+
function S(t) {
|
|
1525
|
+
return t === J;
|
|
1526
|
+
}
|
|
1527
|
+
function D(t) {
|
|
1528
|
+
var e;
|
|
1529
|
+
let r;
|
|
1530
|
+
try {
|
|
1531
|
+
r = (e = t.obterTextoMisto) == null ? void 0 : e.call(t);
|
|
1532
|
+
} catch {
|
|
1533
|
+
}
|
|
1534
|
+
return typeof r == "string" && r.trim() ? r : ee;
|
|
1535
|
+
}
|
|
1536
|
+
function O(t, r) {
|
|
1537
|
+
return t == null && r == null ? !0 : Object.is(t, r);
|
|
1538
|
+
}
|
|
1539
|
+
function X(t) {
|
|
1540
|
+
return t.misto ? J : t.valor;
|
|
1541
|
+
}
|
|
1542
|
+
function _t(t) {
|
|
1543
|
+
if (!Array.isArray(t) || t.length === 0) return;
|
|
1544
|
+
const r = t[0];
|
|
1545
|
+
for (let e = 1; e < t.length; e++)
|
|
1546
|
+
if (!O(r, t[e])) return J;
|
|
1547
|
+
return r;
|
|
1548
|
+
}
|
|
1549
|
+
function er(t) {
|
|
1550
|
+
if (!Array.isArray(t)) return {};
|
|
1551
|
+
const r = t.filter(
|
|
1552
|
+
(o) => o !== null && typeof o == "object" && !Array.isArray(o)
|
|
1553
|
+
), e = /* @__PURE__ */ new Set();
|
|
1554
|
+
r.forEach((o) => Object.keys(o).forEach((a) => e.add(a)));
|
|
1555
|
+
const i = {};
|
|
1556
|
+
return e.forEach((o) => {
|
|
1557
|
+
i[o] = _t(r.map((a) => o in a ? a[o] : void 0));
|
|
1558
|
+
}), i;
|
|
1559
|
+
}
|
|
1560
|
+
function te(t) {
|
|
1561
|
+
if (typeof t.casasDecimais == "number" && t.casasDecimais >= 0) return t.casasDecimais;
|
|
1562
|
+
if (typeof t.precisao == "number" && t.precisao >= 0) return t.precisao;
|
|
1563
|
+
}
|
|
1564
|
+
function yt(t, r) {
|
|
1565
|
+
return typeof t.passo == "number" && t.passo > 0 ? t.passo : typeof t.step == "number" && t.step > 0 ? t.step : r !== void 0 ? Math.pow(10, -r) : 1;
|
|
1566
|
+
}
|
|
1567
|
+
function K(t, r) {
|
|
1568
|
+
let e = t;
|
|
1569
|
+
return typeof r.min == "number" && Number.isFinite(r.min) && (e = Math.max(r.min, e)), typeof r.max == "number" && Number.isFinite(r.max) && (e = Math.min(r.max, e)), e;
|
|
1570
|
+
}
|
|
1571
|
+
function Ee(t, r, e, i) {
|
|
1572
|
+
t.classList.toggle("ui-prop__editor--misto", e), e ? t.placeholder = i : r.placeholder ? t.placeholder = r.placeholder : t.removeAttribute("placeholder");
|
|
1573
|
+
}
|
|
1574
|
+
function Et(t, r, e) {
|
|
1575
|
+
const i = document.createElement("span"), o = e ? te(e) : void 0, a = (n) => {
|
|
1576
|
+
if (S(n)) {
|
|
1577
|
+
i.className = "ui-prop__valor-readonly ui-prop__editor--misto", i.textContent = r ? D({ obterTextoMisto: r }) : ee;
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
if (n == null) {
|
|
1581
|
+
i.className = "ui-prop__valor-readonly", i.textContent = "—";
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
if ((e == null ? void 0 : e.tipo) === "booleano" && typeof n == "boolean") {
|
|
1585
|
+
i.className = "ui-prop__valor-readonly", i.textContent = n ? "Sim" : "Não";
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
if (e != null && e.opcoes && e.opcoes.length > 0) {
|
|
1589
|
+
const u = e.opcoes.find((c) => c && String(c.id) === String(n));
|
|
1590
|
+
if (u) {
|
|
1591
|
+
i.className = "ui-prop__valor-readonly", i.textContent = u.rotulo;
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
const s = typeof n == "number" || typeof n == "string" && /^-?\d+(\.\d+)?$/.test(n.trim());
|
|
1596
|
+
if (i.className = `ui-prop__valor-readonly ${s ? "ui-prop__valor-readonly--numero" : ""}`.trim(), s && o !== void 0) {
|
|
1597
|
+
const u = Number(n);
|
|
1598
|
+
i.textContent = Number.isFinite(u) ? u.toFixed(o) : String(n);
|
|
1599
|
+
} else
|
|
1600
|
+
i.textContent = String(n);
|
|
1601
|
+
};
|
|
1602
|
+
return a(t), T(i, a), i;
|
|
1603
|
+
}
|
|
1604
|
+
function wt(t, r, e, i) {
|
|
1605
|
+
const o = document.createElement("label");
|
|
1606
|
+
o.className = "ui-prop__editor-booleano", o.setAttribute("role", "checkbox"), o.tabIndex = 0, o.setAttribute("aria-label", String(r.rotulo ?? r.id));
|
|
1607
|
+
const a = document.createElement("div");
|
|
1608
|
+
a.className = "ui-prop__checkbox-custom";
|
|
1609
|
+
const n = document.createElement("span");
|
|
1610
|
+
n.className = "ui-prop__booleano-rotulo";
|
|
1611
|
+
const s = (c) => {
|
|
1612
|
+
const d = S(c), p = !d && !!c;
|
|
1613
|
+
o.classList.toggle("ui-prop__editor--misto", d), a.classList.toggle("ui-prop__checkbox-custom--marcado", p), a.classList.toggle("ui-prop__checkbox-custom--misto", d), a.textContent = d ? "–" : p ? "✓" : "", n.textContent = d ? D(i) : p ? "Sim" : "Não", o.setAttribute("aria-checked", d ? "mixed" : String(p));
|
|
1614
|
+
};
|
|
1615
|
+
s(e), T(o, s), o.appendChild(a), o.appendChild(n);
|
|
1616
|
+
const u = () => {
|
|
1617
|
+
const c = i.obterValorAtual(r.id), d = S(c) ? !0 : !c;
|
|
1618
|
+
i.registrarAlteracao(t, r.id, d), s(d);
|
|
1619
|
+
};
|
|
1620
|
+
return o.addEventListener("click", (c) => {
|
|
1621
|
+
c.preventDefault(), u();
|
|
1622
|
+
}), o.addEventListener("keydown", (c) => {
|
|
1623
|
+
c.key === " " ? (c.preventDefault(), u()) : c.key === "Enter" && (c.preventDefault(), c.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o));
|
|
1624
|
+
}), o;
|
|
1625
|
+
}
|
|
1626
|
+
function At(t, r, e, i) {
|
|
1627
|
+
const o = document.createElement("select");
|
|
1628
|
+
o.className = "ui-prop__editor-select", o.setAttribute("aria-label", String(r.rotulo ?? r.id)), (Array.isArray(r.opcoes) ? r.opcoes : []).forEach((n) => {
|
|
1629
|
+
if (!n || typeof n != "object") return;
|
|
1630
|
+
const s = document.createElement("option");
|
|
1631
|
+
s.value = String(n.id), s.textContent = String(n.rotulo ?? n.id), o.appendChild(s);
|
|
1632
|
+
});
|
|
1633
|
+
const a = (n) => {
|
|
1634
|
+
o.classList.toggle("ui-prop__editor--misto", S(n)), S(n) ? q(o, D(i)) : H(o, n);
|
|
1635
|
+
};
|
|
1636
|
+
return a(e), T(o, a), o.addEventListener("change", () => {
|
|
1637
|
+
const n = (r.opcoes || []).find((s) => s && String(s.id) === o.value);
|
|
1638
|
+
i.registrarAlteracao(t, r.id, n ? n.id : o.value), a(i.obterValorAtual(r.id));
|
|
1639
|
+
}), o.addEventListener("keydown", (n) => {
|
|
1640
|
+
n.key === "Enter" && (n.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o));
|
|
1641
|
+
}), o;
|
|
1642
|
+
}
|
|
1643
|
+
function Ct(t, r, e) {
|
|
1644
|
+
const i = document.createElement("button");
|
|
1645
|
+
return i.type = "button", i.className = "ui-prop__btn-acao-inline", i.textContent = r.rotuloAcao || "Editar...", i.addEventListener("click", () => {
|
|
1646
|
+
typeof r.onClickAcao == "function" && r.onClickAcao(r), e.despacharEventoAcao(r, t);
|
|
1647
|
+
}), i;
|
|
1648
|
+
}
|
|
1649
|
+
function kt(t, r, e, i) {
|
|
1650
|
+
const o = document.createElement("input");
|
|
1651
|
+
o.type = "text", o.inputMode = "decimal", o.autocomplete = "off", o.spellcheck = !1, o.className = "ui-prop__editor-input ui-prop__editor-input--numero", o.setAttribute("aria-label", String(r.rotulo ?? r.id)), r.placeholder && (o.placeholder = r.placeholder);
|
|
1652
|
+
const a = te(r), n = (c) => {
|
|
1653
|
+
if (c == null || c === "" || S(c)) return "";
|
|
1654
|
+
const d = Number(c);
|
|
1655
|
+
return isNaN(d) ? String(c) : a !== void 0 ? d.toFixed(a) : String(d);
|
|
1656
|
+
}, s = (c) => {
|
|
1657
|
+
o.value = n(c), Ee(o, r, S(c), D(i));
|
|
1658
|
+
};
|
|
1659
|
+
s(e), T(o, s), o.addEventListener("focus", () => {
|
|
1660
|
+
o.select();
|
|
1661
|
+
}), o.addEventListener("input", () => {
|
|
1662
|
+
const c = o.value.trim(), p = !/^[+-]?[0-9]*[.,]?[0-9]*$/.test(c) && (c.startsWith("=") || /[\+\-\*\/\^\%\(\);]|^[a-zA-Z_π]/.test(c));
|
|
1663
|
+
if (o.classList.toggle("ui-prop__editor-input--calculando", p), p) {
|
|
1664
|
+
const l = W(c);
|
|
1665
|
+
o.title = l !== null ? `= ${a !== void 0 ? Number(l.toFixed(a)) : l}` : "";
|
|
1666
|
+
} else
|
|
1667
|
+
o.title = "";
|
|
1668
|
+
});
|
|
1669
|
+
const u = () => {
|
|
1670
|
+
o.classList.remove("ui-prop__editor-input--calculando"), o.title = "";
|
|
1671
|
+
const c = o.value.trim();
|
|
1672
|
+
if (c === "") {
|
|
1673
|
+
if (S(i.obterValorAtual(r.id))) return;
|
|
1674
|
+
i.registrarAlteracao(t, r.id, null);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
const d = W(c);
|
|
1678
|
+
if (d !== null && !isNaN(d)) {
|
|
1679
|
+
let p = K(d, r);
|
|
1680
|
+
a !== void 0 && (p = Number(p.toFixed(a))), i.registrarAlteracao(t, r.id, p), s(p);
|
|
1681
|
+
} else
|
|
1682
|
+
s(i.obterValorAtual(r.id));
|
|
1683
|
+
};
|
|
1684
|
+
return o.addEventListener("change", u), o.addEventListener("blur", u), o.addEventListener("keydown", (c) => {
|
|
1685
|
+
if (c.key === "Enter")
|
|
1686
|
+
u(), c.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o);
|
|
1687
|
+
else if (c.key === "Escape")
|
|
1688
|
+
c.preventDefault(), c.stopPropagation(), o.classList.remove("ui-prop__editor-input--calculando"), o.title = "", s(i.obterValorAtual(r.id)), o.blur();
|
|
1689
|
+
else if (c.key === "ArrowUp" || c.key === "ArrowDown") {
|
|
1690
|
+
c.preventDefault();
|
|
1691
|
+
const d = W(o.value), p = i.obterValorAtual(r.id);
|
|
1692
|
+
if (d === null && S(p)) return;
|
|
1693
|
+
const l = d ?? (Number(p) || 0);
|
|
1694
|
+
let h = yt(r, a);
|
|
1695
|
+
c.shiftKey ? h *= 10 : c.altKey && a === void 0 && (h *= 0.1);
|
|
1696
|
+
let m = c.key === "ArrowUp" ? l + h : l - h;
|
|
1697
|
+
m = K(m, r), a !== void 0 ? m = Number(m.toFixed(a)) : m = Math.round(m * 1e4) / 1e4, i.registrarAlteracao(t, r.id, m), s(m);
|
|
1698
|
+
}
|
|
1699
|
+
}), o;
|
|
1700
|
+
}
|
|
1701
|
+
function zt(t, r, e, i) {
|
|
1702
|
+
const o = document.createElement("input");
|
|
1703
|
+
o.type = "text", o.className = "ui-prop__editor-input", o.setAttribute("aria-label", String(r.rotulo ?? r.id)), r.placeholder && (o.placeholder = r.placeholder);
|
|
1704
|
+
const a = (s) => {
|
|
1705
|
+
const u = S(s);
|
|
1706
|
+
o.value = u || s == null ? "" : String(s), Ee(o, r, u, D(i));
|
|
1707
|
+
};
|
|
1708
|
+
a(e), T(o, a), o.addEventListener("focus", () => {
|
|
1709
|
+
o.select();
|
|
1710
|
+
});
|
|
1711
|
+
const n = () => {
|
|
1712
|
+
o.value === "" && S(i.obterValorAtual(r.id)) || (i.registrarAlteracao(t, r.id, o.value), a(i.obterValorAtual(r.id)));
|
|
1713
|
+
};
|
|
1714
|
+
return o.addEventListener("change", n), o.addEventListener("blur", n), o.addEventListener("keydown", (s) => {
|
|
1715
|
+
s.key === "Enter" ? (n(), s.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(o) : i.focarProximoEditor(o)) : s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), a(i.obterValorAtual(r.id)), o.blur());
|
|
1716
|
+
}), o;
|
|
1717
|
+
}
|
|
1718
|
+
const we = (t, r) => t.toLowerCase() === String(r ?? "").toLowerCase();
|
|
1719
|
+
function re(t, r) {
|
|
1720
|
+
(Array.isArray(r) ? r : []).forEach((e) => {
|
|
1721
|
+
if (!e || typeof e != "object") return;
|
|
1722
|
+
const i = document.createElement("option");
|
|
1723
|
+
i.value = String(e.id), i.textContent = String(e.rotulo ?? e.id), t.appendChild(i);
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
function St(t, r, e, i) {
|
|
1727
|
+
const o = document.createElement("div");
|
|
1728
|
+
o.className = "ui-prop__editor-linha-container";
|
|
1729
|
+
const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1730
|
+
a.setAttribute("class", "ui-prop__linha-amostra-svg"), a.setAttribute("viewBox", "0 0 44 12"), a.setAttribute("aria-hidden", "true");
|
|
1731
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
1732
|
+
n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "44"), n.setAttribute("y2", "6");
|
|
1733
|
+
const s = (p) => {
|
|
1734
|
+
const l = String(p || "").toLowerCase();
|
|
1735
|
+
l.includes("center") || l.includes("eixo") || l.includes("dashdot") || l.includes("traço-ponto") ? n.setAttribute("stroke-dasharray", "8,3,2,3") : l.includes("dash") || l.includes("tracej") || l.includes("hidden") ? n.setAttribute("stroke-dasharray", "6,3") : l.includes("dot") || l.includes("ponto") || l.includes("pontilh") ? n.setAttribute("stroke-dasharray", "2,3") : n.setAttribute("stroke-dasharray", "none");
|
|
1736
|
+
};
|
|
1737
|
+
a.appendChild(n);
|
|
1738
|
+
const u = document.createElement("select");
|
|
1739
|
+
u.className = "ui-prop__linha-select", u.setAttribute("aria-label", String(r.rotulo ?? r.id));
|
|
1740
|
+
const c = r.opcoes && r.opcoes.length > 0 ? r.opcoes : [
|
|
1741
|
+
{ id: "ByLayer", rotulo: "ByLayer" },
|
|
1742
|
+
{ id: "ByBlock", rotulo: "ByBlock" },
|
|
1743
|
+
{ id: "Continuous", rotulo: "Continuous" },
|
|
1744
|
+
{ id: "Dashed", rotulo: "Dashed" },
|
|
1745
|
+
{ id: "Hidden", rotulo: "Hidden" },
|
|
1746
|
+
{ id: "Center", rotulo: "Center" },
|
|
1747
|
+
{ id: "Dotted", rotulo: "Dotted" }
|
|
1748
|
+
];
|
|
1749
|
+
re(u, c);
|
|
1750
|
+
const d = (p) => {
|
|
1751
|
+
const l = S(p);
|
|
1752
|
+
if (o.classList.toggle("ui-prop__editor--misto", l), l) {
|
|
1753
|
+
s(""), q(u, D(i));
|
|
1754
|
+
return;
|
|
1755
|
+
}
|
|
1756
|
+
s(p), H(u, p, we);
|
|
1757
|
+
};
|
|
1758
|
+
return d(e), T(o, d), u.addEventListener("change", () => {
|
|
1759
|
+
const p = c.find((l) => l && String(l.id) === u.value);
|
|
1760
|
+
i.registrarAlteracao(t, r.id, p ? p.id : u.value), d(i.obterValorAtual(r.id));
|
|
1761
|
+
}), u.addEventListener("keydown", (p) => {
|
|
1762
|
+
p.key === "Enter" && (p.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(u) : i.focarProximoEditor(u));
|
|
1763
|
+
}), o.appendChild(a), o.appendChild(u), o;
|
|
1764
|
+
}
|
|
1765
|
+
function Lt(t, r, e, i) {
|
|
1766
|
+
const o = document.createElement("div");
|
|
1767
|
+
o.className = "ui-prop__editor-espessura-container";
|
|
1768
|
+
const a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1769
|
+
a.setAttribute("class", "ui-prop__espessura-amostra-svg"), a.setAttribute("viewBox", "0 0 38 12"), a.setAttribute("aria-hidden", "true");
|
|
1770
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
1771
|
+
n.setAttribute("x1", "0"), n.setAttribute("y1", "6"), n.setAttribute("x2", "38"), n.setAttribute("y2", "6");
|
|
1772
|
+
const s = (p) => {
|
|
1773
|
+
const l = parseFloat(String(p).replace(/[^0-9.]/g, ""));
|
|
1774
|
+
return isNaN(l) || l <= 0 ? 1.5 : Math.min(8, Math.max(1, l * 8));
|
|
1775
|
+
};
|
|
1776
|
+
a.appendChild(n);
|
|
1777
|
+
const u = document.createElement("select");
|
|
1778
|
+
u.className = "ui-prop__espessura-select", u.setAttribute("aria-label", String(r.rotulo ?? r.id));
|
|
1779
|
+
const c = r.opcoes && r.opcoes.length > 0 ? r.opcoes : [
|
|
1780
|
+
{ id: "ByLayer", rotulo: "ByLayer" },
|
|
1781
|
+
{ id: "ByBlock", rotulo: "ByBlock" },
|
|
1782
|
+
{ id: "0.00 mm", rotulo: "0.00 mm" },
|
|
1783
|
+
{ id: "0.05 mm", rotulo: "0.05 mm" },
|
|
1784
|
+
{ id: "0.09 mm", rotulo: "0.09 mm" },
|
|
1785
|
+
{ id: "0.13 mm", rotulo: "0.13 mm" },
|
|
1786
|
+
{ id: "0.15 mm", rotulo: "0.15 mm" },
|
|
1787
|
+
{ id: "0.18 mm", rotulo: "0.18 mm" },
|
|
1788
|
+
{ id: "0.20 mm", rotulo: "0.20 mm" },
|
|
1789
|
+
{ id: "0.25 mm", rotulo: "0.25 mm" },
|
|
1790
|
+
{ id: "0.30 mm", rotulo: "0.30 mm" },
|
|
1791
|
+
{ id: "0.35 mm", rotulo: "0.35 mm" },
|
|
1792
|
+
{ id: "0.40 mm", rotulo: "0.40 mm" },
|
|
1793
|
+
{ id: "0.50 mm", rotulo: "0.50 mm" },
|
|
1794
|
+
{ id: "0.60 mm", rotulo: "0.60 mm" },
|
|
1795
|
+
{ id: "0.70 mm", rotulo: "0.70 mm" },
|
|
1796
|
+
{ id: "1.00 mm", rotulo: "1.00 mm" },
|
|
1797
|
+
{ id: "1.40 mm", rotulo: "1.40 mm" },
|
|
1798
|
+
{ id: "2.00 mm", rotulo: "2.00 mm" }
|
|
1799
|
+
];
|
|
1800
|
+
re(u, c);
|
|
1801
|
+
const d = (p) => {
|
|
1802
|
+
const l = S(p);
|
|
1803
|
+
o.classList.toggle("ui-prop__editor--misto", l), n.setAttribute("stroke-width", String(s(l ? "" : p))), l ? q(u, D(i)) : H(u, p, we);
|
|
1804
|
+
};
|
|
1805
|
+
return d(e), T(o, d), u.addEventListener("change", () => {
|
|
1806
|
+
const p = c.find((l) => l && String(l.id) === u.value);
|
|
1807
|
+
i.registrarAlteracao(t, r.id, p ? p.id : u.value), d(i.obterValorAtual(r.id));
|
|
1808
|
+
}), u.addEventListener("keydown", (p) => {
|
|
1809
|
+
p.key === "Enter" && (p.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(u) : i.focarProximoEditor(u));
|
|
1810
|
+
}), o.appendChild(a), o.appendChild(u), o;
|
|
1811
|
+
}
|
|
1812
|
+
const ie = [
|
|
1813
|
+
{ nome: "Red", indice: 1, hex: "#ff0000" },
|
|
1814
|
+
{ nome: "Yellow", indice: 2, hex: "#ffff00" },
|
|
1815
|
+
{ nome: "Green", indice: 3, hex: "#00ff00" },
|
|
1816
|
+
{ nome: "Cyan", indice: 4, hex: "#00ffff" },
|
|
1817
|
+
{ nome: "Blue", indice: 5, hex: "#0000ff" },
|
|
1818
|
+
{ nome: "Magenta", indice: 6, hex: "#ff00ff" },
|
|
1819
|
+
{ nome: "White", indice: 7, hex: "#ffffff" }
|
|
1820
|
+
], Ae = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
1821
|
+
function Y(t) {
|
|
1822
|
+
const r = String(t ?? "").trim().toLowerCase(), e = ie.find((i) => String(i.indice) === r || i.nome.toLowerCase() === r);
|
|
1823
|
+
return e ? e.nome.toLowerCase() : r;
|
|
1824
|
+
}
|
|
1825
|
+
function Mt(t) {
|
|
1826
|
+
const r = Y(t), e = ie.find((i) => i.nome.toLowerCase() === r);
|
|
1827
|
+
return e ? e.hex : Ae.test(r) ? r : "#ffffff";
|
|
1828
|
+
}
|
|
1829
|
+
function Ce(t) {
|
|
1830
|
+
return t.length === 4 ? "#" + t.slice(1).split("").map((r) => r + r).join("") : t;
|
|
1831
|
+
}
|
|
1832
|
+
function Nt(t, r, e, i) {
|
|
1833
|
+
const o = document.createElement("div");
|
|
1834
|
+
o.className = "ui-prop__editor-cor-cad-container";
|
|
1835
|
+
const a = document.createElement("div");
|
|
1836
|
+
a.className = "ui-prop__cor-amostra";
|
|
1837
|
+
const n = document.createElement("select");
|
|
1838
|
+
n.className = "ui-prop__cor-cad-select", n.setAttribute("aria-label", String(r.rotulo ?? r.id)), re(n, [
|
|
1839
|
+
{ id: "ByLayer", rotulo: "ByLayer" },
|
|
1840
|
+
{ id: "ByBlock", rotulo: "ByBlock" },
|
|
1841
|
+
...ie.map((d) => ({ id: d.nome, rotulo: `${d.nome} (${d.indice})` }))
|
|
1842
|
+
]);
|
|
1843
|
+
const s = document.createElement("option");
|
|
1844
|
+
s.value = "__escolher", s.textContent = "Selecionar cor...", s.setAttribute("data-acao", ""), n.appendChild(s);
|
|
1845
|
+
const u = document.createElement("input");
|
|
1846
|
+
u.type = "color", u.className = "ui-prop__cor-picker-oculto", u.tabIndex = -1, u.setAttribute("aria-hidden", "true");
|
|
1847
|
+
const c = (d) => {
|
|
1848
|
+
const p = S(d);
|
|
1849
|
+
if (o.classList.toggle("ui-prop__editor--misto", p), a.classList.toggle("ui-prop__cor-amostra--misto", p), p) {
|
|
1850
|
+
a.style.backgroundColor = "", u.value = "#ffffff", q(n, D(i));
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
const l = Mt(d);
|
|
1854
|
+
a.style.backgroundColor = l, u.value = Ce(l), H(
|
|
1855
|
+
n,
|
|
1856
|
+
d,
|
|
1857
|
+
(h, m) => Y(h) === Y(m),
|
|
1858
|
+
(h) => h == null || h === "" ? "—" : String(h)
|
|
1859
|
+
);
|
|
1860
|
+
};
|
|
1861
|
+
return c(e), T(o, c), u.addEventListener("input", () => {
|
|
1862
|
+
a.style.backgroundColor = u.value;
|
|
1863
|
+
}), u.addEventListener("change", () => {
|
|
1864
|
+
i.registrarAlteracao(t, r.id, u.value), c(i.obterValorAtual(r.id));
|
|
1865
|
+
}), n.addEventListener("change", () => {
|
|
1866
|
+
if (n.value === "__escolher") {
|
|
1867
|
+
c(i.obterValorAtual(r.id)), u.click();
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
i.registrarAlteracao(t, r.id, n.value), c(i.obterValorAtual(r.id));
|
|
1871
|
+
}), n.addEventListener("keydown", (d) => {
|
|
1872
|
+
d.key === "Enter" && (d.shiftKey && i.focarEditorAnterior ? i.focarEditorAnterior(n) : i.focarProximoEditor(n));
|
|
1873
|
+
}), o.appendChild(a), o.appendChild(n), o.appendChild(u), o;
|
|
1874
|
+
}
|
|
1875
|
+
function Tt(t, r, e, i) {
|
|
1876
|
+
const o = document.createElement("div");
|
|
1877
|
+
o.className = "ui-prop__editor-cor-container", o.setAttribute("role", "button"), o.tabIndex = 0;
|
|
1878
|
+
const a = document.createElement("div");
|
|
1879
|
+
a.className = "ui-prop__cor-amostra";
|
|
1880
|
+
const n = document.createElement("span");
|
|
1881
|
+
n.className = "ui-prop__cor-texto";
|
|
1882
|
+
const s = document.createElement("input");
|
|
1883
|
+
s.type = "color", s.className = "ui-prop__cor-picker-oculto", s.tabIndex = -1, s.setAttribute("aria-hidden", "true");
|
|
1884
|
+
const u = (c) => {
|
|
1885
|
+
const d = S(c);
|
|
1886
|
+
if (o.classList.toggle("ui-prop__editor--misto", d), a.classList.toggle("ui-prop__cor-amostra--misto", d), d) {
|
|
1887
|
+
const l = D(i);
|
|
1888
|
+
a.style.backgroundColor = "", n.textContent = l, s.value = "#ffffff", o.setAttribute("aria-label", `${r.rotulo ?? r.id}: ${l}`);
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
const p = typeof c == "string" && Ae.test(c) ? Ce(c) : null;
|
|
1892
|
+
a.style.backgroundColor = c || "#ffffff", n.textContent = r.textoAmostra || String(c || "ByLayer"), s.value = p ?? "#ffffff", o.setAttribute("aria-label", `${r.rotulo ?? r.id}: ${c || "ByLayer"}`);
|
|
1893
|
+
};
|
|
1894
|
+
return u(e), T(o, u), s.addEventListener("input", () => {
|
|
1895
|
+
a.style.backgroundColor = s.value, n.textContent = r.textoAmostra || s.value;
|
|
1896
|
+
}), s.addEventListener("change", () => {
|
|
1897
|
+
i.registrarAlteracao(t, r.id, s.value), u(i.obterValorAtual(r.id));
|
|
1898
|
+
}), o.addEventListener("click", (c) => {
|
|
1899
|
+
c.target !== s && s.click();
|
|
1900
|
+
}), o.addEventListener("keydown", (c) => {
|
|
1901
|
+
(c.key === " " || c.key === "Enter") && (c.preventDefault(), s.click());
|
|
1902
|
+
}), o.appendChild(a), o.appendChild(n), o.appendChild(s), o;
|
|
1903
|
+
}
|
|
1904
|
+
function Dt(t, r, e, i) {
|
|
1905
|
+
let o;
|
|
1906
|
+
return r.somenteLeitura || r.tipo === "readonly" ? o = Et(e, i.obterTextoMisto, r) : r.tipo === "booleano" ? o = wt(t, r, e, i) : r.tipo === "linha" || r.tipo === "linetype" ? o = St(t, r, e, i) : r.tipo === "espessura" || r.tipo === "lineweight" ? o = Lt(t, r, e, i) : r.tipo === "cor-cad" ? o = Nt(t, r, e, i) : r.tipo === "selecao" ? o = At(t, r, e, i) : r.tipo === "cor" ? o = Tt(t, r, e, i) : r.tipo === "acao" ? o = Ct(t, r, i) : r.tipo === "numero" ? o = kt(t, r, e, i) : o = zt(t, r, e, i), o.setAttribute("part", "editor"), r.dica && o.setAttribute("aria-description", r.dica), o;
|
|
1907
|
+
}
|
|
1908
|
+
function Rt(t) {
|
|
1909
|
+
if (!t.tipoContainerElement) return;
|
|
1910
|
+
const r = (Array.isArray(t.tipos) ? t.tipos : []).filter(
|
|
1911
|
+
(i) => !!(i && typeof i == "object" && i.id !== void 0 && i.id !== null)
|
|
1912
|
+
);
|
|
1913
|
+
if (r.length === 0) {
|
|
1914
|
+
t.tipoContainerElement.style.display = "none", t.tipoContainerElement.innerHTML = "";
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
t.tipoContainerElement.style.display = "flex", t.tipoContainerElement.innerHTML = "";
|
|
1918
|
+
const e = r.find((i) => String(i.id) === String(t.tipoSelecionadoId)) || r[0];
|
|
1919
|
+
if (t.estiloVisual === "revit") {
|
|
1920
|
+
const i = document.createElement("div");
|
|
1921
|
+
i.className = "ui-prop__tipo-revit-card", i.title = "Editar tipo de família", i.addEventListener("click", () => t.onEditarTipo(e));
|
|
1922
|
+
const o = document.createElement("div");
|
|
1923
|
+
o.className = "ui-prop__tipo-miniatura";
|
|
1924
|
+
const a = e.iconeSvg ? Se(e.iconeSvg) : null;
|
|
1925
|
+
a ? o.appendChild(a) : o.innerHTML = `
|
|
1926
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1927
|
+
<rect x="3" y="3" width="18" height="18" rx="2"></rect>
|
|
1928
|
+
<path d="M3 9h18M9 21V9"></path>
|
|
1929
|
+
</svg>
|
|
1930
|
+
`;
|
|
1931
|
+
const n = document.createElement("div");
|
|
1932
|
+
n.className = "ui-prop__tipo-info";
|
|
1933
|
+
const s = document.createElement("div");
|
|
1934
|
+
s.className = "ui-prop__tipo-nome", s.textContent = String(e.rotulo ?? e.id);
|
|
1935
|
+
const u = document.createElement("div");
|
|
1936
|
+
u.className = "ui-prop__tipo-subtexto", u.textContent = e.subtipo || "Tipo de Família", n.appendChild(s), n.appendChild(u), i.appendChild(o), i.appendChild(n);
|
|
1937
|
+
const c = document.createElement("div");
|
|
1938
|
+
c.className = "ui-prop__tipo-revit-subbarra";
|
|
1939
|
+
const d = document.createElement("select");
|
|
1940
|
+
d.className = "ui-prop__tipo-select", d.setAttribute("aria-label", "Selecionar tipo de família"), r.forEach((l) => {
|
|
1941
|
+
const h = document.createElement("option");
|
|
1942
|
+
h.value = String(l.id), h.textContent = `${l.rotulo ?? l.id}${l.subtipo ? ` : ${l.subtipo}` : ""}`, String(l.id) === String(e.id) && (h.selected = !0), d.appendChild(h);
|
|
1943
|
+
}), d.addEventListener("change", () => {
|
|
1944
|
+
t.onSelecionarTipo(d.value);
|
|
1945
|
+
});
|
|
1946
|
+
const p = document.createElement("button");
|
|
1947
|
+
p.type = "button", p.className = "ui-prop__btn-editar-tipo", p.innerHTML = `
|
|
1948
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-right: 4px; vertical-align: -1px;" aria-hidden="true">
|
|
1949
|
+
<rect x="3" y="3" width="12" height="12" rx="1"></rect>
|
|
1950
|
+
<rect x="9" y="9" width="12" height="12" rx="1"></rect>
|
|
1951
|
+
</svg>
|
|
1952
|
+
<span>Editar tipo</span>
|
|
1953
|
+
`, p.addEventListener("click", () => {
|
|
1954
|
+
t.onEditarTipo(e);
|
|
1955
|
+
}), c.appendChild(d), c.appendChild(p), t.tipoContainerElement.appendChild(i), t.tipoContainerElement.appendChild(c);
|
|
1956
|
+
} else {
|
|
1957
|
+
const i = document.createElement("div");
|
|
1958
|
+
i.className = "ui-prop__tipo-autocad-bar";
|
|
1959
|
+
const o = document.createElement("select");
|
|
1960
|
+
o.className = "ui-prop__tipo-select", o.setAttribute("aria-label", "Selecionar tipo de objeto"), r.forEach((c) => {
|
|
1961
|
+
const d = document.createElement("option");
|
|
1962
|
+
d.value = String(c.id), d.textContent = String(c.rotulo ?? c.id), String(c.id) === String(e.id) && (d.selected = !0), o.appendChild(d);
|
|
1963
|
+
}), o.addEventListener("change", () => {
|
|
1964
|
+
t.onSelecionarTipo(o.value);
|
|
1965
|
+
});
|
|
1966
|
+
const a = document.createElement("div");
|
|
1967
|
+
a.className = "ui-prop__tipo-autocad-acoes";
|
|
1968
|
+
const n = document.createElement("button");
|
|
1969
|
+
n.type = "button", n.className = "ui-prop__btn-autocad", n.title = "Seleção rápida", n.setAttribute("aria-label", "Seleção rápida"), n.innerHTML = `
|
|
1970
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1971
|
+
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
|
|
1972
|
+
</svg>
|
|
1973
|
+
`, n.addEventListener("click", () => {
|
|
1974
|
+
t.onQuickSelect(e);
|
|
1975
|
+
});
|
|
1976
|
+
const s = document.createElement("button");
|
|
1977
|
+
s.type = "button", s.className = "ui-prop__btn-autocad", s.title = "Selecionar objetos", s.setAttribute("aria-label", "Selecionar objetos"), s.innerHTML = `
|
|
1978
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1979
|
+
<circle cx="12" cy="12" r="7"></circle>
|
|
1980
|
+
<line x1="12" y1="2" x2="12" y2="7"></line>
|
|
1981
|
+
<line x1="12" y1="17" x2="12" y2="22"></line>
|
|
1982
|
+
<line x1="2" y1="12" x2="7" y2="12"></line>
|
|
1983
|
+
<line x1="17" y1="12" x2="22" y2="12"></line>
|
|
1984
|
+
<line x1="12" y1="9" x2="12" y2="15" stroke-width="2.5"></line>
|
|
1985
|
+
<line x1="9" y1="12" x2="15" y2="12" stroke-width="2.5"></line>
|
|
1986
|
+
</svg>
|
|
1987
|
+
`, s.addEventListener("click", () => {
|
|
1988
|
+
t.onSelectObjects(e);
|
|
1989
|
+
});
|
|
1990
|
+
const u = document.createElement("button");
|
|
1991
|
+
u.type = "button", u.className = "ui-prop__btn-autocad", u.title = "Calculadora rápida", u.setAttribute("aria-label", "Calculadora rápida"), u.innerHTML = `
|
|
1992
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
1993
|
+
<rect x="4" y="2" width="16" height="20" rx="2"></rect>
|
|
1994
|
+
<line x1="8" y1="6" x2="16" y2="6"></line>
|
|
1995
|
+
<circle cx="8" cy="11" r="1" fill="currentColor"></circle>
|
|
1996
|
+
<circle cx="12" cy="11" r="1" fill="currentColor"></circle>
|
|
1997
|
+
<circle cx="16" cy="11" r="1" fill="currentColor"></circle>
|
|
1998
|
+
<circle cx="8" cy="15" r="1" fill="currentColor"></circle>
|
|
1999
|
+
<circle cx="12" cy="15" r="1" fill="currentColor"></circle>
|
|
2000
|
+
<circle cx="16" cy="15" r="1" fill="currentColor"></circle>
|
|
2001
|
+
</svg>
|
|
2002
|
+
`, u.addEventListener("click", () => {
|
|
2003
|
+
t.onCalculadora(e);
|
|
2004
|
+
}), a.appendChild(n), a.appendChild(s), a.appendChild(u), i.appendChild(o), i.appendChild(a), t.tipoContainerElement.appendChild(i);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
function Bt(t) {
|
|
2008
|
+
let r = 45;
|
|
2009
|
+
function e(a) {
|
|
2010
|
+
if (!Number.isFinite(a)) return r;
|
|
2011
|
+
const n = Math.max(20, Math.min(65, a));
|
|
2012
|
+
return r = n, t.hostElement.style.setProperty("--ui-prop-rotulo-largura", `${n}%`), t.splitterElement && (t.splitterElement.style.left = `calc(${n}% - 4px)`, t.splitterElement.setAttribute("aria-valuenow", String(Math.round(n)))), n;
|
|
2013
|
+
}
|
|
2014
|
+
function i(a) {
|
|
2015
|
+
t.onLarguraAlterada(a), t.hostElement.dispatchEvent(
|
|
2016
|
+
new CustomEvent("ui-splitter-resize", {
|
|
2017
|
+
bubbles: !0,
|
|
2018
|
+
composed: !0,
|
|
2019
|
+
detail: { larguraPorcentagem: a }
|
|
2020
|
+
})
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
function o() {
|
|
2024
|
+
if (!t.splitterElement || !t.corpoElement) return;
|
|
2025
|
+
t.splitterListeners.cleanup();
|
|
2026
|
+
let a = !1;
|
|
2027
|
+
const n = (s) => {
|
|
2028
|
+
if (s.button !== 0) return;
|
|
2029
|
+
s.preventDefault(), s.stopPropagation(), a = !0, t.splitterElement.classList.add("ui-prop__splitter--ativo");
|
|
2030
|
+
try {
|
|
2031
|
+
t.splitterElement.setPointerCapture(s.pointerId);
|
|
2032
|
+
} catch {
|
|
2033
|
+
}
|
|
2034
|
+
const u = t.corpoElement.getBoundingClientRect(), c = (p) => {
|
|
2035
|
+
if (!a) return;
|
|
2036
|
+
const l = u.width;
|
|
2037
|
+
if (l <= 0) return;
|
|
2038
|
+
const h = p.clientX - u.left;
|
|
2039
|
+
let b = Math.max(80, Math.min(l - 130, h)) / l * 100;
|
|
2040
|
+
b = Math.max(20, Math.min(65, b)), e(b);
|
|
2041
|
+
}, d = (p) => {
|
|
2042
|
+
if (a) {
|
|
2043
|
+
a = !1, t.splitterElement.classList.remove("ui-prop__splitter--ativo");
|
|
2044
|
+
try {
|
|
2045
|
+
t.splitterElement.hasPointerCapture(p.pointerId) && t.splitterElement.releasePointerCapture(p.pointerId);
|
|
2046
|
+
} catch {
|
|
2047
|
+
}
|
|
2048
|
+
t.splitterElement.removeEventListener("pointermove", c), t.splitterElement.removeEventListener("pointerup", d), t.splitterElement.removeEventListener("pointercancel", d), i(r);
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
t.splitterElement.addEventListener("pointermove", c), t.splitterElement.addEventListener("pointerup", d), t.splitterElement.addEventListener("pointercancel", d);
|
|
2052
|
+
};
|
|
2053
|
+
t.splitterListeners.add(t.splitterElement, "pointerdown", n), t.splitterListeners.add(t.splitterElement, "dblclick", () => {
|
|
2054
|
+
const s = e(45);
|
|
2055
|
+
i(s);
|
|
2056
|
+
}), t.splitterListeners.add(t.splitterElement, "keydown", (s) => {
|
|
2057
|
+
const u = s.shiftKey ? 5 : 2;
|
|
2058
|
+
let c = null;
|
|
2059
|
+
if (s.key === "ArrowLeft" ? c = r - u : s.key === "ArrowRight" ? c = r + u : s.key === "Home" ? c = 20 : s.key === "End" ? c = 65 : s.key === "Enter" && (c = 45), c !== null) {
|
|
2060
|
+
s.preventDefault(), s.stopPropagation();
|
|
2061
|
+
const d = e(c);
|
|
2062
|
+
i(d);
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
return {
|
|
2067
|
+
init: o,
|
|
2068
|
+
definirLarguraRotulo: e
|
|
2069
|
+
};
|
|
2070
|
+
}
|
|
2071
|
+
const Ot = `:host{display:flex;flex-direction:column;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:var(--ui-tamanho-corpo-sm, 12px);color:var(--ui-cor-texto, #e1e1e6);background-color:var(--ui-cor-superficie, #141417);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 4px);overflow:hidden;width:100%;max-width:100%;height:100%;min-height:200px;-webkit-user-select:none;user-select:none;--ui-prop-altura-linha: 22px;--ui-prop-rotulo-largura: 45%}:host([densidade="compacta"]){--ui-prop-altura-linha: 19px;font-size:10.5px}:host([densidade="ultracompacta"]){--ui-prop-altura-linha: 17px;font-size:10px}:host([densidade="relaxada"]){--ui-prop-altura-linha: 28px;font-size:12px}:host([colapsado]){width:32px!important;min-width:32px!important;max-width:32px!important;height:100%!important;cursor:pointer;transition:width .2s cubic-bezier(.4,0,.2,1)}:host([colapsado]) .ui-prop__header,:host([colapsado]) .ui-prop__tipo-seletor-container,:host([colapsado]) .ui-prop__filtro-container,:host([colapsado]) .ui-prop__corpo-wrapper,:host([colapsado]) .ui-prop__footer,:host([colapsado]) .ui-prop__resizer-canto{display:none!important}:host([colapsado]) .ui-prop__faixa-estreita{display:flex!important;flex-direction:column;align-items:center;width:100%;height:100%;padding:8px 0;gap:10px;box-sizing:border-box;background-color:var(--ui-cor-fundo-elevado, #18181d);-webkit-user-select:none;user-select:none;cursor:pointer}.ui-prop__faixa-estreita{display:none}.ui-prop__faixa-icone{display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__faixa-btn-expandir{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;color:var(--ui-cor-texto, #e1e1e6);cursor:pointer;padding:0;transition:all .15s ease;flex-shrink:0}.ui-prop__faixa-btn-expandir:hover{background-color:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000);border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__faixa-texto{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:2px;color:var(--ui-cor-texto-secundario, #888899);margin-top:8px;flex:1;pointer-events:none}:host([colapsado]):hover .ui-prop__faixa-texto{color:var(--ui-cor-texto, #ffffff)}:host([flutuante]){position:fixed!important;z-index:var(--ui-z-docked-bar, 600)!important;box-shadow:var(--ui-sombra-lg, 0 16px 48px rgba(0, 0, 0, .75)),0 0 0 1px color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 14%,transparent),0 6px 14px #00000080!important;border-radius:6px!important;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);resize:both;overflow:hidden;max-width:95vw;max-height:95vh;min-width:220px;min-height:200px}:host([flutuante]) .ui-prop__header{cursor:grab;-webkit-user-select:none;user-select:none}:host([flutuante].arrastando) .ui-prop__header{cursor:grabbing!important}.ui-prop__resizer-canto{display:none}:host([flutuante]) .ui-prop__resizer-canto{display:block;position:absolute;bottom:0;right:0;width:14px;height:14px;cursor:nwse-resize;z-index:50;background:linear-gradient(135deg,transparent 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 50%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 65%,transparent 65%,transparent 80%,color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent) 80%);pointer-events:auto}.ui-prop__btn-icone--ativo{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent)!important;color:var(--ui-cor-destaque, #00E08A)!important}.ui-prop__container{display:flex;flex-direction:column;width:100%;height:100%;min-height:0;flex:1;overflow:hidden;box-sizing:border-box}.ui-prop__header{display:flex;align-items:center;justify-content:space-between;height:22px;min-height:22px;padding:0 8px;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__header{height:20px;min-height:20px;padding:0 6px}:host([densidade="ultracompacta"]) .ui-prop__header{height:18px;min-height:18px;padding:0 5px}.ui-prop__header-titulo{display:flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;color:var(--ui-cor-texto, #ffffff);text-transform:uppercase;letter-spacing:.4px}:host([densidade="compacta"]) .ui-prop__header-titulo{font-size:10px;gap:4px}:host([densidade="ultracompacta"]) .ui-prop__header-titulo{font-size:9.5px;gap:3px}.ui-prop__header-icone{display:flex;align-items:center;color:var(--ui-cor-destaque, #00E08A)}.ui-prop__header-icone svg{width:12px;height:12px}:host([densidade="ultracompacta"]) .ui-prop__header-icone svg{width:10px;height:10px}.ui-prop__header-acoes{display:flex;align-items:center;gap:2px}.ui-prop__btn-icone{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;transition:all .15s ease;padding:0}.ui-prop__btn-icone:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}:host([densidade="compacta"]) .ui-prop__btn-icone{width:17px;height:17px}:host([densidade="ultracompacta"]) .ui-prop__btn-icone{width:16px;height:16px}.ui-prop__tipo-seletor-container{padding:3px 6px;background-color:var(--ui-cor-superficie, #141417);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));display:flex;flex-direction:column;gap:3px;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__tipo-seletor-container{padding:2px 5px;gap:2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-seletor-container{padding:1px 4px;gap:1px}.ui-prop__tipo-revit-card{display:flex;align-items:center;gap:10px;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-sm, 4px);padding:6px 8px;cursor:pointer;transition:border-color .15s ease}.ui-prop__tipo-revit-card:hover{border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-miniatura{width:32px;height:32px;border-radius:3px;background-color:var(--ui-cor-fundo-elevado, #24242a);display:flex;align-items:center;justify-content:center;color:var(--ui-cor-destaque, #00E08A);flex-shrink:0}.ui-prop__tipo-info{display:flex;flex-direction:column;flex:1;min-width:0}.ui-prop__tipo-nome{font-weight:600;font-size:12px;color:var(--ui-cor-texto, #ffffff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-subtexto{font-size:11px;color:var(--ui-cor-texto-secundario, #888899);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-prop__tipo-revit-subbarra{display:flex;align-items:center;gap:6px}.ui-prop__tipo-select{flex:1;min-width:0;width:0;height:20px;background-color:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:2px;padding:0 16px 0 2px;font-size:10.5px;font-weight:500;cursor:pointer;outline:none;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 4px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;box-sizing:border-box;transition:background-color .15s ease,color .15s ease}.ui-prop__tipo-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 5%,transparent);color:var(--ui-cor-texto, #ffffff)}.ui-prop__tipo-select:focus{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent);color:var(--ui-cor-destaque, #00E08A)}:host([densidade="compacta"]) .ui-prop__tipo-select{height:18px;font-size:10px;padding:0 14px 0 2px}:host([densidade="ultracompacta"]) .ui-prop__tipo-select{height:16px;font-size:9.5px;padding:0 12px 0 2px}.ui-prop__btn-editar-tipo{height:20px;padding:0 6px;background-color:transparent;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:2px;color:var(--ui-cor-texto, #ffffff);font-size:10.5px;font-weight:500;cursor:pointer;white-space:nowrap;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-editar-tipo{height:18px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__btn-editar-tipo{height:16px;font-size:9.5px}.ui-prop__btn-editar-tipo:hover{background-color:var(--ui-cor-botao-secundario-hover, #2a2a34);border-color:var(--ui-cor-destaque, #00E08A)}.ui-prop__tipo-autocad-bar{display:flex;align-items:center;gap:2px;width:100%;min-width:0;box-sizing:border-box;background:transparent}.ui-prop__tipo-autocad-acoes{display:flex;align-items:center;gap:1px;flex-shrink:0;border-left:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));padding-left:3px;margin-left:1px}.ui-prop__btn-autocad{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;background:transparent;border:none;border-radius:2px;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;padding:0;transition:all .15s ease}:host([densidade="compacta"]) .ui-prop__btn-autocad{width:18px;height:18px}:host([densidade="ultracompacta"]) .ui-prop__btn-autocad{width:16px;height:16px}.ui-prop__btn-autocad:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .1));color:var(--ui-cor-destaque, #00E08A)}.ui-prop__btn-autocad:active{transform:scale(.92);background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-prop__filtro-container{display:flex;align-items:center;padding:4px 8px;background-color:var(--ui-cor-fundo, #0b0b0d);border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));gap:6px;flex-shrink:0}.ui-prop__filtro-icone{color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0}.ui-prop__filtro-input{flex:1;background:transparent;border:none;outline:none;font-size:11px;color:var(--ui-cor-texto, #e1e1e6);padding:3px 0}.ui-prop__filtro-limpar{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);cursor:pointer;font-size:11px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center;border-radius:2px}.ui-prop__filtro-limpar:hover{color:var(--ui-cor-texto, #ffffff);background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-prop__filtro-input::placeholder{color:var(--ui-cor-texto-secundario, #666677)}.ui-prop__corpo-wrapper{position:relative;flex:1;min-height:0;width:100%;overflow:hidden;display:flex;flex-direction:column}.ui-prop__corpo{flex:1;min-height:0;width:100%;overflow-y:auto;overflow-x:hidden;background-color:var(--ui-cor-superficie, #141417);position:relative;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent) var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar{width:8px}.ui-prop__corpo::-webkit-scrollbar-track{background:var(--ui-cor-fundo, #0b0b0d)}.ui-prop__corpo::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-radius:var(--ui-raio-sm, 4px)}.ui-prop__corpo::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent)}.ui-prop__categoria{border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1))}.ui-prop__categoria-header{position:relative;z-index:25;display:flex;align-items:center;justify-content:space-between;height:21px;padding:0 6px;background-color:var(--ui-cor-fundo-elevado, #18181d);cursor:pointer;-webkit-user-select:none;user-select:none;font-weight:600;font-size:10.5px;color:var(--ui-cor-texto, #ffffff);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .05));transition:background-color .15s ease;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__categoria-header{height:19px;font-size:10px;padding:0 5px}:host([densidade="ultracompacta"]) .ui-prop__categoria-header{height:17px;font-size:9.5px;padding:0 4px}.ui-prop__categoria-header:focus-visible{outline:1.5px solid var(--ui-cor-destaque, #00E08A);outline-offset:-1.5px}.ui-prop__categoria-header:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .06))}.ui-prop__categoria-titulo-bloco{display:flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__categoria-seta{display:inline-flex;align-items:center;justify-content:center;font-size:9px;width:12px;height:12px;color:var(--ui-cor-texto-secundario, #888899);transition:transform .15s ease}.ui-prop__categoria--aberta .ui-prop__categoria-seta{transform:rotate(90deg)}.ui-prop__categoria-contador{font-size:10px;font-weight:400;color:var(--ui-cor-texto-secundario, #888899)}.ui-prop__categoria-conteudo{display:none}.ui-prop__categoria--aberta .ui-prop__categoria-conteudo{display:block}.ui-prop__linha{display:flex;align-items:stretch;min-height:var(--ui-prop-altura-linha, 24px);border-bottom:1px dotted var(--ui-cor-borda, rgba(255, 255, 255, .08));box-sizing:border-box;position:relative;z-index:1;transition:background-color .1s ease}.ui-prop__linha:hover{background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .04))}.ui-prop__linha:focus-within{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__linha:focus-within .ui-prop__col-rotulo{color:var(--ui-cor-texto, #ffffff);font-weight:500}.ui-prop__linha--modificada{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo{width:var(--ui-prop-rotulo-largura, 45%);padding:1px 4px 1px 8px;display:flex;align-items:center;color:var(--ui-cor-texto-secundario, #9999aa);border-right:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10.5px;position:relative;flex-shrink:0;box-sizing:border-box}:host([densidade="compacta"]) .ui-prop__col-rotulo{padding:0 4px 0 6px;font-size:10px}:host([densidade="ultracompacta"]) .ui-prop__col-rotulo{padding:0 3px 0 5px;font-size:9.5px}.ui-prop__col-rotulo span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__col-rotulo--scrub{cursor:ew-resize;-webkit-user-select:none;user-select:none;transition:color .15s ease,background-color .15s ease}.ui-prop__col-rotulo--scrub:hover{color:var(--ui-cor-destaque, #00E08A);background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 5%,transparent)}.ui-prop__col-rotulo--arrastando{color:var(--ui-cor-texto-sobre-primaria, #000000)!important;background-color:var(--ui-cor-destaque, #00E08A)!important;font-weight:600;cursor:ew-resize!important}.ui-prop__col-rotulo--arrastando span{color:var(--ui-cor-texto-sobre-primaria, #000000)!important}.ui-prop__splitter{position:absolute;top:0;bottom:0;min-height:100%;left:calc(var(--ui-prop-rotulo-largura, 45%) - 4px);width:8px;cursor:col-resize;z-index:30;touch-action:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:center}.ui-prop__splitter:after{content:"";position:absolute;top:0;bottom:0;left:3px;width:2px;background-color:transparent;pointer-events:none;transition:background-color .15s ease,box-shadow .15s ease}.ui-prop__splitter:hover:after,.ui-prop__splitter--ativo:after{background-color:var(--ui-cor-destaque, #00E08A);box-shadow:0 0 6px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 50%,transparent)}.ui-prop__splitter:focus-visible{outline:none}.ui-prop__splitter:focus-visible:after{background-color:var(--ui-cor-destaque, #00E08A);box-shadow:0 0 6px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 50%,transparent)}.ui-prop__splitter--ativo{background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)}.ui-prop__col-valor{width:calc(100% - var(--ui-prop-rotulo-largura, 45%));flex:1 1 0px;min-width:0!important;display:flex;align-items:stretch;padding:0;overflow:hidden;box-sizing:border-box;position:relative;transition:background-color .1s ease,box-shadow .1s ease}.ui-prop__col-valor:focus-within{background-color:var(--ui-cor-fundo, #0b0b0d);box-shadow:inset 0 0 0 1px var(--ui-cor-destaque, #00E08A)}.ui-prop__editor-input{width:100%;min-width:0;height:100%;min-height:var(--ui-prop-altura-linha, 24px);background:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-family:inherit;font-size:11px;padding:0 8px;outline:none;box-sizing:border-box;transition:background-color .1s ease}.ui-prop__editor-input:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-input--numero{text-align:right;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__editor-input--calculando{color:var(--ui-cor-destaque, #00E08A)!important;font-weight:500}.ui-prop__col-valor:has(.ui-prop__editor-input--calculando){background-color:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 8%,transparent)!important;box-shadow:inset 0 0 0 1.5px var(--ui-cor-destaque, #00E08A)!important}.ui-prop__editor-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);background-color:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 8px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;transition:background-color .1s ease}.ui-prop__editor-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__editor-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 20px 0 8px;box-sizing:border-box;position:relative;border:none;border-radius:0;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;transition:background-color .1s ease}.ui-prop__editor-cor-container:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent)}.ui-prop__cor-amostra{width:13px;height:13px;border-radius:2px;border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);flex-shrink:0;box-sizing:border-box}.ui-prop__cor-texto{flex:1 1 0px;min-width:0!important;width:0!important;font-size:11px;color:var(--ui-cor-texto, #ffffff);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-prop__cor-picker-oculto{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.ui-prop__editor-linha-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__linha-amostra-svg{width:24px;height:10px;flex-shrink:0}.ui-prop__linha-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6);stroke-width:1.5}.ui-prop__linha-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__linha-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__linha-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-espessura-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__espessura-amostra-svg{width:20px;height:10px;flex-shrink:0}.ui-prop__espessura-amostra-svg line{stroke:var(--ui-cor-texto, #e1e1e6)}.ui-prop__espessura-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__espessura-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__espessura-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-cor-cad-container{display:flex;align-items:center;gap:6px;width:100%;max-width:100%;min-width:0!important;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 0 0 8px;box-sizing:border-box;overflow:hidden;border:none;border-radius:0}.ui-prop__cor-cad-select{flex:1 1 0px;min-width:0!important;width:0!important;max-width:100%;height:100%;background:transparent;color:var(--ui-cor-texto, #ffffff);border:none;border-radius:0;font-size:11px;padding:0 20px 0 4px;outline:none;cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888899' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 6px center;background-size:8px 5px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.ui-prop__cor-cad-select:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__cor-cad-select option{background-color:var(--ui-cor-fundo-elevado, #18181c);color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor-booleano{display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);cursor:pointer;padding:0 8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.ui-prop__editor-booleano:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-prop__checkbox-custom{width:13px;height:13px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .25));border-radius:2px;background-color:var(--ui-cor-fundo, #0b0b0d);display:flex;align-items:center;justify-content:center;transition:all .15s ease}.ui-prop__checkbox-custom--marcado{background-color:var(--ui-cor-destaque, #00E08A);border-color:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-prop__booleano-rotulo{font-size:11px;color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-acao-inline{width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);padding:0 8px;background-color:transparent;border:none;border-radius:0;color:var(--ui-cor-texto, #ffffff);font-size:11px;font-weight:500;cursor:pointer;white-space:nowrap;text-align:left;transition:all .15s ease;box-sizing:border-box}.ui-prop__btn-acao-inline:hover{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 4%,transparent);color:var(--ui-cor-destaque, #00E08A)}.ui-prop__valor-readonly{display:flex;align-items:center;width:100%;height:100%;min-height:var(--ui-prop-altura-linha, 24px);font-size:11px;color:var(--ui-cor-texto-secundario, #777788);padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;-webkit-user-select:text;user-select:text}.ui-prop__valor-readonly--numero{justify-content:flex-end;font-family:var(--ui-fonte-codigo, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-variant-numeric:tabular-nums}.ui-prop__unidade-sufixo{display:flex;align-items:center;font-size:10px;color:var(--ui-cor-texto-secundario, #777788);padding-right:8px;flex-shrink:0;-webkit-user-select:none;user-select:none}.ui-prop__vazio{padding:24px 16px;text-align:center;color:var(--ui-cor-texto-secundario, #888899);font-size:12px}.ui-prop__footer{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;background-color:var(--ui-cor-fundo-elevado, #18181c);border-top:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .1));flex-shrink:0}.ui-prop__link-ajuda{font-size:11px;color:var(--ui-cor-destaque, #00E08A);text-decoration:none;cursor:pointer}.ui-prop__link-ajuda:hover{text-decoration:underline}.ui-prop__footer-botoes{display:flex;gap:6px}.ui-prop__btn-aplicar{height:24px;padding:0 12px;background-color:var(--ui-cor-destaque, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000);border:none;border-radius:3px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s ease}.ui-prop__btn-aplicar:disabled{background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 10%,transparent);color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent);cursor:not-allowed}.ui-prop__btn-desfazer{height:24px;padding:0 8px;background:transparent;color:var(--ui-cor-texto-secundario, #888899);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:3px;font-size:11px;cursor:pointer;transition:all .15s ease}.ui-prop__btn-desfazer:hover:not(:disabled){background-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08));color:var(--ui-cor-texto, #ffffff)}.ui-prop__btn-desfazer:disabled{opacity:.4;cursor:not-allowed}@media (max-width: 640px){:host{--ui-prop-altura-linha: 28px;font-size:13px}.ui-prop__btn-icone{min-width:28px;min-height:28px}.ui-prop__footer-botoes{gap:8px}.ui-prop__btn-aplicar,.ui-prop__btn-desfazer{height:30px;font-size:12px;padding:0 12px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-prop__editor-input,.ui-prop__editor-select{touch-action:manipulation;font-size:14px}}.ui-prop__editor--misto,.ui-prop__editor--misto .ui-prop__booleano-rotulo,.ui-prop__editor--misto .ui-prop__cor-texto,.ui-prop__editor--misto select,select.ui-prop__editor--misto{font-style:italic;color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab))}.ui-prop__editor-input.ui-prop__editor--misto::placeholder{font-style:italic;color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));opacity:1}.ui-prop__editor--misto option:not([data-misto]),select.ui-prop__editor--misto option:not([data-misto]){font-style:normal;color:var(--ui-cor-texto, #ffffff)}.ui-prop__editor--misto svg{opacity:.35}.ui-prop__checkbox-custom--misto{border-color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));color:var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab));font-style:normal}.ui-prop__cor-amostra--misto{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--ui-prop-misto-cor, var(--ui-cor-texto-secundario, #a0a0ab)) 50%,transparent calc(50% + 1px))}`;
|
|
2072
|
+
function It() {
|
|
2073
|
+
return `
|
|
2074
|
+
<style>${Ot}</style>
|
|
2075
|
+
<div class="ui-prop__container" id="container" part="base">
|
|
2076
|
+
<!-- 0. Faixa Vertical da Coluna Estreita (visível quando colapsado) -->
|
|
2077
|
+
<div class="ui-prop__faixa-estreita" id="faixa-estreita" part="faixa-estreita" title="Clique para expandir painel">
|
|
2078
|
+
<span class="ui-prop__faixa-icone" aria-hidden="true">
|
|
2079
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
2080
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
2081
|
+
<line x1="3" y1="9" x2="21" y2="9"></line>
|
|
2082
|
+
<line x1="9" y1="21" x2="9" y2="9"></line>
|
|
2083
|
+
</svg>
|
|
2084
|
+
</span>
|
|
2085
|
+
<button type="button" class="ui-prop__faixa-btn-expandir" id="btn-expandir-faixa" title="Expandir painel de propriedades" aria-label="Expandir painel de propriedades">
|
|
2086
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2">
|
|
2087
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
|
2088
|
+
<line x1="5" y1="5" x2="5" y2="19"></line>
|
|
2089
|
+
</svg>
|
|
2090
|
+
</button>
|
|
2091
|
+
<span class="ui-prop__faixa-texto">PROPRIEDADES</span>
|
|
2092
|
+
</div>
|
|
2093
|
+
|
|
2094
|
+
<!-- 1. Header Superior -->
|
|
2095
|
+
<header class="ui-prop__header" id="header" part="cabecalho">
|
|
2096
|
+
<div class="ui-prop__header-titulo">
|
|
2097
|
+
<span class="ui-prop__header-icone" aria-hidden="true">
|
|
2098
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
2099
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
2100
|
+
<line x1="3" y1="9" x2="21" y2="9"></line>
|
|
2101
|
+
<line x1="9" y1="21" x2="9" y2="9"></line>
|
|
2102
|
+
</svg>
|
|
2103
|
+
</span>
|
|
2104
|
+
<span id="header-titulo-texto" part="titulo">Propriedades</span>
|
|
2105
|
+
</div>
|
|
2106
|
+
<div class="ui-prop__header-acoes" part="acoes-cabecalho">
|
|
2107
|
+
<button type="button" class="ui-prop__btn-icone" id="btn-flutuante" title="Desacoplar / Modo flutuante (CAD)" aria-label="Modo flutuante">
|
|
2108
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
2109
|
+
<rect x="3" y="3" width="14" height="14" rx="2"></rect>
|
|
2110
|
+
<polyline points="15 3 21 3 21 9"></polyline>
|
|
2111
|
+
<line x1="10" y1="14" x2="21" y2="3"></line>
|
|
2112
|
+
</svg>
|
|
2113
|
+
</button>
|
|
2114
|
+
<button type="button" class="ui-prop__btn-icone" id="btn-colapsar-horizontal" title="Recolher para coluna estreita" aria-label="Recolher para coluna estreita">
|
|
2115
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
2116
|
+
<polyline points="11 17 6 12 11 7"></polyline>
|
|
2117
|
+
<line x1="18" y1="5" x2="18" y2="19"></line>
|
|
2118
|
+
</svg>
|
|
2119
|
+
</button>
|
|
2120
|
+
<button type="button" class="ui-prop__btn-icone" id="btn-densidade" title="Alternar compressão vertical" aria-label="Alternar densidade vertical">
|
|
2121
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
2122
|
+
<polyline points="4 7 12 11 20 7"></polyline>
|
|
2123
|
+
<polyline points="4 17 12 13 20 17"></polyline>
|
|
2124
|
+
<line x1="4" y1="12" x2="20" y2="12"></line>
|
|
2125
|
+
</svg>
|
|
2126
|
+
</button>
|
|
2127
|
+
<button type="button" class="ui-prop__btn-icone" id="btn-expandir-tudo" title="Expandir/Recolher Tudo" aria-label="Expandir ou recolher tudo">
|
|
2128
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2129
|
+
<polyline points="7 13 12 18 17 13"></polyline>
|
|
2130
|
+
<polyline points="7 6 12 11 17 6"></polyline>
|
|
2131
|
+
</svg>
|
|
2132
|
+
</button>
|
|
2133
|
+
<button type="button" class="ui-prop__btn-icone" id="btn-fechar" title="Fechar" aria-label="Fechar" style="display: none;">
|
|
2134
|
+
✕
|
|
2135
|
+
</button>
|
|
2136
|
+
</div>
|
|
2137
|
+
</header>
|
|
2138
|
+
|
|
2139
|
+
<!-- 2. Seletor de Tipo (AutoCAD / Revit) -->
|
|
2140
|
+
<div class="ui-prop__tipo-seletor-container" id="tipo-container" part="seletor-tipo" style="display: none;"></div>
|
|
2141
|
+
|
|
2142
|
+
<!-- 3. Busca Rápida de Propriedades -->
|
|
2143
|
+
<div class="ui-prop__filtro-container" id="filtro-container" part="filtro" style="display: none;">
|
|
2144
|
+
<svg class="ui-prop__filtro-icone" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
|
2145
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
2146
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
2147
|
+
</svg>
|
|
2148
|
+
<input type="text" class="ui-prop__filtro-input" id="filtro-input" part="filtro-input" placeholder="Filtrar propriedades..." aria-label="Filtrar propriedades" autocomplete="off" spellcheck="false" />
|
|
2149
|
+
<button type="button" class="ui-prop__filtro-limpar" id="btn-limpar-filtro" title="Limpar filtro (Esc)" aria-label="Limpar filtro" style="display: none;">✕</button>
|
|
2150
|
+
</div>
|
|
2151
|
+
|
|
2152
|
+
<!-- 4. Corpo Rolável com Grade de Categorias -->
|
|
2153
|
+
<div class="ui-prop__corpo-wrapper" id="corpo-wrapper">
|
|
2154
|
+
<div class="ui-prop__splitter" id="splitter" part="splitter" role="separator" tabindex="0" aria-orientation="vertical" aria-valuemin="20" aria-valuemax="65" aria-valuenow="45" aria-label="Redimensionar coluna de rótulos" title="Arraste para redimensionar colunas (duplo-clique reseta para 45%)"></div>
|
|
2155
|
+
<div class="ui-prop__corpo" id="corpo" part="corpo">
|
|
2156
|
+
<div class="ui-prop__lista-categorias" id="lista-categorias" part="lista-categorias"></div>
|
|
2157
|
+
</div>
|
|
2158
|
+
</div>
|
|
2159
|
+
|
|
2160
|
+
<!-- 5. Rodapé com Ações (Aplicar / Desfazer) -->
|
|
2161
|
+
<footer class="ui-prop__footer" id="footer" part="rodape" style="display: none;">
|
|
2162
|
+
<a class="ui-prop__link-ajuda" id="link-ajuda" part="ajuda" href="#" role="button">Ajuda de propriedades</a>
|
|
2163
|
+
<div class="ui-prop__footer-botoes">
|
|
2164
|
+
<button type="button" class="ui-prop__btn-desfazer" id="btn-desfazer" part="desfazer" disabled>Desfazer</button>
|
|
2165
|
+
<button type="button" class="ui-prop__btn-aplicar" id="btn-aplicar" part="aplicar" disabled>Aplicar</button>
|
|
2166
|
+
</div>
|
|
2167
|
+
</footer>
|
|
2168
|
+
|
|
2169
|
+
<!-- 6. Grip para redimensionar no modo flutuante -->
|
|
2170
|
+
<div class="ui-prop__resizer-canto" id="resizer-canto" title="Redimensionar"></div>
|
|
2171
|
+
</div>
|
|
2172
|
+
`;
|
|
2173
|
+
}
|
|
2174
|
+
function Pt(t) {
|
|
2175
|
+
const { listaContainer: r, categorias: e, termoBusca: i, onToggleCategoria: o, linhaCtx: a } = t;
|
|
2176
|
+
r.innerHTML = "";
|
|
2177
|
+
const n = (Array.isArray(e) ? e : []).filter(
|
|
2178
|
+
(d) => !!(d && typeof d == "object")
|
|
2179
|
+
);
|
|
2180
|
+
if (n.length === 0) {
|
|
2181
|
+
const d = document.createElement("div");
|
|
2182
|
+
d.className = "ui-prop__vazio", d.setAttribute("part", "vazio"), d.textContent = "Nenhuma propriedade disponível.", r.appendChild(d);
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
const s = document.createDocumentFragment(), u = (i || "").trim().toLowerCase();
|
|
2186
|
+
let c = 0;
|
|
2187
|
+
if (n.forEach((d) => {
|
|
2188
|
+
const p = String(d.titulo ?? d.id ?? "").toLowerCase(), l = !!u && p.includes(u), h = (Array.isArray(d.propriedades) ? d.propriedades : []).filter((x) => {
|
|
2189
|
+
if (!x || typeof x != "object" || x.id === void 0 || x.id === null) return !1;
|
|
2190
|
+
if (!u || l) return !0;
|
|
2191
|
+
const k = String(x.rotulo ?? "").toLowerCase(), w = String(x.id).toLowerCase(), L = String(a.valoresAtuais[x.id] ?? "").toLowerCase();
|
|
2192
|
+
return k.includes(u) || w.includes(u) || L.includes(u);
|
|
2193
|
+
});
|
|
2194
|
+
if (u && h.length === 0)
|
|
2195
|
+
return;
|
|
2196
|
+
c += h.length;
|
|
2197
|
+
const m = d.aberto !== void 0 ? d.aberto !== !1 : d.aberta !== !1, v = !!u || m, f = document.createElement("div");
|
|
2198
|
+
f.className = `ui-prop__categoria ${v ? "ui-prop__categoria--aberta" : ""}`, f.setAttribute("data-cat-id", String(d.id)), f.setAttribute("part", "categoria"), R(f, "categoria-aberta", v);
|
|
2199
|
+
const b = document.createElement("div");
|
|
2200
|
+
b.className = "ui-prop__categoria-header", b.setAttribute("part", "categoria-cabecalho"), b.setAttribute("role", "button"), b.tabIndex = 0, b.setAttribute("aria-expanded", String(v));
|
|
2201
|
+
const _ = document.createElement("div");
|
|
2202
|
+
_.className = "ui-prop__categoria-titulo-bloco";
|
|
2203
|
+
const y = document.createElement("span");
|
|
2204
|
+
y.className = "ui-prop__categoria-seta", y.setAttribute("aria-hidden", "true"), y.textContent = "▶";
|
|
2205
|
+
const A = document.createElement("span");
|
|
2206
|
+
A.textContent = String(d.titulo ?? d.id), _.appendChild(y), _.appendChild(A);
|
|
2207
|
+
const C = document.createElement("span");
|
|
2208
|
+
C.className = "ui-prop__categoria-contador", C.textContent = String(h.length), b.appendChild(_), b.appendChild(C), b.addEventListener("click", () => o(String(d.id))), b.addEventListener("keydown", (x) => {
|
|
2209
|
+
if (x.key === "Enter" || x.key === " ")
|
|
2210
|
+
x.preventDefault(), o(String(d.id));
|
|
2211
|
+
else if (x.key === "ArrowRight")
|
|
2212
|
+
f.classList.contains("ui-prop__categoria--aberta") || (x.preventDefault(), o(String(d.id)));
|
|
2213
|
+
else if (x.key === "ArrowLeft")
|
|
2214
|
+
f.classList.contains("ui-prop__categoria--aberta") && (x.preventDefault(), o(String(d.id)));
|
|
2215
|
+
else if (x.key === "ArrowDown" || x.key === "ArrowUp") {
|
|
2216
|
+
const k = Array.from(r.querySelectorAll(".ui-prop__categoria-header")), w = k.indexOf(b);
|
|
2217
|
+
if (w !== -1) {
|
|
2218
|
+
const L = x.key === "ArrowDown" ? w + 1 : w - 1;
|
|
2219
|
+
L >= 0 && L < k.length && (x.preventDefault(), k[L].focus());
|
|
2220
|
+
}
|
|
2221
|
+
} else if (x.key === "Home") {
|
|
2222
|
+
const k = r.querySelector(".ui-prop__categoria-header");
|
|
2223
|
+
k && (x.preventDefault(), k.focus());
|
|
2224
|
+
} else if (x.key === "End") {
|
|
2225
|
+
const k = r.querySelectorAll(".ui-prop__categoria-header");
|
|
2226
|
+
k.length > 0 && (x.preventDefault(), k[k.length - 1].focus());
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
const E = document.createElement("div");
|
|
2230
|
+
E.className = "ui-prop__categoria-conteudo", E.setAttribute("part", "categoria-conteudo"), h.forEach((x) => {
|
|
2231
|
+
const k = Ft(String(d.id), x, a);
|
|
2232
|
+
E.appendChild(k);
|
|
2233
|
+
}), f.appendChild(b), f.appendChild(E), s.appendChild(f);
|
|
2234
|
+
}), u && c === 0) {
|
|
2235
|
+
const d = document.createElement("div");
|
|
2236
|
+
d.className = "ui-prop__vazio", d.setAttribute("part", "vazio"), d.textContent = `Nenhuma propriedade encontrada para "${i}".`, r.appendChild(d);
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
r.appendChild(s);
|
|
2240
|
+
}
|
|
2241
|
+
function Ft(t, r, e) {
|
|
2242
|
+
const i = document.createElement("div");
|
|
2243
|
+
i.className = "ui-prop__linha", i.setAttribute("data-prop-id", String(r.id)), i.setAttribute("part", "linha");
|
|
2244
|
+
const o = e.valoresAtuais[r.id] !== void 0 ? e.valoresAtuais[r.id] : X(r), a = r.id in e.valoresOriginais ? e.valoresOriginais[r.id] : X(r), n = !O(o, a), s = S(o);
|
|
2245
|
+
n && (i.classList.add("ui-prop__linha--modificada"), R(i, "linha-modificada", !0)), s && (i.classList.add("ui-prop__linha--misto"), R(i, "linha-mista", !0)), i.addEventListener("dblclick", () => {
|
|
2246
|
+
const h = i.querySelector(
|
|
2247
|
+
'input:not([type="color"]):not(.ui-prop__cor-picker-oculto), select, .ui-prop__btn-acao-inline'
|
|
2248
|
+
);
|
|
2249
|
+
h && (h.focus(), h instanceof HTMLInputElement && h.select());
|
|
2250
|
+
});
|
|
2251
|
+
const u = document.createElement("div");
|
|
2252
|
+
u.className = "ui-prop__col-rotulo", u.setAttribute("part", "rotulo");
|
|
2253
|
+
const c = String(r.rotulo ?? r.id);
|
|
2254
|
+
u.title = r.dica ? `${c} — ${r.dica}` : c;
|
|
2255
|
+
const d = document.createElement("span");
|
|
2256
|
+
d.textContent = c, u.appendChild(d), r.tipo === "numero" && !r.somenteLeitura && Vt(u, t, r, e);
|
|
2257
|
+
const p = document.createElement("div");
|
|
2258
|
+
p.className = "ui-prop__col-valor", p.setAttribute("part", "valor");
|
|
2259
|
+
const l = Dt(t, r, o, e.editorCtx);
|
|
2260
|
+
if (p.appendChild(l), r.unidade) {
|
|
2261
|
+
const h = document.createElement("span");
|
|
2262
|
+
h.className = "ui-prop__unidade-sufixo", h.setAttribute("part", "unidade"), h.textContent = r.unidade, p.appendChild(h);
|
|
2263
|
+
}
|
|
2264
|
+
return i.appendChild(u), i.appendChild(p), i;
|
|
2265
|
+
}
|
|
2266
|
+
function Vt(t, r, e, i) {
|
|
2267
|
+
t.classList.add("ui-prop__col-rotulo--scrub");
|
|
2268
|
+
const o = String(e.rotulo ?? e.id), a = e.dica ? `${o} — ${e.dica}` : o;
|
|
2269
|
+
t.title = `${a} (Arraste para ajustar, duplo-clique para editar)`;
|
|
2270
|
+
let n = 0, s = 0, u = !1;
|
|
2271
|
+
t.addEventListener("pointerdown", (c) => {
|
|
2272
|
+
if (c.button !== 0 || S(i.editorCtx.obterValorAtual(e.id))) return;
|
|
2273
|
+
n = c.clientX;
|
|
2274
|
+
const d = i.editorCtx.obterValorAtual(e.id);
|
|
2275
|
+
s = typeof d == "number" ? d : parseFloat(String(d || 0)) || 0, u = !1;
|
|
2276
|
+
try {
|
|
2277
|
+
t.setPointerCapture(c.pointerId);
|
|
2278
|
+
} catch {
|
|
2279
|
+
}
|
|
2280
|
+
t.classList.add("ui-prop__col-rotulo--arrastando");
|
|
2281
|
+
const p = (h) => {
|
|
2282
|
+
const m = h.clientX - n;
|
|
2283
|
+
if (Math.abs(m) > 2 && (u = !0), u) {
|
|
2284
|
+
let v = 1;
|
|
2285
|
+
h.shiftKey ? v = 0.1 : (h.ctrlKey || h.metaKey) && (v = 10);
|
|
2286
|
+
const f = te(e), b = typeof e.passo == "number" && e.passo > 0 ? e.passo * 0.01 : typeof e.step == "number" && e.step > 0 ? e.step * 0.01 : Math.pow(10, -Math.min(f !== void 0 ? f : 2, 2));
|
|
2287
|
+
let _ = s + m * b * v;
|
|
2288
|
+
_ = K(_, e), f !== void 0 ? _ = Number(_.toFixed(f)) : _ = Math.round(_ * 100) / 100, i.editorCtx.registrarAlteracao(r, e.id, _), i.onAtualizarCampoVisual(e.id, _);
|
|
2289
|
+
}
|
|
2290
|
+
}, l = (h) => {
|
|
2291
|
+
t.classList.remove("ui-prop__col-rotulo--arrastando");
|
|
2292
|
+
try {
|
|
2293
|
+
t.hasPointerCapture(h.pointerId) && t.releasePointerCapture(h.pointerId);
|
|
2294
|
+
} catch {
|
|
2295
|
+
}
|
|
2296
|
+
t.removeEventListener("pointermove", p), t.removeEventListener("pointerup", l), t.removeEventListener("pointercancel", l);
|
|
2297
|
+
};
|
|
2298
|
+
t.addEventListener("pointermove", p), t.addEventListener("pointerup", l), t.addEventListener("pointercancel", l);
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
const me = 300, Ht = 480, P = /* @__PURE__ */ new WeakMap();
|
|
2302
|
+
function qt(t) {
|
|
2303
|
+
var i, o, a;
|
|
2304
|
+
const r = t.hasAttribute("flutuante"), e = t.style;
|
|
2305
|
+
if (r) {
|
|
2306
|
+
const n = P.get(t) ?? { acoplado: { width: "", height: "" } };
|
|
2307
|
+
n.flutuante = { left: e.left, top: e.top, width: e.width, height: e.height }, P.set(t, n), t.removeAttribute("flutuante"), e.left = "", e.top = "", e.right = "", e.bottom = "", e.position = "", e.zIndex = "", e.width = n.acoplado.width, e.height = n.acoplado.height;
|
|
2308
|
+
} else {
|
|
2309
|
+
const n = {
|
|
2310
|
+
acoplado: { width: e.width, height: e.height },
|
|
2311
|
+
flutuante: (i = P.get(t)) == null ? void 0 : i.flutuante
|
|
2312
|
+
};
|
|
2313
|
+
if (P.set(t, n), t.setAttribute("flutuante", ""), e.position = "fixed", (o = n.flutuante) != null && o.left || (a = n.flutuante) != null && a.top)
|
|
2314
|
+
e.left = n.flutuante.left, e.top = n.flutuante.top, e.width = n.flutuante.width, e.height = n.flutuante.height;
|
|
2315
|
+
else if (!e.left && !e.top) {
|
|
2316
|
+
const s = Math.max(
|
|
2317
|
+
20,
|
|
2318
|
+
(typeof window < "u" ? window.innerWidth : 1024) - me - 30
|
|
2319
|
+
);
|
|
2320
|
+
e.left = `${s}px`, e.top = "70px", e.width = `${me}px`, e.height = `${Ht}px`;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return !r;
|
|
2324
|
+
}
|
|
2325
|
+
function $t(t, r, e) {
|
|
2326
|
+
const i = r.getElementById("header");
|
|
2327
|
+
if (i) {
|
|
2328
|
+
let a = null, n = 0, s = 0, u = 0, c = 0;
|
|
2329
|
+
const d = (l) => {
|
|
2330
|
+
if (a === null) return;
|
|
2331
|
+
const h = l.clientX - n, m = l.clientY - s;
|
|
2332
|
+
let v = u + h, f = c + m;
|
|
2333
|
+
const b = Math.max(0, (typeof window < "u" ? window.innerWidth : 1024) - t.offsetWidth), _ = Math.max(0, (typeof window < "u" ? window.innerHeight : 768) - 30);
|
|
2334
|
+
v = Math.max(0, Math.min(b, v)), f = Math.max(0, Math.min(_, f)), t.style.left = `${v}px`, t.style.top = `${f}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
2335
|
+
}, p = (l) => {
|
|
2336
|
+
if (a !== null) {
|
|
2337
|
+
try {
|
|
2338
|
+
i.releasePointerCapture(l.pointerId);
|
|
2339
|
+
} catch {
|
|
2340
|
+
}
|
|
2341
|
+
i.removeEventListener("pointermove", d), i.removeEventListener("pointerup", p), i.removeEventListener("pointercancel", p), a = null, t.classList.remove("arrastando"), t.dispatchEvent(new CustomEvent("ui-mover", {
|
|
2342
|
+
bubbles: !0,
|
|
2343
|
+
composed: !0,
|
|
2344
|
+
detail: { left: t.style.left, top: t.style.top }
|
|
2345
|
+
}));
|
|
2346
|
+
}
|
|
2347
|
+
};
|
|
2348
|
+
e.add(i, "pointerdown", (l) => {
|
|
2349
|
+
if (!t.hasAttribute("flutuante") || l.target.closest("button, input, select, a") || l.button !== 0) return;
|
|
2350
|
+
l.preventDefault(), a = l.pointerId, n = l.clientX, s = l.clientY;
|
|
2351
|
+
const m = t.getBoundingClientRect();
|
|
2352
|
+
u = m.left, c = m.top, t.classList.add("arrastando");
|
|
2353
|
+
try {
|
|
2354
|
+
i.setPointerCapture(l.pointerId);
|
|
2355
|
+
} catch {
|
|
2356
|
+
}
|
|
2357
|
+
i.addEventListener("pointermove", d), i.addEventListener("pointerup", p), i.addEventListener("pointercancel", p);
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
const o = r.getElementById("resizer-canto");
|
|
2361
|
+
if (o) {
|
|
2362
|
+
let a = null, n = 0, s = 0, u = 0, c = 0;
|
|
2363
|
+
const d = (l) => {
|
|
2364
|
+
if (a === null) return;
|
|
2365
|
+
const h = Math.max(200, n + (l.clientX - u)), m = Math.max(180, s + (l.clientY - c));
|
|
2366
|
+
t.style.width = `${h}px`, t.style.height = `${m}px`;
|
|
2367
|
+
}, p = (l) => {
|
|
2368
|
+
if (a !== null) {
|
|
2369
|
+
try {
|
|
2370
|
+
o.releasePointerCapture(l.pointerId);
|
|
2371
|
+
} catch {
|
|
2372
|
+
}
|
|
2373
|
+
o.removeEventListener("pointermove", d), o.removeEventListener("pointerup", p), o.removeEventListener("pointercancel", p), a = null, t.dispatchEvent(new CustomEvent("ui-redimensionar", {
|
|
2374
|
+
bubbles: !0,
|
|
2375
|
+
composed: !0,
|
|
2376
|
+
detail: { width: t.style.width, height: t.style.height }
|
|
2377
|
+
}));
|
|
2378
|
+
}
|
|
2379
|
+
};
|
|
2380
|
+
e.add(o, "pointerdown", (l) => {
|
|
2381
|
+
if (!t.hasAttribute("flutuante") || l.button !== 0) return;
|
|
2382
|
+
l.preventDefault(), l.stopPropagation(), a = l.pointerId, u = l.clientX, c = l.clientY;
|
|
2383
|
+
const h = t.getBoundingClientRect();
|
|
2384
|
+
n = h.width, s = h.height;
|
|
2385
|
+
try {
|
|
2386
|
+
o.setPointerCapture(l.pointerId);
|
|
2387
|
+
} catch {
|
|
2388
|
+
}
|
|
2389
|
+
o.addEventListener("pointermove", d), o.addEventListener("pointerup", p), o.addEventListener("pointercancel", p);
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
function jt(t) {
|
|
2394
|
+
return t === "compacta" ? "ultracompacta" : t === "ultracompacta" ? "padrao" : "compacta";
|
|
2395
|
+
}
|
|
2396
|
+
class Ut {
|
|
2397
|
+
constructor(r) {
|
|
2398
|
+
g(this, "valoresOriginais", {});
|
|
2399
|
+
g(this, "valoresAtuais", {});
|
|
2400
|
+
this.ctx = r;
|
|
2401
|
+
}
|
|
2402
|
+
inicializarCategorias(r) {
|
|
2403
|
+
this.valoresOriginais = {}, this.valoresAtuais = {};
|
|
2404
|
+
const e = /* @__PURE__ */ new Set();
|
|
2405
|
+
(Array.isArray(r) ? r : []).forEach((i) => {
|
|
2406
|
+
!i || typeof i != "object" || (Array.isArray(i.propriedades) ? i.propriedades : []).forEach((o) => {
|
|
2407
|
+
if (!o || typeof o != "object" || o.id === void 0 || o.id === null) return;
|
|
2408
|
+
const a = String(o.id);
|
|
2409
|
+
e.has(a) && typeof console < "u" && console.warn(`[ui-tabela-propriedades] id de propriedade repetido: "${a}". Os valores são indexados por id e serão compartilhados.`), e.add(a);
|
|
2410
|
+
const n = X(o);
|
|
2411
|
+
this.valoresOriginais[a] = n, this.valoresAtuais[a] = n;
|
|
2412
|
+
});
|
|
2413
|
+
}), this.ctx.onAtualizarBotoesFooter(!1);
|
|
2414
|
+
}
|
|
2415
|
+
/** Há alguma propriedade com valor diferente do original (último aplicar/carregar)? */
|
|
2416
|
+
get isDirty() {
|
|
2417
|
+
return Object.keys(this.valoresAtuais).some((r) => this.isModificada(r));
|
|
2418
|
+
}
|
|
2419
|
+
isModificada(r) {
|
|
2420
|
+
return !O(this.valoresAtuais[r], this.valoresOriginais[r]);
|
|
2421
|
+
}
|
|
2422
|
+
getValores() {
|
|
2423
|
+
return { ...this.valoresAtuais };
|
|
2424
|
+
}
|
|
2425
|
+
getValoresOriginais() {
|
|
2426
|
+
return { ...this.valoresOriginais };
|
|
2427
|
+
}
|
|
2428
|
+
setValores(r) {
|
|
2429
|
+
!r || typeof r != "object" || (Object.keys(r).forEach((e) => {
|
|
2430
|
+
this.valoresAtuais[e] = r[e], this.valoresOriginais[e] = r[e];
|
|
2431
|
+
}), this.ctx.onAtualizarBotoesFooter(this.isDirty));
|
|
2432
|
+
}
|
|
2433
|
+
obterValor(r) {
|
|
2434
|
+
return this.valoresAtuais[r];
|
|
2435
|
+
}
|
|
2436
|
+
obterValorOriginal(r) {
|
|
2437
|
+
return this.valoresOriginais[r];
|
|
2438
|
+
}
|
|
2439
|
+
/** Alteração programática: atualiza o editor na tela; não emite se o valor não mudou. */
|
|
2440
|
+
definirValor(r, e, i = !0) {
|
|
2441
|
+
const o = this.valoresAtuais[r];
|
|
2442
|
+
O(o, e) || (this.valoresAtuais[r] = e, this.aposAlterar(r), this.ctx.onAtualizarCampoVisual(r, e), i && this.emitirAlteracao(r, e, o, this.categoriaDe(r)));
|
|
2443
|
+
}
|
|
2444
|
+
/** Restaura uma propriedade individual ao seu valor original (antes da edição). */
|
|
2445
|
+
redefinirValor(r, e = !0) {
|
|
2446
|
+
if (!(r in this.valoresOriginais)) return;
|
|
2447
|
+
const i = this.valoresOriginais[r];
|
|
2448
|
+
this.definirValor(r, i, e && !this.ctx.isModoManual());
|
|
2449
|
+
}
|
|
2450
|
+
/** Alteração feita pelo usuário num editor. Em modo manual só emite no Aplicar. */
|
|
2451
|
+
registrarAlteracao(r, e, i) {
|
|
2452
|
+
const o = this.valoresAtuais[e];
|
|
2453
|
+
O(o, i) || (this.valoresAtuais[e] = i, this.aposAlterar(e), this.ctx.isModoManual() || this.emitirAlteracao(e, i, o, r));
|
|
2454
|
+
}
|
|
2455
|
+
aplicar() {
|
|
2456
|
+
var e;
|
|
2457
|
+
if (!this.isDirty) return;
|
|
2458
|
+
this.valoresOriginais = { ...this.valoresAtuais }, this.ctx.onAtualizarBotoesFooter(!1);
|
|
2459
|
+
const r = (e = this.ctx.hostElement.shadowRoot) == null ? void 0 : e.querySelectorAll(".ui-prop__linha--modificada");
|
|
2460
|
+
r == null || r.forEach((i) => {
|
|
2461
|
+
i.classList.remove("ui-prop__linha--modificada"), R(i, "linha-modificada", !1);
|
|
2462
|
+
}), this.ctx.hostElement.dispatchEvent(
|
|
2463
|
+
new CustomEvent("ui-aplicar", {
|
|
2464
|
+
bubbles: !0,
|
|
2465
|
+
composed: !0,
|
|
2466
|
+
detail: { valores: { ...this.valoresAtuais } }
|
|
2467
|
+
})
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
desfazer() {
|
|
2471
|
+
this.isDirty && (this.valoresAtuais = { ...this.valoresOriginais }, this.ctx.onAtualizarBotoesFooter(!1), this.ctx.onRenderCategorias(), this.ctx.hostElement.dispatchEvent(
|
|
2472
|
+
new CustomEvent("ui-desfazer", {
|
|
2473
|
+
bubbles: !0,
|
|
2474
|
+
composed: !0,
|
|
2475
|
+
detail: { valores: { ...this.valoresAtuais } }
|
|
2476
|
+
})
|
|
2477
|
+
));
|
|
2478
|
+
}
|
|
2479
|
+
/** Marca/desmarca a linha (modificada e mista) e recalcula os botões do rodapé (voltar ao original limpa o estado). */
|
|
2480
|
+
aposAlterar(r) {
|
|
2481
|
+
const e = _e(this.ctx.hostElement.shadowRoot, r);
|
|
2482
|
+
if (e) {
|
|
2483
|
+
const i = this.isModificada(r), o = S(this.valoresAtuais[r]);
|
|
2484
|
+
e.classList.toggle("ui-prop__linha--modificada", i), e.classList.toggle("ui-prop__linha--misto", o), R(e, "linha-modificada", i), R(e, "linha-mista", o);
|
|
2485
|
+
}
|
|
2486
|
+
this.ctx.onAtualizarBotoesFooter(this.isDirty);
|
|
2487
|
+
}
|
|
2488
|
+
categoriaDe(r) {
|
|
2489
|
+
for (const e of this.ctx.getCategorias())
|
|
2490
|
+
if (e && Array.isArray(e.propriedades) && e.propriedades.some((i) => i && String(i.id) === String(r)))
|
|
2491
|
+
return e.id;
|
|
2492
|
+
return "";
|
|
2493
|
+
}
|
|
2494
|
+
emitirAlteracao(r, e, i, o = "") {
|
|
2495
|
+
this.ctx.hostElement.dispatchEvent(
|
|
2496
|
+
new CustomEvent("ui-propriedade-alterada", {
|
|
2497
|
+
bubbles: !0,
|
|
2498
|
+
composed: !0,
|
|
2499
|
+
detail: {
|
|
2500
|
+
id: r,
|
|
2501
|
+
categoriaId: o,
|
|
2502
|
+
valor: e,
|
|
2503
|
+
valorAnterior: i,
|
|
2504
|
+
todosValores: { ...this.valoresAtuais }
|
|
2505
|
+
}
|
|
2506
|
+
})
|
|
2507
|
+
);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
function Wt(t) {
|
|
2511
|
+
const {
|
|
2512
|
+
shadow: r,
|
|
2513
|
+
listeners: e,
|
|
2514
|
+
host: i,
|
|
2515
|
+
onToggleExpandirTodas: o,
|
|
2516
|
+
onFiltrar: a,
|
|
2517
|
+
onAplicar: n,
|
|
2518
|
+
onDesfazer: s,
|
|
2519
|
+
onAlternarDensidade: u,
|
|
2520
|
+
onAlternarFlutuante: c,
|
|
2521
|
+
onAlternarColapsoHorizontal: d,
|
|
2522
|
+
onFocarPrimeiroEditor: p
|
|
2523
|
+
} = t, l = r.getElementById("btn-flutuante");
|
|
2524
|
+
l && c && e.add(l, "click", c);
|
|
2525
|
+
const h = r.getElementById("btn-colapsar-horizontal");
|
|
2526
|
+
h && d && e.add(h, "click", d);
|
|
2527
|
+
const m = r.getElementById("faixa-estreita");
|
|
2528
|
+
m && d && e.add(m, "click", d);
|
|
2529
|
+
const v = r.getElementById("btn-expandir-faixa");
|
|
2530
|
+
v && d && e.add(v, "click", (w) => {
|
|
2531
|
+
w.stopPropagation(), d();
|
|
2532
|
+
});
|
|
2533
|
+
const f = r.getElementById("btn-densidade");
|
|
2534
|
+
f && u && e.add(f, "click", u);
|
|
2535
|
+
const b = r.getElementById("btn-expandir-tudo");
|
|
2536
|
+
b && e.add(b, "click", o);
|
|
2537
|
+
const _ = r.getElementById("btn-fechar");
|
|
2538
|
+
_ && e.add(_, "click", () => {
|
|
2539
|
+
i.dispatchEvent(new CustomEvent("ui-fechar", { bubbles: !0, composed: !0 }));
|
|
2540
|
+
});
|
|
2541
|
+
const y = r.getElementById("filtro-input"), A = r.getElementById("btn-limpar-filtro"), C = () => {
|
|
2542
|
+
A && y && (A.style.display = y.value ? "inline-flex" : "none");
|
|
2543
|
+
};
|
|
2544
|
+
y && (e.add(y, "input", () => {
|
|
2545
|
+
C();
|
|
2546
|
+
const w = (y.value || "").trim().toLowerCase();
|
|
2547
|
+
a(w);
|
|
2548
|
+
}), e.add(y, "keydown", (w) => {
|
|
2549
|
+
w.key === "Escape" ? y.value ? (w.preventDefault(), w.stopPropagation(), y.value = "", C(), a("")) : y.blur() : (w.key === "Enter" || w.key === "ArrowDown") && p && (w.preventDefault(), p());
|
|
2550
|
+
})), A && y && e.add(A, "click", () => {
|
|
2551
|
+
y.value = "", C(), a(""), y.focus();
|
|
2552
|
+
});
|
|
2553
|
+
const E = r.getElementById("btn-aplicar");
|
|
2554
|
+
E && e.add(E, "click", n);
|
|
2555
|
+
const x = r.getElementById("btn-desfazer");
|
|
2556
|
+
x && e.add(x, "click", s);
|
|
2557
|
+
const k = r.getElementById("link-ajuda");
|
|
2558
|
+
k && e.add(k, "click", (w) => {
|
|
2559
|
+
w.preventDefault(), i.dispatchEvent(new CustomEvent("ui-ajuda", { bubbles: !0, composed: !0 }));
|
|
2560
|
+
}), e.add(r, "keydown", (w) => {
|
|
2561
|
+
const L = w;
|
|
2562
|
+
(L.ctrlKey || L.metaKey) && L.key === "Enter" && i.getAttribute("modo-aplicar") === "manual" && (L.preventDefault(), n());
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
function B(t, r) {
|
|
2566
|
+
const e = t.getElementById("header-titulo-texto");
|
|
2567
|
+
e && (e.textContent = r.getAttribute("titulo") || "Propriedades");
|
|
2568
|
+
const i = t.getElementById("btn-fechar");
|
|
2569
|
+
i && (i.style.display = r.hasAttribute("fechavel") ? "inline-flex" : "none");
|
|
2570
|
+
const o = t.getElementById("btn-flutuante");
|
|
2571
|
+
if (o) {
|
|
2572
|
+
const p = r.hasAttribute("flutuante");
|
|
2573
|
+
o.title = p ? "Acoplar painel (Dock)" : "Desacoplar / Modo flutuante (CAD)", o.setAttribute("aria-pressed", String(p)), o.classList.toggle("ui-prop__btn-icone--ativo", p);
|
|
2574
|
+
}
|
|
2575
|
+
const a = t.getElementById("btn-colapsar-horizontal");
|
|
2576
|
+
if (a) {
|
|
2577
|
+
const p = r.hasAttribute("colapsado");
|
|
2578
|
+
a.title = p ? "Expandir painel" : "Recolher para coluna estreita", a.setAttribute("aria-pressed", String(p)), a.classList.toggle("ui-prop__btn-icone--ativo", p);
|
|
2579
|
+
}
|
|
2580
|
+
const n = t.getElementById("btn-densidade");
|
|
2581
|
+
if (n) {
|
|
2582
|
+
const p = r.getAttribute("densidade") || "padrão";
|
|
2583
|
+
n.title = `Compressão vertical: ${p} (clique para alternar)`;
|
|
2584
|
+
}
|
|
2585
|
+
const s = t.getElementById("filtro-container");
|
|
2586
|
+
s && (s.style.display = r.hasAttribute("filtro") ? "flex" : "none");
|
|
2587
|
+
const u = t.getElementById("filtro-input"), c = t.getElementById("btn-limpar-filtro");
|
|
2588
|
+
c && u && (c.style.display = u.value ? "inline-flex" : "none");
|
|
2589
|
+
const d = t.getElementById("footer");
|
|
2590
|
+
d && (d.style.display = r.getAttribute("modo-aplicar") === "manual" ? "flex" : "none");
|
|
2591
|
+
}
|
|
2592
|
+
class oe extends fe {
|
|
2593
|
+
constructor() {
|
|
2594
|
+
super();
|
|
2595
|
+
g(this, "shadow");
|
|
2596
|
+
g(this, "listeners", new F());
|
|
2597
|
+
g(this, "splitterListeners", new F());
|
|
2598
|
+
g(this, "controladorSplitter");
|
|
2599
|
+
g(this, "gerenciadorValores");
|
|
2600
|
+
g(this, "_categorias", []);
|
|
2601
|
+
g(this, "_tipos", []);
|
|
2602
|
+
g(this, "_tipoSelecionadoId", "");
|
|
2603
|
+
g(this, "_termoBusca", "");
|
|
2604
|
+
g(this, "_larguraRotuloPorcentagem", 45);
|
|
2605
|
+
g(this, "_sincronizandoFlutuante", !1);
|
|
2606
|
+
g(this, "tipoContainerElement");
|
|
2607
|
+
g(this, "corpoElement");
|
|
2608
|
+
g(this, "btnAplicarElement");
|
|
2609
|
+
g(this, "btnDesfazerElement");
|
|
2610
|
+
g(this, "splitterElement");
|
|
2611
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = It(), this.tipoContainerElement = this.shadow.getElementById("tipo-container"), this.corpoElement = this.shadow.getElementById("corpo"), this.btnAplicarElement = this.shadow.getElementById("btn-aplicar"), this.btnDesfazerElement = this.shadow.getElementById("btn-desfazer"), this.splitterElement = this.shadow.getElementById("splitter"), this.gerenciadorValores = new Ut({
|
|
2612
|
+
hostElement: this,
|
|
2613
|
+
getCategorias: () => this._categorias,
|
|
2614
|
+
onAtualizarBotoesFooter: (e) => {
|
|
2615
|
+
this.btnAplicarElement.disabled = !e, this.btnDesfazerElement.disabled = !e;
|
|
2616
|
+
},
|
|
2617
|
+
onAtualizarCampoVisual: (e, i) => he(this.shadow, e, i),
|
|
2618
|
+
onRenderCategorias: () => this.renderCategorias(),
|
|
2619
|
+
isModoManual: () => this.getAttribute("modo-aplicar") === "manual"
|
|
2620
|
+
}), this.controladorSplitter = Bt({
|
|
2621
|
+
hostElement: this,
|
|
2622
|
+
corpoElement: this.corpoElement,
|
|
2623
|
+
splitterElement: this.splitterElement,
|
|
2624
|
+
splitterListeners: this.splitterListeners,
|
|
2625
|
+
onLarguraAlterada: (e) => {
|
|
2626
|
+
this._larguraRotuloPorcentagem = e;
|
|
2627
|
+
}
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
static get observedAttributes() {
|
|
2631
|
+
return [
|
|
2632
|
+
"titulo",
|
|
2633
|
+
"estilo-visual",
|
|
2634
|
+
"modo-aplicar",
|
|
2635
|
+
"filtro",
|
|
2636
|
+
"densidade",
|
|
2637
|
+
"largura-rotulo",
|
|
2638
|
+
"fechavel",
|
|
2639
|
+
"colapsado",
|
|
2640
|
+
"flutuante",
|
|
2641
|
+
"texto-misto"
|
|
2642
|
+
];
|
|
2643
|
+
}
|
|
2644
|
+
get larguraRotuloPorcentagem() {
|
|
2645
|
+
return this._larguraRotuloPorcentagem;
|
|
2646
|
+
}
|
|
2647
|
+
connectedCallback() {
|
|
2648
|
+
this.listeners.cleanup(), Wt({
|
|
2649
|
+
shadow: this.shadow,
|
|
2650
|
+
listeners: this.listeners,
|
|
2651
|
+
host: this,
|
|
2652
|
+
onToggleExpandirTodas: () => this.toggleExpandirTodas(),
|
|
2653
|
+
onFiltrar: (e) => {
|
|
2654
|
+
this._termoBusca = e, this.renderCategorias();
|
|
2655
|
+
},
|
|
2656
|
+
onAplicar: () => this.aplicar(),
|
|
2657
|
+
onDesfazer: () => this.desfazer(),
|
|
2658
|
+
onAlternarDensidade: () => this.alternarDensidade(),
|
|
2659
|
+
onAlternarFlutuante: () => this.alternarFlutuante(),
|
|
2660
|
+
onAlternarColapsoHorizontal: () => this.alternarColapsoHorizontal(),
|
|
2661
|
+
onFocarPrimeiroEditor: () => bt(this.shadow)
|
|
2662
|
+
}), $t(this, this.shadow, this.listeners), this.controladorSplitter.init(), this.syncState();
|
|
2663
|
+
}
|
|
2664
|
+
disconnectedCallback() {
|
|
2665
|
+
this.listeners.cleanup(), this.splitterListeners.cleanup();
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* Cada atributo atualiza só o que depende dele: redesenhar todas as linhas (ex.: ao trocar o
|
|
2669
|
+
* `titulo`) tiraria o foco de um campo em edição.
|
|
2670
|
+
*/
|
|
2671
|
+
attributeChangedCallback(e, i, o) {
|
|
2672
|
+
if (i !== o)
|
|
2673
|
+
switch (e) {
|
|
2674
|
+
case "largura-rotulo": {
|
|
2675
|
+
const a = parseFloat(o ?? "");
|
|
2676
|
+
isNaN(a) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(a));
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
case "estilo-visual":
|
|
2680
|
+
this.renderSeletorTipos();
|
|
2681
|
+
return;
|
|
2682
|
+
case "texto-misto":
|
|
2683
|
+
this.renderCategorias();
|
|
2684
|
+
return;
|
|
2685
|
+
case "filtro":
|
|
2686
|
+
if (B(this.shadow, this), o === null && this._termoBusca) {
|
|
2687
|
+
this._termoBusca = "";
|
|
2688
|
+
const a = this.shadow.getElementById("filtro-input");
|
|
2689
|
+
a && (a.value = ""), this.renderCategorias();
|
|
2690
|
+
}
|
|
2691
|
+
return;
|
|
2692
|
+
case "flutuante":
|
|
2693
|
+
this._sincronizandoFlutuante || B(this.shadow, this);
|
|
2694
|
+
return;
|
|
2695
|
+
default:
|
|
2696
|
+
B(this.shadow, this);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
// --- Propriedades Públicas Espelhadas (Getters e Setters Tipados) ---
|
|
2700
|
+
get titulo() {
|
|
2701
|
+
return this.getAttribute("titulo") || "Propriedades";
|
|
2702
|
+
}
|
|
2703
|
+
set titulo(e) {
|
|
2704
|
+
e ? this.setAttribute("titulo", e) : this.removeAttribute("titulo");
|
|
2705
|
+
}
|
|
2706
|
+
get estiloVisual() {
|
|
2707
|
+
return this.getAttribute("estilo-visual") || "autocad";
|
|
2708
|
+
}
|
|
2709
|
+
set estiloVisual(e) {
|
|
2710
|
+
e && e !== "autocad" ? this.setAttribute("estilo-visual", e) : this.removeAttribute("estilo-visual");
|
|
2711
|
+
}
|
|
2712
|
+
get modoAplicar() {
|
|
2713
|
+
return this.getAttribute("modo-aplicar") || "imediato";
|
|
2714
|
+
}
|
|
2715
|
+
set modoAplicar(e) {
|
|
2716
|
+
e === "manual" ? this.setAttribute("modo-aplicar", "manual") : this.removeAttribute("modo-aplicar");
|
|
2717
|
+
}
|
|
2718
|
+
get filtro() {
|
|
2719
|
+
return this.hasAttribute("filtro");
|
|
2720
|
+
}
|
|
2721
|
+
set filtro(e) {
|
|
2722
|
+
e ? this.setAttribute("filtro", "") : this.removeAttribute("filtro");
|
|
2723
|
+
}
|
|
2724
|
+
get termoBusca() {
|
|
2725
|
+
return this._termoBusca;
|
|
2726
|
+
}
|
|
2727
|
+
set termoBusca(e) {
|
|
2728
|
+
this._termoBusca = (e || "").trim().toLowerCase();
|
|
2729
|
+
const i = this.shadow.getElementById("filtro-input");
|
|
2730
|
+
i && (i.value = e || ""), this.renderCategorias();
|
|
2731
|
+
}
|
|
2732
|
+
get larguraRotulo() {
|
|
2733
|
+
return this._larguraRotuloPorcentagem;
|
|
2734
|
+
}
|
|
2735
|
+
set larguraRotulo(e) {
|
|
2736
|
+
const i = typeof e == "number" ? e : parseFloat(String(e));
|
|
2737
|
+
isNaN(i) || this.setAttribute("largura-rotulo", String(i));
|
|
2738
|
+
}
|
|
2739
|
+
get fechavel() {
|
|
2740
|
+
return this.hasAttribute("fechavel");
|
|
2741
|
+
}
|
|
2742
|
+
set fechavel(e) {
|
|
2743
|
+
e ? this.setAttribute("fechavel", "") : this.removeAttribute("fechavel");
|
|
2744
|
+
}
|
|
2745
|
+
get categorias() {
|
|
2746
|
+
return this._categorias;
|
|
2747
|
+
}
|
|
2748
|
+
set categorias(e) {
|
|
2749
|
+
this._categorias = Array.isArray(e) ? e : [], this.gerenciadorValores.inicializarCategorias(this._categorias), this.renderCategorias();
|
|
2750
|
+
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Texto exibido nas propriedades cujo valor difere entre os objetos selecionados
|
|
2753
|
+
* (`VALOR_MISTO`). Reflete o atributo `texto-misto`; padrão "Varia".
|
|
2754
|
+
*/
|
|
2755
|
+
get textoMisto() {
|
|
2756
|
+
const e = this.getAttribute("texto-misto");
|
|
2757
|
+
return e && e.trim() ? e : ee;
|
|
2758
|
+
}
|
|
2759
|
+
set textoMisto(e) {
|
|
2760
|
+
typeof e == "string" && e.trim() ? this.setAttribute("texto-misto", e) : this.removeAttribute("texto-misto");
|
|
2761
|
+
}
|
|
2762
|
+
get tipos() {
|
|
2763
|
+
return this._tipos;
|
|
2764
|
+
}
|
|
2765
|
+
set tipos(e) {
|
|
2766
|
+
this._tipos = Array.isArray(e) ? e : [], this.renderSeletorTipos();
|
|
2767
|
+
}
|
|
2768
|
+
get tipoSelecionado() {
|
|
2769
|
+
return this._tipoSelecionadoId;
|
|
2770
|
+
}
|
|
2771
|
+
set tipoSelecionado(e) {
|
|
2772
|
+
this._tipoSelecionadoId = String(e ?? ""), this.renderSeletorTipos();
|
|
2773
|
+
}
|
|
2774
|
+
get valores() {
|
|
2775
|
+
return this.gerenciadorValores.getValores();
|
|
2776
|
+
}
|
|
2777
|
+
set valores(e) {
|
|
2778
|
+
this.gerenciadorValores.setValores(e), this.renderCategorias();
|
|
2779
|
+
}
|
|
2780
|
+
get isDirty() {
|
|
2781
|
+
return this.gerenciadorValores.isDirty;
|
|
2782
|
+
}
|
|
2783
|
+
get dirty() {
|
|
2784
|
+
return this.gerenciadorValores.isDirty;
|
|
2785
|
+
}
|
|
2786
|
+
obterValor(e) {
|
|
2787
|
+
return this.gerenciadorValores.obterValor(e);
|
|
2788
|
+
}
|
|
2789
|
+
definirValor(e, i, o = !0) {
|
|
2790
|
+
this.gerenciadorValores.definirValor(e, i, o);
|
|
2791
|
+
}
|
|
2792
|
+
redefinirValor(e, i = !0) {
|
|
2793
|
+
this.gerenciadorValores.redefinirValor(e, i);
|
|
2794
|
+
}
|
|
2795
|
+
aplicar() {
|
|
2796
|
+
this.gerenciadorValores.aplicar();
|
|
2797
|
+
}
|
|
2798
|
+
desfazer() {
|
|
2799
|
+
this.gerenciadorValores.desfazer();
|
|
2800
|
+
}
|
|
2801
|
+
expandirTudo() {
|
|
2802
|
+
gt(this.shadow, this._categorias);
|
|
2803
|
+
}
|
|
2804
|
+
colapsarTudo() {
|
|
2805
|
+
vt(this.shadow, this._categorias);
|
|
2806
|
+
}
|
|
2807
|
+
toggleCategoria(e) {
|
|
2808
|
+
xt(this.shadow, this, this._categorias, e);
|
|
2809
|
+
}
|
|
2810
|
+
get densidade() {
|
|
2811
|
+
return this.getAttribute("densidade") || "padrao";
|
|
2812
|
+
}
|
|
2813
|
+
set densidade(e) {
|
|
2814
|
+
!e || e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e);
|
|
2815
|
+
}
|
|
2816
|
+
alternarDensidade() {
|
|
2817
|
+
const e = jt(this.getAttribute("densidade") || "padrao");
|
|
2818
|
+
return e === "padrao" ? this.removeAttribute("densidade") : this.setAttribute("densidade", e), this.dispatchEvent(
|
|
2819
|
+
new CustomEvent("ui-densidade-alterada", {
|
|
2820
|
+
bubbles: !0,
|
|
2821
|
+
composed: !0,
|
|
2822
|
+
detail: { densidade: e }
|
|
2823
|
+
})
|
|
2824
|
+
), B(this.shadow, this), e;
|
|
2825
|
+
}
|
|
2826
|
+
get flutuante() {
|
|
2827
|
+
return this.hasAttribute("flutuante");
|
|
2828
|
+
}
|
|
2829
|
+
set flutuante(e) {
|
|
2830
|
+
!!e !== this.hasAttribute("flutuante") && this.alternarFlutuante();
|
|
2831
|
+
}
|
|
2832
|
+
get colapsado() {
|
|
2833
|
+
return this.hasAttribute("colapsado");
|
|
2834
|
+
}
|
|
2835
|
+
set colapsado(e) {
|
|
2836
|
+
!!e !== this.hasAttribute("colapsado") && this.alternarColapsoHorizontal();
|
|
2837
|
+
}
|
|
2838
|
+
alternarFlutuante() {
|
|
2839
|
+
this._sincronizandoFlutuante = !0;
|
|
2840
|
+
try {
|
|
2841
|
+
const e = qt(this);
|
|
2842
|
+
return B(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-flutuante-alterado", {
|
|
2843
|
+
bubbles: !0,
|
|
2844
|
+
composed: !0,
|
|
2845
|
+
detail: {
|
|
2846
|
+
flutuante: e,
|
|
2847
|
+
left: this.style.left,
|
|
2848
|
+
top: this.style.top,
|
|
2849
|
+
width: this.style.width,
|
|
2850
|
+
height: this.style.height
|
|
2851
|
+
}
|
|
2852
|
+
})), e;
|
|
2853
|
+
} finally {
|
|
2854
|
+
this._sincronizandoFlutuante = !1;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
alternarColapsoHorizontal() {
|
|
2858
|
+
const e = this.hasAttribute("colapsado");
|
|
2859
|
+
e ? this.removeAttribute("colapsado") : this.setAttribute("colapsado", "");
|
|
2860
|
+
const i = !e;
|
|
2861
|
+
return B(this.shadow, this), this.dispatchEvent(new CustomEvent("ui-colapso-horizontal", {
|
|
2862
|
+
bubbles: !0,
|
|
2863
|
+
composed: !0,
|
|
2864
|
+
detail: { colapsado: i }
|
|
2865
|
+
})), i;
|
|
2866
|
+
}
|
|
2867
|
+
syncState() {
|
|
2868
|
+
B(this.shadow, this);
|
|
2869
|
+
const e = this.getAttribute("largura-rotulo");
|
|
2870
|
+
if (e) {
|
|
2871
|
+
const i = parseFloat(e);
|
|
2872
|
+
isNaN(i) || (this._larguraRotuloPorcentagem = this.controladorSplitter.definirLarguraRotulo(i));
|
|
2873
|
+
}
|
|
2874
|
+
this.renderSeletorTipos(), this.renderCategorias();
|
|
2875
|
+
}
|
|
2876
|
+
toggleExpandirTodas() {
|
|
2877
|
+
this._categorias.some((i) => i.aberto !== void 0 ? i.aberto === !1 : i.aberta === !1) ? this.expandirTudo() : this.colapsarTudo();
|
|
2878
|
+
}
|
|
2879
|
+
renderSeletorTipos() {
|
|
2880
|
+
Rt({
|
|
2881
|
+
tipoContainerElement: this.tipoContainerElement,
|
|
2882
|
+
tipos: this._tipos,
|
|
2883
|
+
tipoSelecionadoId: this._tipoSelecionadoId,
|
|
2884
|
+
estiloVisual: this.getAttribute("estilo-visual") || "autocad",
|
|
2885
|
+
onSelecionarTipo: (e) => {
|
|
2886
|
+
this._tipoSelecionadoId = e, this.renderSeletorTipos();
|
|
2887
|
+
const i = this._tipos.find((o) => o && String(o.id) === String(e));
|
|
2888
|
+
this.dispatchEvent(new CustomEvent("ui-tipo-alterado", { bubbles: !0, composed: !0, detail: { id: e, tipo: i } }));
|
|
2889
|
+
},
|
|
2890
|
+
onEditarTipo: (e) => this.dispatchEvent(new CustomEvent("ui-editar-tipo-clique", { bubbles: !0, composed: !0, detail: { tipo: e } })),
|
|
2891
|
+
onQuickSelect: (e) => this.dispatchEvent(new CustomEvent("ui-quick-select", { bubbles: !0, composed: !0, detail: { tipo: e } })),
|
|
2892
|
+
onSelectObjects: (e) => this.dispatchEvent(new CustomEvent("ui-selecionar-objetos", { bubbles: !0, composed: !0, detail: { tipo: e } })),
|
|
2893
|
+
onCalculadora: (e) => this.dispatchEvent(new CustomEvent("ui-calculadora", { bubbles: !0, composed: !0, detail: { tipo: e } }))
|
|
2894
|
+
});
|
|
2895
|
+
}
|
|
2896
|
+
renderCategorias() {
|
|
2897
|
+
const e = this.shadow.getElementById("lista-categorias");
|
|
2898
|
+
e && Pt({
|
|
2899
|
+
listaContainer: e,
|
|
2900
|
+
categorias: this._categorias,
|
|
2901
|
+
termoBusca: this._termoBusca,
|
|
2902
|
+
onToggleCategoria: (i) => this.toggleCategoria(i),
|
|
2903
|
+
linhaCtx: {
|
|
2904
|
+
valoresAtuais: this.gerenciadorValores.getValores(),
|
|
2905
|
+
valoresOriginais: this.gerenciadorValores.getValoresOriginais(),
|
|
2906
|
+
onAtualizarCampoVisual: (i, o) => he(this.shadow, i, o),
|
|
2907
|
+
editorCtx: {
|
|
2908
|
+
obterValorAtual: (i) => this.gerenciadorValores.obterValor(i),
|
|
2909
|
+
registrarAlteracao: (i, o, a) => {
|
|
2910
|
+
this.gerenciadorValores.registrarAlteracao(i, o, a);
|
|
2911
|
+
},
|
|
2912
|
+
focarProximoEditor: (i) => mt(this.shadow, i),
|
|
2913
|
+
focarEditorAnterior: (i) => ft(this.shadow, i),
|
|
2914
|
+
obterTextoMisto: () => this.textoMisto,
|
|
2915
|
+
despacharEventoAcao: (i, o) => {
|
|
2916
|
+
this.dispatchEvent(
|
|
2917
|
+
new CustomEvent("ui-acao-clique", {
|
|
2918
|
+
bubbles: !0,
|
|
2919
|
+
composed: !0,
|
|
2920
|
+
detail: { id: i.id, categoriaId: o, propriedade: i }
|
|
2921
|
+
})
|
|
2922
|
+
);
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
});
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
class Xt extends oe {
|
|
2930
|
+
}
|
|
2931
|
+
class Kt extends oe {
|
|
2932
|
+
}
|
|
2933
|
+
V("ui-tabela-propriedades", oe);
|
|
2934
|
+
V("ui-painel-propriedades", Xt);
|
|
2935
|
+
V("ui-propriedades", Kt);
|
|
2936
|
+
export {
|
|
2937
|
+
G as $,
|
|
2938
|
+
kt as A,
|
|
2939
|
+
Et as B,
|
|
2940
|
+
At as C,
|
|
2941
|
+
zt as D,
|
|
2942
|
+
Dt as E,
|
|
2943
|
+
Ft as F,
|
|
2944
|
+
Ut as G,
|
|
2945
|
+
Je as H,
|
|
2946
|
+
Ze as I,
|
|
2947
|
+
Ye as J,
|
|
2948
|
+
Qe as K,
|
|
2949
|
+
Ke as L,
|
|
2950
|
+
gt as M,
|
|
2951
|
+
ft as N,
|
|
2952
|
+
bt as O,
|
|
2953
|
+
mt as P,
|
|
2954
|
+
be as Q,
|
|
2955
|
+
ge as R,
|
|
2956
|
+
le as S,
|
|
2957
|
+
ee as T,
|
|
2958
|
+
Xt as U,
|
|
2959
|
+
J as V,
|
|
2960
|
+
ve as W,
|
|
2961
|
+
et as X,
|
|
2962
|
+
We as Y,
|
|
2963
|
+
ne as Z,
|
|
2964
|
+
S as _,
|
|
2965
|
+
Pe as a,
|
|
2966
|
+
Te as a0,
|
|
2967
|
+
q as a1,
|
|
2968
|
+
Ve as a2,
|
|
2969
|
+
U as a3,
|
|
2970
|
+
te as a4,
|
|
2971
|
+
yt as a5,
|
|
2972
|
+
tt as a6,
|
|
2973
|
+
jt as a7,
|
|
2974
|
+
Ue as a8,
|
|
2975
|
+
T as a9,
|
|
2976
|
+
Pt as aa,
|
|
2977
|
+
je as ab,
|
|
2978
|
+
He as ac,
|
|
2979
|
+
Rt as ad,
|
|
2980
|
+
xe as ae,
|
|
2981
|
+
B as af,
|
|
2982
|
+
H as ag,
|
|
2983
|
+
D as ah,
|
|
2984
|
+
rt as ai,
|
|
2985
|
+
_t as aj,
|
|
2986
|
+
X as ak,
|
|
2987
|
+
O as al,
|
|
2988
|
+
Le as b,
|
|
2989
|
+
De as c,
|
|
2990
|
+
Kt as d,
|
|
2991
|
+
ut as e,
|
|
2992
|
+
oe as f,
|
|
2993
|
+
Ge as g,
|
|
2994
|
+
xt as h,
|
|
2995
|
+
Re as i,
|
|
2996
|
+
qt as j,
|
|
2997
|
+
K as k,
|
|
2998
|
+
Ie as l,
|
|
2999
|
+
he as m,
|
|
3000
|
+
W as n,
|
|
3001
|
+
_e as o,
|
|
3002
|
+
vt as p,
|
|
3003
|
+
er as q,
|
|
3004
|
+
$t as r,
|
|
3005
|
+
Wt as s,
|
|
3006
|
+
Bt as t,
|
|
3007
|
+
Ct as u,
|
|
3008
|
+
wt as v,
|
|
3009
|
+
Nt as w,
|
|
3010
|
+
Tt as x,
|
|
3011
|
+
St as y,
|
|
3012
|
+
Lt as z
|
|
3013
|
+
};
|