@svgrid/grid 2.6.21 → 2.6.23

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 (151) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +22 -0
  3. package/dist/GridMenus.svelte +201 -18
  4. package/dist/SvAutoComplete.svelte +4 -0
  5. package/dist/SvComboBox.svelte +5 -1
  6. package/dist/SvDateRangeInput.svelte +25 -3
  7. package/dist/SvDropDownList.svelte +4 -0
  8. package/dist/SvForm.svelte +8 -8
  9. package/dist/SvGrid.controller.svelte.d.ts +61 -9
  10. package/dist/SvGrid.controller.svelte.js +363 -123
  11. package/dist/SvGrid.css +222 -1
  12. package/dist/SvGrid.helpers.d.ts +55 -0
  13. package/dist/SvGrid.helpers.js +83 -0
  14. package/dist/SvGrid.svelte +255 -56
  15. package/dist/SvGrid.types.d.ts +146 -1
  16. package/dist/SvGridCellEditor.svelte +99 -17
  17. package/dist/SvGridSelect.svelte +6 -2
  18. package/dist/SvGridSelect.svelte.d.ts +1 -1
  19. package/dist/SvListBox.svelte +8 -0
  20. package/dist/SvMultiSelect.svelte +6 -2
  21. package/dist/SvMultiSelect.svelte.d.ts +1 -1
  22. package/dist/SvNumberInput.svelte +4 -0
  23. package/dist/SvRichCell.svelte +125 -0
  24. package/dist/SvRichCell.svelte.d.ts +15 -0
  25. package/dist/SvTextArea.svelte +5 -1
  26. package/dist/SvTreeSelect.svelte +6 -2
  27. package/dist/SvTreeSelect.svelte.d.ts +1 -1
  28. package/dist/builtin-editors.d.ts +2 -2
  29. package/dist/builtin-editors.js +19 -3
  30. package/dist/cdn/GridMenus-BzWXQjv3.js +600 -0
  31. package/dist/cdn/GridMenus-xr_rHx8F.js +601 -0
  32. package/dist/cdn/SvDateRangeInput-CaOuMs8O.js +198 -0
  33. package/dist/cdn/SvDateRangeInput-DMLKmGEc.js +199 -0
  34. package/dist/cdn/SvDateTimePicker-CCbDZNZB.js +816 -0
  35. package/dist/cdn/SvDateTimePicker-sonaH0oh.js +812 -0
  36. package/dist/cdn/SvGridCellEditor-BAPSC7EL.js +550 -0
  37. package/dist/cdn/SvGridCellEditor-BwzmUWtL.js +549 -0
  38. package/dist/cdn/column-resize-DsfNXMom.js +102 -0
  39. package/dist/cdn/date-format-BNii4zeD.js +1393 -0
  40. package/dist/cdn/date-format-BnnHlqGw.js +1395 -0
  41. package/dist/cdn/{editor-registry-CiI0xlKg.js → editor-registry-BhgE3S84.js} +51 -25
  42. package/dist/cdn/row-resize-BRcimkUT.js +95 -0
  43. package/dist/cdn/{src-DBel9wRZ.js → src-DGo7IHug.js} +10017 -9488
  44. package/dist/cdn/{src-BYq-qyrp.js → src-skQN5eqh.js} +7829 -7300
  45. package/dist/cdn/svgrid.js +14 -10
  46. package/dist/cdn/svgrid.svelte-external.js +14 -10
  47. package/dist/cell-values.d.ts +16 -0
  48. package/dist/cell-values.js +28 -0
  49. package/dist/clipboard.d.ts +22 -0
  50. package/dist/clipboard.js +405 -27
  51. package/dist/column-groups.js +1 -1
  52. package/dist/column-resize.d.ts +46 -0
  53. package/dist/column-resize.js +205 -0
  54. package/dist/columns.d.ts +0 -3
  55. package/dist/columns.js +0 -57
  56. package/dist/core.d.ts +19 -4
  57. package/dist/core.js +460 -119
  58. package/dist/editing.js +12 -7
  59. package/dist/editors/cell-editors.d.ts +11 -0
  60. package/dist/editors/cell-editors.js +18 -1
  61. package/dist/filtering/excel-filters.js +28 -0
  62. package/dist/grid-messages.d.ts +15 -0
  63. package/dist/grid-messages.js +15 -0
  64. package/dist/group-display.d.ts +1 -1
  65. package/dist/index.d.ts +6 -1
  66. package/dist/index.js +10 -0
  67. package/dist/list-option.d.ts +6 -0
  68. package/dist/menus.js +41 -8
  69. package/dist/row-resize.d.ts +11 -0
  70. package/dist/row-resize.js +7 -1
  71. package/dist/sanitize-html.d.ts +37 -0
  72. package/dist/sanitize-html.js +234 -0
  73. package/dist/selection-bar-view.svelte.d.ts +25 -0
  74. package/dist/selection-bar-view.svelte.js +13 -0
  75. package/dist/selection.d.ts +2 -1
  76. package/dist/selection.js +133 -8
  77. package/dist/spreadsheet.d.ts +1 -1
  78. package/dist/spreadsheet.js +1 -1
  79. package/package.json +1 -1
  80. package/src/GridMenus.svelte +201 -18
  81. package/src/SvAutoComplete.svelte +4 -0
  82. package/src/SvComboBox.svelte +5 -1
  83. package/src/SvDateRangeInput.svelte +25 -3
  84. package/src/SvDropDownList.svelte +4 -0
  85. package/src/SvForm.svelte +8 -8
  86. package/src/SvGrid.controller.svelte.ts +404 -133
  87. package/src/SvGrid.css +222 -1
  88. package/src/SvGrid.helpers.ts +87 -0
  89. package/src/SvGrid.svelte +255 -56
  90. package/src/SvGrid.types.ts +153 -1
  91. package/src/SvGridCellEditor.svelte +99 -17
  92. package/src/SvGridSelect.svelte +6 -2
  93. package/src/SvListBox.svelte +8 -0
  94. package/src/SvMultiSelect.svelte +6 -2
  95. package/src/SvNumberInput.svelte +4 -0
  96. package/src/SvRichCell.svelte +125 -0
  97. package/src/SvTextArea.svelte +5 -1
  98. package/src/SvTreeSelect.svelte +6 -2
  99. package/src/builtin-editors.test.ts +18 -1
  100. package/src/builtin-editors.ts +19 -3
  101. package/src/cell-values.ts +30 -0
  102. package/src/clipboard.test.ts +93 -20
  103. package/src/clipboard.ts +433 -33
  104. package/src/column-groups.ts +1 -1
  105. package/src/column-resize.test.ts +381 -0
  106. package/src/column-resize.ts +227 -0
  107. package/src/columns.test.ts +0 -103
  108. package/src/columns.ts +0 -58
  109. package/src/core.aggregate.test.ts +134 -0
  110. package/src/core.filter.test.ts +156 -0
  111. package/src/core.grouping.test.ts +146 -0
  112. package/src/core.row-shape.test.ts +119 -0
  113. package/src/core.rowmodel-cache.test.ts +121 -0
  114. package/src/core.sort.test.ts +293 -0
  115. package/src/core.ts +516 -119
  116. package/src/date-string-column.test.ts +87 -0
  117. package/src/editing.test.ts +25 -0
  118. package/src/editing.ts +12 -9
  119. package/src/editor-block-prop.test.ts +132 -0
  120. package/src/editors/cell-editors.ts +27 -1
  121. package/src/filtering/excel-filters.ts +30 -0
  122. package/src/filtering/normalize-fast-path.test.ts +104 -0
  123. package/src/grid-messages.ts +34 -0
  124. package/src/group-display.ts +1 -1
  125. package/src/index.ts +25 -1
  126. package/src/list-option.ts +6 -0
  127. package/src/menus.test.ts +43 -0
  128. package/src/menus.ts +38 -8
  129. package/src/move-cells.test.ts +850 -0
  130. package/src/number-editor-literal.test.ts +84 -0
  131. package/src/number-editor.grid.test.ts +160 -0
  132. package/src/resize-props.test.ts +361 -0
  133. package/src/row-resize.test.ts +31 -0
  134. package/src/row-resize.ts +21 -3
  135. package/src/sanitize-html.test.ts +182 -0
  136. package/src/sanitize-html.ts +235 -0
  137. package/src/selection-bar-view.svelte.ts +36 -0
  138. package/src/selection.test.ts +157 -0
  139. package/src/selection.ts +135 -8
  140. package/src/spreadsheet.ts +1 -1
  141. package/src/svgrid.filter-menu-listbox.svelte.test.ts +56 -10
  142. package/src/svgrid.in-suggest-snapshot.svelte.test.ts +91 -0
  143. package/src/svgrid.menu-scroll-close.test.ts +204 -0
  144. package/src/svgrid.selection-bar-seam.test.ts +185 -0
  145. package/src/svgrid.upsell-license.test.ts +117 -0
  146. package/dist/cdn/GridMenus-BfTAKn84.js +0 -488
  147. package/dist/cdn/GridMenus-C3bJd7w8.js +0 -489
  148. package/dist/cdn/SvDateTimePicker-CHnUkWcH.js +0 -2206
  149. package/dist/cdn/SvDateTimePicker-CRQH_U7E.js +0 -2201
  150. package/dist/cdn/SvGridCellEditor-BGUCzuPB.js +0 -523
  151. package/dist/cdn/SvGridCellEditor-G8IMWIws.js +0 -522
