@svgrid/grid-wc 2.6.2 → 3.0.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 (58) hide show
  1. package/dist/GridMenus-DpmS1pzo.js +1121 -0
  2. package/dist/SvDateRangeInput-u4ibte8S.js +196 -0
  3. package/dist/SvDateTimePicker-DVFiDxUq.js +765 -0
  4. package/dist/{dismissable-xj_k_fnZ.js → SvField-ChCI-O2O.js} +44 -84
  5. package/dist/{SvGrid.helpers-CgUd39VT.js → SvGrid.helpers-BdVDtjUm.js} +37 -11
  6. package/dist/SvGridCellEditor-DvsQyE9a.js +550 -0
  7. package/dist/{SvGridChart-BztTavvw.js → SvGridChart-yK5Zv85y.js} +158 -158
  8. package/dist/{SvGridChartPanel-Ca5HWIZ3.js → SvGridChartPanel-B38_VjXM.js} +52 -52
  9. package/dist/{SvGridChartView-AcWj_tcs.js → SvGridChartView-ScXTF6t-.js} +4 -4
  10. package/dist/{SvGridDropdown-BXqvR1cs.js → SvGridDropdown-DnAESFDu.js} +29 -29
  11. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs +358 -0
  12. package/dist/angular/fesm2022/svgrid-grid-wc-angular.mjs.map +1 -0
  13. package/dist/angular/package.json +25 -0
  14. package/dist/angular/types/svgrid-grid-wc-angular.d.ts +161 -0
  15. package/dist/{client-DoXxrq8q.js → client-DjwUji8D.js} +1 -1
  16. package/dist/column-resize-DvCRUrN3.js +101 -0
  17. package/dist/date-format-CPHqTHN6.js +1127 -0
  18. package/dist/dismissable-DvhBKm3q.js +41 -0
  19. package/dist/react/index.d.ts +313 -0
  20. package/dist/react/index.js +72 -0
  21. package/dist/{row-drag-touch-Ddaa-QeB.js → row-drag-touch-CycRR65n.js} +12 -10
  22. package/dist/row-resize-D-8s3cqT.js +94 -0
  23. package/dist/shadow/GridMenus-DpmS1pzo.js +1121 -0
  24. package/dist/shadow/SvDateRangeInput-u4ibte8S.js +196 -0
  25. package/dist/shadow/SvDateTimePicker-DVFiDxUq.js +765 -0
  26. package/dist/shadow/SvField-ChCI-O2O.js +146 -0
  27. package/dist/shadow/SvGrid.helpers-BdVDtjUm.js +135 -0
  28. package/dist/shadow/SvGridCellEditor-DvsQyE9a.js +550 -0
  29. package/dist/shadow/SvGridChart-yK5Zv85y.js +1199 -0
  30. package/dist/shadow/SvGridChartPanel-B38_VjXM.js +584 -0
  31. package/dist/shadow/SvGridChartView-ScXTF6t-.js +50 -0
  32. package/dist/shadow/SvGridDropdown-DnAESFDu.js +256 -0
  33. package/dist/shadow/cell-formatting-C0OsDmi_.js +86 -0
  34. package/dist/shadow/chart-uvs3sFJA.js +1220 -0
  35. package/dist/shadow/client-DjwUji8D.js +2960 -0
  36. package/dist/shadow/column-resize-DvCRUrN3.js +101 -0
  37. package/dist/shadow/date-format-CPHqTHN6.js +1127 -0
  38. package/dist/shadow/dismissable-DvhBKm3q.js +41 -0
  39. package/dist/shadow/editor-contract-peBDxir_.js +22 -0
  40. package/dist/shadow/editor-registry-DxGKqcvx.js +24 -0
  41. package/dist/shadow/export-format-C8kZGZfz.js +161 -0
  42. package/dist/shadow/popover-WsGlvtQv.js +69 -0
  43. package/dist/shadow/row-drag-touch-CycRR65n.js +93 -0
  44. package/dist/shadow/row-resize-D-8s3cqT.js +94 -0
  45. package/dist/shadow/sv-grid-shadow-element.d.ts +246 -0
  46. package/dist/shadow/sv-grid-shadow-element.js +10175 -0
  47. package/dist/{svelte-virtualizer.svelte-CFoYP2Ls.js → shadow/svelte-virtualizer.svelte-DZ9UcyfT.js} +35 -30
  48. package/dist/shadow/validate-CgmAtX1A.js +75 -0
  49. package/dist/sv-grid-element.d.ts +246 -0
  50. package/dist/sv-grid-element.js +3655 -2620
  51. package/dist/svelte-virtualizer.svelte-DZ9UcyfT.js +527 -0
  52. package/dist/validate-CgmAtX1A.js +75 -0
  53. package/dist/vue/index.d.ts +147 -0
  54. package/dist/vue/index.js +72 -0
  55. package/package.json +71 -6
  56. package/dist/GridMenus-CU_-Ks4f.js +0 -1001
  57. package/dist/SvDateTimePicker-Ch1Vug8H.js +0 -1885
  58. package/dist/SvGridCellEditor-CBJUbAsR.js +0 -523
