@gemologic/sheen-table 0.3.0 → 0.4.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 (43) hide show
  1. package/dist/DataTable.d.ts +57 -13
  2. package/dist/DataTable.js +963 -820
  3. package/dist/FilterBar.d.ts +3 -3
  4. package/dist/FilterBar.js +5 -1
  5. package/dist/client-state.d.ts +9 -3
  6. package/dist/client-state.js +38 -32
  7. package/dist/core.d.ts +5 -5
  8. package/dist/core.js +28 -28
  9. package/dist/data-table-features.d.ts +18 -13
  10. package/dist/data-table-features.js +11 -1
  11. package/dist/index.d.ts +5 -3
  12. package/dist/index.js +32 -31
  13. package/dist/messages.d.ts +3 -0
  14. package/dist/messages.js +3 -0
  15. package/dist/pagination.d.ts +43 -1
  16. package/dist/pagination.js +109 -54
  17. package/dist/requests.d.ts +3 -3
  18. package/dist/requests.js +38 -28
  19. package/dist/saved-views.d.ts +17 -14
  20. package/dist/saved-views.js +71 -68
  21. package/dist/server-export.d.ts +16 -7
  22. package/dist/server-export.js +57 -53
  23. package/dist/table-state-changes.d.ts +6 -3
  24. package/dist/table-state-changes.js +44 -40
  25. package/dist/table-state.d.ts +20 -4
  26. package/dist/table-state.js +66 -40
  27. package/dist/url-state.d.ts +12 -9
  28. package/dist/url-state.js +33 -30
  29. package/package.json +3 -3
  30. package/src/DataTable.tsx +221 -61
  31. package/src/FilterBar.tsx +5 -3
  32. package/src/client-state.ts +31 -17
  33. package/src/core.ts +5 -5
  34. package/src/data-table-features.tsx +23 -10
  35. package/src/index.ts +5 -3
  36. package/src/messages.ts +1 -1
  37. package/src/pagination.ts +83 -14
  38. package/src/requests.ts +22 -8
  39. package/src/saved-views.ts +33 -11
  40. package/src/server-export.ts +17 -11
  41. package/src/table-state-changes.ts +22 -12
  42. package/src/table-state.ts +53 -11
  43. package/src/url-state.ts +27 -10
package/dist/url-state.js CHANGED
@@ -1,10 +1,10 @@
1
- import { deserializeState as e, serializeState as t } from "./table-state.js";
1
+ import { deserializeState as e, schemaPagination as t, serializeState as n } from "./table-state.js";
2
2
  // src/url-state.ts
