@svgrid/grid-wc 2.2.1 → 2.5.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.
@@ -1,50 +0,0 @@
1
- import { A as e, G as t, L as n, O as r, Q as i, T as a, X as o, Y as s, et as c, o as l, rt as u, tt as d } from "./client-DOa609yZ.js";
2
- import { a as f } from "./chart-CSZhFIR9.js";
3
- import { t as p } from "./SvGridChart-EY7OOxv6.js";
4
- //#region ../grid/dist/SvGridChartView.svelte
5
- var m = e("<div class=\"sv-grid-chart-view svelte-9enbu0\"><!></div>");
6
- function h(e, h) {
7
- d(h, !0);
8
- let g = o(0), _ = o(0), v = i(() => {
9
- let e = f(h.data ?? [], {
10
- type: h.chart.type ?? "bar",
11
- category: h.chart.category,
12
- value: h.chart.value,
13
- series: h.chart.series,
14
- reduce: h.chart.reduce,
15
- stacked: h.chart.stacked,
16
- stacked100: h.chart.stacked100,
17
- sort: h.chart.sort,
18
- topN: h.chart.topN,
19
- palette: h.chart.palette
20
- });
21
- return h.chart.valueFormat && (e.valueFormat = h.chart.valueFormat), e;
22
- });
23
- var y = m(), b = t(y), x = (e) => {
24
- {
25
- let t = i(() => h.chart.legend ?? !0), r = i(() => h.chart.dataLabels ?? !1);
26
- p(e, {
27
- get spec() {
28
- return n(v);
29
- },
30
- get width() {
31
- return n(g);
32
- },
33
- get height() {
34
- return n(_);
35
- },
36
- get legend() {
37
- return n(t);
38
- },
39
- get dataLabels() {
40
- return n(r);
41
- }
42
- });
43
- }
44
- };
45
- a(b, (e) => {
46
- n(g) > 0 && n(_) > 0 && e(x);
47
- }), u(y), l(y, "clientWidth", (e) => s(g, e)), l(y, "clientHeight", (e) => s(_, e)), r(e, y), c();
48
- }
49
- //#endregion
50
- export { h as default };
@@ -1,251 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { A as t, B as n, C as r, D as i, F as a, G as o, I as s, J as c, K as l, L as u, M as d, O as f, P as p, Q as m, T as h, V as g, X as _, Y as v, _ as y, a as b, b as x, d as S, et as C, k as ee, n as w, nt as T, q as E, rt as D, s as te, tt as ne, u as re, v as O } from "./client-DOa609yZ.js";
3
- import { n as ie, r as ae, t as k } from "./popover-WsGlvtQv.js";
4
- //#region ../grid/dist/SvGridDropdown.svelte
5
- var A = /* @__PURE__ */ e({ default: () => j }), oe = t("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-13rpzh6\"> <span class=\"sv-grid-chip-remove svelte-13rpzh6\" role=\"button\">×</span></span>"), se = t("<span class=\"sv-grid-dropdown-chips svelte-13rpzh6\"></span>"), ce = t("<span class=\"sv-grid-chip svelte-13rpzh6\"> </span>"), le = t("<span class=\"sv-grid-dropdown-label svelte-13rpzh6\"> </span>"), ue = t("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), de = t("<div class=\"sv-grid-dropdown-empty\"> </div>"), fe = t("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), pe = t("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), me = t("<span class=\"sv-grid-dropdown-option-label\"> </span>"), he = t("<div role=\"option\"><!> <!></div>"), ge = t("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), _e = t("<div role=\"listbox\"><!> <!> <!></div>"), ve = t("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-13rpzh6\" aria-hidden=\"true\">▾</span></button> <!></div>");
6
- function j(e, t) {
7
- let p = d();
8
- ne(t, !0);
9
- let A = w(t, "multiple", 3, !1), j = w(t, "placeholder", 3, "Select…"), M = w(t, "renderChipsInTrigger", 3, !1), N = w(t, "searchable", 3, !1), ye = w(t, "autoOpen", 3, !0);
10
- function P(e) {
11
- return e >= 0 && e < u(L).length ? `${p}-opt-${e}` : void 0;
12
- }
13
- let F = m(() => t.options.some((e) => e.color) ? 40 : 32), I = _(""), L = m(() => !N() || !u(I).trim() ? t.options : (() => {
14
- let e = u(I).trim().toLowerCase();
15
- return t.options.filter((t) => t.label.toLowerCase().includes(e));
16
- })()), R = _(!1), z = _(-1), B = _(null), V = _(null), H = _(null), U = _(c({
17
- top: 0,
18
- left: 0,
19
- width: 0,
20
- openUpward: !1,
21
- maxHeight: 0,
22
- availHeight: 0
23
- })), W = m(() => Array.isArray(t.value) ? t.value : t.value == null || t.value === "" ? [] : [t.value]), be = m(() => {
24
- if (u(W).length === 0) return j();
25
- if (!A()) {
26
- let e = u(W)[0], n = t.options.find((t) => String(t.value) === String(e));
27
- return n ? n.label : String(e);
28
- }
29
- return `${u(W).length} selected`;
30
- }), xe = m(() => {
31
- if (A() || u(W).length !== 1) return;
32
- let e = u(W)[0];
33
- return t.options.find((t) => String(t.value) === String(e))?.color;
34
- });
35
- function G(e) {
36
- return u(W).some((t) => String(t) === String(e.value));
37
- }
38
- function K(e) {
39
- if (A()) {
40
- let n = G(e) ? u(W).filter((t) => String(t) !== String(e.value)) : [...u(W), e.value];
41
- t.onChange?.(n);
42
- } else t.onChange?.(e.value), v(R, !1), t.onCommit?.();
43
- }
44
- function q() {
45
- if (!u(R)) {
46
- if (v(R, !0), u(z) < 0) {
47
- let e = t.options.findIndex((e) => G(e));
48
- v(z, e >= 0 ? e : 0, !0);
49
- }
50
- Se();
51
- }
52
- }
53
- function Se() {
54
- if (!u(V)) return;
55
- let e = Math.min(t.options.length, 10) * u(F) + (A() ? 40 : 0) + 8;
56
- v(U, k(u(V).getBoundingClientRect(), {
57
- estimatedHeight: e,
58
- clampHorizontal: !1
59
- }), !0);
60
- }
61
- g(() => {
62
- if (!u(R)) return;
63
- let e = () => Se();
64
- return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
65
- window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
66
- };
67
- });
68
- function J() {
69
- v(R, !1), v(z, -1);
70
- }
71
- function Ce(e) {
72
- if (e.stopPropagation(), e.key === "Escape") {
73
- e.preventDefault(), J(), t.onCancel?.();
74
- return;
75
- }
76
- if (e.key === "ArrowDown") {
77
- if (e.preventDefault(), !u(R)) {
78
- q();
79
- return;
80
- }
81
- v(z, Math.min(u(z) + 1, t.options.length - 1), !0), Y();
82
- } else if (e.key === "ArrowUp") {
83
- if (e.preventDefault(), !u(R)) {
84
- q();
85
- return;
86
- }
87
- v(z, Math.max(u(z) - 1, 0), !0), Y();
88
- } else if (e.key === "Home") {
89
- if (!u(R)) return;
90
- e.preventDefault(), v(z, 0), Y();
91
- } else if (e.key === "End") {
92
- if (!u(R)) return;
93
- e.preventDefault(), v(z, t.options.length - 1), Y();
94
- } else if (e.key === "Enter") {
95
- if (e.preventDefault(), !u(R)) {
96
- q();
97
- return;
98
- }
99
- let n = t.options[u(z)];
100
- n ? K(n) : A() && (J(), t.onCommit?.());
101
- } else if (e.key === " " && u(R)) {
102
- e.preventDefault();
103
- let n = t.options[u(z)];
104
- n && K(n);
105
- } else e.key === "Tab" && (u(R) && J(), t.onCommit?.());
106
- }
107
- function Y() {
108
- queueMicrotask(() => {
109
- u(H) && u(H).querySelector(`[data-opt-idx="${u(z)}"]`)?.scrollIntoView({ block: "nearest" });
110
- });
111
- }
112
- function we(e) {
113
- let n = e.relatedTarget;
114
- n && u(B)?.contains(n) || (u(R) && J(), t.onCommit?.());
115
- }
116
- function Te(e, n) {
117
- n.preventDefault(), n.stopPropagation();
118
- let r = u(W).filter((t) => String(t) !== String(e));
119
- t.onChange?.(A() ? r : r[0] ?? null);
120
- }
121
- function Ee(e) {
122
- ye() && (e.focus(), q());
123
- }
124
- g(() => {
125
- if (!u(R)) return;
126
- let e = (e) => {
127
- let n = e.target;
128
- n && (u(B)?.contains(n) || u(H)?.contains(n) || (J(), t.onCommit?.()));
129
- };
130
- return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
131
- });
132
- function X(e) {
133
- return `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));`;
134
- }
135
- var Z = ve();
136
- let De;
137
- var Q = o(Z);
138
- let $;
139
- var Oe = o(Q), ke = (e) => {
140
- var s = se();
141
- r(s, 21, () => u(W), (e) => String(e), (e, r) => {
142
- let s = m(() => t.options.find((e) => String(e.value) === String(u(r))));
143
- var c = oe(), l = o(c), d = E(l);
144
- S(d, "tabindex", -1), D(c), n((e, t, n) => {
145
- y(c, e), i(l, `${t ?? ""} `), S(d, "aria-label", `Remove ${n ?? ""}`);
146
- }, [
147
- () => u(s)?.color ? X(u(s).color) : "",
148
- () => u(s) ? u(s).label : String(u(r)),
149
- () => u(s) ? u(s).label : String(u(r))
150
- ]), a("mousedown", d, (e) => e.preventDefault()), a("click", d, (e) => Te(u(r), e)), f(e, c);
151
- }), D(s), f(e, s);
152
- }, Ae = (e) => {
153
- var t = ce(), r = o(t, !0);
154
- D(t), n((e) => {
155
- y(t, e), i(r, u(be));
156
- }, [() => X(u(xe))]), f(e, t);
157
- }, je = (e) => {
158
- var t = le(), r = o(t, !0);
159
- D(t), n(() => i(r, u(be))), f(e, t);
160
- };
161
- h(Oe, (e) => {
162
- M() && u(W).length > 0 ? e(ke) : !A() && u(W).length === 1 && u(xe) ? e(Ae, 1) : e(je, -1);
163
- }), T(2), D(Q), b(Q, (e) => v(V, e), () => u(V)), x(Q, (e) => Ee?.(e));
164
- var Me = E(Q, 2), Ne = (e) => {
165
- let c = m(() => t.options.length > 10), d = m(() => Math.min(u(c) ? 10 * u(F) + (A() ? 40 : 0) + 8 : Infinity, u(U).maxHeight));
166
- var p = _e();
167
- let g, _;
168
- var C = o(p), w = (e) => {
169
- var n = ue();
170
- re(n), a("mousedown", n, (e) => e.stopPropagation()), a("click", n, (e) => e.stopPropagation()), a("keydown", n, (e) => {
171
- e.key === "Escape" && (e.preventDefault(), v(R, !1), t.onCancel?.());
172
- }), te(n, () => u(I), (e) => v(I, e)), f(e, n);
173
- };
174
- h(C, (e) => {
175
- N() && e(w);
176
- });
177
- var T = E(C, 2), ne = (e) => {
178
- var t = de(), r = o(t, !0);
179
- D(t), n(() => i(r, N() && u(I) ? `No matches for "${u(I)}"` : "No options")), f(e, t);
180
- }, k = (e) => {
181
- var t = ee();
182
- r(l(t), 19, () => u(L), (e) => String(e.value), (e, t, r) => {
183
- let c = m(() => G(u(t)));
184
- var l = he();
185
- let d;
186
- var p = o(l), g = (e) => {
187
- var t = fe(), r = o(t, !0);
188
- D(t), n(() => i(r, u(c) ? "✓" : "")), f(e, t);
189
- };
190
- h(p, (e) => {
191
- A() && e(g);
192
- });
193
- var _ = E(p, 2), b = (e) => {
194
- var r = pe(), a = o(r, !0);
195
- D(r), n((e) => {
196
- y(r, e), i(a, u(t).label);
197
- }, [() => X(u(t).color)]), f(e, r);
198
- }, x = (e) => {
199
- var r = me(), a = o(r, !0);
200
- D(r), n(() => i(a, u(t).label)), f(e, r);
201
- };
202
- h(_, (e) => {
203
- u(t).color ? e(b) : e(x, -1);
204
- }), D(l), n((e) => {
205
- d = O(l, 1, "sv-grid-dropdown-option", null, d, {
206
- "sv-grid-dropdown-option-selected": u(c),
207
- "sv-grid-dropdown-option-highlighted": u(r) === u(z)
208
- }), S(l, "id", e), S(l, "aria-selected", u(c)), S(l, "data-opt-idx", u(r));
209
- }, [() => P(u(r))]), a("mousedown", l, (e) => {
210
- e.preventDefault(), K(u(t));
211
- }), s("mouseenter", l, () => v(z, u(r), !0)), f(e, l);
212
- }), f(e, t);
213
- };
214
- h(T, (e) => {
215
- u(L).length === 0 ? e(ne) : e(k, -1);
216
- });
217
- var oe = E(T, 2), se = (e) => {
218
- var n = ge(), r = o(n);
219
- D(n), a("mousedown", r, (e) => e.preventDefault()), a("click", r, () => {
220
- J(), t.onCommit?.();
221
- }), f(e, n);
222
- };
223
- h(oe, (e) => {
224
- A() && e(se);
225
- }), D(p), b(p, (e) => v(H, e), () => u(H)), x(p, (e) => ae?.(e)), x(p, (e, t) => ie?.(e, t), () => ({ up: u(U).openUpward })), n(() => {
226
- g = O(p, 1, "sv-grid-dropdown-panel", null, g, { "sv-grid-dropdown-panel-fits": !u(c) }), S(p, "aria-multiselectable", A()), _ = y(p, "", _, {
227
- position: "fixed",
228
- top: `${u(U).top}px`,
229
- left: `${u(U).left}px`,
230
- width: `${u(U).width}px`,
231
- "max-height": u(d) === null ? null : `${u(d)}px`,
232
- "z-index": "2147483647"
233
- });
234
- }), a("pointerdown", p, (e) => e.stopPropagation()), a("mousedown", p, (e) => e.stopPropagation()), a("click", p, (e) => e.stopPropagation()), f(e, p);
235
- };
236
- h(Me, (e) => {
237
- u(R) && e(Ne);
238
- }), D(Z), b(Z, (e) => v(B, e), () => u(B)), n((e) => {
239
- De = O(Z, 1, "sv-grid-dropdown svelte-13rpzh6", null, De, { "sv-grid-dropdown-open": u(R) }), $ = O(Q, 1, "sv-grid-dropdown-trigger svelte-13rpzh6", null, $, { "sv-grid-dropdown-trigger-chips": M() && u(W).length > 0 }), S(Q, "aria-expanded", u(R)), S(Q, "aria-activedescendant", e);
240
- }, [() => u(R) ? P(u(z)) : void 0]), a("focusout", Z, we), a("click", Z, (e) => e.stopPropagation()), a("dblclick", Z, (e) => e.stopPropagation()), a("pointerdown", Z, (e) => e.stopPropagation()), a("mousedown", Z, (e) => e.stopPropagation()), a("click", Q, () => u(R) ? J() : q()), a("keydown", Q, Ce), f(e, Z), C();
241
- }
242
- p([
243
- "focusout",
244
- "click",
245
- "dblclick",
246
- "pointerdown",
247
- "mousedown",
248
- "keydown"
249
- ]);
250
- //#endregion
251
- export { A as n, j as t };
@@ -1,265 +0,0 @@
1
- //#region ../grid/dist/cell-formatting.js
2
- function e(e, t) {
3
- if (e) switch (e.trim()) {
4
- case "d": return t === "datetime" ? {
5
- year: "numeric",
6
- month: "numeric",
7
- day: "numeric",
8
- hour: "numeric",
9
- minute: "numeric"
10
- } : {
11
- year: "numeric",
12
- month: "numeric",
13
- day: "numeric"
14
- };
15
- case "D": return t === "datetime" ? {
16
- weekday: "long",
17
- year: "numeric",
18
- month: "long",
19
- day: "numeric",
20
- hour: "numeric",
21
- minute: "numeric"
22
- } : {
23
- weekday: "long",
24
- year: "numeric",
25
- month: "long",
26
- day: "numeric"
27
- };
28
- case "y-m-d": return t === "datetime" ? {
29
- year: "numeric",
30
- month: "2-digit",
31
- day: "2-digit",
32
- hour: "2-digit",
33
- minute: "2-digit",
34
- hour12: !1
35
- } : {
36
- year: "numeric",
37
- month: "2-digit",
38
- day: "2-digit"
39
- };
40
- case "medium": return {
41
- dateStyle: "medium",
42
- timeStyle: t === "datetime" ? "short" : void 0
43
- };
44
- case "short": return {
45
- dateStyle: "short",
46
- timeStyle: t === "datetime" ? "short" : void 0
47
- };
48
- case "long": return {
49
- dateStyle: "long",
50
- timeStyle: t === "datetime" ? "short" : void 0
51
- };
52
- default: return;
53
- }
54
- }
55
- var t = /* @__PURE__ */ new Map();
56
- function n(e, n) {
57
- let r = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (n.style ?? "") + "|" + (n.currency ?? "") + "|" + (n.minimumFractionDigits ?? "") + "|" + (n.maximumFractionDigits ?? "") + "|" + (n.useGrouping ?? "") + "|" + (n.currencyDisplay ?? "") + "|" + (n.notation ?? ""), i = t.get(r);
58
- return i || (i = new Intl.NumberFormat(e, n), t.set(r, i)), i;
59
- }
60
- var r = /* @__PURE__ */ new Map();
61
- function i(e, t) {
62
- let n = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (t.dateStyle ?? "") + "|" + (t.timeStyle ?? "") + "|" + (t.year ?? "") + "|" + (t.month ?? "") + "|" + (t.day ?? "") + "|" + (t.hour ?? "") + "|" + (t.minute ?? "") + "|" + (t.second ?? "") + "|" + (t.weekday ?? "") + "|" + (t.hour12 ?? ""), i = r.get(n);
63
- return i || (i = new Intl.DateTimeFormat(e, t), r.set(n, i)), i;
64
- }
65
- function a(e, t) {
66
- let r = typeof e == "number" ? e : Number(e);
67
- if (!Number.isFinite(r)) return String(e ?? "");
68
- let i = t.locales;
69
- if (t.type === "currency") return n(i, {
70
- style: "currency",
71
- currency: t.currency ?? "USD",
72
- ...t.options
73
- }).format(r);
74
- if (t.type === "percent") {
75
- let e = t.valueIsPercentPoints === !0 ? r / 100 : r;
76
- return n(i, {
77
- style: "percent",
78
- minimumFractionDigits: 0,
79
- maximumFractionDigits: 2,
80
- ...t.options
81
- }).format(e);
82
- }
83
- return n(i, t.options ?? {}).format(r);
84
- }
85
- //#endregion
86
- //#region ../grid/dist/conditional-formatting.js
87
- var o = {
88
- arrows: [
89
- "↓",
90
- "→",
91
- "↑"
92
- ],
93
- traffic: [
94
- "🔴",
95
- "🟡",
96
- "🟢"
97
- ],
98
- triangles: [
99
- "▼",
100
- "◆",
101
- "▲"
102
- ]
103
- };
104
- function s(e) {
105
- let t = Infinity, n = -Infinity, r = !1;
106
- for (let i of e) {
107
- if (i == null || i === "") continue;
108
- let e = Number(i);
109
- Number.isFinite(e) && (r = !0, e < t && (t = e), e > n && (n = e));
110
- }
111
- return r ? {
112
- min: t,
113
- max: n
114
- } : null;
115
- }
116
- function c(e, t, n) {
117
- let r = 0;
118
- for (let e = 0; e < t.length; e += 1) n >= t[e] && (r = e + 1);
119
- return e[Math.min(e.length - 1, Math.max(0, r))] ?? e[e.length - 1];
120
- }
121
- function l(e) {
122
- return e < 0 ? 0 : e > 1 ? 1 : e;
123
- }
124
- function u(e) {
125
- let t = /^#?([0-9a-f]{6})$/i.exec(e.trim());
126
- if (!t) return null;
127
- let n = parseInt(t[1], 16);
128
- return [
129
- n >> 16 & 255,
130
- n >> 8 & 255,
131
- n & 255
132
- ];
133
- }
134
- function d(e) {
135
- return "#" + e.map((e) => Math.round(l(e / 255) * 255).toString(16).padStart(2, "0")).join("");
136
- }
137
- function f(e) {
138
- let t = u(e);
139
- if (!t) return null;
140
- let n = t.map((e) => {
141
- let t = e / 255;
142
- return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
143
- });
144
- return .2126 * n[0] + .7152 * n[1] + .0722 * n[2] > .45 ? "#1e293b" : "#ffffff";
145
- }
146
- function p(e, t, n) {
147
- let r = u(e), i = u(t);
148
- if (!r || !i) return e;
149
- let a = l(n);
150
- return d([
151
- r[0] + (i[0] - r[0]) * a,
152
- r[1] + (i[1] - r[1]) * a,
153
- r[2] + (i[2] - r[2]) * a
154
- ]);
155
- }
156
- function m(e, t) {
157
- let n = u(e);
158
- return n ? `rgba(${n[0]}, ${n[1]}, ${n[2]}, ${l(t).toFixed(3)})` : e;
159
- }
160
- function h(e, t) {
161
- let n = [...e].sort((e, t) => e.offset - t.offset);
162
- if (n.length === 0) return "#000000";
163
- if (t <= n[0].offset) return n[0].color;
164
- let r = n[n.length - 1];
165
- if (t >= r.offset) return r.color;
166
- for (let e = 0; e < n.length - 1; e += 1) {
167
- let r = n[e], i = n[e + 1];
168
- if (t >= r.offset && t <= i.offset) {
169
- let e = i.offset - r.offset || 1;
170
- return p(r.color, i.color, (t - r.offset) / e);
171
- }
172
- }
173
- return r.color;
174
- }
175
- function g(e, t) {
176
- if (e.stops && e.stops.length >= 2) return h(e.stops, t);
177
- let n = e.min ?? "#ffffff", r = e.max ?? "#000000";
178
- return e.mid ? t <= .5 ? p(n, e.mid, t / .5) : p(e.mid, r, (t - .5) / .5) : p(n, r, t);
179
- }
180
- function _(e, t, n, r) {
181
- let i;
182
- if (e.compareColumn) {
183
- let r = Number(n?.[e.compareColumn]);
184
- if (!Number.isFinite(r) || r === 0) return null;
185
- i = l(t / r);
186
- } else if (e.type === "colorScale" && e.zeroCentred) {
187
- let n = e.minValue ?? r?.min ?? t, a = e.maxValue ?? r?.max ?? t;
188
- i = l(.5 + t / (Math.max(Math.abs(n), Math.abs(a)) || 1) / 2);
189
- } else {
190
- let n = r?.min ?? t, a = r?.max ?? t, o, s;
191
- if (e.bounds === "percent") {
192
- let t = a - n;
193
- o = n + (e.minValue ?? 0) / 100 * t, s = n + (e.maxValue ?? 100) / 100 * t;
194
- } else o = e.minValue ?? n, s = e.maxValue ?? a;
195
- i = s === o ? .5 : l((t - o) / (s - o));
196
- }
197
- return e.type === "colorScale" && e.reverse && (i = 1 - i), i;
198
- }
199
- function v(e, t, n, r, i) {
200
- let a = {};
201
- for (let s of r) {
202
- if (s.columns && !s.columns.includes(n)) continue;
203
- let r = Number(e);
204
- if (s.type === "rule") {
205
- if (s.when({
206
- value: e,
207
- row: t
208
- })) {
209
- if (s.background && (a.background = s.background, !s.color)) {
210
- let e = f(s.background);
211
- e && (a.color = e);
212
- }
213
- s.color && (a.color = s.color), s.fontWeight != null && (a.fontWeight = s.fontWeight);
214
- }
215
- continue;
216
- }
217
- if (!(e == null || e === "" || !Number.isFinite(r))) {
218
- if (s.type === "colorScale") {
219
- let n = _(s, r, t, i);
220
- if (n == null) continue;
221
- if (s.mode === "alpha") {
222
- let [e, t] = s.alphaBounds ?? [.05, .85];
223
- a.background = m(s.base ?? "#2563eb", e + (t - e) * n);
224
- } else {
225
- a.background = g(s, n);
226
- let e = f(a.background);
227
- e && (a.color = e);
228
- }
229
- s.tooltip === "value" ? a.title = String(e) : s.tooltip === "percent" && (a.title = `${Math.round(n * 100)}%`);
230
- } else if (s.type === "dataBar") {
231
- let e;
232
- if (s.compareColumn) {
233
- let n = _(s, r, t, i);
234
- if (n == null) continue;
235
- e = n * 100;
236
- } else if (s.bounds === "percent") {
237
- let n = _(s, r, t, i);
238
- if (n == null) continue;
239
- e = n * 100;
240
- } else {
241
- let t = s.minValue ?? Math.min(0, i?.min ?? 0), n = (s.maxValue ?? i?.max ?? r) - t || 1;
242
- e = l((r - t) / n) * 100;
243
- }
244
- a.dataBar = {
245
- percent: e,
246
- color: r < 0 ? s.negativeColor ?? "#ef4444" : s.color,
247
- fromRight: !1,
248
- gradient: s.gradient
249
- }, s.showValue === !1 && (a.color = "transparent");
250
- } else if (s.type === "iconSet") {
251
- let e = o[s.set ?? "arrows"];
252
- a.icon = c(e, s.thresholds, r), s.iconOnly && (a.iconOnly = !0);
253
- }
254
- }
255
- }
256
- return a;
257
- }
258
- function y(e) {
259
- return (e.type === "colorScale" || e.type === "dataBar") && !("compareColumn" in e && e.compareColumn);
260
- }
261
- function b(e) {
262
- return e.some(y);
263
- }
264
- //#endregion
265
- export { v as a, e as c, b as i, f as n, a as o, y as r, i as s, s as t };
@@ -1,41 +0,0 @@
1
- //#region ../grid/dist/a11y/dismissable.js
2
- function e(e, t) {
3
- return t ? (Array.isArray(e) ? e : [e]).some((e) => e != null && e.contains(t)) : !1;
4
- }
5
- var t = [], n = !1;
6
- function r() {
7
- n || typeof document > "u" || (n = !0, document.addEventListener("keydown", (e) => {
8
- if (e.key !== "Escape") return;
9
- let n = t[t.length - 1];
10
- n?.closeOnEscape && (e.stopPropagation(), n.onDismiss("escape"));
11
- }, !0), document.addEventListener("pointerdown", (n) => {
12
- let r = t[t.length - 1];
13
- r?.closeOnOutside && (e(r.element(), n.target) || r.onDismiss("outside"));
14
- }, !0));
15
- }
16
- function i(e) {
17
- let n = {
18
- element: e.element,
19
- onDismiss: e.onDismiss,
20
- closeOnEscape: e.closeOnEscape ?? !0,
21
- closeOnOutside: e.closeOnOutside ?? !0
22
- };
23
- return {
24
- activate() {
25
- r(), t.includes(n) || t.push(n);
26
- },
27
- release() {
28
- let e = t.indexOf(n);
29
- e >= 0 && t.splice(e, 1);
30
- }
31
- };
32
- }
33
- function a(t, n) {
34
- if (typeof window > "u") return () => {};
35
- let r = (r) => {
36
- e(t(), r.target) || n();
37
- };
38
- return window.addEventListener("scroll", r, !0), () => window.removeEventListener("scroll", r, !0);
39
- }
40
- //#endregion
41
- export { a as n, i as t };
@@ -1,11 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.defineProperty, t = (t, n) => {
3
- let r = {};
4
- for (var i in t) e(r, i, {
5
- get: t[i],
6
- enumerable: !0
7
- });
8
- return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
- };
10
- //#endregion
11
- export { t };