@@ -58,34 +58,60 @@ function u(e) {
58
58
  return t === "number" ? "number" : t === "date" ? "date" : t === "datetime" ? "datetime-local" : t === "time" ? "time" : t === "password" ? "password" : t === "color" ? "color" : "text";
59
59
  }
60
60
  function d(e) {
61
+ if (!e || Number.isNaN(e.getTime())) return "";
62
+ let t = (e) => String(e).padStart(2, "0");
63
+ return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
64
+ }
65
+ function f(e) {
66
+ if (!e) return null;
67
+ let t = /^(\d{4})-(\d{2})-(\d{2})/.exec(e);
68
+ if (!t) {
69
+ let t = new Date(e);
70
+ return Number.isNaN(t.getTime()) ? null : t;
71
+ }
72
+ let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
73
+ return Number.isNaN(n.getTime()) ? null : n;
74
+ }
75
+ function p(e) {
76
+ if (!e || String(e).endsWith("-native")) return !1;
77
+ let t = o(e);
78
+ return t === "date" || t === "datetime" || t === "time";
79
+ }
80
+ function m(e) {
81
+ return o(e) === "number" ? "text" : u(e);
82
+ }
83
+ function h(e) {
84
+ return /^-?(\d*\.?\d*)(e-?\d*)?$/i.test(e);
85
+ }
86
+ function g(e) {
61
87
  return e == null || e === "" ? [] : Array.isArray(e) ? e.filter((e) => e != null && e !== "") : [e];
62
88
  }