@@ -0,0 +1,527 @@
1
+ import { R as e, X as t, Z as n } from "./client-DjwUji8D.js";
2
+ //#region ../grid/dist/sv-grid-scrollbar.js
3
+ var r = 16, i = 280, a = 50, o = "http://www.w3.org/2000/svg";
4
+ function s() {
5
+ let e = document.createElementNS(o, "svg");
6
+ e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("fill", "none"), e.setAttribute("stroke", "currentColor"), e.setAttribute("stroke-width", "3"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round");
7
+ let t = document.createElementNS(o, "path");
8
+ return t.setAttribute("d", "M6 9l6 6 6-6"), e.appendChild(t), e;
9
+ }
10
+ var c = `
11
+ :host {
12
+ display: flex;
13
+ user-select: none;
14
+ background: var(--sg-scrollbar-bg, #eef2f8);
15
+ /* The 1px separator is drawn on the INNER edge only (the edge facing
16
+ the grid body) via the orientation rules below. A full inset box
17
+ here doubled up with the grid's own frame border on the outer edge,
18
+ reading as a 2px border - most visible in dense-gridline themes
19
+ like Excel, which should show a single 1px line. */
20
+ /* Start hidden + non-interactive - viewport/content sizes are 0 until
21
+ after the first layout pass, so without this default the scrollbar
22
+ paints visible for one frame and then JS hides it on mount. That
23
+ flicker is what shows up as a "flashing horizontal scrollbar"
24
+ every time a demo first renders. updateGeometry() switches us to
25
+ opacity 1 the moment the grid genuinely has overflow. */
26
+ opacity: 0;
27
+ pointer-events: none;
28
+ transition: opacity 120ms ease;
29
+ }
30
+ :host([orientation="vertical"]) {
31
+ flex-direction: column;
32
+ width: ${r}px;
33
+ /* LTR: vertical scrollbar sits at the right, inner edge is the left. */
34
+ box-shadow: inset 1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
35
+ }
36
+ :host([orientation="vertical"]:dir(rtl)) {
37
+ /* RTL flips the scrollbar to the left, so the inner edge is the right. */
38
+ box-shadow: inset -1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
39
+ }
40
+ :host([orientation="horizontal"]) {
41
+ flex-direction: row;
42
+ height: ${r}px;
43
+ /* Horizontal scrollbar sits at the bottom, inner edge is the top. */
44
+ box-shadow: inset 0 1px 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
45
+ }
46
+ .arrow {
47
+ flex: none;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ width: ${r}px;
52
+ height: ${r}px;
53
+ margin: 0;
54
+ padding: 0;
55
+ border: 0;
56
+ border-radius: 3px;
57
+ background: transparent;
58
+ color: var(--sg-scrollbar-arrow, #64748b);
59
+ cursor: pointer;
60
+ transition: background-color 100ms ease, color 100ms ease;
61
+ }
62
+ .arrow:hover {
63
+ background: var(--sg-scrollbar-arrow-hover-bg, #dde4ee);
64
+ color: var(--sg-scrollbar-arrow-hover, #1f2937);
65
+ }
66
+ .arrow:active {
67
+ background: var(--sg-scrollbar-arrow-active-bg, #c7d1df);
68
+ color: var(--sg-scrollbar-arrow-active, #0f172a);
69
+ }
70
+ .arrow:disabled {
71
+ color: var(--sg-scrollbar-arrow-disabled, #cbd5e1);
72
+ cursor: default;
73
+ }
74
+ .arrow:disabled:hover {
75
+ background: transparent;
76
+ }
77
+ .arrow svg {
78
+ width: 10px;
79
+ height: 10px;
80
+ display: block;
81
+ }
82
+ :host([orientation="vertical"]) .arrow-start svg {
83
+ transform: rotate(180deg);
84
+ }
85
+ :host([orientation="horizontal"]) .arrow-start svg {
86
+ transform: rotate(90deg);
87
+ }
88
+ :host([orientation="horizontal"]) .arrow-end svg {
89
+ transform: rotate(-90deg);
90
+ }
91
+ .track {
92
+ position: relative;
93
+ flex: 1 1 0;
94
+ min-width: 0;
95
+ min-height: 0;
96
+ }
97
+ .thumb {
98
+ position: absolute;
99
+ border-radius: var(--sg-scrollbar-thumb-radius, 6px);
100
+ background: var(--sg-scrollbar-thumb, #b1bccd);
101
+ cursor: pointer;
102
+ transition: background-color 100ms ease;
103
+ }
104
+ .thumb:hover {
105
+ background: var(--sg-scrollbar-thumb-hover, #8693a7);
106
+ }
107
+ .thumb:active {
108
+ background: var(--sg-scrollbar-thumb-active, #64748b);
109
+ }
110
+ :host([orientation="vertical"]) .thumb {
111
+ left: 3px;
112
+ right: 3px;
113
+ }
114
+ :host([orientation="horizontal"]) .thumb {
115
+ top: 3px;
116
+ bottom: 3px;
117
+ }
118
+ `, l = typeof HTMLElement < "u" ? HTMLElement : class {}, u = class extends l {
119
+ constructor() {
120
+ super(...arguments), this.dragging = !1, this.dragStart = 0, this.valueStart = 0, this.holdTimer = null, this.resizeObserver = null, this.resizeFrame = 0, this.onArrowStartPointerDown = (e) => {
121
+ e.preventDefault(), this.startHold(-1);
122
+ }, this.onArrowEndPointerDown = (e) => {
123
+ e.preventDefault(), this.startHold(1);
124
+ }, this.stopHold = () => {
125
+ this.holdTimer !== null && (clearTimeout(this.holdTimer), clearInterval(this.holdTimer), this.holdTimer = null);
126
+ }, this.onThumbPointerDown = (e) => {
127
+ e.preventDefault(), this.dragging = !0, this.dragStart = this.orientation === "vertical" ? e.clientY : e.clientX, this.valueStart = this.value, document.addEventListener("pointermove", this.onPointerMove), document.addEventListener("pointerup", this.onPointerUp);
128
+ }, this.onTrackPointerDown = (e) => {
129
+ if (e.target === this.thumb) return;
130
+ let t = this.track.getBoundingClientRect(), n = this.orientation === "vertical" ? e.clientY - t.top : e.clientX - t.left, r = this.orientation === "vertical" ? t.height : t.width, i = this.computeThumbSize(r), a = Math.max(r - i, 1), o = Math.min(Math.max(n - i / 2, 0), a);
131
+ this.emitScroll(o / a * this.maxValue);
132
+ }, this.onPointerMove = (e) => {
133
+ if (!this.dragging) return;
134
+ let t = (this.orientation === "vertical" ? e.clientY : e.clientX) - this.dragStart, n = this.track.getBoundingClientRect(), r = this.orientation === "vertical" ? n.height : n.width, i = this.computeThumbSize(r), a = Math.max(r - i, 1);
135
+ this.emitScroll(this.valueStart + t / a * this.maxValue);
136
+ }, this.onPointerUp = () => {
137
+ this.dragging = !1, document.removeEventListener("pointermove", this.onPointerMove), document.removeEventListener("pointerup", this.onPointerUp);
138
+ };
139
+ }
140
+ static get observedAttributes() {
141
+ return [
142
+ "orientation",
143
+ "viewport-size",
144
+ "content-size",
145
+ "value",
146
+ "step"
147
+ ];
148
+ }
149
+ connectedCallback() {
150
+ if (this.shadowRoot) return;
151
+ let e = this.attachShadow({ mode: "open" }), t = document.createElement("style");
152
+ t.textContent = c, this.startArrow = this.createArrow("start"), this.endArrow = this.createArrow("end"), this.track = document.createElement("div"), this.track.className = "track", this.thumb = document.createElement("div"), this.thumb.className = "thumb", this.track.appendChild(this.thumb), e.append(t, this.startArrow, this.track, this.endArrow), this.thumb.addEventListener("pointerdown", this.onThumbPointerDown), this.track.addEventListener("pointerdown", this.onTrackPointerDown), this.startArrow.addEventListener("pointerdown", this.onArrowStartPointerDown), this.endArrow.addEventListener("pointerdown", this.onArrowEndPointerDown);
153
+ for (let e of [this.startArrow, this.endArrow]) e.addEventListener("pointerup", this.stopHold), e.addEventListener("pointerleave", this.stopHold), e.addEventListener("pointercancel", this.stopHold);
154
+ this.resizeObserver = new ResizeObserver(() => {
155
+ this.resizeFrame ||= requestAnimationFrame(() => {
156
+ this.resizeFrame = 0, this.render();
157
+ });
158
+ }), this.resizeObserver.observe(this), this.render();
159
+ }
160
+ disconnectedCallback() {
161
+ this.stopHold(), this.resizeFrame && cancelAnimationFrame(this.resizeFrame), this.resizeFrame = 0, this.resizeObserver?.disconnect(), this.resizeObserver = null, document.removeEventListener("pointermove", this.onPointerMove), document.removeEventListener("pointerup", this.onPointerUp);
162
+ }
163
+ attributeChangedCallback() {
164
+ this.render();
165
+ }
166
+ get orientation() {
167
+ return this.getAttribute("orientation") === "horizontal" ? "horizontal" : "vertical";
168
+ }
169
+ get viewportSize() {
170
+ return Number(this.getAttribute("viewport-size") || "0");
171
+ }
172
+ get contentSize() {
173
+ return Number(this.getAttribute("content-size") || "0");
174
+ }
175
+ get value() {
176
+ return Number(this.getAttribute("value") || "0");
177
+ }
178
+ get step() {
179
+ let e = Number(this.getAttribute("step") || "40");
180
+ return e > 0 ? e : 40;
181
+ }
182
+ get maxValue() {
183
+ return Math.max(this.contentSize - this.viewportSize, 0);
184
+ }
185
+ getTrackLength() {
186
+ let e = this.track.getBoundingClientRect(), t = this.orientation === "vertical" ? e.height : e.width;
187
+ return t > 0 ? t : Math.max(this.viewportSize - 32, 1);
188
+ }
189
+ computeThumbSize(e) {
190
+ if (this.contentSize <= 0 || this.viewportSize <= 0 || e <= 0) return 0;
191
+ let t = Math.min(this.viewportSize / this.contentSize, 1);
192
+ return Math.max(20, t * e);
193
+ }
194
+ createArrow(e) {
195
+ let t = document.createElement("button");
196
+ return t.type = "button", t.className = `arrow arrow-${e}`, t.setAttribute("aria-label", e === "start" ? "Scroll back" : "Scroll forward"), t.appendChild(s()), t;
197
+ }
198
+ startHold(e) {
199
+ this.stopHold();
200
+ let t = () => this.emitScroll(this.value + e * this.step);
201
+ t(), this.holdTimer = setTimeout(() => {
202
+ this.holdTimer = setInterval(t, a);
203
+ }, i);
204
+ }
205
+ emitScroll(e) {
206
+ let t = Math.min(Math.max(e, 0), this.maxValue);
207
+ this.dispatchEvent(new CustomEvent("scroll-change", {
208
+ detail: { value: t },
209
+ bubbles: !0,
210
+ composed: !0
211
+ }));
212
+ }
213
+ render() {
214
+ if (!this.shadowRoot) return;
215
+ let e = this.viewportSize, t = this.contentSize <= e || e <= 0;
216
+ this.style.opacity = t ? "0" : "1", this.style.pointerEvents = t ? "none" : "auto";
217
+ let n = this.getTrackLength(), r = this.computeThumbSize(n), i = this.maxValue, a = (i > 0 ? this.value / i : 0) * Math.max(n - r, 0);
218
+ this.orientation === "vertical" ? (this.thumb.style.height = `${r}px`, this.thumb.style.transform = `translateY(${a}px)`) : (this.thumb.style.width = `${r}px`, this.thumb.style.transform = `translateX(${a}px)`), this.startArrow.disabled = t || this.value <= 0, this.endArrow.disabled = t || this.value >= i;
219
+ }
220
+ };
221
+ typeof window < "u" && !customElements.get("sv-grid-scrollbar") && customElements.define("sv-grid-scrollbar", u);
222
+ //#endregion
223
+ //#region ../grid/dist/filtering/excel-filters.js
224
+ var d = /[̀-ͯ]/g;
225
+ function f(e, t) {
226
+ if (!e) return "";
227
+ if (p(e)) return t ? e.toLocaleLowerCase(t) : e.toLowerCase();
228
+ let n = e.normalize("NFD").replace(d, "");
229
+ return t ? n.toLocaleLowerCase(t) : n.toLowerCase();
230
+ }
231
+ function p(e) {
232
+ for (let t = 0; t < e.length; t++) if (e.charCodeAt(t) > 127) return !1;
233
+ return !0;
234
+ }
235
+ function m(e) {
236
+ let { tokens: t, trailing: n } = _(e);
237
+ return n && t.push(n), t;
238
+ }
239
+ function h(e) {
240
+ return e.map((e) => e.trim()).filter((e) => e.length > 0).map((e) => /["\n,]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e).join(", ");
241
+ }
242
+ function g(e) {
243
+ return _(e).trailing;
244
+ }
245
+ function _(e) {
246
+ let t = String(e ?? ""), n = [], r = "", i = !1, a = !1, o = !1, s = () => {
247
+ let e = a ? r : r.trim();
248
+ return r = "", a = !1, o = !1, e;
249
+ };
250
+ for (let e = 0; e < t.length; e += 1) {
251
+ let c = t[e];
252
+ if (i) {
253
+ if (c !== "\"") {
254
+ r += c;
255
+ continue;
256
+ }
257
+ if (t[e + 1] === "\"") {
258
+ r += "\"", e += 1;
259
+ continue;
260
+ }
261
+ i = !1, o = !0;
262
+ continue;
263
+ }
264
+ if (c === "," || c === "\n") {
265
+ let e = s();
266
+ e.length && n.push(e);
267
+ continue;
268
+ }
269
+ if (c === "\"" && !o && !r.trim()) {
270
+ i = !0, a = !0, r = "";
271
+ continue;
272
+ }
273
+ r += c;
274
+ }
275
+ return {
276
+ tokens: n,
277
+ trailing: s()
278
+ };
279
+ }
280
+ function v(e, t) {
281
+ let n = t?.locale, r = (e) => f(String(e ?? ""), n), i = r(e.value);
282
+ switch (e.operator) {
283
+ case "contains": return (e) => r(e).includes(i);
284
+ case "notContains": return i === "" ? () => !0 : (e) => !r(e).includes(i);
285
+ case "equals": return (e) => r(e) === i;
286
+ case "notEquals": return i === "" ? () => !0 : (e) => r(e) !== i;
287
+ case "startsWith": return (e) => r(e).startsWith(i);
288
+ case "endsWith": return (e) => r(e).endsWith(i);
289
+ case "regex": {
290
+ let t = String(e.value ?? "");
291
+ if (!t) return () => !0;
292
+ let n;
293
+ try {
294
+ n = new RegExp(t, "i");
295
+ } catch {
296
+ return () => !1;
297
+ }
298
+ return (e) => n.test(String(e ?? ""));
299
+ }
300
+ case "in":
301
+ case "notIn": {
302
+ let t = m(e.value);
303
+ if (t.length === 0) return () => !0;
304
+ let i = new Set(t.map((e) => f(e, n)));
305
+ return e.operator === "in" ? (e) => i.has(r(e)) : (e) => !i.has(r(e));
306
+ }
307
+ case "greaterThan": {
308
+ let t = Number(e.value), n = Number.isFinite(t), r = String(e.value ?? "");
309
+ return (e) => {
310
+ let i = Number(e);
311
+ return n && Number.isFinite(i) ? i > t : String(e ?? "") > r;
312
+ };
313
+ }
314
+ case "lessThan": {
315
+ let t = Number(e.value), n = Number.isFinite(t), r = String(e.value ?? "");
316
+ return (e) => {
317
+ let i = Number(e);
318
+ return n && Number.isFinite(i) ? i < t : String(e ?? "") < r;
319
+ };
320
+ }
321
+ case "between": {
322
+ let t = e.value == null ? 0 : Number(e.value), n = e.valueTo == null ? 0 : Number(e.valueTo), r = Number.isFinite(t) && Number.isFinite(n), i = String(e.value ?? ""), a = String(e.valueTo ?? "");
323
+ return (e) => {
324
+ let o = Number(e ?? 0);
325
+ if (r && Number.isFinite(o)) return o >= t && o <= n;
326
+ let s = String(e ?? "");
327
+ return s >= i && s <= a;
328
+ };
329
+ }
330
+ case "isBlank": return (e) => String(e ?? "").trim().length === 0;
331
+ case "isNotBlank": return (e) => String(e ?? "").trim().length > 0;
332
+ }
333
+ }
334
+ //#endregion
335
+ //#region ../grid/dist/virtualization/virtualizer.js
336
+ function y(e, t, n) {
337
+ return Math.min(Math.max(e, t), n);
338
+ }
339
+ function b(e, t) {
340
+ return e.count === t.count && e.estimateSize === t.estimateSize && (e.overscan ?? 6) === (t.overscan ?? 6) && e.viewportHeight === t.viewportHeight && (e.scrollOffset ?? 0) === (t.scrollOffset ?? 0);
341
+ }
342
+ function x(e, t) {
343
+ if (e.totalSize !== t.totalSize || e.startIndex !== t.startIndex || e.endIndex !== t.endIndex || e.viewportHeight !== t.viewportHeight || e.items.length !== t.items.length) return !1;
344
+ for (let n = 0; n < e.items.length; n += 1) {
345
+ let r = e.items[n], i = t.items[n];
346
+ if (r.index !== i.index || r.start !== i.start || r.size !== i.size) return !1;
347
+ }
348
+ return !0;
349
+ }
350
+ function S(e, t, n) {
351
+ let r = [];
352
+ for (let i = e; i <= t; i += 1) {
353
+ let t = i * n;
354
+ r.push({
355
+ index: i,
356
+ start: t,
357
+ size: n,
358
+ end: t + n,
359
+ key: `virtual_slot_${i - e}`
360
+ });
361
+ }
362
+ return r;
363
+ }
364
+ function C(e, t, n, r) {
365
+ if (e <= 0) return [];
366
+ let i = Math.max(t, 1), a = Math.ceil(Math.max(n, 0) / i), o = Math.min(a + Math.max(r, 0), e - 1);
367
+ return S(0, Math.max(o, 0), i);
368
+ }
369
+ function w(e, t, n) {
370
+ let r = [];
371
+ for (let i = e; i <= t; i += 1) {
372
+ let t = n[i] ?? 0, a = n[i + 1] ?? t;
373
+ r.push({
374
+ index: i,
375
+ start: t,
376
+ size: a - t,
377
+ end: a,
378
+ key: `virtual_slot_${i - e}`
379
+ });
380
+ }
381
+ return r;
382
+ }
383
+ function T(e, t) {
384
+ let n = Math.max(e.count, 0), r = Math.max(e.overscan ?? 6, 0), i = Math.max(e.viewportHeight, 0);
385
+ if (typeof e.estimateSize == "function" && t) {
386
+ let a = t[n] ?? 0, o = Math.max(a - i, 0), s = y(e.scrollOffset ?? 0, 0, o), c = 0, l = n;
387
+ for (; c < l;) {
388
+ let e = c + l >>> 1;
389
+ (t[e + 1] ?? 0) <= s ? c = e + 1 : l = e;
390
+ }
391
+ let u = c, d = s + i;
392
+ for (c = u, l = n; c < l;) {
393
+ let e = c + l >>> 1;
394
+ (t[e] ?? 0) < d ? c = e + 1 : l = e;
395
+ }
396
+ let f = Math.max(c - 1, u), p = n === 0 ? 0 : y(u - r, 0, n - 1), m = n === 0 ? -1 : y(f + r, 0, n - 1);
397
+ return {
398
+ items: m >= p ? w(p, m, t) : [],
399
+ totalSize: a,
400
+ startIndex: p,
401
+ endIndex: m,
402
+ scrollOffset: s,
403
+ viewportHeight: i
404
+ };
405
+ }
406
+ let a = Math.max(typeof e.estimateSize == "number" ? e.estimateSize : 1, 1), o = n * a, s = Math.max(o - i, 0), c = y(e.scrollOffset ?? 0, 0, s), l = Math.floor(c / a), u = Math.ceil(i / a), d = Math.min(l + u, Math.max(n - 1, 0)), f = n === 0 ? 0 : y(l - r, 0, n - 1), p = n === 0 ? -1 : y(d + r, 0, n - 1);
407
+ return {
408
+ items: p >= f ? S(f, p, a) : [],
409
+ totalSize: o,
410
+ startIndex: f,
411
+ endIndex: p,
412
+ scrollOffset: c,
413
+ viewportHeight: i
414
+ };
415
+ }
416
+ function E(e) {
417
+ let t = e, n = null;
418
+ function r() {
419
+ if (typeof t.estimateSize != "function") return null;
420
+ let e = Math.max(t.count, 0);
421
+ if (n && n.fn === t.estimateSize && n.count === e) return n.offsets;
422
+ let r = t.estimateSize, i = Array(e + 1);
423
+ i[0] = 0;
424
+ for (let t = 0; t < e; t += 1) i[t + 1] = i[t] + Math.max(r(t), 1);
425
+ return n = {
426
+ fn: r,
427
+ count: e,
428
+ offsets: i
429
+ }, i;
430
+ }
431
+ let i = T(t, r()), a = /* @__PURE__ */ new Set();
432
+ function o() {
433
+ a.forEach((e) => e());
434
+ }
435
+ function s() {
436
+ let e = T(t, r());
437
+ x(i, e) || (i = e, o());
438
+ }
439
+ return {
440
+ setOptions(e) {
441
+ let n = {
442
+ ...t,
443
+ ...e
444
+ };
445
+ b(t, n) || (t = n, s());
446
+ },
447
+ setScrollOffset(e) {
448
+ (t.scrollOffset ?? 0) !== e && (t = {
449
+ ...t,
450
+ scrollOffset: e
451
+ }, s());
452
+ },
453
+ setViewportHeight(e) {
454
+ t.viewportHeight !== e && (t = {
455
+ ...t,
456
+ viewportHeight: e
457
+ }, s());
458
+ },
459
+ scrollToIndex(e) {
460
+ let n = y(e, 0, Math.max(t.count - 1, 0)), a = i.totalSize, o;
461
+ if (typeof t.estimateSize == "function") {
462
+ let e = r();
463
+ if (e) o = e[n] ?? 0;
464
+ else {
465
+ let e = 0, r = t.estimateSize;
466
+ for (let t = 0; t < n; t += 1) e += Math.max(r(t), 1);
467
+ o = e;
468
+ }
469
+ } else o = n * Math.max(t.estimateSize, 1);
470
+ let c = Math.max(a - t.viewportHeight, 0), l = y(o, 0, c);
471
+ (t.scrollOffset ?? 0) !== l && (t = {
472
+ ...t,
473
+ scrollOffset: l
474
+ }, s());
475
+ },
476
+ getVirtualItems() {
477
+ return i.items;
478
+ },
479
+ getTotalSize() {
480
+ return i.totalSize;
481
+ },
482
+ getOffsetForIndex(e) {
483
+ if (e <= 0) return 0;
484
+ let n = Math.max(t.count, 0), i = Math.min(e, n);
485
+ if (typeof t.estimateSize == "function") {
486
+ let e = r();
487
+ if (e) return e[i] ?? 0;
488
+ let n = 0, a = t.estimateSize;
489
+ for (let e = 0; e < i; e += 1) n += Math.max(a(e), 1);
490
+ return n;
491
+ }
492
+ return i * Math.max(t.estimateSize, 1);
493
+ },
494
+ getSizeForIndex(e) {
495
+ return e < 0 || e >= t.count ? 0 : typeof t.estimateSize == "function" ? Math.max(t.estimateSize(e), 1) : Math.max(t.estimateSize, 1);
496
+ },
497
+ getState() {
498
+ return i;
499
+ },
500
+ subscribe(e) {
501
+ return a.add(e), () => a.delete(e);
502
+ }
503
+ };
504
+ }
505
+ //#endregion
506
+ //#region ../grid/dist/virtualization/svelte-virtualizer.svelte.js
507
+ function D(r) {
508
+ let i = E(r), a = n(0);
509
+ return i.subscribe(() => {
510
+ t(a, e(a) + 1);
511
+ }), {
512
+ get version() {
513
+ return e(a);
514
+ },
515
+ setOptions: i.setOptions,
516
+ setScrollOffset: i.setScrollOffset,
517
+ setViewportHeight: i.setViewportHeight,
518
+ scrollToIndex: i.scrollToIndex,
519
+ getVirtualItems: i.getVirtualItems,
520
+ getTotalSize: i.getTotalSize,
521
+ getOffsetForIndex: i.getOffsetForIndex,
522
+ getSizeForIndex: i.getSizeForIndex,
523
+ getState: i.getState
524
+ };
525
+ }
526
+ //#endregion
527
+ export { h as a, g as c, v as i, C as n, f as o, E as r, m as s, D as t };
@@ -0,0 +1,75 @@
1
+ //#region ../grid/dist/validate.js
2
+ var e = "https://svgrid.com/docs/getting-started/3-data-and-columns/";
3
+ function t(e, n = []) {
4
+ for (let r of e) r.columns?.length ? t(r.columns, n) : n.push(r);
5
+ return n;
6
+ }
7
+ function n(n) {
8
+ let i = [], a = t(n.columns ?? []), o = (n.data ?? []).slice(0, 10);
9
+ if (o.length) {
10
+ let t = /* @__PURE__ */ new Set();
11
+ for (let e of o) if (e && typeof e == "object") for (let n of Object.keys(e)) t.add(n);
12
+ for (let n of a) {
13
+ let a = n.field;
14
+ if (!a || n.fieldFn || t.has(a)) continue;
15
+ let o = r(a, [...t]);
16
+ i.push(`[svgrid] Column field "${a}" does not exist on your row data, so that column renders empty.${o ? ` Did you mean "${o}"?` : ""} Available keys: ${[...t].slice(0, 12).join(", ")}. See ${e}`);
17
+ }
18
+ }
19
+ let s = /* @__PURE__ */ new Map();
20
+ for (let e of a) {
21
+ let t = e.id ?? e.field;
22
+ t && s.set(t, (s.get(t) ?? 0) + 1);
23
+ }
24
+ for (let [t, n] of s) n > 1 && i.push(`[svgrid] ${n} columns share the id "${t}". Column state (sorting, filtering, pinning, width) is keyed by id, so they will act as one. Give each an explicit \`id\`. See ${e}`);
25
+ let c = n.pageable === void 0 && n.showPagination === void 0;
26
+ n.pageSize !== void 0 && c && i.push("[svgrid] `pageSize` is set but pagination was never turned on, so it has no effect and every row renders. Add `pageable` to switch the pager on."), !(n.sortable === !0 || n.features?.rowSortingFeature) && a.some((e) => e.sortable === !0) && i.push("[svgrid] A column sets `sortable: true`, but sorting is not enabled on the grid, so its header does nothing. Add `sortable` to <SvGrid> (it registers the sorting feature for you).");
27
+ let l = /* @__PURE__ */ new Set();
28
+ for (let e of a) {
29
+ let t = e.id ?? e.field;
30
+ t && l.add(t);
31
+ }
32
+ for (let e of n.groupBy ?? []) {
33
+ if (l.has(e)) continue;
34
+ let t = r(e, [...l]);
35
+ i.push(`[svgrid] \`groupBy\` refers to column "${e}", which does not exist, so that grouping level is ignored.${t ? ` Did you mean "${t}"?` : ""} Column ids: ${[...l].slice(0, 12).join(", ")}`);
36
+ }
37
+ let u = n.treeData?.column;
38
+ if (u && !l.has(u) && i.push(`[svgrid] \`treeData.column\` refers to column "${u}", which does not exist, so the expander falls back to the first visible column.`), o.length && n.treeData) {
39
+ let e = /* @__PURE__ */ new Set();
40
+ for (let t of o) if (t && typeof t == "object") for (let n of Object.keys(t)) e.add(n);
41
+ let t = n.treeData.parentField;
42
+ if (t && !e.has(t)) {
43
+ let n = r(t, [...e]);
44
+ i.push(`[svgrid] \`treeData.parentField\` is "${t}", which is not on your row data, so every row becomes a root and no hierarchy appears.${n ? ` Did you mean "${n}"?` : ""}`);
45
+ }
46
+ let a = n.treeData.idField;
47
+ a && !e.has(a) && i.push(`[svgrid] \`treeData.idField\` is "${a}", which is not on your row data, so parent lookups cannot match and the tree stays flat.`);
48
+ }
49
+ return (n.initialColumnPinning?.left?.length ?? 0) + (n.initialColumnPinning?.right?.length ?? 0) > 0 && n.columnVirtualization !== !1 && i.push("[svgrid] `initialColumnPinning` is set while column virtualization is on (its default), so the pinned columns will not stick - the virtualizer recycles column nodes. Add `columnVirtualization={false}`."), n.externalPagination === !0 && n.rowCount === void 0 && i.push("[svgrid] `externalPagination` is on but `rowCount` is not set, so the pager cannot know how many pages exist. Pass the server total as `rowCount`."), n.externalSort === !0 && !n.onSortingChange && i.push("[svgrid] `externalSort` is on but there is no `onSortingChange` handler, so clicking a header changes nothing - the grid stopped sorting and nobody is listening. Add `onSortingChange` and re-fetch in your handler."), n.externalFilter === !0 && !n.onFiltersChange && i.push("[svgrid] `externalFilter` is on but there is no `onFiltersChange` handler, so filtering the grid changes nothing. Add `onFiltersChange` and re-fetch in your handler."), i;
50
+ }
51
+ function r(e, t) {
52
+ let n, r = Infinity;
53
+ for (let a of t) {
54
+ let t = i(e.toLowerCase(), a.toLowerCase());
55
+ t < r && (r = t, n = a);
56
+ }
57
+ let a = Math.min(3, Math.floor(e.length / 3) + 1);
58
+ return r <= a ? n : void 0;
59
+ }
60
+ function i(e, t) {
61
+ if (e === t) return 0;
62
+ let n = Array(t.length + 1);
63
+ for (let e = 0; e <= t.length; e++) n[e] = e;
64
+ for (let r = 1; r <= e.length; r++) {
65
+ let i = n[0];
66
+ n[0] = r;
67
+ for (let a = 1; a <= t.length; a++) {
68
+ let o = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[r - 1] === t[a - 1] ? 0 : 1));
69
+ i = n[a], n[a] = o;
70
+ }
71
+ }
72
+ return n[t.length];
73
+ }
74
+ //#endregion
75
+ export { n as validateGridConfig };