@aintela/bi 0.2.0

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 (175) hide show
  1. package/README.md +299 -0
  2. package/dist/BiClientProvider-CWJochvi.js +219 -0
  3. package/dist/BiClientProvider-CWJochvi.js.map +1 -0
  4. package/dist/ChartCardDefaultsContext-Cl5T25H0.js +32 -0
  5. package/dist/ChartCardDefaultsContext-Cl5T25H0.js.map +1 -0
  6. package/dist/ChartContext-C_f_6khG.js +14 -0
  7. package/dist/ChartContext-C_f_6khG.js.map +1 -0
  8. package/dist/DashboardParametersContext-Clv--79U.js +39 -0
  9. package/dist/DashboardParametersContext-Clv--79U.js.map +1 -0
  10. package/dist/cards/ChartCard.d.ts +62 -0
  11. package/dist/cards/DataTableCard.d.ts +55 -0
  12. package/dist/cards/GaugeCard.d.ts +20 -0
  13. package/dist/cards/GaugeGroup.d.ts +12 -0
  14. package/dist/cards/MapBubbles.d.ts +35 -0
  15. package/dist/cards/MapConnections.d.ts +28 -0
  16. package/dist/cards/MetricCard.d.ts +15 -0
  17. package/dist/cards/MetricGroupCard.d.ts +10 -0
  18. package/dist/cards/TreeMapCard.d.ts +15 -0
  19. package/dist/cards/geoLayers.d.ts +23 -0
  20. package/dist/cards/index.d.ts +24 -0
  21. package/dist/cards/licenseGuard.d.ts +9 -0
  22. package/dist/cards/mapUtils.d.ts +23 -0
  23. package/dist/cards/useContainerRectangle.d.ts +9 -0
  24. package/dist/cards/worldMapPath.d.ts +7 -0
  25. package/dist/cards.d.ts +2 -0
  26. package/dist/cards.js +28 -0
  27. package/dist/cards.js.map +1 -0
  28. package/dist/client/BiClient.d.ts +160 -0
  29. package/dist/client/BiClientProvider.d.ts +21 -0
  30. package/dist/client/index.d.ts +4 -0
  31. package/dist/client.d.ts +2 -0
  32. package/dist/client.js +11 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/composer/environment/environmentDom.d.ts +31 -0
  35. package/dist/composer/environment/types.d.ts +67 -0
  36. package/dist/composer/icons/cardTypeIcons.d.ts +31 -0
  37. package/dist/composer/index.d.ts +66 -0
  38. package/dist/composer/llm/ExampleCardSketch.d.ts +22 -0
  39. package/dist/composer/llm/ExamplePad.d.ts +18 -0
  40. package/dist/composer/llm/PrototypePad.d.ts +13 -0
  41. package/dist/composer/llm/useDashboardPad.d.ts +25 -0
  42. package/dist/composer/models/catalog.d.ts +33 -0
  43. package/dist/composer/models/sketchModels.d.ts +102 -0
  44. package/dist/composer/models/utils.d.ts +9 -0
  45. package/dist/composer/pad/CardSketch.d.ts +25 -0
  46. package/dist/composer/pad/ClonedComponent.d.ts +13 -0
  47. package/dist/composer/pad/DashboardPad.d.ts +38 -0
  48. package/dist/composer/pad/DashboardPadEditor.d.ts +35 -0
  49. package/dist/composer/pad/DashboardPadSketch.d.ts +31 -0
  50. package/dist/composer/pad/DatasetParameterizationControls.d.ts +34 -0
  51. package/dist/composer/pad/FilterSketch.d.ts +10 -0
  52. package/dist/composer/pad/HoverButton.d.ts +12 -0
  53. package/dist/composer/pad/TitleSketch.d.ts +19 -0
  54. package/dist/composer/pad/ToolBox.d.ts +11 -0
  55. package/dist/composer/store/ComposerProvider.d.ts +36 -0
  56. package/dist/composer/store/createComposerStore.d.ts +107 -0
  57. package/dist/composer/store/drafts.d.ts +20 -0
  58. package/dist/composer/view/ComposerChatBinding.d.ts +10 -0
  59. package/dist/composer/view/ComposerView.d.ts +49 -0
  60. package/dist/composer/view/DashboardPin.d.ts +3 -0
  61. package/dist/composer/view/DashboardSidePanel.d.ts +10 -0
  62. package/dist/composer/view/DrawablePrompt.d.ts +22 -0
  63. package/dist/composer/view/EntryEmptyState.d.ts +22 -0
  64. package/dist/composer/view/SpotlightOverlay.d.ts +21 -0
  65. package/dist/composer/view/composerAnimations.d.ts +11 -0
  66. package/dist/composer/view/composerTypes.d.ts +18 -0
  67. package/dist/composer/view/data/suggestions.d.ts +10 -0
  68. package/dist/composer/view/data/templates.d.ts +33 -0
  69. package/dist/composer/view/surfaces.d.ts +19 -0
  70. package/dist/composer/view/useComposerChatBridge.d.ts +43 -0
  71. package/dist/composer.d.ts +2 -0
  72. package/dist/composer.js +99 -0
  73. package/dist/composer.js.map +1 -0
  74. package/dist/createBiTheme-TyUv_UHM.js +93 -0
  75. package/dist/createBiTheme-TyUv_UHM.js.map +1 -0
  76. package/dist/data/ChartCardDefaultsContext.d.ts +43 -0
  77. package/dist/data/dataUtils.d.ts +152 -0
  78. package/dist/data/index.d.ts +5 -0
  79. package/dist/data/queryModel.d.ts +23 -0
  80. package/dist/data.d.ts +2 -0
  81. package/dist/data.js +37 -0
  82. package/dist/data.js.map +1 -0
  83. package/dist/dataUtils-CAUE5uZY.js +372 -0
  84. package/dist/dataUtils-CAUE5uZY.js.map +1 -0
  85. package/dist/filters/VizAutoComplete.d.ts +23 -0
  86. package/dist/filters/VizDatePicker.d.ts +9 -0
  87. package/dist/filters/VizDateRangePicker.d.ts +14 -0
  88. package/dist/filters/VizSelect.d.ts +12 -0
  89. package/dist/filters/VizTextField.d.ts +8 -0
  90. package/dist/filters/VizTriggerButton.d.ts +9 -0
  91. package/dist/filters/filterFactory.d.ts +30 -0
  92. package/dist/filters/friendlyName.d.ts +4 -0
  93. package/dist/filters/index.d.ts +15 -0
  94. package/dist/filters.d.ts +2 -0
  95. package/dist/filters.js +15 -0
  96. package/dist/filters.js.map +1 -0
  97. package/dist/grid/BiErrorBoundary.d.ts +24 -0
  98. package/dist/grid/ChartContext.d.ts +14 -0
  99. package/dist/grid/GridCard.d.ts +45 -0
  100. package/dist/grid/GridCardPlaceHolder.d.ts +8 -0
  101. package/dist/grid/GridLayout.d.ts +147 -0
  102. package/dist/grid/gridModels.d.ts +33 -0
  103. package/dist/grid/index.d.ts +14 -0
  104. package/dist/grid/types.d.ts +23 -0
  105. package/dist/grid/useGridConfigTranslator.d.ts +72 -0
  106. package/dist/grid.d.ts +2 -0
  107. package/dist/grid.js +20 -0
  108. package/dist/grid.js.map +1 -0
  109. package/dist/hooks/DashboardParametersContext.d.ts +32 -0
  110. package/dist/hooks/index.d.ts +8 -0
  111. package/dist/hooks/useDashboardData.d.ts +20 -0
  112. package/dist/hooks/useDashboardLazyData.d.ts +79 -0
  113. package/dist/hooks.d.ts +2 -0
  114. package/dist/hooks.js +16 -0
  115. package/dist/hooks.js.map +1 -0
  116. package/dist/index-BYc79sSy.js +131 -0
  117. package/dist/index-BYc79sSy.js.map +1 -0
  118. package/dist/index-C6JQ6770.js +4545 -0
  119. package/dist/index-C6JQ6770.js.map +1 -0
  120. package/dist/index-CZbCaXMC.js +15 -0
  121. package/dist/index-CZbCaXMC.js.map +1 -0
  122. package/dist/index-D3OoOPjl.js +259 -0
  123. package/dist/index-D3OoOPjl.js.map +1 -0
  124. package/dist/index-D7Oo_dC-.js +94 -0
  125. package/dist/index-D7Oo_dC-.js.map +1 -0
  126. package/dist/index-D7tVPX8d.js +347 -0
  127. package/dist/index-D7tVPX8d.js.map +1 -0
  128. package/dist/index-DGyvUtY3.js +494 -0
  129. package/dist/index-DGyvUtY3.js.map +1 -0
  130. package/dist/index-DOpx0R4Y.js +41 -0
  131. package/dist/index-DOpx0R4Y.js.map +1 -0
  132. package/dist/index-wtSLspPh.js +1065 -0
  133. package/dist/index-wtSLspPh.js.map +1 -0
  134. package/dist/index.d.ts +12 -0
  135. package/dist/index.js +236 -0
  136. package/dist/index.js.map +1 -0
  137. package/dist/inline/Chart.d.ts +29 -0
  138. package/dist/inline/IFrame.d.ts +19 -0
  139. package/dist/inline/Metric.d.ts +16 -0
  140. package/dist/inline/MetricGroup.d.ts +11 -0
  141. package/dist/inline/index.d.ts +9 -0
  142. package/dist/inline/parseKnownNumbers.d.ts +11 -0
  143. package/dist/inline.d.ts +2 -0
  144. package/dist/inline.js +9 -0
  145. package/dist/inline.js.map +1 -0
  146. package/dist/runtime/IDashboardDefinition.d.ts +22 -0
  147. package/dist/runtime/biModuleSurface.d.ts +2 -0
  148. package/dist/runtime/createBiUiTools.d.ts +74 -0
  149. package/dist/runtime/index.d.ts +9 -0
  150. package/dist/runtime/loadDashboardBundle.d.ts +32 -0
  151. package/dist/runtime/registerBiModules.d.ts +36 -0
  152. package/dist/runtime/version.d.ts +6 -0
  153. package/dist/runtime.d.ts +2 -0
  154. package/dist/runtime.js +19 -0
  155. package/dist/runtime.js.map +1 -0
  156. package/dist/style.css +1 -0
  157. package/dist/theme/BiThemeBridge.d.ts +32 -0
  158. package/dist/theme/biPalette.d.ts +23 -0
  159. package/dist/theme/createBiTheme.d.ts +25 -0
  160. package/dist/theme/index.d.ts +5 -0
  161. package/dist/theme.d.ts +2 -0
  162. package/dist/theme.js +15 -0
  163. package/dist/theme.js.map +1 -0
  164. package/dist/version-DnqajORq.js +83 -0
  165. package/dist/version-DnqajORq.js.map +1 -0
  166. package/dist/viewer/ScriptDashboardViewer.d.ts +82 -0
  167. package/dist/viewer/ScriptDashboardViewerVertical.d.ts +24 -0
  168. package/dist/viewer/cardMetadata.d.ts +15 -0
  169. package/dist/viewer/index.d.ts +8 -0
  170. package/dist/viewer/models.d.ts +67 -0
  171. package/dist/viewer/useDashboardBundle.d.ts +73 -0
  172. package/dist/viewer.d.ts +2 -0
  173. package/dist/viewer.js +9 -0
  174. package/dist/viewer.js.map +1 -0
  175. package/package.json +196 -0
