@thibezer/ui-components-kit 2.17.1 → 2.17.3

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