@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.
- package/dist/DataTable.d.ts +57 -13
- package/dist/DataTable.js +963 -820
- package/dist/FilterBar.d.ts +3 -3
- package/dist/FilterBar.js +5 -1
- package/dist/client-state.d.ts +9 -3
- package/dist/client-state.js +38 -32
- package/dist/core.d.ts +5 -5
- package/dist/core.js +28 -28
- package/dist/data-table-features.d.ts +18 -13
- package/dist/data-table-features.js +11 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +32 -31
- package/dist/messages.d.ts +3 -0
- package/dist/messages.js +3 -0
- package/dist/pagination.d.ts +43 -1
- package/dist/pagination.js +109 -54
- package/dist/requests.d.ts +3 -3
- package/dist/requests.js +38 -28
- package/dist/saved-views.d.ts +17 -14
- package/dist/saved-views.js +71 -68
- package/dist/server-export.d.ts +16 -7
- package/dist/server-export.js +57 -53
- package/dist/table-state-changes.d.ts +6 -3
- package/dist/table-state-changes.js +44 -40
- package/dist/table-state.d.ts +20 -4
- package/dist/table-state.js +66 -40
- package/dist/url-state.d.ts +12 -9
- package/dist/url-state.js +33 -30
- package/package.json +3 -3
- package/src/DataTable.tsx +221 -61
- package/src/FilterBar.tsx +5 -3
- package/src/client-state.ts +31 -17
- package/src/core.ts +5 -5
- package/src/data-table-features.tsx +23 -10
- package/src/index.ts +5 -3
- package/src/messages.ts +1 -1
- package/src/pagination.ts +83 -14
- package/src/requests.ts +22 -8
- package/src/saved-views.ts +33 -11
- package/src/server-export.ts +17 -11
- package/src/table-state-changes.ts +22 -12
- package/src/table-state.ts +53 -11
- package/src/url-state.ts +27 -10
package/dist/url-state.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { deserializeState as e,
|
|
1
|
+
import { deserializeState as e, schemaPagination as t, serializeState as n } from "./table-state.js";
|
|
2
2
|
// src/url-state.ts
|
|
3
|
-
function
|
|
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
|
|
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
|
|
16
|
+
function a(e, t, n) {
|
|
17
17
|
let r = t.toString();
|
|
18
18
|
return `${e}${r ? `?${r}` : ""}${n}`;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
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 } =
|
|
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 ${
|
|
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:
|
|
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
|
|
39
|
-
let o =
|
|
40
|
-
o.parameters.set(
|
|
41
|
-
let
|
|
42
|
-
return
|
|
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:
|
|
45
|
-
}) : (
|
|
46
|
-
replace:
|
|
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:
|
|
53
|
+
to: l
|
|
51
54
|
}));
|
|
52
55
|
}
|
|
53
|
-
function
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
let o =
|
|
57
|
-
return o ===
|
|
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
|
-
}) : (
|
|
61
|
-
replace:
|
|
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:
|
|
70
|
-
write:
|
|
71
|
-
clear:
|
|
72
|
+
read: c,
|
|
73
|
+
write: l,
|
|
74
|
+
clear: u
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
|
-
export {
|
|
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
|
+
"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.
|
|
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.
|
|
59
|
+
"@gemologic/sheen": "0.4.0",
|
|
60
60
|
"solid-js": "1.9.19",
|
|
61
61
|
"vite-plugin-solid": "2.11.14"
|
|
62
62
|
},
|