@gemologic/sheen-table 0.2.1 → 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 +58 -10
- package/dist/DataTable.js +1294 -1625
- package/dist/DataTableToolbar.js +1 -2
- package/dist/FilterBar.d.ts +3 -0
- package/dist/FilterBar.js +131 -108
- package/dist/QueryBuilder.js +72 -68
- package/dist/cell-edit.js +1 -2
- package/dist/client-state.d.ts +9 -3
- package/dist/client-state.js +36 -31
- package/dist/client-view.js +12 -13
- package/dist/column-layout.js +1 -2
- package/dist/columns.d.ts +5 -1
- package/dist/columns.js +7 -5
- package/dist/constrained-columns.js +1 -2
- package/dist/core.d.ts +5 -5
- package/dist/core.js +28 -28
- package/dist/data-table-features.d.ts +134 -0
- package/dist/data-table-features.js +560 -0
- package/dist/export.js +1 -2
- package/dist/facets.js +5 -7
- package/dist/filter-bar-state.js +14 -18
- package/dist/filter-client.js +1 -2
- package/dist/filter.js +1 -2
- package/dist/grouping.js +1 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +32 -31
- package/dist/messages.d.ts +4 -1
- package/dist/messages.js +5 -3
- package/dist/pagination.d.ts +43 -1
- package/dist/pagination.js +110 -56
- package/dist/query-builder-state.js +1 -2
- package/dist/requests.d.ts +3 -3
- package/dist/requests.js +39 -30
- package/dist/row-hierarchy.js +1 -2
- package/dist/row-identity.js +1 -2
- package/dist/saved-views.d.ts +17 -14
- package/dist/saved-views.js +72 -70
- package/dist/search-controller.js +1 -2
- package/dist/search.js +1 -2
- package/dist/selection-client.js +1 -2
- package/dist/selection.d.ts +3 -0
- package/dist/selection.js +9 -2
- package/dist/server-export.d.ts +16 -7
- package/dist/server-export.js +58 -55
- package/dist/sorting.js +1 -2
- package/dist/table-state-changes.d.ts +6 -3
- package/dist/table-state-changes.js +45 -42
- package/dist/table-state.d.ts +20 -4
- package/dist/table-state.js +67 -42
- package/dist/text-normalization.js +1 -2
- package/dist/url-state.d.ts +12 -9
- package/dist/url-state.js +34 -32
- package/package.json +5 -5
- package/src/DataTable.tsx +490 -766
- package/src/FilterBar.tsx +19 -3
- package/src/QueryBuilder.tsx +5 -5
- package/src/client-state.ts +31 -17
- package/src/columns.ts +9 -3
- package/src/core.ts +5 -5
- package/src/data-table-features.tsx +592 -0
- package/src/index.ts +5 -3
- package/src/messages.ts +2 -2
- package/src/pagination.ts +83 -14
- package/src/requests.ts +22 -8
- package/src/saved-views.ts +33 -11
- package/src/selection.ts +8 -0
- package/src/server-export.ts +17 -11
- package/src/styles.css +17 -11
- package/src/table-state-changes.ts +22 -12
- package/src/table-state.ts +53 -11
- package/src/url-state.ts +27 -10
|
@@ -1,67 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { changeQueryState as e } from "./client-state.js";
|
|
2
|
+
import { parseCursorPagination as t, parsePagination as n } from "./pagination.js";
|
|
3
|
+
import { parseTableStateWith as r, schemaPagination as i } from "./table-state.js";
|
|
4
|
+
// src/table-state-changes.ts
|
|
5
|
+
function a(e, r, a) {
|
|
6
|
+
return i(a) === "cursor" ? o(e, r, a, t) : o(e, r, a, n);
|
|
7
|
+
}
|
|
8
|
+
function o(t, n, i, a) {
|
|
9
|
+
let o = (e) => r(e, i, a), s = (t, n) => e(t, n, i, a), c = o(t), l = {
|
|
10
|
+
search: c.search,
|
|
11
|
+
filter: c.filter,
|
|
12
|
+
sorting: c.sorting,
|
|
13
|
+
pagination: c.pagination
|
|
10
14
|
};
|
|
11
|
-
switch (
|
|
12
|
-
case "query": return
|
|
13
|
-
...
|
|
14
|
-
columns:
|
|
15
|
-
}
|
|
15
|
+
switch (n.kind) {
|
|
16
|
+
case "query": return o({
|
|
17
|
+
...s(l, n.change),
|
|
18
|
+
columns: c.columns
|
|
19
|
+
});
|
|
16
20
|
case "sortCycle": {
|
|
17
|
-
if (!i.sortColumns.some((e) => e.id ===
|
|
18
|
-
let
|
|
19
|
-
column:
|
|
20
|
-
direction:
|
|
21
|
-
},
|
|
22
|
-
return
|
|
23
|
-
...
|
|
21
|
+
if (!i.sortColumns.some((e) => e.id === n.column)) throw Error(`Column does not support sorting: ${n.column}`);
|
|
22
|
+
let e = c.sorting.find((e) => e.column === n.column), t = e?.direction === "desc" ? null : {
|
|
23
|
+
column: n.column,
|
|
24
|
+
direction: e ? "desc" : "asc"
|
|
25
|
+
}, r;
|
|
26
|
+
return r = n.multiple ? !e && t ? [...c.sorting, t] : c.sorting.flatMap((e) => e.column === n.column ? t ? [t] : [] : [e]) : t ? [t] : [], o({
|
|
27
|
+
...s(l, {
|
|
24
28
|
kind: "sorting",
|
|
25
|
-
value:
|
|
26
|
-
}
|
|
27
|
-
columns:
|
|
28
|
-
}
|
|
29
|
+
value: r
|
|
30
|
+
}),
|
|
31
|
+
columns: c.columns
|
|
32
|
+
});
|
|
29
33
|
}
|
|
30
34
|
case "columnOrder": {
|
|
31
|
-
let e = new Map(
|
|
32
|
-
return
|
|
33
|
-
...
|
|
34
|
-
columns: Array.from(
|
|
35
|
-
}
|
|
35
|
+
let e = new Map(c.columns.map((e) => [e.id, e]));
|
|
36
|
+
return o({
|
|
37
|
+
...c,
|
|
38
|
+
columns: Array.from(n.ids, (t) => e.get(t))
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
case "columnVisibility":
|
|
38
42
|
case "columnWidth":
|
|
39
43
|
case "columnPin": {
|
|
40
|
-
if (!
|
|
41
|
-
let e =
|
|
42
|
-
if (e.id !==
|
|
43
|
-
switch (
|
|
44
|
+
if (!c.columns.some((e) => e.id === n.column)) throw Error(`Unknown table column: ${n.column}`);
|
|
45
|
+
let e = c.columns.map((e) => {
|
|
46
|
+
if (e.id !== n.column) return e;
|
|
47
|
+
switch (n.kind) {
|
|
44
48
|
case "columnVisibility": return {
|
|
45
49
|
...e,
|
|
46
|
-
visible:
|
|
50
|
+
visible: n.visible
|
|
47
51
|
};
|
|
48
52
|
case "columnWidth": return {
|
|
49
53
|
...e,
|
|
50
|
-
width:
|
|
54
|
+
width: n.width
|
|
51
55
|
};
|
|
52
56
|
case "columnPin": return {
|
|
53
57
|
...e,
|
|
54
|
-
pin:
|
|
58
|
+
pin: n.pin
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
});
|
|
58
|
-
return
|
|
59
|
-
...
|
|
62
|
+
return o({
|
|
63
|
+
...c,
|
|
60
64
|
columns: e
|
|
61
|
-
}
|
|
65
|
+
});
|
|
62
66
|
}
|
|
63
67
|
default: throw Error("Unknown table state change");
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
|
|
67
|
-
export { n as changeTableState };
|
|
70
|
+
export { a as changeTableState, o as changeTableStateWith };
|
package/dist/table-state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ClientStateSchema } from "./client-state.ts";
|
|
2
|
-
import type {
|
|
1
|
+
import type { ClientStateSchema, QueryState } from "./client-state.ts";
|
|
2
|
+
import type { CursorPagination, ServerPagination, TablePagination } from "./pagination.ts";
|
|
3
3
|
export interface ColumnState {
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly visible: boolean;
|
|
@@ -7,14 +7,30 @@ export interface ColumnState {
|
|
|
7
7
|
readonly width: number | null;
|
|
8
8
|
readonly pin: "start" | "end" | false;
|
|
9
9
|
}
|
|
10
|
-
export interface TableState extends
|
|
10
|
+
export interface TableState<Pagination extends ServerPagination = TablePagination> extends QueryState<Pagination> {
|
|
11
11
|
/** Array order is the user-defined column order. Every available column occurs once. */
|
|
12
12
|
readonly columns: readonly ColumnState[];
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/** Shared column and query fields; internal pagination-generic owners accept it. */
|
|
15
|
+
export interface TableStateSchemaFields extends ClientStateSchema {
|
|
15
16
|
readonly columns: readonly string[];
|
|
16
17
|
}
|
|
18
|
+
/** Schema for complete or numbered pagination state. */
|
|
19
|
+
export interface TableStateSchema extends TableStateSchemaFields {
|
|
20
|
+
readonly pagination?: never;
|
|
21
|
+
}
|
|
22
|
+
/** Schema for cursor pagination state. Persisted envelopes always store `cursor: null` because cursor tokens are short-lived. */
|
|
23
|
+
export interface CursorTableStateSchema extends TableStateSchemaFields {
|
|
24
|
+
readonly pagination: "cursor";
|
|
25
|
+
}
|
|
26
|
+
/** Cursor schemas read only cursor state; other schemas read complete or numbered state. Unknown schema kinds fail closed. */
|
|
27
|
+
export declare function schemaPagination(schema: TableStateSchema | CursorTableStateSchema): "cursor" | "page";
|
|
17
28
|
/** Strictly validate before applying saved/URL state, never partially restore it. */
|
|
29
|
+
export declare function parseTableState(value: unknown, schema: CursorTableStateSchema): TableState<CursorPagination>;
|
|
18
30
|
export declare function parseTableState(value: unknown, schema: TableStateSchema): TableState;
|
|
31
|
+
export declare function parseTableStateWith<Pagination extends ServerPagination>(value: unknown, schema: TableStateSchemaFields, readPagination: (value: unknown) => Pagination): TableState<Pagination>;
|
|
32
|
+
/** Cursor state is persisted as its first page: the live cursor token is replaced with null. */
|
|
33
|
+
export declare function serializeState(state: TableState<CursorPagination>, schema: CursorTableStateSchema): string;
|
|
19
34
|
export declare function serializeState(state: TableState, schema: TableStateSchema): string;
|
|
35
|
+
export declare function deserializeState(serialized: string, schema: CursorTableStateSchema): TableState<CursorPagination>;
|
|
20
36
|
export declare function deserializeState(serialized: string, schema: TableStateSchema): TableState;
|
package/dist/table-state.js
CHANGED
|
@@ -1,46 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { parseQueryState as e } from "./client-state.js";
|
|
2
|
+
import { parseCursorPagination as t, parsePagination as n } from "./pagination.js";
|
|
3
|
+
// src/table-state.ts
|
|
4
|
+
function r(e) {
|
|
4
5
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
+
function i(e, t, n) {
|
|
7
8
|
for (let r of Object.keys(e)) if (!t.includes(r)) throw Error(`Invalid table state at ${n}: unknown field ${r}`);
|
|
8
9
|
for (let r of t) if (!Object.hasOwn(e, r)) throw Error(`Invalid table state at ${n}: missing ${r}`);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function a(e) {
|
|
12
|
+
let t = e.pagination;
|
|
13
|
+
if (t === void 0) return "page";
|
|
14
|
+
if (t === "cursor") return t;
|
|
15
|
+
throw Error("Table state schema pagination must be omitted or cursor");
|
|
16
|
+
}
|
|
17
|
+
function o(e) {
|
|
18
|
+
let n = t(e);
|
|
19
|
+
if (n.cursor !== null) throw Error("Persisted cursor pagination must use cursor: null");
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function s(e, r) {
|
|
23
|
+
return a(r) === "cursor" ? c(e, r, t) : c(e, r, n);
|
|
24
|
+
}
|
|
25
|
+
function c(t, n, a) {
|
|
26
|
+
let o = /* @__PURE__ */ new Set();
|
|
27
|
+
for (let e of n.columns) {
|
|
28
|
+
if (typeof e != "string" || !e.trim() || o.has(e)) throw Error("Invalid or duplicate table schema column");
|
|
29
|
+
o.add(e);
|
|
15
30
|
}
|
|
16
|
-
for (let e of [...
|
|
17
|
-
if (!t
|
|
18
|
-
|
|
31
|
+
for (let e of [...n.filterColumns, ...n.sortColumns]) if (!o.has(e.id)) throw Error(`Query schema references unavailable table column: ${e.id}`);
|
|
32
|
+
if (!r(t)) throw Error("Invalid table state: expected an object");
|
|
33
|
+
i(t, [
|
|
19
34
|
"search",
|
|
20
35
|
"filter",
|
|
21
36
|
"sorting",
|
|
22
37
|
"pagination",
|
|
23
38
|
"columns"
|
|
24
39
|
], "$");
|
|
25
|
-
let
|
|
26
|
-
search:
|
|
27
|
-
filter:
|
|
28
|
-
sorting:
|
|
29
|
-
pagination:
|
|
30
|
-
},
|
|
31
|
-
if (!Array.isArray(
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
if (!
|
|
35
|
-
if (
|
|
40
|
+
let s = e({
|
|
41
|
+
search: t.search,
|
|
42
|
+
filter: t.filter,
|
|
43
|
+
sorting: t.sorting,
|
|
44
|
+
pagination: t.pagination
|
|
45
|
+
}, n, a);
|
|
46
|
+
if (!Array.isArray(t.columns) || t.columns.length !== o.size) throw Error("Invalid table state: expected one state entry per available column");
|
|
47
|
+
let c = /* @__PURE__ */ new Set(), l = Array.from(t.columns, (e, t) => {
|
|
48
|
+
let n = `$.columns[${t}]`;
|
|
49
|
+
if (!r(e)) throw Error(`Invalid table state at ${n}: expected a column object`);
|
|
50
|
+
if (i(e, [
|
|
36
51
|
"id",
|
|
37
52
|
"visible",
|
|
38
53
|
"width",
|
|
39
54
|
"pin"
|
|
40
|
-
],
|
|
41
|
-
if (
|
|
42
|
-
if (e.width !== null && (typeof e.width != "number" || !Number.isFinite(e.width) || e.width <= 0)) throw Error(`Invalid table state at ${
|
|
43
|
-
if (e.pin !== !1 && e.pin !== "start" && e.pin !== "end") throw Error(`Invalid table state at ${
|
|
55
|
+
], n), typeof e.id != "string" || !o.has(e.id) || c.has(e.id)) throw Error(`Invalid table state at ${n}: unknown or duplicate column`);
|
|
56
|
+
if (c.add(e.id), typeof e.visible != "boolean") throw Error(`Invalid table state at ${n}: visible must be boolean`);
|
|
57
|
+
if (e.width !== null && (typeof e.width != "number" || !Number.isFinite(e.width) || e.width <= 0)) throw Error(`Invalid table state at ${n}: width must be null or a positive finite pixel value`);
|
|
58
|
+
if (e.pin !== !1 && e.pin !== "start" && e.pin !== "end") throw Error(`Invalid table state at ${n}: pin must be false, start, or end`);
|
|
44
59
|
return Object.freeze({
|
|
45
60
|
id: e.id,
|
|
46
61
|
visible: e.visible,
|
|
@@ -49,29 +64,39 @@ function r(r, i) {
|
|
|
49
64
|
});
|
|
50
65
|
});
|
|
51
66
|
return Object.freeze({
|
|
52
|
-
...
|
|
53
|
-
columns: Object.freeze(
|
|
67
|
+
...s,
|
|
68
|
+
columns: Object.freeze(l)
|
|
54
69
|
});
|
|
55
70
|
}
|
|
56
|
-
function
|
|
57
|
-
let
|
|
71
|
+
function l(e) {
|
|
72
|
+
let t = JSON.stringify({
|
|
58
73
|
version: 1,
|
|
59
|
-
state:
|
|
74
|
+
state: e
|
|
60
75
|
});
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
76
|
+
if (t.length > 262144) throw Error("Serialized table state exceeds 262144 characters");
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
function u(e, r) {
|
|
80
|
+
if (a(r) === "page") return l(c(e, r, n));
|
|
81
|
+
let i = c(e, r, t);
|
|
82
|
+
return l(c({
|
|
83
|
+
...i,
|
|
84
|
+
pagination: {
|
|
85
|
+
...i.pagination,
|
|
86
|
+
cursor: null
|
|
87
|
+
}
|
|
88
|
+
}, r, o));
|
|
63
89
|
}
|
|
64
|
-
function
|
|
90
|
+
function d(e, t) {
|
|
65
91
|
if (e.length > 262144) throw Error("Serialized table state exceeds 262144 characters");
|
|
66
|
-
let
|
|
92
|
+
let s;
|
|
67
93
|
try {
|
|
68
|
-
|
|
94
|
+
s = JSON.parse(e);
|
|
69
95
|
} catch {
|
|
70
96
|
throw Error("Invalid table state JSON");
|
|
71
97
|
}
|
|
72
|
-
if (!
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
98
|
+
if (!r(s)) throw Error("Invalid table state envelope");
|
|
99
|
+
if (i(s, ["version", "state"], "$"), s.version !== 1) throw Error("Unsupported table state version");
|
|
100
|
+
return a(t) === "cursor" ? c(s.state, t, o) : c(s.state, t, n);
|
|
75
101
|
}
|
|
76
|
-
|
|
77
|
-
export { a as deserializeState, r as parseTableState, i as serializeState };
|
|
102
|
+
export { d as deserializeState, s as parseTableState, c as parseTableStateWith, a as schemaPagination, u as serializeState };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/text-normalization.ts
|
|
2
2
|
var e = /^[\u0000-\u007f]*$/u;
|
|
3
3
|
function t(t, n = !1) {
|
|
4
4
|
let r = n || "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toLocaleLowerCase(t) === "abcdefghijklmnopqrstuvwxyz";
|
|
@@ -8,5 +8,4 @@ function t(t, n = !1) {
|
|
|
8
8
|
return n ? a : a.toLocaleLowerCase(t).normalize("NFC");
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { t as createTextNormalizer };
|
package/dist/url-state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CursorPagination, ServerPagination, TablePagination } from "./pagination.ts";
|
|
2
|
+
import type { CursorTableStateSchema, TableState, TableStateSchema } from "./table-state.ts";
|
|
2
3
|
export interface TableUrlLocation {
|
|
3
4
|
readonly pathname: string;
|
|
4
5
|
readonly search: string;
|
|
@@ -11,11 +12,11 @@ export interface TableUrlRouter {
|
|
|
11
12
|
readonly scroll?: boolean;
|
|
12
13
|
}) => void;
|
|
13
14
|
}
|
|
14
|
-
export type TableUrlRead = {
|
|
15
|
+
export type TableUrlRead<Pagination extends ServerPagination = TablePagination> = {
|
|
15
16
|
readonly kind: "absent";
|
|
16
17
|
} | {
|
|
17
18
|
readonly kind: "accepted";
|
|
18
|
-
readonly state: TableState
|
|
19
|
+
readonly state: TableState<Pagination>;
|
|
19
20
|
} | {
|
|
20
21
|
readonly kind: "invalid";
|
|
21
22
|
readonly error: unknown;
|
|
@@ -27,13 +28,15 @@ export type TableUrlWrite = {
|
|
|
27
28
|
readonly kind: "navigated";
|
|
28
29
|
readonly to: string;
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
write: (state: TableState, options?: {
|
|
31
|
+
export interface TableUrlState<Pagination extends ServerPagination = TablePagination> {
|
|
32
|
+
readonly read: () => TableUrlRead<Pagination>;
|
|
33
|
+
readonly write: (state: TableState<Pagination>, options?: {
|
|
34
34
|
readonly replace?: boolean;
|
|
35
35
|
}) => TableUrlWrite;
|
|
36
|
-
clear: (options?: {
|
|
36
|
+
readonly clear: (options?: {
|
|
37
37
|
readonly replace?: boolean;
|
|
38
38
|
}) => TableUrlWrite;
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
|
+
/** Pull-based URL state using the same structural adapter as AppShell. Cursor schemas write and read only the first page. */
|
|
41
|
+
export declare function createTableUrlState(router: TableUrlRouter, parameter: string, schema: CursorTableStateSchema): TableUrlState<CursorPagination>;
|
|
42
|
+
export declare function createTableUrlState(router: TableUrlRouter, parameter: string, schema: TableStateSchema): TableUrlState;
|
package/dist/url-state.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { deserializeState as e,
|
|
2
|
-
|
|
3
|
-
function
|
|
1
|
+
import { deserializeState as e, schemaPagination as t, serializeState as n } from "./table-state.js";
|
|
2
|
+
// src/url-state.ts
|
|
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,10 +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
|
-
|
|
75
|
-
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
|
+
"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,15 +49,15 @@
|
|
|
49
49
|
"./styles.css": "./src/styles.css"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@gemologic/sheen": "0.
|
|
53
|
-
"solid-js": "1.9.
|
|
52
|
+
"@gemologic/sheen": "0.4.0",
|
|
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.
|
|
60
|
-
"solid-js": "1.9.
|
|
59
|
+
"@gemologic/sheen": "0.4.0",
|
|
60
|
+
"solid-js": "1.9.19",
|
|
61
61
|
"vite-plugin-solid": "2.11.14"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|