@tetrascience-npm/tetrascience-react-ui 1.0.0-beta.157.1 → 1.0.0-beta.158.1
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/README.md +113 -0
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.d.ts +5 -1
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +32 -30
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapEditor.d.ts +269 -13
- package/dist/components/composed/PlateMapEditor/PlateMapEditor.js +392 -310
- package/dist/components/composed/PlateMapEditor/PlateMapEditor.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapForm.d.ts +5 -1
- package/dist/components/composed/PlateMapEditor/PlateMapForm.js +19 -15
- package/dist/components/composed/PlateMapEditor/PlateMapForm.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.d.ts +12 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.js +69 -63
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapManifest.d.ts +13 -4
- package/dist/components/composed/PlateMapEditor/PlateMapManifest.js +38 -29
- package/dist/components/composed/PlateMapEditor/PlateMapManifest.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.d.ts +6 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +490 -275
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.d.ts +8 -2
- package/dist/components/composed/PlateMapEditor/WellLegend.js +8 -7
- package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.d.ts +6 -2
- package/dist/components/composed/PlateMapEditor/WellManifestTable.js +288 -256
- package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellMetadataForm.d.ts +5 -1
- package/dist/components/composed/PlateMapEditor/WellMetadataForm.js +61 -66
- package/dist/components/composed/PlateMapEditor/WellMetadataForm.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs +2 -0
- package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs.map +1 -0
- package/dist/components/composed/PlateMapEditor/WellQuickPaint.d.ts +23 -0
- package/dist/components/composed/PlateMapEditor/WellQuickPaint.js +75 -0
- package/dist/components/composed/PlateMapEditor/WellQuickPaint.js.map +1 -0
- package/dist/components/composed/PlateMapEditor/index.d.ts +6 -2
- package/dist/components/composed/PlateMapEditor/types.d.ts +65 -0
- package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs +2 -0
- package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs.map +1 -0
- package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.d.ts +109 -0
- package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js +246 -0
- package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js.map +1 -0
- package/dist/composed/PlateMapEditor.cjs +1 -1
- package/dist/composed/PlateMapEditor.js +48 -42
- package/dist/composed/PlateMapEditor.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +701 -695
- package/dist/index.js.map +1 -1
- package/dist/index.scoped.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/package.json +1 -1
|
@@ -1,244 +1,273 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Layers as _e, Check as
|
|
3
|
-
import * as
|
|
4
|
-
import { ManifestFilterPopover as
|
|
5
|
-
import { Badge as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import { useComboboxAnchor as
|
|
9
|
-
import { applyFilterCondition as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { Select as
|
|
12
|
-
import { Switch as
|
|
13
|
-
import { Table as
|
|
14
|
-
import { TooltipProvider as
|
|
15
|
-
import { cn as
|
|
16
|
-
function
|
|
17
|
-
ariaLabel:
|
|
18
|
-
value:
|
|
19
|
-
options:
|
|
20
|
-
placeholder:
|
|
21
|
-
onChange:
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Layers as _e, Check as ne, ChevronRight as Me, ChevronDown as Te, ArrowDownToLine as ze } from "lucide-react";
|
|
3
|
+
import * as p from "react";
|
|
4
|
+
import { ManifestFilterPopover as Re } from "./ManifestFilterPopover.js";
|
|
5
|
+
import { Badge as te } from "../../../ui/badge.js";
|
|
6
|
+
import { Button as z } from "../../../ui/button.js";
|
|
7
|
+
import { Checkbox as le } from "../../../ui/checkbox.js";
|
|
8
|
+
import { useComboboxAnchor as Ge, Combobox as Le, ComboboxChips as Ie, ComboboxValue as Be, ComboboxChip as De, ComboboxChipsInput as Ve, ComboboxContent as We, ComboboxEmpty as $e, ComboboxList as je, ComboboxItem as He } from "../../../ui/combobox.js";
|
|
9
|
+
import { applyFilterCondition as Ue } from "../../ui/data-table/data-table.js";
|
|
10
|
+
import { Input as Ze } from "../../../ui/input.js";
|
|
11
|
+
import { Select as V, SelectTrigger as W, SelectValue as $, SelectContent as j, SelectItem as R } from "../../../ui/select.js";
|
|
12
|
+
import { Switch as Oe } from "../../../ui/switch.js";
|
|
13
|
+
import { Table as Ke, TableHeader as Ye, TableRow as G, TableHead as H, TableBody as qe, TableCell as _ } from "../../../ui/table.js";
|
|
14
|
+
import { TooltipProvider as Je, Tooltip as Qe, TooltipTrigger as Xe, TooltipContent as er } from "../../../ui/tooltip.js";
|
|
15
|
+
import { cn as L } from "../../../lib/utils.js";
|
|
16
|
+
function rr({
|
|
17
|
+
ariaLabel: s,
|
|
18
|
+
value: i,
|
|
19
|
+
options: d,
|
|
20
|
+
placeholder: u,
|
|
21
|
+
onChange: g
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
}, [
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
23
|
+
const x = Ge(), b = p.useMemo(() => {
|
|
24
|
+
const h = /* @__PURE__ */ new Map();
|
|
25
|
+
return d.forEach((w) => h.set(w.value, w.label)), h;
|
|
26
|
+
}, [d]);
|
|
27
|
+
return /* @__PURE__ */ c(Le, { multiple: !0, items: d.map((h) => h.value), value: i, onValueChange: g, children: [
|
|
28
|
+
/* @__PURE__ */ c(Ie, { ref: x, className: L("min-h-7 w-full py-0.5", U), children: [
|
|
29
|
+
/* @__PURE__ */ r(Be, { children: (h) => h.map((w) => /* @__PURE__ */ r(De, { children: b.get(w) ?? w }, w)) }),
|
|
30
|
+
/* @__PURE__ */ r(Ve, { "aria-label": s, placeholder: u ?? "Select…" })
|
|
31
31
|
] }),
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ c(We, { anchor: x, children: [
|
|
33
|
+
/* @__PURE__ */ r($e, { children: "No options." }),
|
|
34
|
+
/* @__PURE__ */ r(je, { "aria-label": s, children: (h) => /* @__PURE__ */ r(He, { value: h, children: b.get(h) ?? h }, h) })
|
|
35
35
|
] })
|
|
36
36
|
] });
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
function
|
|
40
|
-
return
|
|
38
|
+
const U = "border-transparent shadow-none hover:border-input/40", oe = 25, nr = 50, tr = 100, lr = oe, ar = [oe, nr, tr];
|
|
39
|
+
function ae(s) {
|
|
40
|
+
return s != null && s !== "";
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const or = {
|
|
43
43
|
number: "number",
|
|
44
44
|
integer: "number",
|
|
45
45
|
date: "date",
|
|
46
46
|
datetime: "datetime-local",
|
|
47
47
|
time: "time"
|
|
48
48
|
};
|
|
49
|
-
function
|
|
50
|
-
return
|
|
49
|
+
function sr(s) {
|
|
50
|
+
return or[s] ?? "text";
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
return Number.isFinite(
|
|
52
|
+
function ir(s, i) {
|
|
53
|
+
if (i !== "") {
|
|
54
|
+
if (s === "number") {
|
|
55
|
+
const d = parseFloat(i);
|
|
56
|
+
return Number.isFinite(d) ? d : i;
|
|
57
57
|
}
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
return Number.isFinite(
|
|
58
|
+
if (s === "integer") {
|
|
59
|
+
const d = parseInt(i, 10);
|
|
60
|
+
return Number.isFinite(d) ? d : i;
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return i;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
const cr = {
|
|
66
|
+
showAllWells: "Show all wells",
|
|
67
|
+
hideEmptyWells: "Hide empty wells",
|
|
68
|
+
groupBy: "Group by",
|
|
69
|
+
groupByPlaceholder: "Group by…",
|
|
70
|
+
noGrouping: "No grouping",
|
|
71
|
+
selectedColumn: "Selected",
|
|
72
|
+
wellColumn: "Well",
|
|
73
|
+
emptyRows: "No rows. Paint wells on the plate.",
|
|
74
|
+
rowsPerPage: "Rows per page",
|
|
75
|
+
previousPage: "Prev",
|
|
76
|
+
nextPage: "Next",
|
|
77
|
+
blankGroup: "(blank)",
|
|
78
|
+
filter: "Filter",
|
|
79
|
+
filterValuePlaceholder: "Value…",
|
|
80
|
+
clearFilters: "Clear all",
|
|
81
|
+
rowSummary: (s, i) => `${s} rows · ${i} selected`,
|
|
82
|
+
groupRowCount: (s) => `(${s} ${s === 1 ? "row" : "rows"})`,
|
|
83
|
+
pageRange: (s, i, d) => d === 0 ? "0 of 0" : `${s}–${i} of ${d}`
|
|
84
|
+
};
|
|
85
|
+
function dr(s, i) {
|
|
86
|
+
if (!i) return s;
|
|
87
|
+
const d = { ...s };
|
|
88
|
+
for (const [u, g] of Object.entries(i))
|
|
89
|
+
g !== void 0 && (d[u] = g);
|
|
90
|
+
return d;
|
|
91
|
+
}
|
|
92
|
+
function ur(s, i, d) {
|
|
66
93
|
const u = /* @__PURE__ */ new Map();
|
|
67
|
-
for (const
|
|
68
|
-
const
|
|
69
|
-
|
|
94
|
+
for (const g of s) {
|
|
95
|
+
const x = g.row[i], b = x == null || x === "" ? d : String(x), h = u.get(b);
|
|
96
|
+
h ? h.rows.push(g) : u.set(b, { key: b, rows: [g] });
|
|
70
97
|
}
|
|
71
98
|
return [...u.values()];
|
|
72
99
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
100
|
+
function mr(s) {
|
|
101
|
+
return s.filter((i) => !!i.field).map((i) => ({ columnId: i.field, label: i.header }));
|
|
75
102
|
}
|
|
76
|
-
function
|
|
77
|
-
values:
|
|
78
|
-
columns:
|
|
79
|
-
fields:
|
|
80
|
-
selection:
|
|
81
|
-
onSelectionChange:
|
|
82
|
-
onChange:
|
|
83
|
-
emptyEntry:
|
|
84
|
-
isPopulated:
|
|
85
|
-
pageSize:
|
|
86
|
-
pageSizeOptions:
|
|
103
|
+
function Pr({
|
|
104
|
+
values: s,
|
|
105
|
+
columns: i,
|
|
106
|
+
fields: d,
|
|
107
|
+
selection: u,
|
|
108
|
+
onSelectionChange: g,
|
|
109
|
+
onChange: x,
|
|
110
|
+
emptyEntry: b,
|
|
111
|
+
isPopulated: h,
|
|
112
|
+
pageSize: w = lr,
|
|
113
|
+
pageSizeOptions: se = ar,
|
|
87
114
|
enableFillDown: Z = !0,
|
|
88
|
-
rowProps:
|
|
89
|
-
filterable:
|
|
90
|
-
filterColumns:
|
|
91
|
-
groupable:
|
|
92
|
-
|
|
115
|
+
rowProps: ie,
|
|
116
|
+
filterable: I = !1,
|
|
117
|
+
filterColumns: O,
|
|
118
|
+
groupable: B = !1,
|
|
119
|
+
defaultGroupBy: ce = "",
|
|
120
|
+
labels: K,
|
|
121
|
+
className: de
|
|
93
122
|
}) {
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
const
|
|
123
|
+
const m = p.useMemo(() => dr(cr, K), [K]), [M, ue] = p.useState(!1), [v, E] = p.useState(0), [C, me] = p.useState(w), [P, he] = p.useState([]), [T, pe] = p.useState(ce), [fe, ge] = p.useState(/* @__PURE__ */ new Set());
|
|
124
|
+
p.useEffect(() => {
|
|
125
|
+
E(0);
|
|
126
|
+
}, [M]);
|
|
127
|
+
const Y = p.useMemo(() => {
|
|
99
128
|
const e = /* @__PURE__ */ new Map();
|
|
100
|
-
return (
|
|
101
|
-
}, [
|
|
102
|
-
() =>
|
|
103
|
-
[
|
|
104
|
-
),
|
|
105
|
-
const e = [...
|
|
106
|
-
id:
|
|
129
|
+
return (d ?? []).forEach((n) => e.set(n.key, n)), e;
|
|
130
|
+
}, [d]), be = p.useMemo(
|
|
131
|
+
() => O ?? mr(i),
|
|
132
|
+
[i, O]
|
|
133
|
+
), y = p.useMemo(() => {
|
|
134
|
+
const e = [...s.entries()].map(([t, l]) => ({
|
|
135
|
+
id: t,
|
|
107
136
|
row: l
|
|
108
137
|
}));
|
|
109
138
|
let n = e;
|
|
110
|
-
if (!
|
|
111
|
-
const l =
|
|
112
|
-
return
|
|
113
|
-
const
|
|
114
|
-
return
|
|
139
|
+
if (!M && h && (n = e.filter((t) => h(t.row))), I && P.length > 0 && (n = n.filter((t) => {
|
|
140
|
+
const l = t.row;
|
|
141
|
+
return P.every((a) => {
|
|
142
|
+
const o = l[a.columnId], f = o == null ? "" : String(o);
|
|
143
|
+
return Ue(f, a.operator, a.value);
|
|
115
144
|
});
|
|
116
|
-
})),
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
!
|
|
145
|
+
})), u && u.size > 0) {
|
|
146
|
+
const t = new Set(n.map((l) => l.id));
|
|
147
|
+
u.forEach((l) => {
|
|
148
|
+
!t.has(l) && !s.has(l) && (n = [...n, { id: l, row: b(l) }]);
|
|
120
149
|
});
|
|
121
150
|
}
|
|
122
|
-
return n.sort((
|
|
123
|
-
}, [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}, [
|
|
127
|
-
const
|
|
128
|
-
() =>
|
|
129
|
-
[
|
|
151
|
+
return n.sort((t, l) => t.id.localeCompare(l.id));
|
|
152
|
+
}, [s, M, h, u, b, I, P]);
|
|
153
|
+
p.useEffect(() => {
|
|
154
|
+
E(0);
|
|
155
|
+
}, [P]);
|
|
156
|
+
const D = p.useMemo(
|
|
157
|
+
() => y.slice(v * C, v * C + C),
|
|
158
|
+
[y, v, C]
|
|
130
159
|
), S = (e, n) => {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
if (!
|
|
135
|
-
const n = new Set(
|
|
136
|
-
n.has(e) ? n.delete(e) : n.add(e),
|
|
137
|
-
},
|
|
160
|
+
const t = new Map(s), l = t.get(e) ?? b(e);
|
|
161
|
+
t.set(e, { ...l, ...n }), x(t);
|
|
162
|
+
}, xe = (e) => {
|
|
163
|
+
if (!g) return;
|
|
164
|
+
const n = new Set(u ?? []);
|
|
165
|
+
n.has(e) ? n.delete(e) : n.add(e), g(n);
|
|
166
|
+
}, q = (e) => {
|
|
138
167
|
if (!e.field) return null;
|
|
139
|
-
const n = !!
|
|
168
|
+
const n = !!u && u.size > 0, l = n ? y.filter(({ id: N }) => u.has(N)) : B && !!T ? y : D, a = l.findIndex(({ row: N }) => ae(N[e.field]));
|
|
140
169
|
if (a < 0) return null;
|
|
141
|
-
const
|
|
170
|
+
const o = l[a], f = n ? l.filter(({ id: N }) => N !== o.id) : l.slice(a + 1);
|
|
142
171
|
return {
|
|
143
172
|
field: e.field,
|
|
144
|
-
source:
|
|
173
|
+
source: o,
|
|
145
174
|
targets: f,
|
|
146
|
-
value:
|
|
175
|
+
value: o.row[e.field]
|
|
147
176
|
};
|
|
148
|
-
},
|
|
149
|
-
const n =
|
|
177
|
+
}, we = (e) => {
|
|
178
|
+
const n = q(e);
|
|
150
179
|
if (!n || n.targets.length === 0) return;
|
|
151
|
-
const
|
|
180
|
+
const t = new Map(s);
|
|
152
181
|
n.targets.forEach(({ id: l }) => {
|
|
153
|
-
const a =
|
|
154
|
-
|
|
155
|
-
}),
|
|
156
|
-
},
|
|
157
|
-
|
|
182
|
+
const a = t.get(l) ?? b(l);
|
|
183
|
+
t.set(l, { ...a, [n.field]: n.value });
|
|
184
|
+
}), x(t);
|
|
185
|
+
}, Ce = (e, n, t, l, a) => /* @__PURE__ */ c(
|
|
186
|
+
V,
|
|
158
187
|
{
|
|
159
|
-
value:
|
|
160
|
-
onValueChange: (
|
|
188
|
+
value: t ?? "",
|
|
189
|
+
onValueChange: (o) => S(l, { [n]: o }),
|
|
161
190
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
|
|
191
|
+
/* @__PURE__ */ r(W, { size: "sm", className: L("h-7 w-full", U), "aria-label": a, children: /* @__PURE__ */ r($, { placeholder: e.placeholder ?? "Select…" }) }),
|
|
192
|
+
/* @__PURE__ */ r(j, { children: (e.options ?? []).map((o) => /* @__PURE__ */ r(R, { value: o.value, children: /* @__PURE__ */ c("span", { className: "inline-flex items-center gap-2", children: [
|
|
193
|
+
o.swatch ? /* @__PURE__ */ r(
|
|
165
194
|
"span",
|
|
166
195
|
{
|
|
167
196
|
className: "inline-block h-2.5 w-2.5 rounded-sm border border-foreground/20",
|
|
168
|
-
style: { backgroundColor:
|
|
197
|
+
style: { backgroundColor: o.swatch },
|
|
169
198
|
"aria-hidden": !0
|
|
170
199
|
}
|
|
171
200
|
) : null,
|
|
172
|
-
|
|
173
|
-
] }) },
|
|
201
|
+
o.label
|
|
202
|
+
] }) }, o.value)) })
|
|
174
203
|
]
|
|
175
204
|
}
|
|
176
|
-
),
|
|
177
|
-
const
|
|
178
|
-
return e.boolStyle === "switch" ? /* @__PURE__ */
|
|
179
|
-
|
|
205
|
+
), ve = (e, n, t, l, a) => {
|
|
206
|
+
const o = !!t;
|
|
207
|
+
return e.boolStyle === "switch" ? /* @__PURE__ */ r(
|
|
208
|
+
Oe,
|
|
180
209
|
{
|
|
181
210
|
"aria-label": a,
|
|
182
|
-
checked:
|
|
211
|
+
checked: o,
|
|
183
212
|
onCheckedChange: (f) => S(l, { [n]: f })
|
|
184
213
|
}
|
|
185
|
-
) : /* @__PURE__ */
|
|
186
|
-
|
|
214
|
+
) : /* @__PURE__ */ r(
|
|
215
|
+
le,
|
|
187
216
|
{
|
|
188
217
|
"aria-label": a,
|
|
189
|
-
checked:
|
|
218
|
+
checked: o,
|
|
190
219
|
onCheckedChange: (f) => S(l, { [n]: f === !0 })
|
|
191
220
|
}
|
|
192
221
|
);
|
|
193
|
-
},
|
|
194
|
-
|
|
222
|
+
}, ye = (e, n, t, l, a) => /* @__PURE__ */ r(
|
|
223
|
+
Ze,
|
|
195
224
|
{
|
|
196
|
-
type:
|
|
225
|
+
type: sr(e.kind),
|
|
197
226
|
step: e.kind === "integer" ? 1 : void 0,
|
|
198
227
|
placeholder: e.placeholder,
|
|
199
228
|
"aria-label": a,
|
|
200
|
-
className:
|
|
201
|
-
value:
|
|
202
|
-
onChange: (
|
|
229
|
+
className: L("h-7", U),
|
|
230
|
+
value: t ?? "",
|
|
231
|
+
onChange: (o) => S(l, { [n]: ir(e.kind, o.target.value) })
|
|
203
232
|
}
|
|
204
|
-
),
|
|
205
|
-
const a = n.field,
|
|
206
|
-
if (e.kind === "select") return
|
|
233
|
+
), Ne = (e, n, t, l) => {
|
|
234
|
+
const a = n.field, o = l[a], f = `${e.label} for ${t}`;
|
|
235
|
+
if (e.kind === "select") return Ce(e, a, o, t, f);
|
|
207
236
|
if (e.kind === "multiselect") {
|
|
208
|
-
const N = Array.isArray(
|
|
209
|
-
return /* @__PURE__ */
|
|
210
|
-
|
|
237
|
+
const N = Array.isArray(o) ? o : [];
|
|
238
|
+
return /* @__PURE__ */ r(
|
|
239
|
+
rr,
|
|
211
240
|
{
|
|
212
241
|
ariaLabel: f,
|
|
213
242
|
value: N,
|
|
214
243
|
options: e.options ?? [],
|
|
215
244
|
placeholder: e.placeholder,
|
|
216
|
-
onChange: (
|
|
245
|
+
onChange: (re) => S(t, { [a]: re.length === 0 ? void 0 : re })
|
|
217
246
|
}
|
|
218
247
|
);
|
|
219
248
|
}
|
|
220
|
-
return e.kind === "boolean" ?
|
|
221
|
-
},
|
|
249
|
+
return e.kind === "boolean" ? ve(e, a, o, t, f) : ye(e, a, o, t, f);
|
|
250
|
+
}, Se = (e, n) => {
|
|
222
251
|
if (e?.kind === "select") {
|
|
223
|
-
const
|
|
224
|
-
return
|
|
225
|
-
|
|
252
|
+
const t = (e.options ?? []).find((l) => l.value === n);
|
|
253
|
+
return t ? /* @__PURE__ */ c(te, { variant: "secondary", children: [
|
|
254
|
+
t.swatch ? /* @__PURE__ */ r(
|
|
226
255
|
"span",
|
|
227
256
|
{
|
|
228
257
|
className: "size-2 rounded-sm border border-foreground/20",
|
|
229
|
-
style: { backgroundColor:
|
|
258
|
+
style: { backgroundColor: t.swatch },
|
|
230
259
|
"aria-hidden": !0
|
|
231
260
|
}
|
|
232
261
|
) : null,
|
|
233
|
-
|
|
234
|
-
] }) : /* @__PURE__ */
|
|
262
|
+
t.label
|
|
263
|
+
] }) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" });
|
|
235
264
|
}
|
|
236
265
|
if (e?.kind === "multiselect") {
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
const a = (e.options ?? []).find((
|
|
240
|
-
return /* @__PURE__ */
|
|
241
|
-
a?.swatch ? /* @__PURE__ */
|
|
266
|
+
const t = Array.isArray(n) ? n : [];
|
|
267
|
+
return t.length === 0 ? /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" }) : /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1", children: t.map((l) => {
|
|
268
|
+
const a = (e.options ?? []).find((o) => o.value === l);
|
|
269
|
+
return /* @__PURE__ */ c(te, { variant: "secondary", children: [
|
|
270
|
+
a?.swatch ? /* @__PURE__ */ r(
|
|
242
271
|
"span",
|
|
243
272
|
{
|
|
244
273
|
className: "size-2 rounded-sm border border-foreground/20",
|
|
@@ -250,27 +279,27 @@ function Sn({
|
|
|
250
279
|
] }, l);
|
|
251
280
|
}) });
|
|
252
281
|
}
|
|
253
|
-
return e?.kind === "boolean" ? n ? /* @__PURE__ */
|
|
254
|
-
},
|
|
282
|
+
return e?.kind === "boolean" ? n ? /* @__PURE__ */ r(ne, { "aria-label": "Yes", className: "size-4 text-foreground" }) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" }) : ae(n) ? String(n) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" });
|
|
283
|
+
}, ke = (e, n, t) => {
|
|
255
284
|
if (e.render)
|
|
256
285
|
return e.render({
|
|
257
|
-
row:
|
|
286
|
+
row: t,
|
|
258
287
|
wellId: n,
|
|
259
|
-
update: (
|
|
288
|
+
update: (o) => S(n, o)
|
|
260
289
|
});
|
|
261
290
|
if (!e.field) return null;
|
|
262
|
-
const l =
|
|
263
|
-
return l?.editableInTable && l.kind !== "custom" ?
|
|
264
|
-
},
|
|
265
|
-
const n = e.field ?
|
|
266
|
-
return /* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */
|
|
291
|
+
const l = Y.get(e.field), a = t[e.field];
|
|
292
|
+
return l?.editableInTable && l.kind !== "custom" ? Ne(l, e, n, t) : Se(l, a);
|
|
293
|
+
}, Ee = (e) => {
|
|
294
|
+
const n = e.field ? Y.get(e.field) : void 0, t = e.icon ?? n?.icon, l = Z ? q(e) : null, a = !!l && l.targets.length > 0, o = u && u.size > 0 ? `Fill selected ${e.header} cells from the first selected value` : `Fill visible ${e.header} cells downward from the first value`;
|
|
295
|
+
return /* @__PURE__ */ c("span", { className: "flex min-w-0 items-center justify-between gap-2", children: [
|
|
296
|
+
/* @__PURE__ */ c("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
|
|
297
|
+
t ? /* @__PURE__ */ r("span", { className: "inline-flex text-muted-foreground [&_svg]:size-3.5", children: t }) : null,
|
|
298
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: e.header })
|
|
270
299
|
] }),
|
|
271
|
-
Z && e.field ? /* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
|
|
300
|
+
Z && e.field ? /* @__PURE__ */ c(Qe, { children: [
|
|
301
|
+
/* @__PURE__ */ r(Xe, { asChild: !0, children: /* @__PURE__ */ r(
|
|
302
|
+
z,
|
|
274
303
|
{
|
|
275
304
|
type: "button",
|
|
276
305
|
variant: "ghost",
|
|
@@ -279,143 +308,146 @@ function Sn({
|
|
|
279
308
|
disabled: !a,
|
|
280
309
|
"aria-label": `Fill down ${e.header}`,
|
|
281
310
|
onClick: (f) => {
|
|
282
|
-
f.preventDefault(), f.stopPropagation(),
|
|
311
|
+
f.preventDefault(), f.stopPropagation(), we(e);
|
|
283
312
|
},
|
|
284
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ r(ze, {})
|
|
285
314
|
}
|
|
286
315
|
) }),
|
|
287
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ r(er, { children: o })
|
|
288
317
|
] }) : null
|
|
289
318
|
] });
|
|
290
|
-
},
|
|
291
|
-
() =>
|
|
292
|
-
[y,
|
|
293
|
-
),
|
|
294
|
-
const
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
|
|
299
|
-
|
|
319
|
+
}, Pe = p.useMemo(() => i.filter((e) => !!e.field), [i]), k = B && T ? T : "", A = p.useMemo(
|
|
320
|
+
() => k ? ur(y, k, m.blankGroup) : null,
|
|
321
|
+
[k, y, m.blankGroup]
|
|
322
|
+
), F = y.length, J = Math.max(0, Math.ceil(F / C) - 1), Ae = u?.size ?? 0, Q = i.length + 1 + (g ? 1 : 0), X = (e, n) => {
|
|
323
|
+
const t = u?.has(e), l = ie?.({ wellId: e, row: n, isSelected: !!t });
|
|
324
|
+
return /* @__PURE__ */ c(G, { ...l, children: [
|
|
325
|
+
g ? /* @__PURE__ */ r(_, { className: "w-10", children: /* @__PURE__ */ r(le, { checked: !!t, onCheckedChange: () => xe(e), "aria-label": `Select ${e}` }) }) : null,
|
|
326
|
+
/* @__PURE__ */ r(_, { className: "font-semibold", children: e }),
|
|
327
|
+
i.map((a) => /* @__PURE__ */ r(
|
|
328
|
+
_,
|
|
300
329
|
{
|
|
301
330
|
style: a.minWidth ? { minWidth: a.minWidth } : void 0,
|
|
302
|
-
children:
|
|
331
|
+
children: ke(a, e, n)
|
|
303
332
|
},
|
|
304
333
|
a.id ?? a.field ?? a.header
|
|
305
334
|
))
|
|
306
335
|
] }, e);
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
return
|
|
336
|
+
}, ee = (e) => {
|
|
337
|
+
ge((n) => {
|
|
338
|
+
const t = new Set(n);
|
|
339
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
311
340
|
});
|
|
312
|
-
},
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
341
|
+
}, Fe = k ? i.find((n) => n.field === k)?.header ?? k : "";
|
|
342
|
+
return /* @__PURE__ */ c("div", { "data-slot": "well-manifest-table", className: L("flex flex-col gap-2", de), children: [
|
|
343
|
+
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
344
|
+
/* @__PURE__ */ r(z, { variant: "outline", size: "sm", onClick: () => ue((e) => !e), children: M ? m.hideEmptyWells : m.showAllWells }),
|
|
345
|
+
I ? /* @__PURE__ */ r(
|
|
346
|
+
Re,
|
|
347
|
+
{
|
|
348
|
+
columns: be,
|
|
349
|
+
filters: P,
|
|
350
|
+
onFiltersChange: he,
|
|
351
|
+
triggerLabel: m.filter,
|
|
352
|
+
valuePlaceholder: m.filterValuePlaceholder,
|
|
353
|
+
clearAllLabel: m.clearFilters
|
|
354
|
+
}
|
|
355
|
+
) : null,
|
|
356
|
+
B ? /* @__PURE__ */ c("div", { className: "inline-flex items-center gap-1.5", children: [
|
|
357
|
+
/* @__PURE__ */ r(_e, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
|
|
358
|
+
/* @__PURE__ */ c(V, { value: T || "__none", onValueChange: (e) => pe(e === "__none" ? "" : e), children: [
|
|
359
|
+
/* @__PURE__ */ r(W, { size: "sm", className: "h-7 min-w-40", "aria-label": m.groupBy, children: /* @__PURE__ */ r($, { placeholder: m.groupByPlaceholder }) }),
|
|
360
|
+
/* @__PURE__ */ c(j, { children: [
|
|
361
|
+
/* @__PURE__ */ r(R, { value: "__none", children: m.noGrouping }),
|
|
362
|
+
Pe.map((e) => /* @__PURE__ */ r(R, { value: e.field ?? "", children: e.header }, e.id ?? e.field))
|
|
324
363
|
] })
|
|
325
364
|
] })
|
|
326
365
|
] }) : null,
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
z,
|
|
329
|
-
" rows · ",
|
|
330
|
-
ke,
|
|
331
|
-
" selected"
|
|
332
|
-
] })
|
|
366
|
+
/* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: m.rowSummary(F, Ae) })
|
|
333
367
|
] }),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ r(Je, { children: /* @__PURE__ */ c(Ke, { "data-density": "default", children: [
|
|
369
|
+
/* @__PURE__ */ r(Ye, { children: /* @__PURE__ */ c(G, { children: [
|
|
370
|
+
g ? /* @__PURE__ */ r(H, { className: "w-10 text-center", children: /* @__PURE__ */ c("span", { className: "inline-flex items-center justify-center text-muted-foreground [&_svg]:size-3.5", children: [
|
|
371
|
+
/* @__PURE__ */ r(ne, { "aria-hidden": !0 }),
|
|
372
|
+
/* @__PURE__ */ r("span", { className: "sr-only", children: m.selectedColumn })
|
|
339
373
|
] }) }) : null,
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
374
|
+
/* @__PURE__ */ r(H, { style: { minWidth: 60 }, children: m.wellColumn }),
|
|
375
|
+
i.map((e) => /* @__PURE__ */ r(
|
|
342
376
|
H,
|
|
343
377
|
{
|
|
344
378
|
style: e.minWidth ? { minWidth: e.minWidth } : void 0,
|
|
345
|
-
children:
|
|
379
|
+
children: Ee(e)
|
|
346
380
|
},
|
|
347
381
|
e.id ?? e.field ?? e.header
|
|
348
382
|
))
|
|
349
383
|
] }) }),
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
352
|
-
const n =
|
|
353
|
-
return /* @__PURE__ */
|
|
354
|
-
/* @__PURE__ */
|
|
355
|
-
|
|
384
|
+
/* @__PURE__ */ c(qe, { children: [
|
|
385
|
+
A ? A.map((e) => {
|
|
386
|
+
const n = fe.has(e.key);
|
|
387
|
+
return /* @__PURE__ */ c(p.Fragment, { children: [
|
|
388
|
+
/* @__PURE__ */ r(
|
|
389
|
+
G,
|
|
356
390
|
{
|
|
357
391
|
className: "cursor-pointer bg-muted/40",
|
|
358
|
-
onClick: () =>
|
|
359
|
-
onKeyDown: (
|
|
360
|
-
(
|
|
392
|
+
onClick: () => ee(e.key),
|
|
393
|
+
onKeyDown: (t) => {
|
|
394
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), ee(e.key));
|
|
361
395
|
},
|
|
362
396
|
role: "button",
|
|
363
397
|
tabIndex: 0,
|
|
364
398
|
"aria-expanded": !n,
|
|
365
|
-
children: /* @__PURE__ */
|
|
366
|
-
n ? /* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
|
|
399
|
+
children: /* @__PURE__ */ r(_, { colSpan: Q, className: "py-1.5", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2 text-xs font-medium", children: [
|
|
400
|
+
n ? /* @__PURE__ */ r(Me, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }) : /* @__PURE__ */ r(Te, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
|
|
401
|
+
/* @__PURE__ */ c("span", { children: [
|
|
402
|
+
Fe,
|
|
369
403
|
": ",
|
|
370
404
|
e.key
|
|
371
405
|
] }),
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
"(",
|
|
374
|
-
e.rows.length,
|
|
375
|
-
" ",
|
|
376
|
-
e.rows.length === 1 ? "row" : "rows",
|
|
377
|
-
")"
|
|
378
|
-
] })
|
|
406
|
+
/* @__PURE__ */ r("span", { className: "text-muted-foreground", children: m.groupRowCount(e.rows.length) })
|
|
379
407
|
] }) })
|
|
380
408
|
}
|
|
381
409
|
),
|
|
382
|
-
n ? null : e.rows.map(({ id:
|
|
410
|
+
n ? null : e.rows.map(({ id: t, row: l }) => X(t, l))
|
|
383
411
|
] }, e.key);
|
|
384
|
-
}) :
|
|
385
|
-
(
|
|
412
|
+
}) : D.map(({ id: e, row: n }) => X(e, n)),
|
|
413
|
+
(A ? A.length === 0 : D.length === 0) ? /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(_, { colSpan: Q, className: "text-xs text-muted-foreground", children: m.emptyRows }) }) : null
|
|
386
414
|
] })
|
|
387
415
|
] }) }),
|
|
388
|
-
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
|
|
416
|
+
A ? null : /* @__PURE__ */ c("div", { className: "flex items-center justify-end gap-3 text-xs text-muted-foreground", children: [
|
|
417
|
+
/* @__PURE__ */ r("span", { className: "text-muted-foreground", children: m.rowsPerPage }),
|
|
418
|
+
/* @__PURE__ */ c(
|
|
419
|
+
V,
|
|
392
420
|
{
|
|
393
421
|
value: String(C),
|
|
394
422
|
onValueChange: (e) => {
|
|
395
|
-
|
|
423
|
+
me(parseInt(e, 10)), E(0);
|
|
396
424
|
},
|
|
397
425
|
children: [
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ r(W, { size: "sm", className: "h-7 w-18", "aria-label": m.rowsPerPage, children: /* @__PURE__ */ r($, {}) }),
|
|
427
|
+
/* @__PURE__ */ r(j, { children: se.map((e) => /* @__PURE__ */ r(R, { value: String(e), children: e }, e)) })
|
|
400
428
|
]
|
|
401
429
|
}
|
|
402
430
|
),
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
F
|
|
431
|
+
/* @__PURE__ */ r("span", { children: m.pageRange(
|
|
432
|
+
F === 0 ? 0 : v * C + 1,
|
|
433
|
+
Math.min((v + 1) * C, F),
|
|
434
|
+
F
|
|
435
|
+
) }),
|
|
436
|
+
/* @__PURE__ */ r(z, { variant: "outline", size: "sm", disabled: v === 0, onClick: () => E((e) => Math.max(0, e - 1)), children: m.previousPage }),
|
|
437
|
+
/* @__PURE__ */ r(
|
|
438
|
+
z,
|
|
407
439
|
{
|
|
408
440
|
variant: "outline",
|
|
409
441
|
size: "sm",
|
|
410
|
-
disabled:
|
|
411
|
-
onClick: () =>
|
|
412
|
-
children:
|
|
442
|
+
disabled: v >= J,
|
|
443
|
+
onClick: () => E((e) => Math.min(J, e + 1)),
|
|
444
|
+
children: m.nextPage
|
|
413
445
|
}
|
|
414
446
|
)
|
|
415
447
|
] })
|
|
416
448
|
] });
|
|
417
449
|
}
|
|
418
450
|
export {
|
|
419
|
-
|
|
451
|
+
Pr as WellManifestTable
|
|
420
452
|
};
|
|
421
453
|
//# sourceMappingURL=WellManifestTable.js.map
|