@@ -0,0 +1,347 @@
1
+ var X = Object.defineProperty;
2
+ var l = (e, a) => X(e, "name", { value: a, configurable: !0 });
3
+ import { jsxs as b, jsx as r } from "react/jsx-runtime";
4
+ import R, { useState as D, useMemo as _, useEffect as Y, createElement as Z, useRef as p } from "react";
5
+ import { Stack as M, CircularProgress as L, Chip as $, Typography as S, Autocomplete as ee, Box as j, TextField as q, MenuItem as A, FormControl as ae, InputLabel as te, Select as ne, Button as le, Tooltip as re } from "@mui/material";
6
+ import { u as F } from "./DashboardParametersContext-Clv--79U.js";
7
+ import { a as ie } from "./BiClientProvider-CWJochvi.js";
8
+ import { DatePicker as oe } from "@mui/x-date-pickers/DatePicker";
9
+ import z from "dayjs";
10
+ import { DateRangePicker as ce } from "@mui/x-date-pickers-pro/DateRangePicker";
11
+ import { SaveAlt as me, ErrorOutline as se } from "@mui/icons-material";
12
+ function V(e) {
13
+ if (!e) return "";
14
+ const a = e.split("_");
15
+ return a[0] && (a[0] = `${a[0][0].toLocaleUpperCase()}${a[0].slice(1)}`), a.join(" ");
16
+ }
17
+ l(V, "getFriendlyName");
18
+ let T = 0;
19
+ function W() {
20
+ return T += 1, `bi-filter-${T}`;
21
+ }
22
+ l(W, "nextFilterId");
23
+ const de = `
24
+ Este componente necessita que você gere um datasource com a query para selecionar os valores.
25
+ Crie um datasource utilizando no parametro clientId o id(i) deste filtro para que o componente possa utilizá-lo. Neste datasource você não precisa enviar parametros, uma vez que o sistema executará a query sem enviar qualquer definição de parametros
26
+ Sua query deve retornar os campos {{filterName}} e {{filterName}}_display, um para ser enviado efetivamente para as queries do dashboard e o outro para apresentar para o usuário na listagem do auto complete.
27
+ `;
28
+ function ue(e) {
29
+ var t;
30
+ const a = [];
31
+ for (const n of e.rows) {
32
+ const c = {};
33
+ for (let i = 0; i < e.headers.length; i++)
34
+ c[e.headers[i]] = ((t = n.values[i]) == null ? void 0 : t.v) ?? "";
35
+ a.push(c);
36
+ }
37
+ return a;
38
+ }
39
+ l(ue, "responseToRows");
40
+ const B = /* @__PURE__ */ l((e) => {
41
+ const [a, t] = D(null), [n, c] = D([]), [i, s] = D(e.options ?? null), [u, o] = D(!1), [f, h] = D(null), g = F(), C = ie(), v = _(() => e.id ?? W(), [e.id]), N = e.valueFieldName ?? e.displayFieldName, w = e.showAsText ?? !1, E = JSON.stringify(e.selectedValues ?? []);
42
+ Y(() => {
43
+ if (e.partial) return;
44
+ let m = !1;
45
+ const d = /* @__PURE__ */ l((x) => {
46
+ const y = e.selectedValues ?? [];
47
+ if (y.length === 0) return;
48
+ const P = x.filter((G) => y.some((H) => H === G[N]));
49
+ e.multipleSelection ? (c(P), t(null)) : (t(P[0] ?? null), c([]));
50
+ }, "applySelection");
51
+ if (e.options) {
52
+ s(e.options), d(e.options);
53
+ return;
54
+ }
55
+ if (!C) {
56
+ h("Error: BiClient não configurado");
57
+ return;
58
+ }
59
+ if (!e.dashboardId) {
60
+ h("Error: dashboardId ausente");
61
+ return;
62
+ }
63
+ return o(!0), h(null), C.getFilterOptions(e.dashboardId, v).then((x) => {
64
+ if (m) return;
65
+ if (!x) {
66
+ h("Error: Filtro não encontrado");
67
+ return;
68
+ }
69
+ const y = ue(x);
70
+ s(y), d(y);
71
+ }).catch((x) => {
72
+ m || h(String(x));
73
+ }).finally(() => {
74
+ m || o(!1);
75
+ }), () => {
76
+ m = !0;
77
+ };
78
+ }, [e.parameterName, E, e.partial, e.dashboardId, v, C, e.options]);
79
+ const K = /* @__PURE__ */ l((m) => {
80
+ var x;
81
+ let d = [];
82
+ if (m)
83
+ if (e.multipleSelection) {
84
+ const y = m;
85
+ c(y), d = y.map((P) => P[N]);
86
+ } else {
87
+ const y = m;
88
+ t(y), d = [y[N]];
89
+ }
90
+ else
91
+ t(null), c([]);
92
+ (x = e.onChange) == null || x.call(e, e.parameterName, d), g == null || g.setParameter(e.parameterName, d.length > 0 ? d : void 0);
93
+ }, "onChange"), Q = u ? "Loading..." : V(e.parameterName), I = e.multipleSelection ? n : a ? [a] : [];
94
+ return /* @__PURE__ */ b(M, { direction: "row", gap: 1, sx: { minWidth: w ? "unset" : "230px", display: "inline-flex", alignItems: "center" }, children: [
95
+ !w && u && /* @__PURE__ */ r(L, { size: 16 }),
96
+ w ? I.length > 0 ? /* @__PURE__ */ r(
97
+ $,
98
+ {
99
+ sx: { borderRadius: 1 },
100
+ label: /* @__PURE__ */ b(M, { direction: "row", gap: 1, children: [
101
+ /* @__PURE__ */ b(S, { variant: "body1", children: [
102
+ e.parameterName.replaceAll("_", " "),
103
+ ":"
104
+ ] }),
105
+ /* @__PURE__ */ r(S, { variant: "body1", children: I.map((m) => m[e.displayFieldName]).join(", ") })
106
+ ] })
107
+ }
108
+ ) : null : /* @__PURE__ */ r(
109
+ ee,
110
+ {
111
+ size: "small",
112
+ sx: { minWidth: "230px", maxWidth: "500px", flex: 1, "& .MuiInputBase-root": { flexWrap: "wrap" } },
113
+ disabled: e.partial,
114
+ id: v,
115
+ multiple: e.multipleSelection,
116
+ options: i ?? [],
117
+ value: e.multipleSelection ? n : a,
118
+ onChange: /* @__PURE__ */ l((m, d) => K(d), "onChange"),
119
+ getOptionLabel: /* @__PURE__ */ l((m) => m[e.displayFieldName] ?? m[Object.keys(m)[0]] ?? "", "getOptionLabel"),
120
+ renderInput: /* @__PURE__ */ l((m) => /* @__PURE__ */ r(q, { ...m, label: f || Q, placeholder: f || "...", multiline: !0 }), "renderInput"),
121
+ renderOption: /* @__PURE__ */ l((m, d) => /* @__PURE__ */ Z("li", { ...m, key: d[N] }, /* @__PURE__ */ b(j, { children: [
122
+ /* @__PURE__ */ r(S, { variant: "body2", sx: { fontWeight: 500 }, children: d[e.displayFieldName] ?? d[Object.keys(d)[1]] }),
123
+ /* @__PURE__ */ r(S, { variant: "caption", sx: { padding: 0, color: "text.secondary" }, children: d[N] ?? d[Object.keys(d)[0]] })
124
+ ] })), "renderOption"),
125
+ isOptionEqualToValue: /* @__PURE__ */ l((m, d) => (m[N] ?? m[Object.keys(m)[0]]) === (d[N] ?? d[Object.keys(d)[0]]), "isOptionEqualToValue"),
126
+ slotProps: { chip: { size: "small", color: "secondary", variant: "outlined" } }
127
+ },
128
+ v
129
+ )
130
+ ] });
131
+ }, "VizAutoComplete"), U = /* @__PURE__ */ l((e) => {
132
+ const a = F(), [t, n] = D(e.initialValue), c = /* @__PURE__ */ l((o, f) => {
133
+ var h;
134
+ (h = e.onChange) == null || h.call(e, o, f), a == null || a.setParameter(o, f);
135
+ }, "setParam");
136
+ if (Y(() => {
137
+ if (!e.initialValue) {
138
+ const o = (/* @__PURE__ */ new Date()).toISOString();
139
+ n(o), c(e.parameterName, o);
140
+ }
141
+ }, [e.parameterName, e.initialValue]), !e.onChange && !a) return null;
142
+ const i = /* @__PURE__ */ l((o) => {
143
+ const f = (o == null ? void 0 : o.toISOString()) ?? "";
144
+ n(f), c(e.parameterName, f);
145
+ }, "handleChange"), s = a == null ? void 0 : a.getParameter(e.parameterName), u = typeof s == "string" && s ? s : t;
146
+ return /* @__PURE__ */ r(
147
+ oe,
148
+ {
149
+ sx: { maxWidth: "150px" },
150
+ formatDensity: "dense",
151
+ label: V(e.parameterName),
152
+ slotProps: { textField: { size: "small" } },
153
+ value: z(u ?? /* @__PURE__ */ new Date()),
154
+ onChange: i
155
+ }
156
+ );
157
+ }, "VizDatePicker"), J = /* @__PURE__ */ l((e) => {
158
+ var f, h;
159
+ const a = F(), [t, n] = D(null), c = p(null), i = /* @__PURE__ */ l((g, C) => {
160
+ var v;
161
+ (v = e.onChange) == null || v.call(e, g, C), a == null || a.setParameter(g, C);
162
+ }, "setParam"), s = e.showAsText ?? !1, u = /* @__PURE__ */ l((g) => {
163
+ n(g), c.current = g;
164
+ }, "onChange"), o = /* @__PURE__ */ l(() => {
165
+ const g = c.current;
166
+ g && g[0] && g[1] && (i(e.parameterStartDateName, g[0].format("YYYY-MM-DD")), i(e.parameterEndDateName, g[1].format("YYYY-MM-DD")));
167
+ }, "onClose");
168
+ return Y(() => {
169
+ var w, E;
170
+ const g = Date.now(), C = e.initialStartValue || new Date(g - 1e3 * 3600 * 24 * 30).toISOString(), v = e.initialEndValue || (/* @__PURE__ */ new Date()).toISOString(), N = [z(C), z(v)];
171
+ n(N), c.current = N, i(e.parameterStartDateName, ((w = N[0]) == null ? void 0 : w.format("YYYY-MM-DD")) ?? ""), i(e.parameterEndDateName, ((E = N[1]) == null ? void 0 : E.format("YYYY-MM-DD")) ?? "");
172
+ }, [e.parameterEndDateName, e.parameterStartDateName, e.initialStartValue, e.initialEndValue]), !a && !e.onChange ? /* @__PURE__ */ r(S, { color: "error", children: "Não foi possível obter o dashboardContext" }) : t == null ? null : /* @__PURE__ */ r("div", { children: s ? /* @__PURE__ */ r(
173
+ $,
174
+ {
175
+ sx: { borderRadius: 1 },
176
+ label: /* @__PURE__ */ b(M, { direction: "row", gap: 1, children: [
177
+ /* @__PURE__ */ b(S, { variant: "body1", children: [
178
+ e.parameterStartDateName.replaceAll("_", " "),
179
+ ":"
180
+ ] }),
181
+ /* @__PURE__ */ r(S, { variant: "body1", children: (f = t[0]) == null ? void 0 : f.format("DD MMM YYYY").toLocaleUpperCase() }),
182
+ /* @__PURE__ */ r("span", { children: "-" }),
183
+ /* @__PURE__ */ b(S, { variant: "body1", children: [
184
+ e.parameterEndDateName.replaceAll("_", " "),
185
+ ":"
186
+ ] }),
187
+ /* @__PURE__ */ r(S, { variant: "body1", children: (h = t[1]) == null ? void 0 : h.format("DD MMM YYYY").toLocaleUpperCase() })
188
+ ] })
189
+ }
190
+ ) : /* @__PURE__ */ r(
191
+ ce,
192
+ {
193
+ disabled: e.partial,
194
+ sx: { maxWidth: "230px" },
195
+ closeOnSelect: !0,
196
+ format: "YYYY-MM-DD",
197
+ desktopModeMediaQuery: "@media (min-width: 720px)",
198
+ showDaysOutsideCurrentMonth: !0,
199
+ label: V(e.parameterStartDateName) + " - " + V(e.parameterEndDateName),
200
+ formatDensity: "dense",
201
+ slotProps: { textField: { size: "small" } },
202
+ value: t,
203
+ onChange: u,
204
+ onClose: o
205
+ },
206
+ e.id ?? e.parameterStartDateName + e.parameterEndDateName
207
+ ) });
208
+ }, "VizDateRangePicker"), fe = /* @__PURE__ */ l((e) => {
209
+ const [a, t] = D(""), n = F(), c = _(() => e.id ?? W(), [e.id]);
210
+ if (Y(() => {
211
+ const o = n == null ? void 0 : n.getParameter(e.parameterName);
212
+ t((typeof o == "string" ? o : void 0) ?? e.initialValue ?? "");
213
+ }, [e.parameterName]), !n && !e.onChange) return null;
214
+ const i = /* @__PURE__ */ l((o) => {
215
+ var f;
216
+ t(o), (f = e.onChange) == null || f.call(e, e.parameterName, o), n == null || n.setParameter(e.parameterName, o);
217
+ }, "onChange"), s = R.Children.map(e.children, (o, f) => {
218
+ if (R.isValidElement(o) && o.type === "option") {
219
+ const h = o.props;
220
+ return /* @__PURE__ */ r(A, { value: h.value ?? "", children: h.children }, h.value ?? f);
221
+ }
222
+ return o;
223
+ }), u = V(e.parameterName);
224
+ return /* @__PURE__ */ b(ae, { size: "small", sx: { minWidth: 160 }, children: [
225
+ /* @__PURE__ */ r(te, { id: `${c}-label`, children: u }),
226
+ /* @__PURE__ */ b(ne, { labelId: `${c}-label`, id: c, label: u, value: a, onChange: /* @__PURE__ */ l((o) => i(String(o.target.value)), "onChange"), children: [
227
+ /* @__PURE__ */ r(A, { value: "None", children: u }),
228
+ s
229
+ ] })
230
+ ] });
231
+ }, "VizSelect"), ge = /* @__PURE__ */ l((e) => {
232
+ const [a, t] = D(null), n = F();
233
+ if (Y(() => {
234
+ t(e.initialValue);
235
+ }, [e.parameterName]), !n && !e.onChange || a == null) return null;
236
+ const c = /* @__PURE__ */ l((i) => {
237
+ var s;
238
+ t(i), (s = e.onChange) == null || s.call(e, e.parameterName, i), n == null || n.setParameter(e.parameterName, i);
239
+ }, "onChange");
240
+ return /* @__PURE__ */ r(q, { label: V(e.parameterName), size: "small", value: a, onChange: /* @__PURE__ */ l((i) => c(i.target.value), "onChange") });
241
+ }, "VizTextField"), he = /* @__PURE__ */ l((e) => {
242
+ const [a, t] = D(!1), [n, c] = D(null);
243
+ return /* @__PURE__ */ r(le, { onClick: /* @__PURE__ */ l(() => {
244
+ c(null);
245
+ const s = e.onTrigger();
246
+ s && typeof s.then == "function" && (t(!0), s.catch((u) => c("Exception: " + String(u))).finally(() => t(!1)));
247
+ }, "onClick"), size: "small", fullWidth: !1, disabled: a, sx: { maxWidth: "200px" }, children: /* @__PURE__ */ b(M, { direction: "row", gap: 0.5, children: [
248
+ /* @__PURE__ */ r(S, { children: a ? "Loading" : e.text ?? "Filtrar" }),
249
+ a ? /* @__PURE__ */ r(L, { size: "1.5rem", color: "primary" }) : /* @__PURE__ */ r(me, { sx: { ml: 1 }, fontSize: "small" }),
250
+ !!n && /* @__PURE__ */ r(re, { title: n, children: /* @__PURE__ */ r(se, { sx: { ml: 1, color: "error.main" }, fontSize: "small" }) })
251
+ ] }) });
252
+ }, "VizTriggerButton"), k = "_fim", O = "_inicio", Ne = /* @__PURE__ */ l((e) => e.normalize("NFD").replace(/[̀-ͯ]/g, ""), "stripDiacritics");
253
+ function ye(e, a, t = {}) {
254
+ const n = Ne(a.name), c = n.toLocaleLowerCase();
255
+ let i;
256
+ const s = {};
257
+ for (const u of Object.keys(t.parameters ?? {}))
258
+ s[u.toLowerCase()] = t.parameters[u];
259
+ switch (a.filterType) {
260
+ case "AutoComplete": {
261
+ let u = s[c] ?? [];
262
+ Array.isArray(u) || (u = [u]), i = /* @__PURE__ */ r(
263
+ B,
264
+ {
265
+ partial: t.partial,
266
+ showAsText: t.readonly,
267
+ dashboardId: e,
268
+ id: a.i,
269
+ selectedValues: u,
270
+ multipleSelection: a.multipleSelection ?? !0,
271
+ parameterName: n,
272
+ valueFieldName: a.name,
273
+ displayFieldName: `${n}_display`,
274
+ onChange: t.onChange
275
+ },
276
+ a.i
277
+ );
278
+ break;
279
+ }
280
+ case "DateRangePicker":
281
+ i = /* @__PURE__ */ r(
282
+ J,
283
+ {
284
+ showAsText: t.readonly,
285
+ partial: t.partial,
286
+ id: a.i,
287
+ initialStartValue: s[`${c}${O}`],
288
+ initialEndValue: s[`${c}${k}`],
289
+ parameterStartDateName: `${n}${O}`,
290
+ parameterEndDateName: `${n}${k}`,
291
+ onChange: t.onChange
292
+ },
293
+ a.i
294
+ );
295
+ break;
296
+ case "DatePicker":
297
+ i = /* @__PURE__ */ r(U, { parameterName: n, onChange: t.onChange }, a.i);
298
+ break;
299
+ default:
300
+ i = /* @__PURE__ */ b("div", { children: [
301
+ "Unsupported filter type: ",
302
+ a.filterType
303
+ ] });
304
+ }
305
+ return /* @__PURE__ */ r(
306
+ j,
307
+ {
308
+ className: "llm-env-target llm-env-filter llm-env-filter-generated",
309
+ "data-env-id": a.i,
310
+ "data-env-key": a.i,
311
+ "data-env-name": a.name,
312
+ "data-env-kind": "generated-filter",
313
+ children: i
314
+ },
315
+ a.i
316
+ );
317
+ }
318
+ l(ye, "createFilterComponent");
319
+ const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
320
+ __proto__: null,
321
+ AutoCompleteInstructions: de,
322
+ DateRangeFilterBeginSuffix: O,
323
+ DateRangeFilterEndSuffix: k,
324
+ VizAutoComplete: B,
325
+ VizDatePicker: U,
326
+ VizDateRangePicker: J,
327
+ VizSelect: fe,
328
+ VizTextField: ge,
329
+ VizTriggerButton: he,
330
+ createFilterComponent: ye,
331
+ getFriendlyName: V
332
+ }, Symbol.toStringTag, { value: "Module" }));
333
+ export {
334
+ de as A,
335
+ O as D,
336
+ Ee as F,
337
+ B as V,
338
+ k as a,
339
+ U as b,
340
+ J as c,
341
+ fe as d,
342
+ ge as e,
343
+ he as f,
344
+ ye as g,
345
+ V as h
346
+ };
347
+ //# sourceMappingURL=index-D7tVPX8d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-D7tVPX8d.js","sources":["../src/filters/friendlyName.ts","../src/filters/VizAutoComplete.tsx","../src/filters/VizDatePicker.tsx","../src/filters/VizDateRangePicker.tsx","../src/filters/VizSelect.tsx","../src/filters/VizTextField.tsx","../src/filters/VizTriggerButton.tsx","../src/filters/filterFactory.tsx"],"sourcesContent":["/** `data_inicio` → `Data inicio` — the label the filter components show. */\nexport function getFriendlyName(key: string): string {\n if (!key) return '';\n const parts = key.split('_');\n if (parts[0]) parts[0] = `${parts[0][0].toLocaleUpperCase()}${parts[0].slice(1)}`;\n return parts.join(' ');\n}\n\nlet counter = 0;\n/** Stable-enough id for an uncontrolled filter element. */\nexport function nextFilterId(): string {\n counter += 1;\n return `bi-filter-${counter}`;\n}\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { Autocomplete, Box, Chip, CircularProgress, Stack, TextField, Typography } from '@mui/material';\nimport type { IRow, QueryResult } from '../data/queryModel';\nimport { useDashboardParameters } from '../hooks/DashboardParametersContext';\nimport { useBiClientOptional } from '../client';\nimport { getFriendlyName, nextFilterId } from './friendlyName';\n\nexport interface VizAutoCompleteProps {\n /** Filter id — also the id of the data source that serves its options. */\n id?: string;\n multipleSelection: boolean;\n /** Render the current selection as a read-only chip (print preview). */\n showAsText?: boolean;\n parameterName: string;\n dashboardId: string;\n selectedValues?: string[];\n valueFieldName?: string;\n displayFieldName: string;\n /** Called on every change; the value is also pushed to `DashboardParametersContext` when one is mounted. */\n onChange?: (parameterName: string, value: string | string[]) => void;\n /** When true, skip loading the options (placeholder mode). */\n partial?: boolean;\n /** Options supplied directly — skips the server fetch. */\n options?: IRow[];\n}\n\nexport const AutoCompleteInstructions = `\nEste componente necessita que você gere um datasource com a query para selecionar os valores.\nCrie um datasource utilizando no parametro clientId o id(i) deste filtro para que o componente possa utilizá-lo. Neste datasource você não precisa enviar parametros, uma vez que o sistema executará a query sem enviar qualquer definição de parametros\nSua query deve retornar os campos {{filterName}} e {{filterName}}_display, um para ser enviado efetivamente para as queries do dashboard e o outro para apresentar para o usuário na listagem do auto complete.\n`;\n\nfunction responseToRows(result: QueryResult): IRow[] {\n const rows: IRow[] = [];\n for (const generatedRow of result.rows) {\n const row: IRow = {};\n for (let i = 0; i < result.headers.length; i++) {\n row[result.headers[i]] = generatedRow.values[i]?.v ?? '';\n }\n rows.push(row);\n }\n return rows;\n}\n\nexport const VizAutoComplete: React.FC<VizAutoCompleteProps> = (props) => {\n const [selectedValue, setSelectedValue] = useState<IRow | null>(null);\n const [selectedValues, setSelectedValues] = useState<IRow[]>([]);\n const [allRows, setAllRows] = useState<IRow[] | null>(props.options ?? null);\n const [loading, setLoading] = useState(false);\n const [loadingError, setLoadingError] = useState<string | null>(null);\n const dashContext = useDashboardParameters();\n const client = useBiClientOptional();\n const calcId = useMemo(() => props.id ?? nextFilterId(), [props.id]);\n\n const calcValueFieldName = props.valueFieldName ?? props.displayFieldName;\n const showAsText = props.showAsText ?? false;\n const selectedKey = JSON.stringify(props.selectedValues ?? []);\n\n useEffect(() => {\n if (props.partial) return;\n let cancelled = false;\n\n const applySelection = (rows: IRow[]) => {\n const wanted = props.selectedValues ?? [];\n if (wanted.length === 0) return;\n const related = rows.filter((r) => wanted.some((v) => v === r[calcValueFieldName]));\n if (props.multipleSelection) {\n setSelectedValues(related);\n setSelectedValue(null);\n } else {\n setSelectedValue(related[0] ?? null);\n setSelectedValues([]);\n }\n };\n\n if (props.options) {\n setAllRows(props.options);\n applySelection(props.options);\n return;\n }\n if (!client) {\n setLoadingError('Error: BiClient não configurado');\n return;\n }\n if (!props.dashboardId) {\n setLoadingError('Error: dashboardId ausente');\n return;\n }\n\n setLoading(true);\n setLoadingError(null);\n client\n .getFilterOptions<QueryResult>(props.dashboardId, calcId)\n .then((json) => {\n if (cancelled) return;\n if (!json) {\n setLoadingError('Error: Filtro não encontrado');\n return;\n }\n const converted = responseToRows(json);\n setAllRows(converted);\n applySelection(converted);\n })\n .catch((error) => {\n if (!cancelled) setLoadingError(String(error));\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n\n return () => {\n cancelled = true;\n };\n }, [props.parameterName, selectedKey, props.partial, props.dashboardId, calcId, client, props.options]);\n\n const onChange = (value: IRow | IRow[] | null) => {\n let valueList: string[] = [];\n if (value) {\n if (props.multipleSelection) {\n const valueRows = value as IRow[];\n setSelectedValues(valueRows);\n valueList = valueRows.map((r) => r[calcValueFieldName]);\n } else {\n const valueRow = value as IRow;\n setSelectedValue(valueRow);\n valueList = [valueRow[calcValueFieldName]];\n }\n } else {\n setSelectedValue(null);\n setSelectedValues([]);\n }\n props.onChange?.(props.parameterName, valueList);\n dashContext?.setParameter(props.parameterName, valueList.length > 0 ? valueList : undefined);\n };\n\n const name = loading ? 'Loading...' : getFriendlyName(props.parameterName);\n const toPrintValues = props.multipleSelection ? selectedValues : selectedValue ? [selectedValue] : [];\n\n return (\n <Stack direction=\"row\" gap={1} sx={{ minWidth: showAsText ? 'unset' : '230px', display: 'inline-flex', alignItems: 'center' }}>\n {!showAsText && loading && <CircularProgress size={16} />}\n {showAsText ? (\n toPrintValues.length > 0 ? (\n <Chip\n sx={{ borderRadius: 1 }}\n label={\n <Stack direction=\"row\" gap={1}>\n <Typography variant=\"body1\">{props.parameterName.replaceAll('_', ' ')}:</Typography>\n <Typography variant=\"body1\">{toPrintValues.map((r) => r[props.displayFieldName]).join(', ')}</Typography>\n </Stack>\n }\n />\n ) : null\n ) : (\n <Autocomplete\n key={calcId}\n size=\"small\"\n sx={{ minWidth: '230px', maxWidth: '500px', flex: 1, '& .MuiInputBase-root': { flexWrap: 'wrap' } }}\n disabled={props.partial}\n id={calcId}\n multiple={props.multipleSelection}\n options={allRows ?? []}\n value={(props.multipleSelection ? selectedValues : selectedValue) as any}\n onChange={(_, value) => onChange(value as IRow | IRow[] | null)}\n getOptionLabel={(option: IRow) => option[props.displayFieldName] ?? option[Object.keys(option)[0]] ?? ''}\n renderInput={(params) => (\n <TextField {...params} label={loadingError ? loadingError : name} placeholder={loadingError ? loadingError : '...'} multiline />\n )}\n renderOption={(localProps, option: IRow) => (\n <li {...localProps} key={option[calcValueFieldName]}>\n <Box>\n <Typography variant=\"body2\" sx={{ fontWeight: 500 }}>\n {option[props.displayFieldName] ?? option[Object.keys(option)[1]]}\n </Typography>\n <Typography variant=\"caption\" sx={{ padding: 0, color: 'text.secondary' }}>\n {option[calcValueFieldName] ?? option[Object.keys(option)[0]]}\n </Typography>\n </Box>\n </li>\n )}\n isOptionEqualToValue={(option: IRow, value: IRow) =>\n (option[calcValueFieldName] ?? option[Object.keys(option)[0]]) === (value[calcValueFieldName] ?? value[Object.keys(value)[0]])\n }\n slotProps={{ chip: { size: 'small', color: 'secondary', variant: 'outlined' } }}\n />\n )}\n </Stack>\n );\n};\n\nexport default VizAutoComplete;\n","import React, { useEffect, useState } from 'react';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport dayjs from 'dayjs';\nimport { useDashboardParameters } from '../hooks/DashboardParametersContext';\nimport { getFriendlyName } from './friendlyName';\n\nexport interface VizDatePickerProps {\n initialValue?: string;\n parameterName: string;\n onChange?: (parameterName: string, value: string) => void;\n}\n\n/** Single-date filter. Requires the host to mount `@mui/x-date-pickers`' `LocalizationProvider`. */\nexport const VizDatePicker: React.FC<VizDatePickerProps> = (props) => {\n const dashContext = useDashboardParameters();\n const [localValue, setLocalValue] = useState<string | undefined>(props.initialValue);\n\n const setParam = (key: string, value: string) => {\n props.onChange?.(key, value);\n dashContext?.setParameter(key, value);\n };\n\n useEffect(() => {\n if (!props.initialValue) {\n const today = new Date().toISOString();\n setLocalValue(today);\n setParam(props.parameterName, today);\n }\n }, [props.parameterName, props.initialValue]);\n\n if (!props.onChange && !dashContext) return null;\n\n const handleChange = (value: dayjs.Dayjs | null) => {\n const str = value?.toISOString() ?? '';\n setLocalValue(str);\n setParam(props.parameterName, str);\n };\n\n const current = dashContext?.getParameter(props.parameterName);\n const value = typeof current === 'string' && current ? current : localValue;\n\n return (\n <DatePicker\n sx={{ maxWidth: '150px' }}\n formatDensity=\"dense\"\n label={getFriendlyName(props.parameterName)}\n slotProps={{ textField: { size: 'small' } }}\n value={dayjs(value ?? new Date())}\n onChange={handleChange}\n />\n );\n};\n\nexport default VizDatePicker;\n","import React, { useEffect, useRef, useState } from 'react';\nimport { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';\nimport dayjs from 'dayjs';\nimport { Chip, Stack, Typography } from '@mui/material';\nimport { useDashboardParameters } from '../hooks/DashboardParametersContext';\nimport { getFriendlyName } from './friendlyName';\n\nexport interface VizDateRangePickerProps {\n id?: string;\n showAsText?: boolean;\n initialStartValue?: string;\n initialEndValue?: string;\n parameterStartDateName: string;\n parameterEndDateName: string;\n partial?: boolean;\n onChange?: (parameterName: string, value: string) => void;\n}\n\ntype Range = [dayjs.Dayjs | null, dayjs.Dayjs | null];\n\n/** Date-range filter (MUI X Pro). Requires the host's `LocalizationProvider`. */\nexport const VizDateRangePicker: React.FC<VizDateRangePickerProps> = (props) => {\n const dashContext = useDashboardParameters();\n const [dateRangeValue, setDateRangeValue] = useState<Range | null>(null);\n const dateRangeRef = useRef<Range | null>(null);\n\n const setParam = (key: string, value: string) => {\n props.onChange?.(key, value);\n dashContext?.setParameter(key, value);\n };\n\n const showAsText = props.showAsText ?? false;\n\n const onChange = (value: Range) => {\n setDateRangeValue(value);\n dateRangeRef.current = value;\n };\n\n const onClose = () => {\n const v = dateRangeRef.current;\n if (v && v[0] && v[1]) {\n setParam(props.parameterStartDateName, v[0].format('YYYY-MM-DD'));\n setParam(props.parameterEndDateName, v[1].format('YYYY-MM-DD'));\n }\n };\n\n useEffect(() => {\n const now = Date.now();\n const inicial = props.initialStartValue || new Date(now - 1000 * 3600 * 24 * 30).toISOString();\n const final = props.initialEndValue || new Date().toISOString();\n const value: Range = [dayjs(inicial), dayjs(final)];\n setDateRangeValue(value);\n dateRangeRef.current = value;\n setParam(props.parameterStartDateName, value[0]?.format('YYYY-MM-DD') ?? '');\n setParam(props.parameterEndDateName, value[1]?.format('YYYY-MM-DD') ?? '');\n }, [props.parameterEndDateName, props.parameterStartDateName, props.initialStartValue, props.initialEndValue]);\n\n if (!dashContext && !props.onChange) {\n return <Typography color=\"error\">Não foi possível obter o dashboardContext</Typography>;\n }\n if (dateRangeValue == null) return null;\n\n return (\n <div>\n {showAsText ? (\n <Chip\n sx={{ borderRadius: 1 }}\n label={\n <Stack direction=\"row\" gap={1}>\n <Typography variant=\"body1\">{props.parameterStartDateName.replaceAll('_', ' ')}:</Typography>\n <Typography variant=\"body1\">{dateRangeValue[0]?.format('DD MMM YYYY').toLocaleUpperCase()}</Typography>\n <span>-</span>\n <Typography variant=\"body1\">{props.parameterEndDateName.replaceAll('_', ' ')}:</Typography>\n <Typography variant=\"body1\">{dateRangeValue[1]?.format('DD MMM YYYY').toLocaleUpperCase()}</Typography>\n </Stack>\n }\n />\n ) : (\n <DateRangePicker\n disabled={props.partial}\n sx={{ maxWidth: '230px' }}\n key={props.id ?? props.parameterStartDateName + props.parameterEndDateName}\n closeOnSelect\n format=\"YYYY-MM-DD\"\n desktopModeMediaQuery=\"@media (min-width: 720px)\"\n showDaysOutsideCurrentMonth\n label={getFriendlyName(props.parameterStartDateName) + ' - ' + getFriendlyName(props.parameterEndDateName)}\n formatDensity=\"dense\"\n slotProps={{ textField: { size: 'small' } }}\n value={dateRangeValue}\n onChange={onChange}\n onClose={onClose}\n />\n )}\n </div>\n );\n};\n\nexport default VizDateRangePicker;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { FormControl, InputLabel, MenuItem, Select } from '@mui/material';\nimport { useDashboardParameters } from '../hooks/DashboardParametersContext';\nimport { getFriendlyName, nextFilterId } from './friendlyName';\n\nexport interface VizSelectProps {\n id?: string;\n initialValue: string;\n parameterName: string;\n /** `<option>` elements (legacy) or `<MenuItem>` elements. `<option>`s are converted. */\n children: React.ReactNode;\n onChange?: (parameterName: string, value: string) => void;\n}\n\n/** Single-value select filter, rendered with MUI so it follows the theme. */\nexport const VizSelect: React.FC<VizSelectProps> = (props) => {\n const [value, setValue] = useState<string>('');\n const dashContext = useDashboardParameters();\n const calcId = useMemo(() => props.id ?? nextFilterId(), [props.id]);\n\n useEffect(() => {\n const current = dashContext?.getParameter(props.parameterName);\n setValue((typeof current === 'string' ? current : undefined) ?? props.initialValue ?? '');\n }, [props.parameterName]);\n\n if (!dashContext && !props.onChange) return null;\n\n const onChange = (v: string) => {\n setValue(v);\n props.onChange?.(props.parameterName, v);\n dashContext?.setParameter(props.parameterName, v);\n };\n\n // Accept legacy `<option value=\"x\">Label</option>` children.\n const items = React.Children.map(props.children, (child, i) => {\n if (React.isValidElement(child) && child.type === 'option') {\n const p = child.props as { value?: string; children?: React.ReactNode };\n return (\n <MenuItem key={p.value ?? i} value={p.value ?? ''}>\n {p.children}\n </MenuItem>\n );\n }\n return child;\n });\n\n const label = getFriendlyName(props.parameterName);\n return (\n <FormControl size=\"small\" sx={{ minWidth: 160 }}>\n <InputLabel id={`${calcId}-label`}>{label}</InputLabel>\n <Select labelId={`${calcId}-label`} id={calcId} label={label} value={value} onChange={(e) => onChange(String(e.target.value))}>\n <MenuItem value=\"None\">{label}</MenuItem>\n {items}\n </Select>\n </FormControl>\n );\n};\n\nexport default VizSelect;\n","import React, { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\nimport { useDashboardParameters } from '../hooks/DashboardParametersContext';\nimport { getFriendlyName } from './friendlyName';\n\nexport interface VizTextFieldProps {\n initialValue: string;\n parameterName: string;\n onChange?: (parameterName: string, value: string) => void;\n}\n\nexport const VizTextField: React.FC<VizTextFieldProps> = (props) => {\n const [value, setValue] = useState<string | null>(null);\n const dashContext = useDashboardParameters();\n\n useEffect(() => {\n setValue(props.initialValue);\n }, [props.parameterName]);\n\n if (!dashContext && !props.onChange) return null;\n if (value == null) return null;\n\n const onChange = (v: string) => {\n setValue(v);\n props.onChange?.(props.parameterName, v);\n dashContext?.setParameter(props.parameterName, v);\n };\n\n return <TextField label={getFriendlyName(props.parameterName)} size=\"small\" value={value} onChange={(event) => onChange(event.target.value)} />;\n};\n\nexport default VizTextField;\n","import React, { useState } from 'react';\nimport { ErrorOutline, SaveAlt } from '@mui/icons-material';\nimport { Button, CircularProgress, Stack, Tooltip, Typography } from '@mui/material';\n\nexport interface VizTriggerButtonProps {\n text?: string;\n /** Runs the filter. May return a promise; a rejection is shown as an error tooltip. */\n onTrigger: () => void | Promise<unknown>;\n}\n\n/** \"Filtrar\" button — the legacy `executeFilter` context is gone; the host passes `onTrigger`. */\nexport const VizTriggerButton: React.FC<VizTriggerButtonProps> = (props) => {\n const [filterLoading, setFilterLoading] = useState(false);\n const [filterError, setFilterError] = useState<string | null>(null);\n\n const onClick = () => {\n setFilterError(null);\n const result = props.onTrigger();\n if (result && typeof (result as Promise<unknown>).then === 'function') {\n setFilterLoading(true);\n (result as Promise<unknown>)\n .catch((error: unknown) => setFilterError('Exception: ' + String(error)))\n .finally(() => setFilterLoading(false));\n }\n };\n\n return (\n <Button onClick={onClick} size=\"small\" fullWidth={false} disabled={filterLoading} sx={{ maxWidth: '200px' }}>\n <Stack direction=\"row\" gap={0.5}>\n <Typography>{filterLoading ? 'Loading' : (props.text ?? 'Filtrar')}</Typography>\n {filterLoading ? <CircularProgress size=\"1.5rem\" color=\"primary\" /> : <SaveAlt sx={{ ml: 1 }} fontSize=\"small\" />}\n {!!filterError && (\n <Tooltip title={filterError}>\n <ErrorOutline sx={{ ml: 1, color: 'error.main' }} fontSize=\"small\" />\n </Tooltip>\n )}\n </Stack>\n </Button>\n );\n};\n\nexport default VizTriggerButton;\n","import React from 'react';\nimport { Box } from '@mui/material';\nimport { VizAutoComplete } from './VizAutoComplete';\nimport { VizDatePicker } from './VizDatePicker';\nimport { VizDateRangePicker } from './VizDateRangePicker';\n\nexport type FilterType = 'DateRangePicker' | 'DatePicker' | 'AutoComplete';\n\n/** A filter as described on a dashboard document (`Dashboard.filters[]`). */\nexport interface SketchedFilter {\n i: string;\n name: string;\n systemInstructions?: string;\n filterType: FilterType;\n mandatory: boolean;\n /** AutoComplete only — `VizAutoComplete.multipleSelection`. */\n multipleSelection?: boolean;\n}\n\nexport const DateRangeFilterEndSuffix = '_fim';\nexport const DateRangeFilterBeginSuffix = '_inicio';\n\nexport interface FilterFactoryOptions {\n /** When true the filter skips loading its data source (placeholder mode). */\n partial?: boolean;\n /** Direct callback invoked on value change (in addition to the parameters context). */\n onChange?: (parameterName: string, value: string | string[]) => void;\n /** Current parameter values, used to seed the filters' initial selection. */\n parameters?: Record<string, string | string[]>;\n /** Read-only rendering (print preview). */\n readonly?: boolean;\n}\n\nconst stripDiacritics = (s: string) => s.normalize('NFD').replace(/[̀-ͯ]/g, '');\n\n/**\n * Given a `SketchedFilter` descriptor, returns the matching filter component\n * wrapped in a `Box` carrying `data-env-*` attributes (the composer's\n * environment API targets them).\n */\nexport function createFilterComponent(dashboardId: string, filter: SketchedFilter, options: FilterFactoryOptions = {}): React.ReactElement {\n const paramName = stripDiacritics(filter.name);\n const lookupParamName = paramName.toLocaleLowerCase();\n let inner: React.ReactNode;\n\n const selectedParams: Record<string, string | string[]> = {};\n for (const k of Object.keys(options.parameters ?? {})) {\n selectedParams[k.toLowerCase()] = options.parameters![k];\n }\n\n switch (filter.filterType) {\n case 'AutoComplete': {\n let selectedValues = selectedParams[lookupParamName] ?? [];\n if (!Array.isArray(selectedValues)) selectedValues = [selectedValues];\n inner = (\n <VizAutoComplete\n partial={options.partial}\n showAsText={options.readonly}\n dashboardId={dashboardId}\n id={filter.i}\n key={filter.i}\n selectedValues={selectedValues}\n multipleSelection={filter.multipleSelection ?? true}\n parameterName={paramName}\n valueFieldName={filter.name}\n displayFieldName={`${paramName}_display`}\n onChange={options.onChange}\n />\n );\n break;\n }\n case 'DateRangePicker':\n inner = (\n <VizDateRangePicker\n showAsText={options.readonly}\n partial={options.partial}\n id={filter.i}\n key={filter.i}\n initialStartValue={selectedParams[`${lookupParamName}${DateRangeFilterBeginSuffix}`] as string}\n initialEndValue={selectedParams[`${lookupParamName}${DateRangeFilterEndSuffix}`] as string}\n parameterStartDateName={`${paramName}${DateRangeFilterBeginSuffix}`}\n parameterEndDateName={`${paramName}${DateRangeFilterEndSuffix}`}\n onChange={options.onChange}\n />\n );\n break;\n case 'DatePicker':\n inner = <VizDatePicker key={filter.i} parameterName={paramName} onChange={options.onChange} />;\n break;\n default:\n inner = <div>Unsupported filter type: {filter.filterType}</div>;\n }\n\n return (\n <Box\n key={filter.i}\n className=\"llm-env-target llm-env-filter llm-env-filter-generated\"\n data-env-id={filter.i}\n data-env-key={filter.i}\n data-env-name={filter.name}\n data-env-kind=\"generated-filter\"\n >\n {inner}\n </Box>\n );\n}\n"],"names":["getFriendlyName","key","parts","__name","counter","nextFilterId","AutoCompleteInstructions","responseToRows","result","rows","generatedRow","row","_a","VizAutoComplete","props","selectedValue","setSelectedValue","useState","selectedValues","setSelectedValues","allRows","setAllRows","loading","setLoading","loadingError","setLoadingError","dashContext","useDashboardParameters","client","useBiClientOptional","calcId","useMemo","calcValueFieldName","showAsText","selectedKey","useEffect","cancelled","applySelection","wanted","related","r","v","json","converted","error","onChange","value","valueList","valueRows","valueRow","name","toPrintValues","Stack","jsx","CircularProgress","Chip","jsxs","Typography","Autocomplete","_","option","params","TextField","localProps","createElement","Box","VizDatePicker","localValue","setLocalValue","setParam","today","handleChange","str","current","DatePicker","dayjs","VizDateRangePicker","dateRangeValue","setDateRangeValue","dateRangeRef","useRef","onClose","now","inicial","final","_b","DateRangePicker","VizSelect","setValue","items","React","child","i","p","MenuItem","label","FormControl","InputLabel","Select","e","VizTextField","event","VizTriggerButton","filterLoading","setFilterLoading","filterError","setFilterError","Button","SaveAlt","Tooltip","ErrorOutline","DateRangeFilterEndSuffix","DateRangeFilterBeginSuffix","stripDiacritics","s","createFilterComponent","dashboardId","filter","options","paramName","lookupParamName","inner","selectedParams","k"],"mappings":";;;;;;;;;;;AACO,SAASA,EAAgBC,GAAqB;AACjD,MAAI,CAACA,EAAK,QAAO;AACjB,QAAMC,IAAQD,EAAI,MAAM,GAAG;AAC3B,SAAIC,EAAM,CAAC,MAAGA,EAAM,CAAC,IAAI,GAAGA,EAAM,CAAC,EAAE,CAAC,EAAE,kBAAA,CAAmB,GAAGA,EAAM,CAAC,EAAE,MAAM,CAAC,CAAC,KACxEA,EAAM,KAAK,GAAG;AACzB;AALgBC,EAAAH,GAAA;AAOhB,IAAII,IAAU;AAEP,SAASC,IAAuB;AACnC,SAAAD,KAAW,GACJ,aAAaA,CAAO;AAC/B;AAHgBD,EAAAE,GAAA;ACgBT,MAAMC,KAA2B;AAAA;AAAA;AAAA;AAAA;AAMxC,SAASC,GAAeC,GAA6B;;AACjD,QAAMC,IAAe,CAAA;AACrB,aAAWC,KAAgBF,EAAO,MAAM;AACpC,UAAMG,IAAY,CAAA;AAClB,aAAS,IAAI,GAAG,IAAIH,EAAO,QAAQ,QAAQ;AACvC,MAAAG,EAAIH,EAAO,QAAQ,C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