@svgrid/grid 3.0.5 → 3.0.6
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/README.md +28 -7
- package/dist/GridMenus.svelte +34 -4
- package/dist/SvGrid.controller.svelte.d.ts +21 -3
- package/dist/SvGrid.controller.svelte.js +205 -50
- package/dist/SvGrid.css +127 -2
- package/dist/SvGrid.svelte +223 -38
- package/dist/SvGrid.types.d.ts +77 -4
- package/dist/SvGridDropdown.svelte +20 -0
- package/dist/SvGridDropdown.svelte.d.ts +12 -0
- package/dist/SvModal.svelte +22 -0
- package/dist/SvModal.svelte.d.ts +7 -0
- package/dist/a11y/dismissable.d.ts +10 -0
- package/dist/a11y/dismissable.js +24 -2
- package/dist/build-api.js +81 -31
- package/dist/cdn/{GridMenus-CID62rlI.js → GridMenus-C-NtjlrJ.js} +150 -141
- package/dist/cdn/GridMenus-TssHej3q.js +644 -0
- package/dist/cdn/{SvChartMenu-FBSMINA6.js → SvChartMenu-BFSTpvB-.js} +1 -1
- package/dist/cdn/{SvChartMenu-Bl6PBbkT.js → SvChartMenu-BZ1Iwv0y.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-DQwt4UAs.js → SvDateTimePicker-D9u_cOf8.js} +1 -1
- package/dist/cdn/{SvDateTimePicker-vNU6bZ-q.js → SvDateTimePicker-s_6IUpI7.js} +1 -1
- package/dist/cdn/{SvGridCellEditor-B1p-vCK5.js → SvGridCellEditor-BlyCSp0q.js} +1 -1
- package/dist/cdn/{SvGridCellEditor-D_0q4xAu.js → SvGridCellEditor-ClRRA9lW.js} +1 -1
- package/dist/cdn/{SvGridChart-DzLkSwCH.js → SvGridChart-B4EV8U6t.js} +4 -4
- package/dist/cdn/{SvGridChart-C3EWAZaM.js → SvGridChart-DsmwTyZF.js} +4 -4
- package/dist/cdn/{SvGridChartBuilder-CfII62sZ.js → SvGridChartBuilder-cHloHobN.js} +4 -4
- package/dist/cdn/{SvGridChartBuilder-BE2T1ykB.js → SvGridChartBuilder-vOl7C0Za.js} +4 -4
- package/dist/cdn/{SvGridChartPanel-xf4sWVTo.js → SvGridChartPanel-AcqF-Ll5.js} +5 -5
- package/dist/cdn/{SvGridChartPanel-CCX5_Wgd.js → SvGridChartPanel-biMtSBPA.js} +5 -5
- package/dist/cdn/{SvGridChartView-DYwabQWj.js → SvGridChartView-Dx_GmZuL.js} +2 -2
- package/dist/cdn/{SvGridChartView-CfuXmY5I.js → SvGridChartView-I3rDHXAq.js} +2 -2
- package/dist/cdn/{SvGridDropdown-D0VdjeR8.js → SvGridDropdown-BWeM3lMe.js} +46 -46
- package/dist/cdn/{SvGridDropdown-D13MtJ2j.js → SvGridDropdown-CJ6QqTxu.js} +67 -67
- package/dist/cdn/{SvModal-CIZWCcad.js → SvModal-ClxGmpAc.js} +187 -186
- package/dist/cdn/{SvModal-BAE-pjZX.js → SvModal-DhB_VMFR.js} +148 -147
- package/dist/cdn/{cell-formatting-C2Hf5gqd.js → cell-formatting-DVVKOSI9.js} +1 -1
- package/dist/cdn/{chart-Dz7SqMXH.js → chart-DEZxwC0i.js} +1 -1
- package/dist/cdn/{chart-panel-messages-CUbf2R4i.js → chart-panel-messages-D12XcTZJ.js} +1 -1
- package/dist/cdn/{chart-panel-messages-CmNrMdsr.js → chart-panel-messages-DguS7gC5.js} +1 -1
- package/dist/cdn/{chart-summary-BJW_tg_X.js → chart-summary-CMAXBGY-.js} +1 -1
- package/dist/cdn/{chart-trend-CaN9mDEV.js → chart-trend-BkEp61Gj.js} +1 -1
- package/dist/cdn/{dismissable-DAHetSNk.js → dismissable-Brc4EZU1.js} +5 -1
- package/dist/cdn/{export-format-CUDLy2yn.js → export-format-YzdwBww2.js} +1 -1
- package/dist/cdn/{row-resize-niQCp040.js → row-resize-DtOS1KG6.js} +41 -32
- package/dist/cdn/{server-block-cache-CGoWz-87.js → server-block-cache-DIqb3VZn.js} +4 -0
- package/dist/cdn/{src-jcFMkBnN.js → src-CgoeSM8k.js} +4697 -4131
- package/dist/cdn/{src-Bklofsad.js → src-DfwxB1TH.js} +4727 -4161
- package/dist/cdn/svgrid.js +17 -17
- package/dist/cdn/svgrid.svelte-external.js +17 -17
- package/dist/cdn/{validate-C7Rn_Bns.js → validate-AZoD8BoR.js} +6 -2
- package/dist/cell-formatting.js +18 -1
- package/dist/cell-render.js +25 -6
- package/dist/clipboard.d.ts +2 -2
- package/dist/clipboard.js +72 -23
- package/dist/columns.js +7 -2
- package/dist/conditional-formatting.d.ts +2 -0
- package/dist/conditional-formatting.js +2 -0
- package/dist/core.d.ts +22 -6
- package/dist/core.js +365 -25
- package/dist/editing.js +24 -0
- package/dist/grid-messages.d.ts +4 -0
- package/dist/grid-messages.js +4 -0
- package/dist/headless.d.ts +5 -0
- package/dist/headless.js +12 -0
- package/dist/history.d.ts +21 -0
- package/dist/history.js +34 -4
- package/dist/index.d.ts +1 -1
- package/dist/keyboard-handlers.js +24 -1
- package/dist/keyboard.js +4 -0
- package/dist/row-drag-touch.d.ts +1 -1
- package/dist/row-drag.js +35 -1
- package/dist/row-model.d.ts +6 -0
- package/dist/row-resize.js +22 -1
- package/dist/selection.js +1 -1
- package/dist/server-block-cache.d.ts +5 -0
- package/dist/server-block-cache.js +8 -0
- package/dist/server-data-source.d.ts +35 -3
- package/dist/server-data-source.js +11 -2
- package/dist/server.d.ts +1 -1
- package/dist/sparkline.js +7 -5
- package/dist/svgrid-wrapper.types.d.ts +33 -0
- package/dist/validate.js +9 -1
- package/package.json +6 -1
- package/src/GridMenus.svelte +34 -4
- package/src/SvGrid.controller.svelte.ts +206 -53
- package/src/SvGrid.css +127 -2
- package/src/SvGrid.svelte +223 -38
- package/src/SvGrid.types.ts +77 -4
- package/src/SvGridDropdown.svelte +20 -0
- package/src/SvModal.svelte +22 -0
- package/src/SvModal.test.ts +30 -1
- package/src/a11y/dismissable.test.ts +10 -1
- package/src/a11y/dismissable.ts +22 -2
- package/src/build-api.ts +85 -27
- package/src/cell-formatting.test.ts +17 -0
- package/src/cell-formatting.ts +18 -1
- package/src/cell-render.test.ts +24 -2
- package/src/cell-render.ts +24 -8
- package/src/clipboard.test.ts +107 -0
- package/src/clipboard.ts +62 -23
- package/src/columns.test.ts +4 -4
- package/src/columns.ts +7 -2
- package/src/conditional-formatting.test.ts +8 -0
- package/src/conditional-formatting.ts +3 -0
- package/src/core.tick-repair.test.ts +287 -0
- package/src/core.ts +374 -26
- package/src/editing.test.ts +52 -0
- package/src/editing.ts +25 -0
- package/src/grid-messages.test.ts +7 -0
- package/src/grid-messages.ts +10 -0
- package/src/headless.ts +24 -0
- package/src/history.test.ts +49 -1
- package/src/history.ts +48 -2
- package/src/index.ts +2 -0
- package/src/keyboard-handlers.coverage.test.ts +65 -0
- package/src/keyboard-handlers.ts +26 -1
- package/src/keyboard.ts +3 -0
- package/src/row-drag-touch.ts +2 -2
- package/src/row-drag.test.ts +51 -0
- package/src/row-drag.ts +35 -2
- package/src/row-model.ts +6 -0
- package/src/row-resize.ts +24 -1
- package/src/selection.ts +1 -1
- package/src/server-block-cache.test.ts +27 -0
- package/src/server-block-cache.ts +13 -0
- package/src/server-data-source.infinite.test.ts +62 -0
- package/src/server-data-source.test.ts +19 -0
- package/src/server-data-source.ts +48 -4
- package/src/server.ts +2 -0
- package/src/sparkline.test.ts +7 -0
- package/src/sparkline.ts +6 -4
- package/src/svgrid-wrapper.types.ts +32 -0
- package/src/svgrid.api.test.ts +21 -0
- package/src/svgrid.charting.test.ts +12 -4
- package/src/svgrid.context-menu.test.ts +12 -0
- package/src/svgrid.detail-rows.svelte.test.ts +187 -0
- package/src/svgrid.filter-menu-scroll.test.ts +9 -0
- package/src/svgrid.gantt-seam.test.ts +1 -1
- package/src/svgrid.live-update-paths.svelte.test.ts +184 -0
- package/src/svgrid.menu-scroll-close.test.ts +10 -0
- package/src/svgrid.row-model-seam.svelte.test.ts +16 -0
- package/src/svgrid.row-pinning.test.ts +15 -1
- package/src/svgrid.selection-bar-seam.test.ts +1 -1
- package/src/svgrid.sticky-groups.svelte.test.ts +145 -0
- package/src/svgrid.upsell-license.test.ts +1 -1
- package/src/test-setup.ts +12 -0
- package/src/transaction.test.ts +58 -0
- package/src/validate.ts +7 -1
- package/dist/cdn/GridMenus-DLL-qZeu.js +0 -635
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { E as t, F as n, G as r, H as i, I as a, L as o, N as s, U as c, V as l, X as u, Y as d, _ as f, at as p, b as m, d as h, et as g, ft as _, i as v, it as y, k as b, lt as x, nt as S, o as ee, pt as C, rt as w, st as T, t as E, tt as te, u as ne, ut as D, v as O, x as
|
|
3
|
-
import { i as
|
|
2
|
+
import { E as t, F as n, G as r, H as i, I as a, L as o, N as s, U as c, V as l, X as u, Y as d, _ as f, at as p, b as m, d as h, et as g, ft as _, i as v, it as y, k as b, lt as x, nt as S, o as ee, pt as C, rt as w, st as T, t as E, tt as te, u as ne, ut as D, v as O, x as k, z as re } from "./disclose-version-Dr7rEVv-.js";
|
|
3
|
+
import { i as ie, n as ae, r as oe } from "./popover-P-9P2YYn.js";
|
|
4
4
|
//#region src/SvGridDropdown.svelte
|
|
5
5
|
var A = /* @__PURE__ */ e({ default: () => j }), se = o("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-ei8hp3\"> <span class=\"sv-grid-chip-remove svelte-ei8hp3\" role=\"button\">×</span></span>"), ce = o("<span class=\"sv-grid-dropdown-chips svelte-ei8hp3\"></span>"), le = o("<span class=\"sv-grid-chip svelte-ei8hp3\"> </span>"), ue = o("<span class=\"sv-grid-dropdown-label svelte-ei8hp3\"> </span>"), de = o("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), fe = o("<div class=\"sv-grid-dropdown-empty\" role=\"status\" aria-live=\"polite\">Loading…</div>"), pe = o("<div class=\"sv-grid-dropdown-empty\"> </div>"), me = o("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), he = o("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), ge = o("<span class=\"sv-grid-dropdown-option-label\"> </span>"), _e = o("<div role=\"option\"><!> <!></div>"), ve = o("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), ye = o("<div role=\"listbox\"><!> <!> <!></div>"), be = o("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-ei8hp3\" aria-hidden=\"true\">▾</span></button> <!></div>"), xe = {
|
|
6
6
|
hash: "svelte-ei8hp3",
|
|
7
7
|
code: "\n /* All colors derive from the grid's host CSS vars so light/dark themes\n \"just work\". Hard fallbacks are kept so the component is still\n usable in an unthemed page. */.sv-grid-dropdown.svelte-ei8hp3 {position:absolute;top:0;left:0;right:0;height:100%;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-trigger.svelte-ei8hp3 {display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:28px;padding:0 8px;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);border:0;outline:none;font:inherit;text-align:start;cursor:pointer;box-sizing:border-box;}.sv-grid-dropdown-trigger.svelte-ei8hp3:focus {outline:2px solid var(--sg-accent, #2563eb);outline-offset:-2px;}.sv-grid-dropdown-trigger-chips.svelte-ei8hp3 {align-items:center;padding:4px 8px;flex-wrap:wrap;}.sv-grid-dropdown-chips.svelte-ei8hp3 {display:inline-flex;flex-wrap:wrap;gap:4px;flex:1 1 auto;min-width:0;align-items:center;}.sv-grid-dropdown-label.svelte-ei8hp3 {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-caret.svelte-ei8hp3 {flex:0 0 auto;font-size:10px;opacity:0.7;line-height:1;}\n\n /* Popover sits absolutely below the trigger. The parent\n `.sv-grid-cell-editing` has `overflow: visible`, so this can hang\n past the row. Pulls its surface color from the grid's header bg\n so it reads as a slightly elevated layer on either theme. */\n /* Panel is `position: fixed` AND portal'd into document.body via\n `use:portalToBody`, so it escapes every ancestor overflow / clip /\n transform / stacking context. Coords come from updatePanelPosition(). */.sv-grid-dropdown-panel {overflow-y:auto;background:var(--sg-header-bg, var(--sg-bg, #ffffff));color:var(--sg-fg, #0f172a);border:1px solid var(--sg-accent, #2563eb);border-radius:6px;box-shadow:0 12px 28px rgba(0, 0, 0, 0.45);padding:4px 0;font-family:inherit;}\n /* When the option list fits in one panel we want NO scrollbar at all -\n * not even a sub-pixel ghost track. `overflow: visible` rules out the\n * scrollbar gutter that some browsers still reserve under\n * `overflow: auto` when content equals max-height. */.sv-grid-dropdown-panel.sv-grid-dropdown-panel-fits {overflow:visible;}.sv-grid-dropdown-option {display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer;user-select:none;color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.1));}.sv-grid-dropdown-option-selected {font-weight:600;background:var(--sg-selection-bg, rgba(37, 99, 235, 0.15));}.sv-grid-dropdown-option-selected.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.18));}.sv-grid-dropdown-option-label {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-check {flex:0 0 16px;display:inline-flex;align-items:center;justify-content:center;color:var(--sg-accent, #2563eb);font-weight:700;}.sv-grid-dropdown-swatch {flex:0 0 12px;width:12px;height:12px;border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-fg, #0f172a) 25%, transparent);}\n /* Colored option chip. Declared `:global` because the option panel is\n portal'd to <body>, where Svelte's scoped classes don't reach. The\n per-chip background / border / text color come from an inline style\n (see colorfulChipStyleInline) so each option matches its cell chip. */.sv-grid-dropdown-option-chip {display:inline-flex;align-items:center;max-width:100%;padding:2px 11px;border:1px solid transparent;border-radius:999px;font-size:0.9em;font-weight:600;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-empty {padding:8px 10px;color:var(--sg-muted, rgba(15, 23, 42, 0.55));font-style:italic;font-size:0.9em;}.sv-grid-dropdown-footer {display:flex;justify-content:flex-end;padding:4px 6px;border-top:1px solid var(--sg-border, rgba(15, 23, 42, 0.08));margin-top:2px;}.sv-grid-dropdown-done {font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#fff;background:var(--sg-accent, #2563eb);border:0;border-radius:4px;padding:4px 10px;cursor:pointer;}.sv-grid-dropdown-done:hover {filter:brightness(1.12);}\n\n /* Note: option / footer / swatch styles are declared `:global(...)`\n above because the panel is portal'd to <body> and Svelte's scoped\n class won't survive on children of an element living outside the\n component subtree. */\n\n /* Theme-aware chip badges. Inside the trigger they sit on the cell\n background, so we need a tone that contrasts on BOTH themes - a\n translucent accent works well in dark mode and reads as a soft\n blue pill in light mode. */.sv-grid-chip.svelte-ei8hp3 {display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:0.85em;line-height:1.4;background:color-mix(in srgb, var(--sg-accent, #2563eb) 18%, transparent);color:var(--sg-fg, #0f172a);border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-accent, #2563eb) 35%, transparent);white-space:nowrap;}.sv-grid-chip-removable.svelte-ei8hp3 {padding-inline-end:2px;}.sv-grid-chip-remove.svelte-ei8hp3 {display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:999px;background:color-mix(in srgb, var(--sg-fg, #0f172a) 18%, transparent);color:inherit;font-size:12px;line-height:1;cursor:pointer;padding:0;}.sv-grid-chip-remove.svelte-ei8hp3:hover {background:rgba(220, 38, 38, 0.7);color:#fff;}"
|
|
8
8
|
};
|
|
9
9
|
function j(e, o) {
|
|
10
|
-
let l =
|
|
11
|
-
D(o, !0),
|
|
12
|
-
let A = E(o, "multiple", 3, !1), j = E(o, "placeholder", 3, "Select…"),
|
|
13
|
-
function
|
|
10
|
+
let l = re();
|
|
11
|
+
D(o, !0), k(e, xe);
|
|
12
|
+
let A = E(o, "multiple", 3, !1), j = E(o, "placeholder", 3, "Select…"), Se = E(o, "renderChipsInTrigger", 3, !1), M = E(o, "searchable", 3, !1), Ce = E(o, "autoOpen", 3, !0), we = E(o, "loading", 3, !1), Te = E(o, "invalid", 3, !1);
|
|
13
|
+
function N(e) {
|
|
14
14
|
return e >= 0 && e < r(I).length ? `${l}-opt-${e}` : void 0;
|
|
15
15
|
}
|
|
16
|
-
let P = T(() => o.options.some((e) => e.color) ? 40 : 32), F = p(""), I = T(() => !
|
|
16
|
+
let P = T(() => o.options.some((e) => e.color) ? 40 : 32), F = p(""), I = T(() => !M() || !r(F).trim() ? o.options : (() => {
|
|
17
17
|
let e = r(F).trim().toLowerCase();
|
|
18
18
|
return o.options.filter((t) => t.label.toLowerCase().includes(e));
|
|
19
19
|
})()), L = p(!1), R = p(-1), z = p(null), B = p(null), V = p(null), H = p(w({
|
|
@@ -23,100 +23,100 @@ function j(e, o) {
|
|
|
23
23
|
openUpward: !1,
|
|
24
24
|
maxHeight: 0,
|
|
25
25
|
availHeight: 0
|
|
26
|
-
})), U = T(() => Array.isArray(o.value) ? o.value : o.value == null || o.value === "" ? [] : [o.value]),
|
|
26
|
+
})), U = T(() => Array.isArray(o.value) ? o.value : o.value == null || o.value === "" ? [] : [o.value]), Ee = T(() => {
|
|
27
27
|
if (r(U).length === 0) return j();
|
|
28
28
|
if (!A()) {
|
|
29
29
|
let e = r(U)[0], t = o.options.find((t) => String(t.value) === String(e));
|
|
30
30
|
return t ? t.label : String(e);
|
|
31
31
|
}
|
|
32
32
|
return `${r(U).length} selected`;
|
|
33
|
-
}),
|
|
33
|
+
}), W = T(() => {
|
|
34
34
|
if (A() || r(U).length !== 1) return;
|
|
35
35
|
let e = r(U)[0];
|
|
36
36
|
return o.options.find((t) => String(t.value) === String(e))?.color;
|
|
37
37
|
});
|
|
38
|
-
function
|
|
38
|
+
function G(e) {
|
|
39
39
|
return r(U).some((t) => String(t) === String(e.value));
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function K(e) {
|
|
42
42
|
if (A()) {
|
|
43
|
-
let t =
|
|
43
|
+
let t = G(e) ? r(U).filter((t) => String(t) !== String(e.value)) : [...r(U), e.value];
|
|
44
44
|
o.onChange?.(t);
|
|
45
45
|
} else o.onChange?.(e.value), y(L, !1), o.onCommit?.();
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function q() {
|
|
48
48
|
if (!r(L)) {
|
|
49
49
|
if (y(L, !0), r(R) < 0) {
|
|
50
|
-
let e = o.options.findIndex((e) =>
|
|
50
|
+
let e = o.options.findIndex((e) => G(e));
|
|
51
51
|
y(R, e >= 0 ? e : 0, !0);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
J();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function J() {
|
|
57
57
|
if (!r(B)) return;
|
|
58
|
-
let e = Math.min(r(I).length, 10), t =
|
|
59
|
-
y(H,
|
|
58
|
+
let e = Math.min(r(I).length, 10), t = M() ? 38 : 0, n = e * r(P) + (A() ? 40 : 0) + t + 8;
|
|
59
|
+
y(H, ae(r(B).getBoundingClientRect(), {
|
|
60
60
|
estimatedHeight: n,
|
|
61
61
|
clampHorizontal: !1
|
|
62
62
|
}), !0);
|
|
63
63
|
}
|
|
64
64
|
u(() => {
|
|
65
65
|
if (!r(L)) return;
|
|
66
|
-
let e = () =>
|
|
66
|
+
let e = () => J();
|
|
67
67
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
68
68
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
69
69
|
};
|
|
70
70
|
}), u(() => {
|
|
71
|
-
r(L) && (r(I).length, r(P),
|
|
71
|
+
r(L) && (r(I).length, r(P), J());
|
|
72
72
|
});
|
|
73
|
-
function
|
|
73
|
+
function Y() {
|
|
74
74
|
y(L, !1), y(R, -1);
|
|
75
75
|
}
|
|
76
76
|
function De(e) {
|
|
77
77
|
if (e.stopPropagation(), e.key === "Escape") {
|
|
78
|
-
e.preventDefault(),
|
|
78
|
+
e.preventDefault(), Y(), o.onCancel?.();
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
if (e.key === "ArrowDown") {
|
|
82
82
|
if (e.preventDefault(), !r(L)) {
|
|
83
|
-
|
|
83
|
+
q();
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
y(R, Math.min(r(R) + 1, o.options.length - 1), !0),
|
|
86
|
+
y(R, Math.min(r(R) + 1, o.options.length - 1), !0), X();
|
|
87
87
|
} else if (e.key === "ArrowUp") {
|
|
88
88
|
if (e.preventDefault(), !r(L)) {
|
|
89
|
-
|
|
89
|
+
q();
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
y(R, Math.max(r(R) - 1, 0), !0),
|
|
92
|
+
y(R, Math.max(r(R) - 1, 0), !0), X();
|
|
93
93
|
} else if (e.key === "Home") {
|
|
94
94
|
if (!r(L)) return;
|
|
95
|
-
e.preventDefault(), y(R, 0),
|
|
95
|
+
e.preventDefault(), y(R, 0), X();
|
|
96
96
|
} else if (e.key === "End") {
|
|
97
97
|
if (!r(L)) return;
|
|
98
|
-
e.preventDefault(), y(R, o.options.length - 1),
|
|
98
|
+
e.preventDefault(), y(R, o.options.length - 1), X();
|
|
99
99
|
} else if (e.key === "Enter") {
|
|
100
100
|
if (e.preventDefault(), !r(L)) {
|
|
101
|
-
|
|
101
|
+
q();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
let t = o.options[r(R)];
|
|
105
|
-
t ?
|
|
105
|
+
t ? K(t) : A() && (Y(), o.onCommit?.());
|
|
106
106
|
} else if (e.key === " " && r(L)) {
|
|
107
107
|
e.preventDefault();
|
|
108
108
|
let t = o.options[r(R)];
|
|
109
|
-
t &&
|
|
110
|
-
} else e.key === "Tab" && (r(L) &&
|
|
109
|
+
t && K(t);
|
|
110
|
+
} else e.key === "Tab" && (r(L) && Y(), o.onCommit?.());
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function X() {
|
|
113
113
|
queueMicrotask(() => {
|
|
114
114
|
r(V) && r(V).querySelector(`[data-opt-idx="${r(R)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
function Oe(e) {
|
|
118
118
|
let t = e.relatedTarget;
|
|
119
|
-
t && r(z)?.contains(t) || (r(L) &&
|
|
119
|
+
t && r(z)?.contains(t) || (r(L) && Y(), o.onCommit?.());
|
|
120
120
|
}
|
|
121
121
|
function ke(e, t) {
|
|
122
122
|
t.preventDefault(), t.stopPropagation();
|
|
@@ -124,24 +124,24 @@ function j(e, o) {
|
|
|
124
124
|
o.onChange?.(A() ? n : n[0] ?? null);
|
|
125
125
|
}
|
|
126
126
|
function Ae(e) {
|
|
127
|
-
|
|
127
|
+
Ce() && (e.focus(), q());
|
|
128
128
|
}
|
|
129
129
|
u(() => {
|
|
130
130
|
if (!r(L)) return;
|
|
131
131
|
let e = (e) => {
|
|
132
132
|
let t = e.target;
|
|
133
|
-
t && (r(z)?.contains(t) || r(V)?.contains(t) || (
|
|
133
|
+
t && (r(z)?.contains(t) || r(V)?.contains(t) || (Y(), o.onCommit?.()));
|
|
134
134
|
};
|
|
135
135
|
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
136
136
|
});
|
|
137
|
-
function
|
|
137
|
+
function Z(e) {
|
|
138
138
|
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));`;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
141
|
-
let Q;
|
|
142
|
-
var $ = g(Z);
|
|
140
|
+
var Q = be();
|
|
143
141
|
let je;
|
|
144
|
-
var
|
|
142
|
+
var $ = g(Q);
|
|
143
|
+
let Me;
|
|
144
|
+
var Ne = g($), Pe = (e) => {
|
|
145
145
|
var a = ce();
|
|
146
146
|
t(a, 21, () => r(U), (e) => String(e), (e, t) => {
|
|
147
147
|
let a = T(() => o.options.find((e) => String(e.value) === String(r(t))));
|
|
@@ -149,24 +149,24 @@ function j(e, o) {
|
|
|
149
149
|
h(u, "tabindex", -1), C(c), d((e, t, n) => {
|
|
150
150
|
f(c, e), s(l, `${t ?? ""} `), h(u, "aria-label", `Remove ${n ?? ""}`);
|
|
151
151
|
}, [
|
|
152
|
-
() => r(a)?.color ?
|
|
152
|
+
() => r(a)?.color ? Z(r(a).color) : "",
|
|
153
153
|
() => r(a) ? r(a).label : String(r(t)),
|
|
154
154
|
() => r(a) ? r(a).label : String(r(t))
|
|
155
155
|
]), i("mousedown", u, (e) => e.preventDefault()), i("click", u, (e) => ke(r(t), e)), n(e, c);
|
|
156
156
|
}), C(a), n(e, a);
|
|
157
|
-
},
|
|
157
|
+
}, Fe = (e) => {
|
|
158
158
|
var t = le(), i = g(t, !0);
|
|
159
159
|
C(t), d((e) => {
|
|
160
|
-
f(t, e), s(i, r(
|
|
161
|
-
}, [() =>
|
|
162
|
-
},
|
|
160
|
+
f(t, e), s(i, r(Ee));
|
|
161
|
+
}, [() => Z(r(W))]), n(e, t);
|
|
162
|
+
}, Ie = (e) => {
|
|
163
163
|
var t = ue(), i = g(t, !0);
|
|
164
|
-
C(t), d(() => s(i, r(
|
|
164
|
+
C(t), d(() => s(i, r(Ee))), n(e, t);
|
|
165
165
|
};
|
|
166
|
-
b(
|
|
167
|
-
|
|
166
|
+
b(Ne, (e) => {
|
|
167
|
+
Se() && r(U).length > 0 ? e(Pe) : !A() && r(U).length === 1 && r(W) ? e(Fe, 1) : e(Ie, -1);
|
|
168
168
|
}), _(2), C($), v($, (e) => y(B, e), () => r(B)), m($, (e) => Ae?.(e));
|
|
169
|
-
var
|
|
169
|
+
var Le = S($, 2), Re = (e) => {
|
|
170
170
|
let l = T(() => o.options.length > 10), u = T(() => Math.min(r(l) ? 10 * r(P) + (A() ? 40 : 0) + 8 : Infinity, r(H).availHeight));
|
|
171
171
|
var p = ye();
|
|
172
172
|
let _, x;
|
|
@@ -177,18 +177,18 @@ function j(e, o) {
|
|
|
177
177
|
}), ee(t, () => r(F), (e) => y(F, e)), n(e, t);
|
|
178
178
|
};
|
|
179
179
|
b(w, (e) => {
|
|
180
|
-
|
|
180
|
+
M() && e(E);
|
|
181
181
|
});
|
|
182
|
-
var D = S(w, 2),
|
|
182
|
+
var D = S(w, 2), k = (e) => {
|
|
183
183
|
var t = fe();
|
|
184
184
|
n(e, t);
|
|
185
|
-
},
|
|
185
|
+
}, re = (e) => {
|
|
186
186
|
var t = pe(), i = g(t, !0);
|
|
187
|
-
C(t), d(() => s(i,
|
|
188
|
-
},
|
|
187
|
+
C(t), d(() => s(i, M() && r(F) ? `No matches for "${r(F)}"` : "No options")), n(e, t);
|
|
188
|
+
}, ae = (e) => {
|
|
189
189
|
var o = a(), l = te(o);
|
|
190
190
|
t(l, 19, () => r(I), (e) => String(e.value), (e, t, a) => {
|
|
191
|
-
let o = T(() =>
|
|
191
|
+
let o = T(() => G(r(t)));
|
|
192
192
|
var l = _e();
|
|
193
193
|
let u;
|
|
194
194
|
var p = g(l), m = (e) => {
|
|
@@ -202,7 +202,7 @@ function j(e, o) {
|
|
|
202
202
|
var i = he(), a = g(i, !0);
|
|
203
203
|
C(i), d((e) => {
|
|
204
204
|
f(i, e), s(a, r(t).label);
|
|
205
|
-
}, [() =>
|
|
205
|
+
}, [() => Z(r(t).color)]), n(e, i);
|
|
206
206
|
}, x = (e) => {
|
|
207
207
|
var i = ge(), a = g(i, !0);
|
|
208
208
|
C(i), d(() => s(a, r(t).label)), n(e, i);
|
|
@@ -214,23 +214,23 @@ function j(e, o) {
|
|
|
214
214
|
"sv-grid-dropdown-option-selected": r(o),
|
|
215
215
|
"sv-grid-dropdown-option-highlighted": r(a) === r(R)
|
|
216
216
|
}), h(l, "id", e), h(l, "aria-selected", r(o)), h(l, "data-opt-idx", r(a));
|
|
217
|
-
}, [() =>
|
|
218
|
-
e.preventDefault(),
|
|
217
|
+
}, [() => N(r(a))]), i("mousedown", l, (e) => {
|
|
218
|
+
e.preventDefault(), K(r(t));
|
|
219
219
|
}), c("mouseenter", l, () => y(R, r(a), !0)), n(e, l);
|
|
220
220
|
}), n(e, o);
|
|
221
221
|
};
|
|
222
222
|
b(D, (e) => {
|
|
223
|
-
|
|
223
|
+
we() && r(I).length === 0 ? e(k) : r(I).length === 0 ? e(re, 1) : e(ae, -1);
|
|
224
224
|
});
|
|
225
225
|
var se = S(D, 2), ce = (e) => {
|
|
226
226
|
var t = ve(), r = g(t);
|
|
227
227
|
C(t), i("mousedown", r, (e) => e.preventDefault()), i("click", r, () => {
|
|
228
|
-
|
|
228
|
+
Y(), o.onCommit?.();
|
|
229
229
|
}), n(e, t);
|
|
230
230
|
};
|
|
231
231
|
b(se, (e) => {
|
|
232
232
|
A() && e(ce);
|
|
233
|
-
}), C(p), v(p, (e) => y(V, e), () => r(V)), m(p, (e) =>
|
|
233
|
+
}), C(p), v(p, (e) => y(V, e), () => r(V)), m(p, (e) => ie?.(e)), m(p, (e, t) => oe?.(e, t), () => ({ up: r(H).openUpward })), d(() => {
|
|
234
234
|
_ = O(p, 1, "sv-grid-dropdown-panel", null, _, { "sv-grid-dropdown-panel-fits": !r(l) }), h(p, "aria-multiselectable", A()), x = f(p, "", x, {
|
|
235
235
|
position: "fixed",
|
|
236
236
|
top: r(H).openUpward ? null : `${r(H).top}px`,
|
|
@@ -242,11 +242,11 @@ function j(e, o) {
|
|
|
242
242
|
});
|
|
243
243
|
}), i("pointerdown", p, (e) => e.stopPropagation()), i("mousedown", p, (e) => e.stopPropagation()), i("click", p, (e) => e.stopPropagation()), n(e, p);
|
|
244
244
|
};
|
|
245
|
-
b(
|
|
246
|
-
r(L) && e(
|
|
247
|
-
}), C(
|
|
248
|
-
|
|
249
|
-
}, [() => r(L) ?
|
|
245
|
+
b(Le, (e) => {
|
|
246
|
+
r(L) && e(Re);
|
|
247
|
+
}), C(Q), v(Q, (e) => y(z, e), () => r(z)), d((e) => {
|
|
248
|
+
je = O(Q, 1, "sv-grid-dropdown svelte-ei8hp3", null, je, { "sv-grid-dropdown-open": r(L) }), h($, "id", o.id), Me = O($, 1, "sv-grid-dropdown-trigger svelte-ei8hp3", null, Me, { "sv-grid-dropdown-trigger-chips": Se() && r(U).length > 0 }), h($, "aria-expanded", r(L)), h($, "aria-label", o.ariaLabel), h($, "aria-invalid", Te() || void 0), h($, "aria-describedby", o.describedBy), h($, "aria-activedescendant", e);
|
|
249
|
+
}, [() => r(L) ? N(r(R)) : void 0]), i("focusout", Q, Oe), i("click", Q, (e) => e.stopPropagation()), i("dblclick", Q, (e) => e.stopPropagation()), i("pointerdown", Q, (e) => e.stopPropagation()), i("mousedown", Q, (e) => e.stopPropagation()), i("click", $, () => r(L) ? Y() : q()), i("keydown", $, De), n(e, Q), x();
|
|
250
250
|
}
|
|
251
251
|
l([
|
|
252
252
|
"focusout",
|