@ai-matrx/design-system 0.20.2 → 0.20.5
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/CHANGELOG.md +16 -0
- package/dist/data-table/data-row-inspector.cjs +27 -1
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +27 -1
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +27 -1
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +27 -1
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +34 -33
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +34 -33
- package/dist/data-table/index.js.map +1 -1
- package/dist/styles.css +1 -19
- package/package.json +1 -1
package/dist/data-table/index.js
CHANGED
|
@@ -6871,6 +6871,17 @@ function tokenFromColumnName(name) {
|
|
|
6871
6871
|
return name.endsWith("_id") ? name.slice(0, -3) : null;
|
|
6872
6872
|
}
|
|
6873
6873
|
|
|
6874
|
+
// src/data-table/display-value.ts
|
|
6875
|
+
function formatTableDisplayValue(value) {
|
|
6876
|
+
if (typeof value === "number") return value.toLocaleString(void 0, { maximumFractionDigits: 12 });
|
|
6877
|
+
if (value instanceof Date) return value.toLocaleString();
|
|
6878
|
+
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(value) && !Number.isNaN(Date.parse(value))) {
|
|
6879
|
+
return new Date(value).toLocaleString();
|
|
6880
|
+
}
|
|
6881
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
6882
|
+
return stringifyCellValue(value) || "\u2014";
|
|
6883
|
+
}
|
|
6884
|
+
|
|
6874
6885
|
// src/data-table/DataRowInspector.tsx
|
|
6875
6886
|
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6876
6887
|
var noFieldToken = () => null;
|
|
@@ -6943,7 +6954,7 @@ function DataRowInspector({
|
|
|
6943
6954
|
key
|
|
6944
6955
|
);
|
|
6945
6956
|
}
|
|
6946
|
-
const formatted = formatValue(value);
|
|
6957
|
+
const formatted = value !== null && typeof value === "object" && !(value instanceof Date) ? formatValue(value) : formatTableDisplayValue(value);
|
|
6947
6958
|
const multiline = formatted.includes("\n") || formatted.length > 80;
|
|
6948
6959
|
return /* @__PURE__ */ jsxs23(
|
|
6949
6960
|
"div",
|
|
@@ -7072,6 +7083,22 @@ function TabButton({
|
|
|
7072
7083
|
);
|
|
7073
7084
|
}
|
|
7074
7085
|
|
|
7086
|
+
// src/data-table/row-title.ts
|
|
7087
|
+
function defaultRowTitle(row, columns) {
|
|
7088
|
+
const values = columns.map((column) => ({
|
|
7089
|
+
id: columnId(column),
|
|
7090
|
+
value: getCellValue(row, column)
|
|
7091
|
+
})).filter(
|
|
7092
|
+
(entry) => typeof entry.value === "string" && entry.value.trim().length > 0
|
|
7093
|
+
);
|
|
7094
|
+
const named = values.find(
|
|
7095
|
+
({ id, value: value2 }) => inferTableSearchRole(id) === "name" && !isUuidValue(value2)
|
|
7096
|
+
);
|
|
7097
|
+
const identity = values.find(({ id }) => id === "id" || id === "uuid") ?? values.find(({ id }) => inferTableSearchRole(id) === "id");
|
|
7098
|
+
const value = (named ?? identity ?? values[0])?.value.trim();
|
|
7099
|
+
return value ? isUuidValue(value) ? value.slice(0, 8) : value : "Details";
|
|
7100
|
+
}
|
|
7101
|
+
|
|
7075
7102
|
// src/data-table/DirtySavePill.tsx
|
|
7076
7103
|
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7077
7104
|
function DirtySavePill({
|
|
@@ -8565,25 +8592,6 @@ function MatrxDataTableCore({
|
|
|
8565
8592
|
...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
|
|
8566
8593
|
});
|
|
8567
8594
|
const rootRef = useRef10(null);
|
|
8568
|
-
const setDiagnosticBoundaryRef = useCallback6((node) => {
|
|
8569
|
-
rootRef.current = node;
|
|
8570
|
-
if (!node) return;
|
|
8571
|
-
node.style.setProperty("outline", "2px solid #2563eb", "important");
|
|
8572
|
-
node.style.setProperty("outline-offset", "-2px", "important");
|
|
8573
|
-
node.style.setProperty("isolation", "isolate", "important");
|
|
8574
|
-
const position = window.getComputedStyle(node).position;
|
|
8575
|
-
if (position === "" || position === "static") {
|
|
8576
|
-
node.style.setProperty("position", "relative", "important");
|
|
8577
|
-
}
|
|
8578
|
-
const boundary = node.querySelector(":scope > [data-matrx-table-boundary]");
|
|
8579
|
-
if (!boundary) return;
|
|
8580
|
-
boundary.style.setProperty("position", "absolute", "important");
|
|
8581
|
-
boundary.style.setProperty("inset", "0", "important");
|
|
8582
|
-
boundary.style.setProperty("pointer-events", "none", "important");
|
|
8583
|
-
boundary.style.setProperty("z-index", "2147483647", "important");
|
|
8584
|
-
boundary.style.setProperty("box-sizing", "border-box", "important");
|
|
8585
|
-
boundary.style.setProperty("border", "2px solid #2563eb", "important");
|
|
8586
|
-
}, []);
|
|
8587
8595
|
useClippedContentGuard(rootRef, {
|
|
8588
8596
|
label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
|
|
8589
8597
|
});
|
|
@@ -9624,7 +9632,7 @@ function MatrxDataTableCore({
|
|
|
9624
9632
|
/* @__PURE__ */ jsxs29(
|
|
9625
9633
|
"div",
|
|
9626
9634
|
{
|
|
9627
|
-
ref:
|
|
9635
|
+
ref: rootRef,
|
|
9628
9636
|
"data-matrx-table": true,
|
|
9629
9637
|
"data-matrx-table-density": resolvedDensity,
|
|
9630
9638
|
"data-url-state-table": urlState?.id,
|
|
@@ -9633,7 +9641,6 @@ function MatrxDataTableCore({
|
|
|
9633
9641
|
className
|
|
9634
9642
|
),
|
|
9635
9643
|
children: [
|
|
9636
|
-
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", "data-matrx-table-boundary": true }),
|
|
9637
9644
|
notice,
|
|
9638
9645
|
savedViewError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
|
|
9639
9646
|
toolbarActionError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
|
|
@@ -10712,7 +10719,7 @@ function MatrxDataTableCore({
|
|
|
10712
10719
|
{
|
|
10713
10720
|
title: resolveStringTitle(
|
|
10714
10721
|
detail?.title?.(selectedRow),
|
|
10715
|
-
defaultRowTitle(selectedRow,
|
|
10722
|
+
defaultRowTitle(selectedRow, columns)
|
|
10716
10723
|
),
|
|
10717
10724
|
titleNode: detail?.title?.(selectedRow),
|
|
10718
10725
|
description: detail?.description?.(selectedRow),
|
|
@@ -10779,7 +10786,7 @@ function MatrxDataTableCore({
|
|
|
10779
10786
|
{
|
|
10780
10787
|
isOpen: true,
|
|
10781
10788
|
onClose: closeWindow,
|
|
10782
|
-
title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow,
|
|
10789
|
+
title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow, columns),
|
|
10783
10790
|
row: windowRow,
|
|
10784
10791
|
width: windowConfig?.width,
|
|
10785
10792
|
height: windowConfig?.height,
|
|
@@ -11111,7 +11118,8 @@ function normalizeColumnWidthsForColumns(widths, columns) {
|
|
|
11111
11118
|
}
|
|
11112
11119
|
function columnWidthVar(width, resizedWidth, id, resizable) {
|
|
11113
11120
|
if (width === void 0 && resizedWidth === void 0 && !resizable) return void 0;
|
|
11114
|
-
const
|
|
11121
|
+
const inferredWidth = resizable && inferTableSearchRole(id) === "name" ? "12rem" : "auto";
|
|
11122
|
+
const fallback = resizedWidth === void 0 ? width === void 0 ? inferredWidth : typeof width === "number" ? `${width}px` : width : `${resizedWidth}px`;
|
|
11115
11123
|
return {
|
|
11116
11124
|
"--matrx-col-w": resizable ? `var(${columnResizeCssVar(id)}, ${fallback})` : fallback
|
|
11117
11125
|
};
|
|
@@ -11161,19 +11169,12 @@ function renderCell(row, col, index) {
|
|
|
11161
11169
|
if (typeof raw === "boolean") {
|
|
11162
11170
|
return /* @__PURE__ */ jsx39("span", { className: raw ? "rounded bg-emerald-500/10 px-1.5 py-0.5 text-xs text-emerald-600" : "rounded bg-slate-500/10 px-1.5 py-0.5 text-xs text-muted-foreground", children: raw ? "Yes" : "No" });
|
|
11163
11171
|
}
|
|
11164
|
-
const formatted =
|
|
11172
|
+
const formatted = formatTableDisplayValue(raw);
|
|
11165
11173
|
return /* @__PURE__ */ jsxs29(Tooltip, { children: [
|
|
11166
11174
|
/* @__PURE__ */ jsx39(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx39("span", { className: "block text-sm text-foreground", style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", overflowWrap: "anywhere" }, children: formatted }) }),
|
|
11167
11175
|
/* @__PURE__ */ jsx39(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words max-h-80 overflow-auto", children: typeof raw === "object" && raw !== null ? JSON.stringify(raw, null, 2) : formatted })
|
|
11168
11176
|
] });
|
|
11169
11177
|
}
|
|
11170
|
-
function defaultRowTitle(row, columns) {
|
|
11171
|
-
for (const col of columns) {
|
|
11172
|
-
const v = getCellValue(row, col);
|
|
11173
|
-
if (typeof v === "string" && v.trim()) return v;
|
|
11174
|
-
}
|
|
11175
|
-
return "Details";
|
|
11176
|
-
}
|
|
11177
11178
|
function resolveStringTitle(title, fallback) {
|
|
11178
11179
|
if (typeof title === "string" && title.trim()) return title;
|
|
11179
11180
|
if (typeof title === "number") return String(title);
|