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