63
- function f(e, t) {
89
+ function _(e, t) {
64
90
  let n = e.find((e) => e.value === t || String(e.value) === String(t));
65
91
  return n ? n.label : String(t ?? "");
66
92
  }
67
- function p(e, t) {
93
+ function v(e, t) {
68
94
  return e.find((e) => e.value === t || String(e.value) === String(t))?.color;
69
95
  }
70
- function m(e) {
96
+ function y(e) {
71
97
  return e ? `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));` : "";
72
98
  }
73
- function h(e) {
99
+ function b(e) {
74
100
  let t = o(e);
75
101
  return t === "number" ? "sv-grid-cell-editor sv-grid-cell-editor-number" : t === "date" ? "sv-grid-cell-editor sv-grid-cell-editor-date" : t === "datetime" ? "sv-grid-cell-editor sv-grid-cell-editor-datetime" : t === "color" ? "sv-grid-cell-editor sv-grid-cell-editor-color" : "sv-grid-cell-editor";
76
102
  }
77
- function g(e) {
103
+ function x(e) {
78
104
  if (e == null || e === "") return null;
79
105
  let t = e instanceof Date ? e : new Date(e);
80
106
  return Number.isNaN(t.getTime()) ? null : t;
81
107
  }
82
- function _(e, t) {
108
+ function S(e, t) {
83
109
  return Math.max(8, Math.min(e, window.innerWidth - t - 8));
84
110
  }
85
- function v(e) {
111
+ function C(e) {
86
112
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, "\\\"");
87
113
  }
88
- function y(e, t) {
114
+ function w(e, t) {
89
115
  if (e == null || e === "") return NaN;
90
116
  if (t) {
91
117
  let t = (e instanceof Date ? e : new Date(String(e))).getTime();
@@ -94,11 +120,11 @@ function y(e, t) {
94
120
  let n = typeof e == "number" ? e : Number(e);
95
121
  return Number.isFinite(n) ? n : NaN;
96
122
  }
97
- function b(e) {
123
+ function T(e) {
98
124
  let t = Math.abs(e), n = t >= 1e3 ? 0 : t >= 100 ? 1 : t >= 1 ? 2 : 4;
99
125
  return e.toLocaleString(void 0, { maximumFractionDigits: n });
100
126
  }
101
- function x(e) {
127
+ function E(e) {
102
128
  return new Date(e).toLocaleDateString(void 0, {
103
129
  year: "numeric",
104
130
  month: "short",
@@ -107,23 +133,23 @@ function x(e) {
107
133
  }
108
134
  //#endregion
109
135
  //#region src/editor-registry.ts
110
- var S = /* @__PURE__ */ new Map();
111
- function C(e, t) {
112
- S.set(e, typeof t == "function" ? { component: t } : t);
136
+ var D = /* @__PURE__ */ new Map();
137
+ function O(e, t) {
138
+ D.set(e, typeof t == "function" ? { component: t } : t);
113
139
  }
114
- function w(e) {
115
- return S.get(e);
140
+ function k(e) {
141
+ return D.get(e);
116
142
  }
117
- function T(e) {
118
- return S.has(e);
143
+ function A(e) {
144
+ return D.has(e);
119
145
  }
120
- function E(e) {
121
- S.delete(e);
146
+ function j(e) {
147
+ D.delete(e);
122
148
  }
123
- function D() {
124
- return [...S.keys()];
149
+ function M() {
150
+ return [...D.keys()];
125
151
  }
126
- function O(e) {
152
+ function N(e) {
127
153
  return {
128
154
  value: e.value,
129
155
  onChange: e.onChange,
@@ -134,8 +160,8 @@ function O(e) {
134
160
  inCell: e.inCell
135
161
  };
136
162
  }
137
- function k(e, t) {
138
- return e.props ? e.props(t) : O(t);
163
+ function P(e, t) {
164
+ return e.props ? e.props(t) : N(t);
139
165
  }
140
166
  //#endregion
141
- export { y as C, d as E, f as S, s as T, n as _, D as a, u as b, g as c, m as d, v as f, b as g, x as h, C as i, e as l, t as m, w as n, k as o, c as p, T as r, E as s, O as t, _ as u, l as v, r as w, p as x, h as y };
167
+ export { g as A, v as C, r as D, w as E, s as O, u as S, h as T, f as _, M as a, l as b, x as c, y as d, C as f, T as g, E as h, O as i, p as j, d as k, e as l, t as m, k as n, P as o, c as p, A as r, j as s, N as t, S as u, m as v, _ as w, b as x, n as y };
@@ -0,0 +1,95 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ //#region src/row-resize.ts
3
+ var t = /* @__PURE__ */ e({ rowResize: () => r }), n = "sv-grid-row-resize-handle";
4
+ function r(e, t) {
5
+ let r = t, i = null;
6
+ function a(e) {
7
+ let t = e.querySelector("[data-svgrid-row]")?.dataset.svgridRow;
8
+ return t == null ? NaN : Number(t);
9
+ }
10
+ function o(e) {
11
+ if (!i) return;
12
+ let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
13
+ i.trEl.style.height = `${Math.round(a)}px`, r.onResizeMove?.(i.rowIndex, Math.round(a));
14
+ }
15
+ function s(e) {
16
+ if (!i) return;
17
+ let t = r.min ?? 20, n = r.max ?? 320, a = Math.max(t, Math.min(n, i.startHeight + (e.clientY - i.startY)));
18
+ r.onResize(i.rowIndex, Math.round(a)), i.strip.classList.remove("is-resizing");
19
+ try {
20
+ i.trEl.releasePointerCapture(e.pointerId);
21
+ } catch {}
22
+ i = null, window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), document.body.style.cursor = "";
23
+ }
24
+ function c(e) {
25
+ if (r.disabled) return;
26
+ let t = e.target;
27
+ if (!t?.classList.contains(n)) return;
28
+ let i = e.shiftKey ? 1 : 10, o = 0;
29
+ if (e.key === "ArrowUp") o = -i;
30
+ else if (e.key === "ArrowDown") o = i;
31
+ else return;
32
+ let s = t.closest("tr.sv-grid-row");
33
+ if (!s) return;
34
+ let c = a(s);
35
+ if (!Number.isFinite(c)) return;
36
+ e.preventDefault(), e.stopPropagation();
37
+ let l = r.min ?? 20, u = r.max ?? 320, d = Math.round(Math.max(l, Math.min(u, s.getBoundingClientRect().height + o)));
38
+ s.style.height = `${d}px`, r.onResizeMove?.(c, d), r.onResize(c, d);
39
+ }
40
+ function l(e) {
41
+ if (r.disabled) return;
42
+ let t = e.target;
43
+ if (!t?.classList.contains(n)) return;
44
+ let c = t.closest("tr.sv-grid-row");
45
+ if (!c) return;
46
+ let l = a(c);
47
+ if (Number.isFinite(l)) {
48
+ e.preventDefault(), e.stopPropagation(), t.classList.add("is-resizing"), i = {
49
+ rowIndex: l,
50
+ startY: e.clientY,
51
+ startHeight: c.getBoundingClientRect().height,
52
+ trEl: c,
53
+ strip: t
54
+ };
55
+ try {
56
+ c.setPointerCapture(e.pointerId);
57
+ } catch {}
58
+ document.body.style.cursor = "row-resize", window.addEventListener("pointermove", o), window.addEventListener("pointerup", s);
59
+ }
60
+ }
61
+ function u() {
62
+ if (r.disabled) {
63
+ d();
64
+ return;
65
+ }
66
+ let t = e.querySelectorAll("tr.sv-grid-row");
67
+ for (let e of t) {
68
+ if (e.classList.contains("sv-grid-header-row") || e.classList.contains("sv-grid-row-spacer")) continue;
69
+ let t = e.querySelector(".sv-grid-cell.sv-row-gutter, .sv-grid-cell.sv-grid-row-number-cell") ?? (r.anchor === "row" ? e.querySelector(".sv-grid-cell") : null);
70
+ if (!t || t.querySelector(`:scope > .${n}`)) continue;
71
+ getComputedStyle(t).position === "static" && (t.style.position = "relative"), t.style.overflow = "visible";
72
+ let i = document.createElement("div");
73
+ i.className = n, i.setAttribute("role", "separator"), i.setAttribute("aria-orientation", "horizontal"), i.setAttribute("aria-label", "Resize row"), i.tabIndex = 0, i.style.cssText = "position:absolute;left:0;right:0;bottom:0;height:5px;cursor:row-resize;user-select:none;z-index:60;pointer-events:auto;", t.appendChild(i);
74
+ }
75
+ }
76
+ function d() {
77
+ e.querySelectorAll(`.${n}`).forEach((e) => e.remove());
78
+ }
79
+ e.addEventListener("pointerdown", l, { capture: !0 }), e.addEventListener("keydown", c, { capture: !0 });
80
+ let f = new MutationObserver(() => u());
81
+ return f.observe(e, {
82
+ childList: !0,
83
+ subtree: !0
84
+ }), u(), {
85
+ update(e) {
86
+ let t = r.disabled;
87
+ r = e, t !== r.disabled && u();
88
+ },
89
+ destroy() {
90
+ e.removeEventListener("pointerdown", l, { capture: !0 }), e.removeEventListener("keydown", c, { capture: !0 }), window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s), f.disconnect(), d();
91
+ }
92
+ };
93
+ }
94
+ //#endregion
95
+ export { t as n, r as t };