@thibezer/ui-components-kit 2.17.0 → 2.17.2

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