react-semaphor 0.1.178 → 0.1.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dashboard-controls-00cjSeD7.js → dashboard-controls-Baw7eUyM.js} +8 -8
- package/dist/chunks/{dashboard-controls-C9IWIFfW.js → dashboard-controls-CS3pAVZi.js} +473 -470
- package/dist/chunks/{dashboard-json--ke9XK9p.js → dashboard-json-ClalWYi4.js} +1 -1
- package/dist/chunks/{dashboard-json-BDjl-3ej.js → dashboard-json-Cz4bNnCC.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BroCdmtP.js → edit-dashboard-visual-BMElXt-n.js} +30 -35
- package/dist/chunks/{edit-dashboard-visual-BBsC9feJ.js → edit-dashboard-visual-DFJ5FJ7y.js} +11 -22
- package/dist/chunks/editor-action-buttons-DVWnnC_r.js +11 -0
- package/dist/chunks/{editor-action-buttons-CHoiNw7F.js → editor-action-buttons-MtNYw1Bb.js} +57 -45
- package/dist/chunks/index-8Crk3ROJ.js +1 -0
- package/dist/chunks/index-B4EhQdS9.js +1857 -0
- package/dist/chunks/{index-DZjcALSv.js → index-CAeKp6K8.js} +23423 -24714
- package/dist/chunks/index-CfPKTeUk.js +1082 -0
- package/dist/chunks/notification-bell-2dZI5OV0.js +21 -0
- package/dist/chunks/notification-bell-YZ8VqdwA.js +870 -0
- package/dist/chunks/{resource-management-panel-C96ElLa5.js → resource-management-panel-Buhi-kvP.js} +1 -1
- package/dist/chunks/{resource-management-panel-DE8DnPSl.js → resource-management-panel-pxL28GXq.js} +133 -133
- package/dist/chunks/{use-role-aware-display-preferences-Dovp_VmV.js → use-role-aware-display-preferences-B_i2f9tn.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Rd1BhDG4.js → use-role-aware-display-preferences-JljRcjrP.js} +1 -1
- package/dist/chunks/{use-visual-utils-BkRr5LoD.js → use-visual-utils-D3HjbsKO.js} +38 -38
- package/dist/chunks/{use-visual-utils-Cnju2tnE.js → use-visual-utils-DPEHcmFT.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/format-utils/index.cjs +5 -0
- package/dist/format-utils/index.js +451 -0
- package/dist/index.cjs +1 -6
- package/dist/index.js +133 -126
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/format-utils.d.ts +375 -0
- package/dist/types/main.d.ts +262 -0
- package/package.json +14 -1
- package/dist/chunks/editor-action-buttons-JE9t84-4.js +0 -6
- package/dist/chunks/index-CdfFCbJb.js +0 -1077
- package/dist/chunks/schedule-dashboard-BFa0Uljc.js +0 -416
- package/dist/chunks/schedule-dashboard-CzU0ziLB.js +0 -6
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { f as F, p as g, a as I } from "../chunks/index-B4EhQdS9.js";
|
|
2
|
+
const $ = [
|
|
3
|
+
{ value: 1e12, suffix: "T" },
|
|
4
|
+
{ value: 1e9, suffix: "B" },
|
|
5
|
+
{ value: 1e7, suffix: "Cr" },
|
|
6
|
+
// Crore (Indian)
|
|
7
|
+
{ value: 1e6, suffix: "M" },
|
|
8
|
+
{ value: 1e5, suffix: "L" },
|
|
9
|
+
// Lakh (Indian)
|
|
10
|
+
{ value: 1e3, suffix: "K" }
|
|
11
|
+
];
|
|
12
|
+
function S(r) {
|
|
13
|
+
const e = Math.abs(r);
|
|
14
|
+
for (const { value: u, suffix: t } of $)
|
|
15
|
+
if (e >= u)
|
|
16
|
+
return { divisor: u, suffix: t };
|
|
17
|
+
return { divisor: 1, suffix: "" };
|
|
18
|
+
}
|
|
19
|
+
function L(r) {
|
|
20
|
+
try {
|
|
21
|
+
return new Intl.NumberFormat(r), !0;
|
|
22
|
+
} catch {
|
|
23
|
+
return !1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function f(r) {
|
|
27
|
+
return r && L(r) ? r : "en-US";
|
|
28
|
+
}
|
|
29
|
+
function B(r, e) {
|
|
30
|
+
if (r == null || isNaN(r))
|
|
31
|
+
return "";
|
|
32
|
+
const u = f(e == null ? void 0 : e.locale);
|
|
33
|
+
let t = r;
|
|
34
|
+
if (e != null && e.multiplyBy && (t *= e.multiplyBy), e != null && e.useSuffix) {
|
|
35
|
+
const { divisor: a, suffix: l } = S(t);
|
|
36
|
+
t = t / a;
|
|
37
|
+
const i = new Intl.NumberFormat(u, {
|
|
38
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
39
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
|
|
40
|
+
useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
|
|
41
|
+
}).format(t);
|
|
42
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${i}${l}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
43
|
+
}
|
|
44
|
+
const c = new Intl.NumberFormat(u, {
|
|
45
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
46
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
|
|
47
|
+
useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
|
|
48
|
+
}).format(t);
|
|
49
|
+
if (e != null && e.negativeInParentheses && t < 0) {
|
|
50
|
+
const a = c.replace("-", "");
|
|
51
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}(${a})${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
52
|
+
}
|
|
53
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${c}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
54
|
+
}
|
|
55
|
+
function Z(r, e) {
|
|
56
|
+
if (r == null || isNaN(r))
|
|
57
|
+
return "";
|
|
58
|
+
const u = f(e == null ? void 0 : e.locale), t = (e == null ? void 0 : e.currency) || "USD";
|
|
59
|
+
if (e != null && e.useSuffix) {
|
|
60
|
+
const { divisor: c, suffix: a } = S(r), l = r / c;
|
|
61
|
+
return `${new Intl.NumberFormat(u, {
|
|
62
|
+
style: "currency",
|
|
63
|
+
currency: t,
|
|
64
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
65
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
66
|
+
}).format(l)}${a}`;
|
|
67
|
+
}
|
|
68
|
+
return new Intl.NumberFormat(u, {
|
|
69
|
+
style: "currency",
|
|
70
|
+
currency: t,
|
|
71
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
72
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
73
|
+
}).format(r);
|
|
74
|
+
}
|
|
75
|
+
function E(r, e) {
|
|
76
|
+
if (r == null || isNaN(r))
|
|
77
|
+
return "";
|
|
78
|
+
const u = f(e == null ? void 0 : e.locale), t = e != null && e.alreadyPercent ? r / 100 : r;
|
|
79
|
+
return new Intl.NumberFormat(u, {
|
|
80
|
+
style: "percent",
|
|
81
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
82
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
83
|
+
}).format(t);
|
|
84
|
+
}
|
|
85
|
+
function R(r, e) {
|
|
86
|
+
if (r == null || isNaN(r))
|
|
87
|
+
return "";
|
|
88
|
+
const u = f(e == null ? void 0 : e.locale);
|
|
89
|
+
return new Intl.NumberFormat(u, {
|
|
90
|
+
notation: "scientific",
|
|
91
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
92
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
93
|
+
}).format(r);
|
|
94
|
+
}
|
|
95
|
+
function D(r, e, u = "en-US") {
|
|
96
|
+
if (r == null || isNaN(r))
|
|
97
|
+
return "";
|
|
98
|
+
const t = f((e == null ? void 0 : e.locale) || u), c = (e == null ? void 0 : e.style) || "decimal";
|
|
99
|
+
return c === "percent" ? new Intl.NumberFormat(t, {
|
|
100
|
+
style: "percent",
|
|
101
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
102
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
103
|
+
}).format(r / 100) : c === "currency" ? new Intl.NumberFormat(t, {
|
|
104
|
+
style: "currency",
|
|
105
|
+
currency: (e == null ? void 0 : e.currency) || "USD",
|
|
106
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
107
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
108
|
+
}).format(r) : new Intl.NumberFormat(t, {
|
|
109
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
110
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
111
|
+
}).format(r);
|
|
112
|
+
}
|
|
113
|
+
function q(r, e, u) {
|
|
114
|
+
const t = {
|
|
115
|
+
locale: u == null ? void 0 : u.locale,
|
|
116
|
+
currency: u == null ? void 0 : u.currency,
|
|
117
|
+
minimumFractionDigits: u == null ? void 0 : u.decimalPlaces,
|
|
118
|
+
maximumFractionDigits: u == null ? void 0 : u.decimalPlaces,
|
|
119
|
+
useSuffix: u == null ? void 0 : u.useSuffix,
|
|
120
|
+
prefix: u == null ? void 0 : u.prefix,
|
|
121
|
+
suffix: u == null ? void 0 : u.suffix,
|
|
122
|
+
negativeInParentheses: u == null ? void 0 : u.negativeInParentheses,
|
|
123
|
+
multiplyBy: u == null ? void 0 : u.multiplyBy
|
|
124
|
+
};
|
|
125
|
+
switch (e) {
|
|
126
|
+
case "currency":
|
|
127
|
+
return Z(r, t);
|
|
128
|
+
case "percent":
|
|
129
|
+
return E(r, t);
|
|
130
|
+
case "scientific":
|
|
131
|
+
return R(r, t);
|
|
132
|
+
default:
|
|
133
|
+
return B(r, t);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function b(r, e) {
|
|
137
|
+
return r && r !== "auto" ? r : e;
|
|
138
|
+
}
|
|
139
|
+
function J(r, e = /* @__PURE__ */ new Date()) {
|
|
140
|
+
try {
|
|
141
|
+
const u = {
|
|
142
|
+
timeZone: r,
|
|
143
|
+
timeZoneName: "short"
|
|
144
|
+
}, c = new Intl.DateTimeFormat("en-US", u).formatToParts(e).find((a) => a.type === "timeZoneName");
|
|
145
|
+
return (c == null ? void 0 : c.value) || r;
|
|
146
|
+
} catch {
|
|
147
|
+
return r;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function Q(r) {
|
|
151
|
+
try {
|
|
152
|
+
const e = {
|
|
153
|
+
timeZone: r,
|
|
154
|
+
timeZoneName: "long"
|
|
155
|
+
}, t = new Intl.DateTimeFormat("en-US", e).formatToParts(
|
|
156
|
+
/* @__PURE__ */ new Date()
|
|
157
|
+
).find((c) => c.type === "timeZoneName");
|
|
158
|
+
return (t == null ? void 0 : t.value) || r;
|
|
159
|
+
} catch {
|
|
160
|
+
return r;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function A(r, e = "auto") {
|
|
164
|
+
if (!r)
|
|
165
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
166
|
+
const u = r.endsWith("Z"), t = /[+-]\d{2}:?\d{2}$/.test(r), c = /\([A-Z]{3,4}\)$/.test(r);
|
|
167
|
+
if (e === "auto")
|
|
168
|
+
return u || t || c ? new Date(r) : /* @__PURE__ */ new Date(r + "Z");
|
|
169
|
+
if (e === "local") {
|
|
170
|
+
if (u || t) {
|
|
171
|
+
const a = r.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
|
|
172
|
+
return new Date(a);
|
|
173
|
+
}
|
|
174
|
+
return new Date(r);
|
|
175
|
+
} else return e === "UTC" ? u ? new Date(r) : t ? new Date(r) : /* @__PURE__ */ new Date(r + "Z") : u || t || c ? new Date(r) : /* @__PURE__ */ new Date(r + "Z");
|
|
176
|
+
}
|
|
177
|
+
function P(r, e, u) {
|
|
178
|
+
if (r == null)
|
|
179
|
+
return "";
|
|
180
|
+
try {
|
|
181
|
+
const t = typeof r == "string" ? A(r, e == null ? void 0 : e.sourceTimezone) : r;
|
|
182
|
+
if (isNaN(t.getTime()))
|
|
183
|
+
return String(r);
|
|
184
|
+
if (e != null && e.useRelativeTime)
|
|
185
|
+
return H(t);
|
|
186
|
+
const c = e != null && e.useCustomFormat && (e != null && e.customFormat) ? e.customFormat : (e == null ? void 0 : e.format) || "MM/dd/yyyy", a = b(e == null ? void 0 : e.timezone, u || "UTC");
|
|
187
|
+
return F(t, a, c);
|
|
188
|
+
} catch {
|
|
189
|
+
return String(r);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function H(r) {
|
|
193
|
+
if (r == null)
|
|
194
|
+
return "";
|
|
195
|
+
try {
|
|
196
|
+
const e = typeof r == "string" ? g(r) : r;
|
|
197
|
+
return isNaN(e.getTime()) ? String(r) : I(e, { addSuffix: !0 });
|
|
198
|
+
} catch {
|
|
199
|
+
return String(r);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function U(r, e, u) {
|
|
203
|
+
return P(r, e, u);
|
|
204
|
+
}
|
|
205
|
+
function M(r, e, u) {
|
|
206
|
+
if (r == null)
|
|
207
|
+
return "";
|
|
208
|
+
if (!u.useFormattedValues || !e)
|
|
209
|
+
return String(r);
|
|
210
|
+
switch (e.type) {
|
|
211
|
+
case "number":
|
|
212
|
+
return typeof r == "number" ? D(
|
|
213
|
+
r,
|
|
214
|
+
e.numberFormat,
|
|
215
|
+
u.locale
|
|
216
|
+
) : String(r);
|
|
217
|
+
case "date":
|
|
218
|
+
return U(
|
|
219
|
+
r,
|
|
220
|
+
e.dateFormat,
|
|
221
|
+
u.timezone
|
|
222
|
+
);
|
|
223
|
+
case "progress":
|
|
224
|
+
return typeof r == "number" ? `${r}%` : String(r);
|
|
225
|
+
case "badge":
|
|
226
|
+
case "link":
|
|
227
|
+
case "text":
|
|
228
|
+
case "none":
|
|
229
|
+
default:
|
|
230
|
+
return String(r);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function j(r, e) {
|
|
234
|
+
return e.visibleColumns.map((u) => {
|
|
235
|
+
const t = r[u], c = e.columnSettings[u];
|
|
236
|
+
return M(t, c, {
|
|
237
|
+
useFormattedValues: e.useFormattedValues,
|
|
238
|
+
timezone: e.timezone,
|
|
239
|
+
locale: e.locale
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function y(r, e = ",") {
|
|
244
|
+
if (r == null)
|
|
245
|
+
return "";
|
|
246
|
+
const u = String(r);
|
|
247
|
+
return u.includes(e) || u.includes('"') || u.includes(`
|
|
248
|
+
`) || u.includes("\r") ? `"${u.replace(/"/g, '""')}"` : u;
|
|
249
|
+
}
|
|
250
|
+
function h(r, e = ",") {
|
|
251
|
+
return r.map((u) => y(u, e)).join(e);
|
|
252
|
+
}
|
|
253
|
+
function C(r, e = {}) {
|
|
254
|
+
const { delimiter: u = ",", lineEnding: t = `
|
|
255
|
+
` } = e;
|
|
256
|
+
return r.map((c) => h(c, u)).join(t);
|
|
257
|
+
}
|
|
258
|
+
function Y(r, e = {}) {
|
|
259
|
+
if (r.length === 0)
|
|
260
|
+
return "";
|
|
261
|
+
const {
|
|
262
|
+
delimiter: u = ",",
|
|
263
|
+
lineEnding: t = `
|
|
264
|
+
`,
|
|
265
|
+
includeHeaders: c = !0,
|
|
266
|
+
columns: a
|
|
267
|
+
} = e, l = a || Object.keys(r[0]), i = [];
|
|
268
|
+
c && i.push(l);
|
|
269
|
+
for (const m of r) {
|
|
270
|
+
const s = l.map((d) => {
|
|
271
|
+
const n = m[d];
|
|
272
|
+
return n == null ? "" : String(n);
|
|
273
|
+
});
|
|
274
|
+
i.push(s);
|
|
275
|
+
}
|
|
276
|
+
return C(i, { delimiter: u, lineEnding: t });
|
|
277
|
+
}
|
|
278
|
+
function G(r, e) {
|
|
279
|
+
const u = [];
|
|
280
|
+
e.includeHeaders && u.push(h(e.visibleColumns, e.delimiter));
|
|
281
|
+
for (const t of r) {
|
|
282
|
+
const c = j(t, e);
|
|
283
|
+
u.push(
|
|
284
|
+
c.map((a) => y(a, e.delimiter)).join(e.delimiter)
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
return u;
|
|
288
|
+
}
|
|
289
|
+
function v(r, e, u = `
|
|
290
|
+
`) {
|
|
291
|
+
return G(r, e).join(u);
|
|
292
|
+
}
|
|
293
|
+
function O(r, e, u) {
|
|
294
|
+
return r == null ? "" : u.useFormattedValues ? typeof r == "number" && (e == null ? void 0 : e.type) === "number" ? D(
|
|
295
|
+
r,
|
|
296
|
+
e.numberFormat,
|
|
297
|
+
u.locale
|
|
298
|
+
) : typeof r == "number" ? r.toLocaleString(u.locale) : String(r) : String(r);
|
|
299
|
+
}
|
|
300
|
+
function W(r, e, u) {
|
|
301
|
+
var c, a;
|
|
302
|
+
const t = [];
|
|
303
|
+
if (r.isSubtotal && !r.isGrandTotal) {
|
|
304
|
+
const l = e.groupByColumns.findIndex(
|
|
305
|
+
(i) => i.alias === r.subtotalLevel
|
|
306
|
+
);
|
|
307
|
+
e.groupByColumns.forEach((i, m) => {
|
|
308
|
+
var s, d, n, x;
|
|
309
|
+
if (m === l) {
|
|
310
|
+
const N = (d = (s = e.rowAggregates) == null ? void 0 : s.find(
|
|
311
|
+
(V) => V.groupLevel === r.subtotalLevel
|
|
312
|
+
)) == null ? void 0 : d.label, T = (x = (n = r.subtotalContext) == null ? void 0 : n.groupByValues) == null ? void 0 : x[i.alias];
|
|
313
|
+
t.push(N ?? `Subtotal (${T ?? "Total"})`);
|
|
314
|
+
} else m < l ? t.push(String(r[i.alias] ?? "")) : t.push("");
|
|
315
|
+
});
|
|
316
|
+
} else if (r.isGrandTotal) {
|
|
317
|
+
const l = (a = (c = e.rowAggregates) == null ? void 0 : c.find(
|
|
318
|
+
(i) => i.groupLevel === "ALL"
|
|
319
|
+
)) == null ? void 0 : a.label;
|
|
320
|
+
t.push(l || "Grand Total"), e.groupByColumns.slice(1).forEach(() => t.push(""));
|
|
321
|
+
} else
|
|
322
|
+
e.groupByColumns.forEach((l) => {
|
|
323
|
+
t.push(String(r[l.alias] ?? ""));
|
|
324
|
+
});
|
|
325
|
+
return e.pivotSchema.filter((l) => l.isMetricColumn).forEach((l) => {
|
|
326
|
+
const i = r[l.alias], m = u.columnSettings[l.alias];
|
|
327
|
+
t.push(O(i, m, u));
|
|
328
|
+
}), t;
|
|
329
|
+
}
|
|
330
|
+
function k(r) {
|
|
331
|
+
const e = r.groupByColumns.map(
|
|
332
|
+
(t) => t.label || t.name
|
|
333
|
+
), u = r.pivotSchema.filter((t) => t.isMetricColumn).map((t) => t.displayLabel || t.metricLabel || t.metricName || t.alias);
|
|
334
|
+
return [...e, ...u];
|
|
335
|
+
}
|
|
336
|
+
function p(r, e, u) {
|
|
337
|
+
const t = [];
|
|
338
|
+
if (u.includeHeaders) {
|
|
339
|
+
const c = k(e);
|
|
340
|
+
t.push(h(c, u.delimiter));
|
|
341
|
+
}
|
|
342
|
+
for (const c of r) {
|
|
343
|
+
const a = W(
|
|
344
|
+
c,
|
|
345
|
+
e,
|
|
346
|
+
u
|
|
347
|
+
);
|
|
348
|
+
t.push(
|
|
349
|
+
a.map((l) => y(l, u.delimiter)).join(u.delimiter)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return t;
|
|
353
|
+
}
|
|
354
|
+
function w(r, e, u) {
|
|
355
|
+
for (const t of r) {
|
|
356
|
+
if (t.level < u) {
|
|
357
|
+
e[t.level].push(t.name);
|
|
358
|
+
for (let c = 1; c < t.colspan; c++)
|
|
359
|
+
e[t.level].push("");
|
|
360
|
+
}
|
|
361
|
+
t.children ? w(t.children, e, u) : t.columnKey && e[u].push(t.name);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function z(r) {
|
|
365
|
+
const e = r.pivotByColumns.length, u = r.groupByColumns.length, t = Array.from(
|
|
366
|
+
{ length: e + 1 },
|
|
367
|
+
() => []
|
|
368
|
+
);
|
|
369
|
+
for (let c = 0; c < e; c++)
|
|
370
|
+
t[c].push(...Array(u).fill(""));
|
|
371
|
+
if (t[e].push(
|
|
372
|
+
...r.groupByColumns.map((c) => c.label || c.name)
|
|
373
|
+
), w(r.columnHeadersTree, t, e), r.showRowTotals) {
|
|
374
|
+
for (let c = 0; c < e; c++)
|
|
375
|
+
t[c].push("");
|
|
376
|
+
t[e].push("Total");
|
|
377
|
+
}
|
|
378
|
+
return t;
|
|
379
|
+
}
|
|
380
|
+
function K(r, e, u) {
|
|
381
|
+
if (r == null)
|
|
382
|
+
return "";
|
|
383
|
+
if (!u.useFormattedValues)
|
|
384
|
+
return String(r);
|
|
385
|
+
const t = u.columnSettings[e];
|
|
386
|
+
return typeof r == "number" && (t == null ? void 0 : t.type) === "number" ? D(
|
|
387
|
+
r,
|
|
388
|
+
t.numberFormat,
|
|
389
|
+
u.locale
|
|
390
|
+
) : typeof r == "number" ? r.toLocaleString(u.locale) : String(r);
|
|
391
|
+
}
|
|
392
|
+
function X(r, e, u) {
|
|
393
|
+
const t = [];
|
|
394
|
+
r.fieldValues.forEach((a, l) => {
|
|
395
|
+
r.isSubtotal && l === 0 ? t.push(`${a} Total`) : r.isSubtotal ? t.push("") : t.push(String(a ?? ""));
|
|
396
|
+
});
|
|
397
|
+
let c = 0;
|
|
398
|
+
return e.columnHeaders.forEach((a) => {
|
|
399
|
+
var m;
|
|
400
|
+
const l = (m = r.cells[a]) == null ? void 0 : m.value, i = K(l, a, u);
|
|
401
|
+
t.push(i), e.showRowTotals && typeof l == "number" && (c += l);
|
|
402
|
+
}), e.showRowTotals && t.push(c.toLocaleString(u.locale)), t;
|
|
403
|
+
}
|
|
404
|
+
function o(r, e, u) {
|
|
405
|
+
const t = [];
|
|
406
|
+
if (u.includeHeaders) {
|
|
407
|
+
const c = z(e);
|
|
408
|
+
for (const a of c)
|
|
409
|
+
t.push(h(a, u.delimiter));
|
|
410
|
+
}
|
|
411
|
+
for (const c of r) {
|
|
412
|
+
const a = X(
|
|
413
|
+
c,
|
|
414
|
+
e,
|
|
415
|
+
u
|
|
416
|
+
);
|
|
417
|
+
t.push(
|
|
418
|
+
a.map((l) => y(l, u.delimiter)).join(u.delimiter)
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
return t;
|
|
422
|
+
}
|
|
423
|
+
export {
|
|
424
|
+
C as arrayToCSV,
|
|
425
|
+
h as arrayToCSVRow,
|
|
426
|
+
y as escapeCSVValue,
|
|
427
|
+
W as formatAggregateRow,
|
|
428
|
+
p as formatAggregateTableForCSV,
|
|
429
|
+
M as formatCellValue,
|
|
430
|
+
Z as formatCurrency,
|
|
431
|
+
P as formatDate,
|
|
432
|
+
U as formatDateWithColumnSettings,
|
|
433
|
+
B as formatNumber,
|
|
434
|
+
q as formatNumberCustom,
|
|
435
|
+
D as formatNumberWithColumnSettings,
|
|
436
|
+
E as formatPercent,
|
|
437
|
+
X as formatPivotDataRow,
|
|
438
|
+
o as formatPivotTableForCSV,
|
|
439
|
+
H as formatRelativeTime,
|
|
440
|
+
j as formatRowForExport,
|
|
441
|
+
R as formatScientific,
|
|
442
|
+
G as formatTableForCSV,
|
|
443
|
+
k as generateAggregateHeaders,
|
|
444
|
+
z as generatePivotHeaders,
|
|
445
|
+
v as generateTableCSV,
|
|
446
|
+
J as getTimezoneAbbreviation,
|
|
447
|
+
Q as getTimezoneName,
|
|
448
|
+
Y as objectsToCSV,
|
|
449
|
+
A as parseWithSourceTimezone,
|
|
450
|
+
b as resolveTimezone
|
|
451
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const M=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function _(r){const{displayPreferences:o,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[a.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})]})})}function A({cardId:r}){const o=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=b.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),l=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=l==null?void 0:l.find(t=>(t==null?void 0:t.id)===r),f=n==null?void 0:n.find(t=>{var p;return(p=t==null?void 0:t.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:C,frame:f}},[o,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function N({name:r,items:o,value:s,onChange:i,isLoading:n,isError:l,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[x,g]=m.useState(!1),[y,T]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&T(u.current.offsetWidth)},[]);function E(){var d;return n?"Loading...":l?"Error":s?(d=o==null?void 0:o.find(c=>c.id===s))==null?void 0:d.name:`Select ${r}`}function S(d,c){i(c),g(!1)}return a.jsxs(e.Popover,{open:x,onOpenChange:g,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":x,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx("div",{className:"mr-2",children:t}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:E()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:C,children:a.jsx(M,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:c=>S(c,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function w(r,o){b.useEffect(()=>(r&&o&&(window.__SEMAPHOR_PRINT_STATE__={...o}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,o])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.UnsavedChangesAlert=h.UnsavedChangesAlert;exports.VisualEditingControls=h.VisualEditingControls;exports.usePristineSnapshotInitializer=h.usePristineSnapshotInitializer;exports.Combobox=N;exports.Visual=_;exports.useExposePrintState=w;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CfPKTeUk.js"),v=require("./types/index.cjs"),o=require("react/jsx-runtime"),f=require("react"),P=require("./chunks/resource-management-panel-Buhi-kvP.js"),i=require("./chunks/notification-bell-2dZI5OV0.js");require("react-dom");function j(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const x=j(f);function N(t){const{displayPreferences:r,...s}=t,l={...s,id:t.dashboardId};return o.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:o.jsxs(e.SemaphorContextProvider,{dashboardProps:l,children:[o.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:t.cardId}),o.jsx(e.UXProvider,{children:o.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:o.jsx(e.Container,{type:"visual",...l,children:o.jsx(A,{cardId:t.cardId})})})})]})})}function A({cardId:t}){const r=e.useDashboardStore(n=>{var u;return(u=n.dashboard)==null?void 0:u.sheets}),{card:s,frame:l}=f.useMemo(()=>{const n=r==null?void 0:r.flatMap(a=>a.frames),u=n==null?void 0:n.flatMap(a=>a==null?void 0:a.cards),m=u==null?void 0:u.find(a=>(a==null?void 0:a.id)===t),E=n==null?void 0:n.find(a=>{var h;return(h=a==null?void 0:a.cards)==null?void 0:h.find(c=>(c==null?void 0:c.id)===t)});return{card:m,frame:E}},[r,t]);return!s||!l?o.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${t}`}):o.jsx("main",{className:"flex h-full grow flex-col",children:o.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:u})=>o.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:o.jsx(e.DashboardCard,{card:s,frame:l})})})}function _({name:t,items:r,value:s,onChange:l,isLoading:n,isError:u,refetch:m,className:E,icon:a,showNone:h=!1}){const c=x.useRef(null),[g,D]=x.useState(!1),[b,S]=x.useState("100%"),C=h?[...r||[],{id:"none",name:"None"}]:r;x.useLayoutEffect(()=>{c.current&&S(c.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":u?"Error":s?(d=r==null?void 0:r.find(p=>p.id===s))==null?void 0:d.name:`Select ${t}`}function y(d,p){l(p),D(!1)}return o.jsxs(e.Popover,{open:g,onOpenChange:D,children:[o.jsx(e.PopoverTrigger,{asChild:!0,children:o.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":g,className:e.cn("flex h-9 w-full justify-between",E),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[a&&o.jsx("div",{className:"mr-2",children:a}),o.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),o.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),o.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},children:o.jsxs(e.Command,{children:[o.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[o.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),o.jsx(e.IconButton,{className:"h-7",onClick:m,children:o.jsx(i.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),o.jsxs(e.CommandList,{children:[o.jsxs(e.CommandEmpty,{children:["No ",t==null?void 0:t.toLowerCase()," found."]}),o.jsx(e.CommandGroup,{children:C==null?void 0:C.map(d=>o.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:p=>y(p,d.id),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),o.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function M(t,r){f.useEffect(()=>(t&&r&&(window.__SEMAPHOR_PRINT_STATE__={...r}),()=>{t&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[t,r])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useActiveExports=e.useActiveExports;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=P.ResourceManagementPanel;exports.AdvancedModeToggle=i.AdvancedModeToggle;exports.ExportNotificationItem=i.ExportNotificationItem;exports.ExportNotificationList=i.ExportNotificationList;exports.NotificationBell=i.NotificationBell;exports.ScheduleDashboard=i.ScheduleDashboard;exports.UnsavedChangesAlert=i.UnsavedChangesAlert;exports.VisualEditingControls=i.VisualEditingControls;exports.useExportPolling=i.useExportPolling;exports.useExportRecovery=i.useExportRecovery;exports.usePristineSnapshotInitializer=i.usePristineSnapshotInitializer;exports.Combobox=_;exports.Visual=N;exports.useExposePrintState=M;
|