3
- function n(e) {
3
+ function r(e) {
4
4
  if (!/^[A-Za-z][A-Za-z0-9_.-]*$/.test(e)) throw Error("Table URL parameter must start with a letter and contain only letters, digits, dot, underscore, or hyphen");
5
5
  return e;
6
6
  }
7
- function r(e) {
7
+ function i(e) {
8
8
  if (!e.pathname.startsWith("/") || e.pathname.includes("?") || e.pathname.includes("#")) throw Error("Router pathname must be an absolute path without query or hash");
9
9
  if (e.hash && !e.hash.startsWith("#")) throw Error("Router hash must be empty or start with #");
10
10
  return {
@@ -13,20 +13,23 @@ function r(e) {
13
13
  hash: e.hash
14
14
  };
15
15
  }
16
- function i(e, t, n) {
16
+ function a(e, t, n) {
17
17
  let r = t.toString();
18
18
  return `${e}${r ? `?${r}` : ""}${n}`;
19
19
  }
20
- function a(a, o, s) {
21
- let c = n(o);
22
- function l() {
20
+ function o(r, i, a) {
21
+ return t(a), a.pagination, s(r, i, (e) => n(e, a), (t) => e(t, a));
22
+ }
23
+ function s(e, t, n, o) {
24
+ let s = r(t);
25
+ function c() {
23
26
  try {
24
- let { parameters: t } = r(a.location()), n = t.getAll(c);
27
+ let { parameters: t } = i(e.location()), n = t.getAll(s);
25
28
  if (n.length === 0) return Object.freeze({ kind: "absent" });
26
- if (n.length !== 1) throw Error(`Table URL parameter ${c} must occur exactly once`);
29
+ if (n.length !== 1) throw Error(`Table URL parameter ${s} must occur exactly once`);
27
30
  return Object.freeze({
28
31
  kind: "accepted",
29
- state: e(n[0] ?? "", s)
32
+ state: o(n[0] ?? "")
30
33
  });
31
34
  } catch (e) {
32
35
  return Object.freeze({
@@ -35,30 +38,30 @@ function a(a, o, s) {
35
38
  });
36
39
  }
37
40
  }
38
- function u(e, n = {}) {
39
- let o = r(a.location()), l = i(o.pathname, o.parameters, o.hash);
40
- o.parameters.set(c, t(e, s));
41
- let u = i(o.pathname, o.parameters, o.hash);
42
- return u === l ? Object.freeze({
41
+ function l(t, r = {}) {
42
+ let o = i(e.location()), c = a(o.pathname, o.parameters, o.hash);
43
+ o.parameters.set(s, n(t));
44
+ let l = a(o.pathname, o.parameters, o.hash);
45
+ return l === c ? Object.freeze({
43
46
  kind: "unchanged",
44
- to: u
45
- }) : (a.navigate(u, {
46
- replace: n.replace ?? !0,
47
+ to: l
48
+ }) : (e.navigate(l, {
49
+ replace: r.replace ?? !0,
47
50
  scroll: !1
48
51
  }), Object.freeze({
49
52
  kind: "navigated",
50
- to: u
53
+ to: l
51
54
  }));
52
55
  }
53
- function d(e = {}) {
54
- let t = r(a.location()), n = i(t.pathname, t.parameters, t.hash);
55
- t.parameters.delete(c);
56
- let o = i(t.pathname, t.parameters, t.hash);
57
- return o === n ? Object.freeze({
56
+ function u(t = {}) {
57
+ let n = i(e.location()), r = a(n.pathname, n.parameters, n.hash);
58
+ n.parameters.delete(s);
59
+ let o = a(n.pathname, n.parameters, n.hash);
60
+ return o === r ? Object.freeze({
58
61
  kind: "unchanged",
59
62
  to: o
60
- }) : (a.navigate(o, {
61
- replace: e.replace ?? !0,
63
+ }) : (e.navigate(o, {
64
+ replace: t.replace ?? !0,
62
65
  scroll: !1
63
66
  }), Object.freeze({
64
67
  kind: "navigated",
@@ -66,9 +69,9 @@ function a(a, o, s) {
66
69
  }));
67
70
  }
68
71
  return {
69
- read: l,
70
- write: u,
71
- clear: d
72
+ read: c,
73
+ write: l,
74
+ clear: u
72
75
  };
73
76
  }
74
- export { a as createTableUrlState };
77
+ export { o as createTableUrlState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemologic/sheen-table",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Compact accessible data tables and query-building components for Sheen SolidJS applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,14 +49,14 @@
49
49
  "./styles.css": "./src/styles.css"
50
50
  },
51
51
  "peerDependencies": {
52
- "@gemologic/sheen": "0.3.0",
52
+ "@gemologic/sheen": "0.4.0",
53
53
  "solid-js": "1.9.19"
54
54
  },
55
55
  "dependencies": {
56
56
  "@tanstack/solid-virtual": "3.13.37"
57
57
  },
58
58
  "devDependencies": {
59
- "@gemologic/sheen": "0.3.0",
59
+ "@gemologic/sheen": "0.4.0",
60
60
  "solid-js": "1.9.19",
61
61
  "vite-plugin-solid": "2.11.14"
62
62
  },