@gemologic/sheen-table 0.1.0-rc.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/LICENSE +19 -0
- package/README.md +19 -0
- package/dist/DataTable.d.ts +159 -0
- package/dist/DataTable.js +2724 -0
- package/dist/DataTableToolbar.d.ts +28 -0
- package/dist/DataTableToolbar.js +132 -0
- package/dist/FilterBar.d.ts +24 -0
- package/dist/FilterBar.js +681 -0
- package/dist/QueryBuilder.d.ts +11 -0
- package/dist/QueryBuilder.js +693 -0
- package/dist/cell-edit.d.ts +50 -0
- package/dist/cell-edit.js +178 -0
- package/dist/client-state.d.ts +28 -0
- package/dist/client-state.js +57 -0
- package/dist/client-view.d.ts +31 -0
- package/dist/client-view.js +30 -0
- package/dist/column-layout.d.ts +10 -0
- package/dist/column-layout.js +34 -0
- package/dist/columns.d.ts +108 -0
- package/dist/columns.js +217 -0
- package/dist/core.d.ts +54 -0
- package/dist/core.js +28 -0
- package/dist/export.d.ts +14 -0
- package/dist/export.js +27 -0
- package/dist/facets.d.ts +15 -0
- package/dist/facets.js +41 -0
- package/dist/filter-bar-state.d.ts +22 -0
- package/dist/filter-bar-state.js +128 -0
- package/dist/filter-client.d.ts +9 -0
- package/dist/filter-client.js +69 -0
- package/dist/filter.d.ts +64 -0
- package/dist/filter.js +132 -0
- package/dist/grouping.d.ts +37 -0
- package/dist/grouping.js +126 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +31 -0
- package/dist/messages.d.ts +115 -0
- package/dist/messages.js +121 -0
- package/dist/pagination.d.ts +36 -0
- package/dist/pagination.js +102 -0
- package/dist/query-builder-state.d.ts +28 -0
- package/dist/query-builder-state.js +128 -0
- package/dist/requests.d.ts +26 -0
- package/dist/requests.js +106 -0
- package/dist/row-hierarchy.d.ts +32 -0
- package/dist/row-hierarchy.js +170 -0
- package/dist/row-identity.d.ts +11 -0
- package/dist/row-identity.js +36 -0
- package/dist/saved-views.d.ts +52 -0
- package/dist/saved-views.js +153 -0
- package/dist/search-controller.d.ts +22 -0
- package/dist/search-controller.js +75 -0
- package/dist/search.d.ts +28 -0
- package/dist/search.js +111 -0
- package/dist/selection-client.d.ts +9 -0
- package/dist/selection-client.js +14 -0
- package/dist/selection.d.ts +25 -0
- package/dist/selection.js +60 -0
- package/dist/server-export.d.ts +27 -0
- package/dist/server-export.js +105 -0
- package/dist/sorting.d.ts +17 -0
- package/dist/sorting.js +58 -0
- package/dist/table-state-changes.d.ts +27 -0
- package/dist/table-state-changes.js +67 -0
- package/dist/table-state.d.ts +20 -0
- package/dist/table-state.js +77 -0
- package/dist/text-normalization.d.ts +2 -0
- package/dist/text-normalization.js +12 -0
- package/dist/url-state.d.ts +39 -0
- package/dist/url-state.js +75 -0
- package/package.json +66 -0
- package/src/DataTable.tsx +2322 -0
- package/src/DataTableToolbar.tsx +69 -0
- package/src/FilterBar.tsx +396 -0
- package/src/QueryBuilder.tsx +274 -0
- package/src/cell-edit.ts +187 -0
- package/src/client-state.ts +52 -0
- package/src/client-view.ts +61 -0
- package/src/column-layout.ts +47 -0
- package/src/columns.ts +271 -0
- package/src/core.ts +54 -0
- package/src/export.ts +39 -0
- package/src/facets.ts +46 -0
- package/src/filter-bar-state.ts +118 -0
- package/src/filter-client.ts +79 -0
- package/src/filter.ts +113 -0
- package/src/grouping.ts +185 -0
- package/src/index.ts +7 -0
- package/src/messages.ts +29 -0
- package/src/pagination.ts +81 -0
- package/src/query-builder-state.ts +105 -0
- package/src/requests.ts +85 -0
- package/src/row-hierarchy.ts +280 -0
- package/src/row-identity.ts +39 -0
- package/src/saved-views.ts +143 -0
- package/src/search-controller.ts +61 -0
- package/src/search.ts +137 -0
- package/src/selection-client.ts +23 -0
- package/src/selection.ts +62 -0
- package/src/server-export.ts +89 -0
- package/src/sorting.ts +63 -0
- package/src/styles.css +197 -0
- package/src/table-state-changes.ts +51 -0
- package/src/table-state.ts +72 -0
- package/src/text-normalization.ts +14 -0
- package/src/url-state.ts +62 -0
package/dist/columns.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
//#region src/columns.ts
|
|
2
|
+
var e = Symbol("inspect-sheen-columns"), t = class {
|
|
3
|
+
#e;
|
|
4
|
+
constructor(e) {
|
|
5
|
+
this.#e = e, Object.freeze(this);
|
|
6
|
+
}
|
|
7
|
+
[e]() {
|
|
8
|
+
return this.#e;
|
|
9
|
+
}
|
|
10
|
+
}, n = /* @__PURE__ */ new Set([
|
|
11
|
+
"id",
|
|
12
|
+
"header",
|
|
13
|
+
"accessor",
|
|
14
|
+
"cell",
|
|
15
|
+
"footer",
|
|
16
|
+
"width",
|
|
17
|
+
"minWidth",
|
|
18
|
+
"maxWidth",
|
|
19
|
+
"align",
|
|
20
|
+
"numeric",
|
|
21
|
+
"pin",
|
|
22
|
+
"visible",
|
|
23
|
+
"search",
|
|
24
|
+
"sensitive",
|
|
25
|
+
"editor",
|
|
26
|
+
"filter",
|
|
27
|
+
"sort",
|
|
28
|
+
"aggregate",
|
|
29
|
+
"__unsafe_tanstack"
|
|
30
|
+
]);
|
|
31
|
+
function r(e, t) {
|
|
32
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw Error(`${t} must be an object`);
|
|
33
|
+
let n = Object.getPrototypeOf(e);
|
|
34
|
+
if (n !== Object.prototype && n !== null) throw Error(`${t} must be a plain object`);
|
|
35
|
+
}
|
|
36
|
+
function i(e, t, n) {
|
|
37
|
+
for (let r of Object.keys(e)) if (!t.has(r)) throw Error(`${n} has unknown field ${r}`);
|
|
38
|
+
}
|
|
39
|
+
function a(e, t) {
|
|
40
|
+
if (e === void 0) return null;
|
|
41
|
+
if (typeof e != "number" || !Number.isFinite(e) || e <= 0) throw Error(`${t} must be a positive finite number`);
|
|
42
|
+
return e;
|
|
43
|
+
}
|
|
44
|
+
function o(e, t, n) {
|
|
45
|
+
if (e === void 0) return null;
|
|
46
|
+
r(e, n);
|
|
47
|
+
let a = e;
|
|
48
|
+
if (a.type === "text" || a.type === "number" || a.type === "date") return i(a, /* @__PURE__ */ new Set(["type"]), n), Object.freeze({
|
|
49
|
+
id: t,
|
|
50
|
+
type: a.type
|
|
51
|
+
});
|
|
52
|
+
if (a.type !== "enum") throw Error(`${n}.type is invalid`);
|
|
53
|
+
if (i(a, /* @__PURE__ */ new Set([
|
|
54
|
+
"type",
|
|
55
|
+
"options",
|
|
56
|
+
"faceted"
|
|
57
|
+
]), n), !Array.isArray(a.options) || a.options.length === 0) throw Error(`${n}.options must be a nonempty array`);
|
|
58
|
+
let o = /* @__PURE__ */ new Set();
|
|
59
|
+
for (let e of a.options) {
|
|
60
|
+
if (typeof e != "string" || !e || o.has(e)) throw Error(`${n}.options must contain unique nonempty strings`);
|
|
61
|
+
o.add(e);
|
|
62
|
+
}
|
|
63
|
+
if (a.faceted !== void 0 && typeof a.faceted != "boolean") throw Error(`${n}.faceted must be boolean`);
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
id: t,
|
|
66
|
+
type: "enum",
|
|
67
|
+
options: Object.freeze([...o])
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function s(e, t, n, r, i, a) {
|
|
71
|
+
if (!t || e === !1) return null;
|
|
72
|
+
if (e !== void 0 && e !== "text" && e !== "number" && e !== "date") throw Error(`${a} is invalid`);
|
|
73
|
+
let o = e ?? (n?.type === "number" || n?.type === "date" ? n.type : r ? "number" : "text");
|
|
74
|
+
return Object.freeze({
|
|
75
|
+
id: i,
|
|
76
|
+
type: o
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function c(e, t) {
|
|
80
|
+
return e !== void 0 && (r(e, t), e.type === "enum" && e.faceted === !0);
|
|
81
|
+
}
|
|
82
|
+
function l(e, t, n) {
|
|
83
|
+
if (e === void 0) return null;
|
|
84
|
+
if (!t) throw Error(`${n} requires an accessor column`);
|
|
85
|
+
if (r(e, n), e.type !== "text" && e.type !== "number" && e.type !== "boolean" && e.type !== "select") throw Error(`${n}.type is invalid`);
|
|
86
|
+
if (i(e, new Set(e.type === "select" ? [
|
|
87
|
+
"type",
|
|
88
|
+
"options",
|
|
89
|
+
"nullable",
|
|
90
|
+
"validate"
|
|
91
|
+
] : [
|
|
92
|
+
"type",
|
|
93
|
+
"nullable",
|
|
94
|
+
"validate"
|
|
95
|
+
]), n), e.nullable !== void 0 && typeof e.nullable != "boolean") throw Error(`${n}.nullable must be boolean`);
|
|
96
|
+
if (e.type === "boolean" && e.nullable === !0) throw Error(`${n}.boolean editors cannot be nullable`);
|
|
97
|
+
if (e.validate !== void 0 && typeof e.validate != "function") throw Error(`${n}.validate must be a function`);
|
|
98
|
+
if (e.type !== "select") return Object.freeze({
|
|
99
|
+
type: e.type,
|
|
100
|
+
nullable: e.nullable ?? !1,
|
|
101
|
+
...e.validate ? { validate: e.validate } : {}
|
|
102
|
+
});
|
|
103
|
+
if (!Array.isArray(e.options) || e.options.length === 0) throw Error(`${n}.options must be a nonempty array`);
|
|
104
|
+
let a = /* @__PURE__ */ new Set();
|
|
105
|
+
for (let t of e.options) {
|
|
106
|
+
if (typeof t != "string" || !t || a.has(t)) throw Error(`${n}.options must contain unique nonempty strings`);
|
|
107
|
+
a.add(t);
|
|
108
|
+
}
|
|
109
|
+
return Object.freeze({
|
|
110
|
+
type: "select",
|
|
111
|
+
options: Object.freeze([...a]),
|
|
112
|
+
nullable: e.nullable ?? !1,
|
|
113
|
+
...e.validate ? { validate: e.validate } : {}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function u(e, t) {
|
|
117
|
+
return e === null ? null : (n) => {
|
|
118
|
+
let r = e(n);
|
|
119
|
+
if (r !== null && typeof r != "string" && typeof r != "number" && typeof r != "boolean") throw Error(`${t} returned an unsupported value`);
|
|
120
|
+
if (typeof r == "number" && !Number.isFinite(r)) throw Error(`${t} returned a nonfinite number`);
|
|
121
|
+
return r;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function d(e, t, n, r, i) {
|
|
125
|
+
if (e === void 0) return null;
|
|
126
|
+
if (t === null) throw Error(`${i} requires an accessor column`);
|
|
127
|
+
if (!n) throw Error(`${i} cannot target an initially hidden column`);
|
|
128
|
+
if (r) throw Error(`${i} cannot target a sensitive column`);
|
|
129
|
+
if (e !== !0 && typeof e != "function") throw Error(`${i} must be true or a projection function`);
|
|
130
|
+
let a = e === !0 ? t : e;
|
|
131
|
+
return (t) => {
|
|
132
|
+
let n = a(t);
|
|
133
|
+
if (n === null || typeof n == "string" || typeof n == "number" && Number.isFinite(n)) return n;
|
|
134
|
+
if (e === !0 && typeof n == "boolean") return null;
|
|
135
|
+
throw Error(`${i} returned an unsupported search value`);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function f(e) {
|
|
139
|
+
return {
|
|
140
|
+
accessor: e.accessor ?? null,
|
|
141
|
+
cell: e.cell ?? null,
|
|
142
|
+
footer: e.footer ?? null
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function p(e) {
|
|
146
|
+
if (!Array.isArray(e) || e.length === 0) throw Error("defineColumns requires at least one column");
|
|
147
|
+
let p = /* @__PURE__ */ new Set(), m = [], h = 0;
|
|
148
|
+
for (let t of e) {
|
|
149
|
+
let e = `columns[${h}]`, g = t;
|
|
150
|
+
r(t, e);
|
|
151
|
+
let _ = t, v = f(g);
|
|
152
|
+
if (i(_, n, e), typeof _.id != "string" || !_.id || _.id.trim() !== _.id || p.has(_.id)) throw Error(`${e}.id must be a unique nonempty trimmed string`);
|
|
153
|
+
if (p.add(_.id), typeof _.header != "string" || !_.header.trim()) throw Error(`${e}.header must be a nonempty string`);
|
|
154
|
+
let y = v.accessor;
|
|
155
|
+
if (y !== null && typeof y != "function") throw Error(`${e}.accessor must be a function`);
|
|
156
|
+
let b = u(y, `${e}.accessor`), x = v.cell;
|
|
157
|
+
if (x !== null && typeof x != "function") throw Error(`${e}.cell must be a function`);
|
|
158
|
+
if (b === null && x === null) throw Error(`${e} must define an accessor or display cell`);
|
|
159
|
+
if (b === null && (_.filter !== void 0 || _.sort !== void 0 || _.aggregate !== void 0 || _.search !== void 0)) throw Error(`${e} display columns cannot search, filter, sort, or aggregate`);
|
|
160
|
+
if (_.footer !== void 0 && typeof _.footer != "string" && typeof _.footer != "function") throw Error(`${e}.footer must be a string or function`);
|
|
161
|
+
let S = a(_.minWidth, `${e}.minWidth`), C = a(_.maxWidth, `${e}.maxWidth`);
|
|
162
|
+
if (S !== null && C !== null && S > C) throw Error(`${e}.minWidth cannot exceed maxWidth`);
|
|
163
|
+
let w = _.width ?? "fill";
|
|
164
|
+
if (w !== "fill" && w !== "content" && (typeof w != "number" || !Number.isFinite(w) || w <= 0)) throw Error(`${e}.width is invalid`);
|
|
165
|
+
if (typeof w == "number" && (S !== null && w < S || C !== null && w > C)) throw Error(`${e}.width must be within its bounds`);
|
|
166
|
+
if (_.numeric !== void 0 && typeof _.numeric != "boolean") throw Error(`${e}.numeric must be boolean`);
|
|
167
|
+
let T = _.numeric ?? !1, E = _.align ?? (T ? "end" : "start");
|
|
168
|
+
if (E !== "start" && E !== "center" && E !== "end") throw Error(`${e}.align is invalid`);
|
|
169
|
+
let D = _.pin ?? !1;
|
|
170
|
+
if (D !== !1 && D !== "start" && D !== "end") throw Error(`${e}.pin is invalid`);
|
|
171
|
+
if (D !== !1 && typeof w != "number") throw Error(`${e}.width must be numeric when initially pinned`);
|
|
172
|
+
if (_.visible !== void 0 && typeof _.visible != "boolean") throw Error(`${e}.visible must be boolean`);
|
|
173
|
+
if (_.sensitive !== void 0 && typeof _.sensitive != "boolean") throw Error(`${e}.sensitive must be boolean`);
|
|
174
|
+
let O = _.visible ?? !0, k = _.sensitive ?? !1, A = d(g.search, b, O, k, `${e}.search`), j = l(g.editor, b !== null, `${e}.editor`), M = o(_.filter, _.id, `${e}.filter`), N = c(_.filter, `${e}.filter`), P = s(_.sort, b !== null, M, T, _.id, `${e}.sort`), F = _.aggregate ?? null;
|
|
175
|
+
if (F !== null && F !== "sum" && F !== "average" && F !== "min" && F !== "max" && F !== "count") throw Error(`${e}.aggregate is invalid`);
|
|
176
|
+
if (F !== null && F !== "count" && !T && M?.type !== "number") throw Error(`${e}.${F} requires a numeric column`);
|
|
177
|
+
let I = null;
|
|
178
|
+
_.__unsafe_tanstack !== void 0 && (r(_.__unsafe_tanstack, `${e}.__unsafe_tanstack`), I = Object.freeze({ ..._.__unsafe_tanstack })), m.push(Object.freeze({
|
|
179
|
+
id: _.id,
|
|
180
|
+
header: _.header,
|
|
181
|
+
accessor: b,
|
|
182
|
+
cell: x,
|
|
183
|
+
footer: v.footer,
|
|
184
|
+
width: w,
|
|
185
|
+
minWidth: S,
|
|
186
|
+
maxWidth: C,
|
|
187
|
+
align: E,
|
|
188
|
+
numeric: T,
|
|
189
|
+
pin: D,
|
|
190
|
+
visible: O,
|
|
191
|
+
search: A,
|
|
192
|
+
sensitive: k,
|
|
193
|
+
editor: j,
|
|
194
|
+
filter: M,
|
|
195
|
+
faceted: N,
|
|
196
|
+
sort: P,
|
|
197
|
+
aggregate: F,
|
|
198
|
+
unsafeTanStack: I
|
|
199
|
+
})), h++;
|
|
200
|
+
}
|
|
201
|
+
return new t(Object.freeze(m));
|
|
202
|
+
}
|
|
203
|
+
function m(t) {
|
|
204
|
+
let n = t[e];
|
|
205
|
+
if (typeof n != "function") throw Error("Expected columns returned by defineColumns");
|
|
206
|
+
return n.call(t);
|
|
207
|
+
}
|
|
208
|
+
function h(e) {
|
|
209
|
+
let t = m(e);
|
|
210
|
+
return Object.freeze({
|
|
211
|
+
columns: Object.freeze(t.map((e) => e.id)),
|
|
212
|
+
filterColumns: Object.freeze(t.flatMap((e) => e.filter ? [e.filter] : [])),
|
|
213
|
+
sortColumns: Object.freeze(t.flatMap((e) => e.sort ? [e.sort] : []))
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
export { h as columnStateSchema, p as defineColumns, m as readColumnDefinitions };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export { parsePagination, resolvePagination, resetPagination, resizePagination, getPageRange, paginateClientRows, assessServerPage } from "./pagination.ts";
|
|
2
|
+
export type { PageState, TablePagination, PageRange, PageResult, ServerPageAssessment } from "./pagination.ts";
|
|
3
|
+
export { createTableRequests } from "./requests.ts";
|
|
4
|
+
export type { TableRequestState, TableRequestSnapshot, TableRequestOutcome, InitialTableResult } from "./requests.ts";
|
|
5
|
+
export { parseFilter, serializeFilter, deserializeFilter } from "./filter.ts";
|
|
6
|
+
export type { FilterNode, FilterColumn } from "./filter.ts";
|
|
7
|
+
export { queryBuilderFilterColumns, defaultQueryRule, queryNodeAt, replaceQueryNode, appendQueryChild, removeQueryNode, moveQueryNode, toggleQueryNegation } from "./query-builder-state.ts";
|
|
8
|
+
export type { QueryBuilderColumn, QueryBuilderPath } from "./query-builder-state.ts";
|
|
9
|
+
export { listFilterConditions, replaceFilterCondition, removeFilterCondition, appendFilterCondition, removeFilterColumnConditions } from "./filter-bar-state.ts";
|
|
10
|
+
export type { FilterCondition, FilterConditionEntry, FilterPathSegment } from "./filter-bar-state.ts";
|
|
11
|
+
export { compileFilter, filterClientRows } from "./filter-client.ts";
|
|
12
|
+
export type { FilterEvaluation } from "./filter-client.ts";
|
|
13
|
+
export { parseSorting, sortClientRows } from "./sorting.ts";
|
|
14
|
+
export type { SortColumn, SortEntry, SortState, SortEvaluation } from "./sorting.ts";
|
|
15
|
+
export { countClientFacets } from "./facets.ts";
|
|
16
|
+
export type { FacetOption, ColumnFacet, FacetEvaluation } from "./facets.ts";
|
|
17
|
+
export { formatSearchQuery, parseSearchQuery, searchClientRows } from "./search.ts";
|
|
18
|
+
export type { SearchEvaluation, SearchMatch, SearchMode, SearchQuery } from "./search.ts";
|
|
19
|
+
export { createDebouncedSearch } from "./search-controller.ts";
|
|
20
|
+
export type { SearchSnapshot, SearchOutcome, InitialSearchResult } from "./search-controller.ts";
|
|
21
|
+
export { createClientView } from "./client-view.ts";
|
|
22
|
+
export type { ClientView, ClientViewState, ClientViewOptions } from "./client-view.ts";
|
|
23
|
+
export { parseClientViewState, changeClientViewState } from "./client-state.ts";
|
|
24
|
+
export type { ClientStateSchema, ClientStateChange } from "./client-state.ts";
|
|
25
|
+
export { parseTableState, serializeState, deserializeState } from "./table-state.ts";
|
|
26
|
+
export type { ColumnState, TableState, TableStateSchema } from "./table-state.ts";
|
|
27
|
+
export { changeTableState } from "./table-state-changes.ts";
|
|
28
|
+
export type { TableStateChange } from "./table-state-changes.ts";
|
|
29
|
+
export { orderColumnStates, placeColumn, moveColumn, canMoveColumn } from "./column-layout.ts";
|
|
30
|
+
export type { ColumnMoveDirection, ColumnDropPlacement } from "./column-layout.ts";
|
|
31
|
+
export { createTableSelection } from "./selection.ts";
|
|
32
|
+
export type { BulkSelection } from "./selection.ts";
|
|
33
|
+
export { createClientExport } from "./export.ts";
|
|
34
|
+
export type { ExportValue, ExportColumn } from "./export.ts";
|
|
35
|
+
export { selectClientRows } from "./selection-client.ts";
|
|
36
|
+
export type { ClientSelectionOptions } from "./selection-client.ts";
|
|
37
|
+
export { createServerExport } from "./server-export.ts";
|
|
38
|
+
export type { TableExportRequest, ServerExportSnapshot, ServerExportOutcome } from "./server-export.ts";
|
|
39
|
+
export { createCellEdit } from "./cell-edit.ts";
|
|
40
|
+
export type { CellEditValue, CellCommitRequest, CellCommitResult, CellCommitAttempt, CellEditConflict, CellEditSnapshot, CellCommitOutcome, CellEditOptions } from "./cell-edit.ts";
|
|
41
|
+
export { defineColumns } from "./columns.ts";
|
|
42
|
+
export type { ColumnValue, ColumnPin, ColumnAlign, ColumnWidth, ColumnAggregate, ColumnSort, ColumnSearchProjection, ColumnEditor, ColumnFilter, UnsafeTanStackColumnOptions, SheenAccessorColumn, SheenDisplayColumn, SheenColumnInput, SheenColumns } from "./columns.ts";
|
|
43
|
+
export { createRowIdentity } from "./row-identity.ts";
|
|
44
|
+
export type { IdentifiedRow } from "./row-identity.ts";
|
|
45
|
+
export { groupClientRows, normalizeServerGroups } from "./grouping.ts";
|
|
46
|
+
export type { GroupAggregateColumn, GroupAggregateValue, ClientRowGroup, ServerRowGroup, ClientGroupingOptions } from "./grouping.ts";
|
|
47
|
+
export { createRowHierarchy } from "./row-hierarchy.ts";
|
|
48
|
+
export type { HierarchyLoadOutcome, RowHierarchyOptions, HierarchyRow } from "./row-hierarchy.ts";
|
|
49
|
+
export { createTableUrlState } from "./url-state.ts";
|
|
50
|
+
export type { TableUrlLocation, TableUrlRouter, TableUrlRead, TableUrlWrite } from "./url-state.ts";
|
|
51
|
+
export { createSavedViews } from "./saved-views.ts";
|
|
52
|
+
export type { SavedViewRecord, SavedViewSave, SavedViewsAdapter, SavedViewOperation, SavedViewsSnapshot, SavedViewOutcome, SavedViewRestore } from "./saved-views.ts";
|
|
53
|
+
export { englishTableMessages, resolveTableMessages } from "./messages.ts";
|
|
54
|
+
export type { TableMessages } from "./messages.ts";
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { assessServerPage as e, getPageRange as t, paginateClientRows as n, parsePagination as r, resetPagination as i, resizePagination as a, resolvePagination as o } from "./pagination.js";
|
|
2
|
+
import { createTableRequests as s } from "./requests.js";
|
|
3
|
+
import { deserializeFilter as c, parseFilter as l, serializeFilter as u } from "./filter.js";
|
|
4
|
+
import { appendQueryChild as d, defaultQueryRule as f, moveQueryNode as p, queryBuilderFilterColumns as m, queryNodeAt as h, removeQueryNode as g, replaceQueryNode as _, toggleQueryNegation as v } from "./query-builder-state.js";
|
|
5
|
+
import { appendFilterCondition as y, listFilterConditions as b, removeFilterColumnConditions as x, removeFilterCondition as S, replaceFilterCondition as C } from "./filter-bar-state.js";
|
|
6
|
+
import { compileFilter as w, filterClientRows as T } from "./filter-client.js";
|
|
7
|
+
import { parseSorting as E, sortClientRows as D } from "./sorting.js";
|
|
8
|
+
import { countClientFacets as O } from "./facets.js";
|
|
9
|
+
import { formatSearchQuery as k, parseSearchQuery as A, searchClientRows as j } from "./search.js";
|
|
10
|
+
import { createDebouncedSearch as M } from "./search-controller.js";
|
|
11
|
+
import { createClientView as N } from "./client-view.js";
|
|
12
|
+
import { changeClientViewState as P, parseClientViewState as F } from "./client-state.js";
|
|
13
|
+
import { deserializeState as I, parseTableState as L, serializeState as R } from "./table-state.js";
|
|
14
|
+
import { changeTableState as z } from "./table-state-changes.js";
|
|
15
|
+
import { canMoveColumn as B, moveColumn as V, orderColumnStates as H, placeColumn as U } from "./column-layout.js";
|
|
16
|
+
import { createTableSelection as W } from "./selection.js";
|
|
17
|
+
import { createClientExport as G } from "./export.js";
|
|
18
|
+
import { selectClientRows as K } from "./selection-client.js";
|
|
19
|
+
import { createServerExport as q } from "./server-export.js";
|
|
20
|
+
import { createCellEdit as J } from "./cell-edit.js";
|
|
21
|
+
import { defineColumns as Y } from "./columns.js";
|
|
22
|
+
import { createRowIdentity as X } from "./row-identity.js";
|
|
23
|
+
import { groupClientRows as Z, normalizeServerGroups as Q } from "./grouping.js";
|
|
24
|
+
import { createRowHierarchy as $ } from "./row-hierarchy.js";
|
|
25
|
+
import { createTableUrlState as ee } from "./url-state.js";
|
|
26
|
+
import { createSavedViews as te } from "./saved-views.js";
|
|
27
|
+
import { englishTableMessages as ne, resolveTableMessages as re } from "./messages.js";
|
|
28
|
+
export { y as appendFilterCondition, d as appendQueryChild, e as assessServerPage, B as canMoveColumn, P as changeClientViewState, z as changeTableState, w as compileFilter, O as countClientFacets, J as createCellEdit, G as createClientExport, N as createClientView, M as createDebouncedSearch, $ as createRowHierarchy, X as createRowIdentity, te as createSavedViews, q as createServerExport, s as createTableRequests, W as createTableSelection, ee as createTableUrlState, f as defaultQueryRule, Y as defineColumns, c as deserializeFilter, I as deserializeState, ne as englishTableMessages, T as filterClientRows, k as formatSearchQuery, t as getPageRange, Z as groupClientRows, b as listFilterConditions, V as moveColumn, p as moveQueryNode, Q as normalizeServerGroups, H as orderColumnStates, n as paginateClientRows, F as parseClientViewState, l as parseFilter, r as parsePagination, A as parseSearchQuery, E as parseSorting, L as parseTableState, U as placeColumn, m as queryBuilderFilterColumns, h as queryNodeAt, x as removeFilterColumnConditions, S as removeFilterCondition, g as removeQueryNode, C as replaceFilterCondition, _ as replaceQueryNode, i as resetPagination, a as resizePagination, o as resolvePagination, re as resolveTableMessages, j as searchClientRows, K as selectClientRows, u as serializeFilter, R as serializeState, D as sortClientRows, v as toggleQueryNegation };
|
package/dist/export.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ExportValue = string | number | boolean | null;
|
|
2
|
+
export interface ExportColumn<Row> {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly header: string;
|
|
5
|
+
readonly visible?: boolean;
|
|
6
|
+
readonly value: (row: Row) => ExportValue;
|
|
7
|
+
}
|
|
8
|
+
/** Snapshot selected rows from the complete client view and visible export columns before downloading. */
|
|
9
|
+
export declare function createClientExport<Row>(rows: readonly Row[], columns: readonly ExportColumn<Row>[]): Readonly<{
|
|
10
|
+
rowCount: number;
|
|
11
|
+
columnIds: readonly string[];
|
|
12
|
+
toCSV: () => string;
|
|
13
|
+
toJSON: () => string;
|
|
14
|
+
}>;
|
package/dist/export.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/export.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
|
|
4
|
+
throw Error(`Invalid export value at row ${t}, column ${n}: expected string, finite number, boolean, or null`);
|
|
5
|
+
}
|
|
6
|
+
function t(e) {
|
|
7
|
+
let t = e === null ? "" : String(e);
|
|
8
|
+
return typeof e == "string" && (/^[\s\p{Cc}\p{Cf}]*[=+\-@=+-@]/u.test(t) || /^[\p{Cc}\p{Cf}]/u.test(t)) && (t = `'${t}`), `"${t.replaceAll("\"", "\"\"")}"`;
|
|
9
|
+
}
|
|
10
|
+
function n(n, r) {
|
|
11
|
+
let i = /* @__PURE__ */ new Set(), a = Array.from(r).filter((e) => {
|
|
12
|
+
if (!e) throw Error("Invalid export column: missing entry");
|
|
13
|
+
if (typeof e.id != "string" || !e.id.trim() || i.has(e.id)) throw Error("Export column IDs must be unique nonempty strings");
|
|
14
|
+
if (i.add(e.id), typeof e.header != "string" || typeof e.value != "function" || e.visible !== void 0 && typeof e.visible != "boolean") throw Error(`Invalid export column: ${e.id}`);
|
|
15
|
+
return e.visible !== !1;
|
|
16
|
+
});
|
|
17
|
+
if (a.length === 0) throw Error("Export requires at least one visible column");
|
|
18
|
+
let o = a.map((e) => e.header), s = Object.freeze(a.map((e) => e.id)), c = Array.from(n, (t, n) => a.map((r) => e(r.value(t), n, r.id)));
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
rowCount: c.length,
|
|
21
|
+
columnIds: s,
|
|
22
|
+
toCSV: () => [o.map(t).join(","), ...c.map((e) => e.map(t).join(","))].join("\r\n") + "\r\n",
|
|
23
|
+
toJSON: () => JSON.stringify(c.map((e) => Object.fromEntries(s.map((t, n) => [t, e[n]]))))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { n as createClientExport };
|
package/dist/facets.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FilterColumn } from "./filter.ts";
|
|
2
|
+
export interface FacetOption {
|
|
3
|
+
readonly value: string;
|
|
4
|
+
readonly count: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ColumnFacet {
|
|
7
|
+
readonly column: string;
|
|
8
|
+
readonly options: readonly FacetOption[];
|
|
9
|
+
readonly missing: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FacetEvaluation<Row> {
|
|
12
|
+
readonly getValue: (row: Row, column: string) => unknown;
|
|
13
|
+
}
|
|
14
|
+
/** Count the complete filtered view, before pagination. Never removes AST predicates. */
|
|
15
|
+
export declare function countClientFacets<Row>(rows: readonly Row[], columns: readonly FilterColumn[], evaluation: FacetEvaluation<Row>): readonly ColumnFacet[];
|
package/dist/facets.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/facets.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
let r = /* @__PURE__ */ new Set(), i = t.flatMap((e) => {
|
|
4
|
+
if (typeof e.id != "string" || !e.id.trim() || r.has(e.id)) throw Error("Invalid or duplicate facet column");
|
|
5
|
+
if (r.add(e.id), e.type !== "enum") return [];
|
|
6
|
+
if (!Array.isArray(e.options)) throw Error(`Invalid facet options for ${e.id}`);
|
|
7
|
+
let t = /* @__PURE__ */ new Map();
|
|
8
|
+
for (let n of e.options) {
|
|
9
|
+
if (typeof n != "string") throw Error(`Invalid facet option for ${e.id}`);
|
|
10
|
+
t.set(n, 0);
|
|
11
|
+
}
|
|
12
|
+
return [{
|
|
13
|
+
column: e.id,
|
|
14
|
+
counts: t,
|
|
15
|
+
missing: 0
|
|
16
|
+
}];
|
|
17
|
+
});
|
|
18
|
+
for (let t = 0; t < e.length; t++) {
|
|
19
|
+
let r = e[t];
|
|
20
|
+
if (r === void 0) throw Error(`Missing facet row at index ${t}`);
|
|
21
|
+
for (let e of i) {
|
|
22
|
+
let i = n.getValue(r, e.column);
|
|
23
|
+
if (i == null) {
|
|
24
|
+
e.missing++;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (typeof i != "string" || !e.counts.has(i)) throw Error(`Invalid enum value for facet ${e.column} at row ${t}`);
|
|
28
|
+
e.counts.set(i, (e.counts.get(i) ?? 0) + 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return Object.freeze(i.map((e) => Object.freeze({
|
|
32
|
+
column: e.column,
|
|
33
|
+
options: Object.freeze(Array.from(e.counts, ([e, t]) => Object.freeze({
|
|
34
|
+
value: e,
|
|
35
|
+
count: t
|
|
36
|
+
}))),
|
|
37
|
+
missing: e.missing
|
|
38
|
+
})));
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { e as countClientFacets };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FilterNode } from "./filter.ts";
|
|
2
|
+
export type FilterCondition = Extract<FilterNode, {
|
|
3
|
+
readonly column: string;
|
|
4
|
+
}>;
|
|
5
|
+
export type FilterPathSegment = number | "child";
|
|
6
|
+
export interface FilterConditionEntry {
|
|
7
|
+
readonly path: readonly FilterPathSegment[];
|
|
8
|
+
readonly condition: FilterCondition;
|
|
9
|
+
readonly directNegated: boolean;
|
|
10
|
+
readonly inheritedNegated: boolean;
|
|
11
|
+
readonly groups: readonly ("and" | "or")[];
|
|
12
|
+
}
|
|
13
|
+
/** Project editable leaf conditions without flattening or changing the source expression. */
|
|
14
|
+
export declare function listFilterConditions(filter: FilterNode): readonly FilterConditionEntry[];
|
|
15
|
+
/** Replace one leaf, optionally wrapped in a direct not, while preserving surrounding groups. */
|
|
16
|
+
export declare function replaceFilterCondition(filter: FilterNode, path: readonly FilterPathSegment[], condition: FilterCondition, negated: boolean): FilterNode;
|
|
17
|
+
/** Remove one leaf and simplify empty or single-child groups without changing truth semantics. */
|
|
18
|
+
export declare function removeFilterCondition(filter: FilterNode, path: readonly FilterPathSegment[]): FilterNode;
|
|
19
|
+
/** Add a new condition to the root conjunction, wrapping a non-conjunction expression intact. */
|
|
20
|
+
export declare function appendFilterCondition(filter: FilterNode, condition: FilterCondition, negated?: boolean): FilterNode;
|
|
21
|
+
/** Remove every condition for one facet column while preserving all other constraints. */
|
|
22
|
+
export declare function removeFilterColumnConditions(filter: FilterNode, column: string): FilterNode;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//#region src/filter-bar-state.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.kind !== "and" && e.kind !== "or" && e.kind !== "not";
|
|
4
|
+
}
|
|
5
|
+
function t(t) {
|
|
6
|
+
let n = [];
|
|
7
|
+
function r(t, i, a, o) {
|
|
8
|
+
if (t.kind === "and" || t.kind === "or") {
|
|
9
|
+
let e = Object.freeze([...o, t.kind]);
|
|
10
|
+
for (let n = 0; n < t.children.length; n++) r(t.children[n], Object.freeze([...i, n]), a, e);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (t.kind === "not") {
|
|
14
|
+
e(t.child) ? n.push(Object.freeze({
|
|
15
|
+
path: Object.freeze([...i]),
|
|
16
|
+
condition: t.child,
|
|
17
|
+
directNegated: !0,
|
|
18
|
+
inheritedNegated: a,
|
|
19
|
+
groups: Object.freeze([...o])
|
|
20
|
+
})) : r(t.child, Object.freeze([...i, "child"]), !a, o);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!e(t)) throw Error("Filter condition traversal reached a non-leaf node");
|
|
24
|
+
n.push(Object.freeze({
|
|
25
|
+
path: Object.freeze([...i]),
|
|
26
|
+
condition: t,
|
|
27
|
+
directNegated: !1,
|
|
28
|
+
inheritedNegated: a,
|
|
29
|
+
groups: Object.freeze([...o])
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
return r(t, Object.freeze([]), !1, Object.freeze([])), Object.freeze(n);
|
|
33
|
+
}
|
|
34
|
+
function n(e, t) {
|
|
35
|
+
return t ? Object.freeze({
|
|
36
|
+
kind: "not",
|
|
37
|
+
child: e
|
|
38
|
+
}) : e;
|
|
39
|
+
}
|
|
40
|
+
function r(e, t, n, i) {
|
|
41
|
+
if (n === t.length) return i;
|
|
42
|
+
let a = t[n];
|
|
43
|
+
if (typeof a == "number") {
|
|
44
|
+
if (e.kind !== "and" && e.kind !== "or" || a < 0 || a >= e.children.length) throw Error("Filter condition path does not match the expression");
|
|
45
|
+
let o = e.children.map((e, o) => o === a ? r(e, t, n + 1, i) : e);
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
kind: e.kind,
|
|
48
|
+
children: Object.freeze(o)
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (e.kind !== "not") throw Error("Filter condition path does not match the expression");
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
kind: "not",
|
|
54
|
+
child: r(e.child, t, n + 1, i)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function i(e, t, i, a) {
|
|
58
|
+
return r(e, t, 0, n(i, a));
|
|
59
|
+
}
|
|
60
|
+
function a(e, t, n) {
|
|
61
|
+
if (n === t.length) return null;
|
|
62
|
+
let r = t[n];
|
|
63
|
+
if (typeof r == "number") {
|
|
64
|
+
if (e.kind !== "and" && e.kind !== "or" || r < 0 || r >= e.children.length) throw Error("Filter condition path does not match the expression");
|
|
65
|
+
let i = [];
|
|
66
|
+
for (let o = 0; o < e.children.length; o++) {
|
|
67
|
+
let s = o === r ? a(e.children[o], t, n + 1) : e.children[o];
|
|
68
|
+
s && i.push(s);
|
|
69
|
+
}
|
|
70
|
+
return i.length === 0 ? null : i.length === 1 ? i[0] : Object.freeze({
|
|
71
|
+
kind: e.kind,
|
|
72
|
+
children: Object.freeze(i)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (e.kind !== "not") throw Error("Filter condition path does not match the expression");
|
|
76
|
+
let i = a(e.child, t, n + 1);
|
|
77
|
+
return i ? Object.freeze({
|
|
78
|
+
kind: "not",
|
|
79
|
+
child: i
|
|
80
|
+
}) : null;
|
|
81
|
+
}
|
|
82
|
+
function o(e, t) {
|
|
83
|
+
return a(e, t, 0) ?? Object.freeze({
|
|
84
|
+
kind: "and",
|
|
85
|
+
children: Object.freeze([])
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function s(e, t, r = !1) {
|
|
89
|
+
let i = n(t, r);
|
|
90
|
+
return e.kind === "and" ? Object.freeze({
|
|
91
|
+
kind: "and",
|
|
92
|
+
children: Object.freeze([...e.children, i])
|
|
93
|
+
}) : Object.freeze({
|
|
94
|
+
kind: "and",
|
|
95
|
+
children: Object.freeze([e, i])
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function c(t, n) {
|
|
99
|
+
if (t.kind === "and" || t.kind === "or") {
|
|
100
|
+
let e = [], r = !1;
|
|
101
|
+
for (let i of t.children) {
|
|
102
|
+
let t = c(i, n);
|
|
103
|
+
t && e.push(t), t !== i && (r = !0);
|
|
104
|
+
}
|
|
105
|
+
return r ? e.length === 0 ? null : e.length === 1 ? e[0] : Object.freeze({
|
|
106
|
+
kind: t.kind,
|
|
107
|
+
children: Object.freeze(e)
|
|
108
|
+
}) : t;
|
|
109
|
+
}
|
|
110
|
+
if (t.kind === "not") {
|
|
111
|
+
let e = c(t.child, n);
|
|
112
|
+
return e === t.child ? t : e ? Object.freeze({
|
|
113
|
+
kind: "not",
|
|
114
|
+
child: e
|
|
115
|
+
}) : null;
|
|
116
|
+
}
|
|
117
|
+
if (!e(t)) throw Error("Facet traversal reached a non-leaf node");
|
|
118
|
+
return t.column === n ? null : t;
|
|
119
|
+
}
|
|
120
|
+
function l(e, t) {
|
|
121
|
+
if (typeof t != "string" || !t.trim()) throw Error("Facet column must be a nonempty string");
|
|
122
|
+
return c(e, t) ?? Object.freeze({
|
|
123
|
+
kind: "and",
|
|
124
|
+
children: Object.freeze([])
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { s as appendFilterCondition, t as listFilterConditions, l as removeFilterColumnConditions, o as removeFilterCondition, i as replaceFilterCondition };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FilterColumn, FilterNode } from "./filter.ts";
|
|
2
|
+
export interface FilterEvaluation<Row> {
|
|
3
|
+
readonly locale: string;
|
|
4
|
+
readonly getValue: (row: Row, column: string) => unknown;
|
|
5
|
+
}
|
|
6
|
+
/** Validate and compile once per filter/schema/locale change, not once per row. */
|
|
7
|
+
export declare function compileFilter<Row>(filter: FilterNode, columns: readonly FilterColumn[], options: FilterEvaluation<Row>): (row: Row) => boolean;
|
|
8
|
+
/** Operates on the complete client dataset and preserves surviving row identities/order. */
|
|
9
|
+
export declare function filterClientRows<Row>(rows: readonly Row[], filter: FilterNode, columns: readonly FilterColumn[], options: FilterEvaluation<Row>): readonly Row[];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { parseFilter as e } from "./filter.js";
|
|
2
|
+
import { createTextNormalizer as t } from "./text-normalization.js";
|
|
3
|
+
//#region src/filter-client.ts
|
|
4
|
+
function n(n, r, i) {
|
|
5
|
+
let a = Intl.getCanonicalLocales(i.locale)[0] ?? "";
|
|
6
|
+
if (!a) throw Error("Filter evaluation requires an explicit locale");
|
|
7
|
+
let o = i.getValue;
|
|
8
|
+
function s(e) {
|
|
9
|
+
switch (e.kind) {
|
|
10
|
+
case "and": {
|
|
11
|
+
let t = e.children.map(s);
|
|
12
|
+
return (e) => t.every((t) => t(e));
|
|
13
|
+
}
|
|
14
|
+
case "or": {
|
|
15
|
+
let t = e.children.map(s);
|
|
16
|
+
return (e) => t.some((t) => t(e));
|
|
17
|
+
}
|
|
18
|
+
case "not": {
|
|
19
|
+
let t = s(e.child);
|
|
20
|
+
return (e) => !t(e);
|
|
21
|
+
}
|
|
22
|
+
case "empty": return (t) => {
|
|
23
|
+
let n = o(t, e.column);
|
|
24
|
+
return n == null || n === "";
|
|
25
|
+
};
|
|
26
|
+
case "text": {
|
|
27
|
+
let n = t(a, e.caseSensitive), r = n(e.value), i = (t) => {
|
|
28
|
+
switch (e.operator) {
|
|
29
|
+
case "eq": return t === r;
|
|
30
|
+
case "contains": return t.includes(r);
|
|
31
|
+
case "startsWith": return t.startsWith(r);
|
|
32
|
+
case "endsWith": return t.endsWith(r);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return (t) => {
|
|
36
|
+
let r = o(t, e.column);
|
|
37
|
+
return typeof r == "string" && i(n(r));
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
case "enum": {
|
|
41
|
+
let t = new Set(e.values);
|
|
42
|
+
return (n) => {
|
|
43
|
+
let r = o(n, e.column);
|
|
44
|
+
return typeof r == "string" && t.has(r);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
case "date":
|
|
48
|
+
case "number": return (t) => {
|
|
49
|
+
let n = o(t, e.column);
|
|
50
|
+
if (typeof n != "number" || !Number.isFinite(n) || e.kind === "date" && Math.abs(n) > 864e13) return !1;
|
|
51
|
+
switch (e.operator) {
|
|
52
|
+
case "eq": return n === e.value;
|
|
53
|
+
case "lt": return n < e.value;
|
|
54
|
+
case "lte": return n <= e.value;
|
|
55
|
+
case "gt": return n > e.value;
|
|
56
|
+
case "gte": return n >= e.value;
|
|
57
|
+
case "between": return n >= e.min && n <= e.max;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return s(e(n, r));
|
|
63
|
+
}
|
|
64
|
+
function r(e, t, r, i) {
|
|
65
|
+
let a = n(t, r, i);
|
|
66
|
+
return t.kind === "and" && t.children.length === 0 ? e : e.filter(a);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { n as compileFilter, r as filterClientRows };
|