@ai-matrx/design-system 0.18.8 → 0.18.10
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 +21 -0
- package/dist/content-transfer.cjs +163 -202
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.css +43 -30
- package/dist/content-transfer.d.cts +4 -0
- package/dist/content-transfer.d.ts +4 -0
- package/dist/content-transfer.js +225 -264
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/data-row-inspector.cjs +163 -202
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +245 -284
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +163 -202
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +245 -284
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.cjs.map +1 -1
- package/dist/data-table/host.d.cts +2 -0
- package/dist/data-table/host.d.ts +2 -0
- package/dist/data-table/host.js.map +1 -1
- package/dist/data-table/index.cjs +1192 -751
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +24 -3
- package/dist/data-table/index.d.ts +24 -3
- package/dist/data-table/index.js +1264 -823
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/pagination.cjs +5 -5
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +5 -5
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js.map +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +8 -1
- package/dist/tokens.css +2 -0
- package/dist/{types-cH8oLqUx.d.ts → types-C2xN6W_q.d.ts} +46 -3
- package/dist/{types-0CNCWvdK.d.cts → types-D_tpuk6m.d.cts} +46 -3
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ __export(data_table_exports, {
|
|
|
37
37
|
MatrxDataTable: () => MatrxDataTable,
|
|
38
38
|
MatrxDataTableProvider: () => MatrxDataTableProvider,
|
|
39
39
|
MatrxUuidCell: () => MatrxUuidCell,
|
|
40
|
+
SavedViewsControl: () => SavedViewsControl,
|
|
40
41
|
TableTitleRow: () => TableTitleRow,
|
|
41
42
|
buildRowAgentInput: () => buildRowAgentInput,
|
|
42
43
|
buildViewAgentInput: () => buildViewAgentInput,
|
|
@@ -44,6 +45,7 @@ __export(data_table_exports, {
|
|
|
44
45
|
collectSelectOptions: () => collectSelectOptions,
|
|
45
46
|
downloadTableAsXlsx: () => downloadTableAsXlsx,
|
|
46
47
|
filterKindLabel: () => filterKindLabel,
|
|
48
|
+
parseTableViewSnapshot: () => parseTableViewSnapshot,
|
|
47
49
|
resolveFilterKind: () => resolveFilterKind,
|
|
48
50
|
rowsToCsvFromColumns: () => rowsToCsvFromColumns,
|
|
49
51
|
rowsToMarkdownTable: () => rowsToMarkdownTable,
|
|
@@ -797,7 +799,7 @@ var SelectContent = React6.forwardRef(
|
|
|
797
799
|
{
|
|
798
800
|
ref,
|
|
799
801
|
className: cn(
|
|
800
|
-
"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
802
|
+
"relative z-[10001] max-h-96 min-w-[8rem] max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
801
803
|
animated && MOTION_POPPER,
|
|
802
804
|
// The resting gap from the trigger. It is the `translate` property
|
|
803
805
|
// (POPPER_OFFSET), never Tailwind translate utilities: those compose
|
|
@@ -815,7 +817,7 @@ var SelectContent = React6.forwardRef(
|
|
|
815
817
|
SelectPrimitive.Viewport,
|
|
816
818
|
{
|
|
817
819
|
className: cn(
|
|
818
|
-
"
|
|
820
|
+
"max-w-full overflow-y-auto p-0.5",
|
|
819
821
|
position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
|
|
820
822
|
),
|
|
821
823
|
children
|
|
@@ -842,15 +844,15 @@ var SelectItem = React6.forwardRef(({ className, children, description, ...props
|
|
|
842
844
|
{
|
|
843
845
|
ref,
|
|
844
846
|
className: cn(
|
|
845
|
-
"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
847
|
+
"relative flex w-full min-w-0 cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
846
848
|
description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
|
|
847
849
|
className
|
|
848
850
|
),
|
|
849
851
|
...props,
|
|
850
852
|
children: [
|
|
851
853
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
852
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectPrimitive.ItemText, { children }),
|
|
853
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectPrimitive.ItemText, { children }) }),
|
|
855
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "block min-w-0 break-words text-xs leading-snug text-muted-foreground [overflow-wrap:anywhere]", children: description }) : null
|
|
854
856
|
]
|
|
855
857
|
}
|
|
856
858
|
));
|
|
@@ -900,7 +902,7 @@ function TableTitleRow({
|
|
|
900
902
|
{
|
|
901
903
|
"data-matrx-table-toolbar": true,
|
|
902
904
|
className: cn(
|
|
903
|
-
"flex min-w-0 shrink-0 flex-wrap items-center gap-2",
|
|
905
|
+
"flex min-w-0 shrink-0 flex-wrap items-center gap-2 border-t border-border pt-2",
|
|
904
906
|
className
|
|
905
907
|
),
|
|
906
908
|
children: [
|
|
@@ -1907,132 +1909,45 @@ var import_content_transfer2 = require("@ai-matrx/kit/content-transfer");
|
|
|
1907
1909
|
var React13 = __toESM(require("react"), 1);
|
|
1908
1910
|
var import_content_transfer = require("@ai-matrx/kit/content-transfer");
|
|
1909
1911
|
|
|
1910
|
-
// src/
|
|
1911
|
-
var
|
|
1912
|
+
// src/popover.tsx
|
|
1913
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
1912
1914
|
var React12 = __toESM(require("react"), 1);
|
|
1913
1915
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1914
|
-
var
|
|
1915
|
-
var
|
|
1916
|
-
var
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
"data-slot": "dropdown-menu-sub-trigger",
|
|
1924
|
-
className: cn(
|
|
1925
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
1926
|
-
inset && "pl-8",
|
|
1927
|
-
className
|
|
1928
|
-
),
|
|
1929
|
-
...props,
|
|
1930
|
-
children: [
|
|
1931
|
-
children,
|
|
1932
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
1933
|
-
]
|
|
1934
|
-
}
|
|
1935
|
-
));
|
|
1936
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
1937
|
-
var DropdownMenuSubContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1938
|
-
DropdownMenuPrimitive.SubContent,
|
|
1939
|
-
{
|
|
1940
|
-
ref,
|
|
1941
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
1942
|
-
className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
|
|
1943
|
-
...props
|
|
1944
|
-
}
|
|
1945
|
-
));
|
|
1946
|
-
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
1947
|
-
var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
|
|
1948
|
-
const portalContainer = usePortalContainer(container);
|
|
1949
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1950
|
-
DropdownMenuPrimitive.Content,
|
|
1951
|
-
{
|
|
1952
|
-
ref,
|
|
1953
|
-
"data-slot": "dropdown-menu-content",
|
|
1954
|
-
sideOffset,
|
|
1955
|
-
className: cn(
|
|
1956
|
-
MENU_SURFACE_CLASS,
|
|
1957
|
-
"shadow-md",
|
|
1958
|
-
MOTION_POPPER,
|
|
1959
|
-
className
|
|
1960
|
-
),
|
|
1961
|
-
...props
|
|
1962
|
-
}
|
|
1963
|
-
) });
|
|
1964
|
-
});
|
|
1965
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
1966
|
-
var DropdownMenuItem = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1967
|
-
DropdownMenuPrimitive.Item,
|
|
1968
|
-
{
|
|
1969
|
-
ref,
|
|
1970
|
-
"data-slot": "dropdown-menu-item",
|
|
1971
|
-
className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
|
|
1972
|
-
...props
|
|
1973
|
-
}
|
|
1974
|
-
));
|
|
1975
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
1976
|
-
var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1977
|
-
DropdownMenuPrimitive.CheckboxItem,
|
|
1978
|
-
{
|
|
1979
|
-
ref,
|
|
1980
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
1981
|
-
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
1982
|
-
...props,
|
|
1983
|
-
children: [
|
|
1984
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
1985
|
-
children
|
|
1986
|
-
]
|
|
1987
|
-
}
|
|
1988
|
-
));
|
|
1989
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
1990
|
-
var DropdownMenuRadioItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1991
|
-
DropdownMenuPrimitive.RadioItem,
|
|
1992
|
-
{
|
|
1993
|
-
ref,
|
|
1994
|
-
"data-slot": "dropdown-menu-radio-item",
|
|
1995
|
-
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
1996
|
-
...props,
|
|
1997
|
-
children: [
|
|
1998
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
1999
|
-
children
|
|
2000
|
-
]
|
|
2001
|
-
}
|
|
2002
|
-
));
|
|
2003
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
2004
|
-
var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2005
|
-
DropdownMenuPrimitive.Label,
|
|
2006
|
-
{
|
|
2007
|
-
ref,
|
|
2008
|
-
"data-slot": "dropdown-menu-label",
|
|
2009
|
-
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
2010
|
-
...props
|
|
2011
|
-
}
|
|
2012
|
-
));
|
|
2013
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
2014
|
-
var DropdownMenuSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2015
|
-
DropdownMenuPrimitive.Separator,
|
|
2016
|
-
{
|
|
2017
|
-
ref,
|
|
2018
|
-
"data-slot": "dropdown-menu-separator",
|
|
2019
|
-
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
2020
|
-
...props
|
|
2021
|
-
}
|
|
2022
|
-
));
|
|
2023
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
2024
|
-
var DropdownMenuShortcut = ({
|
|
2025
|
-
className,
|
|
2026
|
-
...props
|
|
2027
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2028
|
-
"span",
|
|
2029
|
-
{
|
|
2030
|
-
"data-slot": "dropdown-menu-shortcut",
|
|
2031
|
-
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
1916
|
+
var Popover = PopoverPrimitive.Root;
|
|
1917
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
1918
|
+
var PopoverContent = React12.forwardRef(
|
|
1919
|
+
({
|
|
1920
|
+
className,
|
|
1921
|
+
align = "center",
|
|
1922
|
+
sideOffset = 4,
|
|
1923
|
+
container,
|
|
1924
|
+
animated = true,
|
|
2032
1925
|
...props
|
|
1926
|
+
}, ref) => {
|
|
1927
|
+
const portalContainer = usePortalContainer(container);
|
|
1928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1929
|
+
PopoverPrimitive.Content,
|
|
1930
|
+
{
|
|
1931
|
+
ref,
|
|
1932
|
+
align,
|
|
1933
|
+
sideOffset,
|
|
1934
|
+
className: cn(
|
|
1935
|
+
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
1936
|
+
// than the screen must never trap the user with unreachable content.
|
|
1937
|
+
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
1938
|
+
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
1939
|
+
// above it, and a popover opened from a dialog still stacks above the
|
|
1940
|
+
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
1941
|
+
"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
|
|
1942
|
+
animated && MOTION_POPPER,
|
|
1943
|
+
className
|
|
1944
|
+
),
|
|
1945
|
+
...props
|
|
1946
|
+
}
|
|
1947
|
+
) });
|
|
2033
1948
|
}
|
|
2034
1949
|
);
|
|
2035
|
-
|
|
1950
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2036
1951
|
|
|
2037
1952
|
// src/content-transfer/index.tsx
|
|
2038
1953
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -2055,6 +1970,53 @@ function MenuPresentation({ label, hint, icon: Icon3 }) {
|
|
|
2055
1970
|
] })
|
|
2056
1971
|
] });
|
|
2057
1972
|
}
|
|
1973
|
+
function PaletteGlyph({ format, ai = false, file = false }) {
|
|
1974
|
+
if (ai) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 5a3 3 0 1 0-5.997.125A4 4 0 0 0 3.5 10.9a4 4 0 0 0 .556 6.588A4 4 0 0 0 12 19" }),
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.503 5.775 4 4 0 0 1-.556 6.588A4 4 0 0 1 12 19" }),
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
|
|
1978
|
+
] });
|
|
1979
|
+
if (file) return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
|
|
1981
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
|
|
1982
|
+
] });
|
|
1983
|
+
const path2 = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1984
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
|
|
1986
|
+
] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m14 10 7-7" }),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M20 10h-6V4" }),
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "m3 21 7-7" }),
|
|
1990
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M4 14h6v6" })
|
|
1991
|
+
] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M4 10h16M10 4v16" })
|
|
1994
|
+
] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
|
|
1997
|
+
] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
|
|
2000
|
+
] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
|
|
2002
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
|
|
2003
|
+
] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
|
|
2004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: path2 });
|
|
2005
|
+
}
|
|
2006
|
+
function PaletteRows({ title, items, onRun, extra, ai = false }) {
|
|
2007
|
+
if (!items.length && !extra) return null;
|
|
2008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { children: title }),
|
|
2010
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
|
|
2011
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteGlyph, { ai }),
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
|
|
2013
|
+
item.copyLabel ?? item.label,
|
|
2014
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
|
|
2015
|
+
] })
|
|
2016
|
+
] }, item.id)),
|
|
2017
|
+
extra
|
|
2018
|
+
] });
|
|
2019
|
+
}
|
|
2058
2020
|
var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
|
|
2059
2021
|
var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
|
|
2060
2022
|
var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
|
|
@@ -2143,7 +2105,7 @@ function ContentTransferMenu(props) {
|
|
|
2143
2105
|
const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
|
|
2144
2106
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
|
|
2145
2107
|
}
|
|
2146
|
-
function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
|
|
2108
|
+
function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
|
|
2147
2109
|
const triggerRef = React13.useRef(null);
|
|
2148
2110
|
const inherited = React13.useContext(CapabilityContext);
|
|
2149
2111
|
const nearestSurface = React13.useContext(SurfaceContext);
|
|
@@ -2156,6 +2118,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2156
2118
|
const workspaceCaptures = React13.useRef(/* @__PURE__ */ new Map());
|
|
2157
2119
|
const externalWorkspaceKeys = React13.useRef(/* @__PURE__ */ new Set());
|
|
2158
2120
|
const [notice, setNotice] = React13.useState(null);
|
|
2121
|
+
const [paletteOpen, setPaletteOpen] = React13.useState(false);
|
|
2122
|
+
const [mode, setMode] = React13.useState("copy");
|
|
2159
2123
|
const scopes = React13.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
2160
2124
|
const initialScope = table?.initialScope ?? "target";
|
|
2161
2125
|
if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
|
|
@@ -2407,48 +2371,87 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2407
2371
|
}, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
|
|
2408
2372
|
if (!enabled) return null;
|
|
2409
2373
|
const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
|
|
2410
|
-
const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section)
|
|
2411
|
-
const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
|
|
2412
|
-
const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
|
|
2413
|
-
const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
|
|
2374
|
+
const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
|
|
2375
|
+
const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
|
|
2376
|
+
const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
|
|
2377
|
+
const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
|
|
2414
2378
|
const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
|
|
2379
|
+
const downloadActions = visibleActions.filter((action) => action.placement === "download");
|
|
2380
|
+
const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
|
|
2381
|
+
const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
|
|
2382
|
+
const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
|
|
2383
|
+
const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
|
|
2384
|
+
const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
|
|
2385
|
+
const closePalette = () => setPaletteOpen(false);
|
|
2386
|
+
const tile = (id, label2, onClick, options = {}) => {
|
|
2387
|
+
const presentation = options.action;
|
|
2388
|
+
const Icon3 = presentation?.icon;
|
|
2389
|
+
const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
|
|
2390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
|
|
2391
|
+
closePalette();
|
|
2392
|
+
onClick();
|
|
2393
|
+
}, children: [
|
|
2394
|
+
Icon3 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { children: [
|
|
2396
|
+
label2,
|
|
2397
|
+
presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
|
|
2398
|
+
] })
|
|
2399
|
+
] }, id);
|
|
2400
|
+
};
|
|
2415
2401
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
2416
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2417
|
-
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
2403
|
+
setPaletteOpen(open);
|
|
2404
|
+
if (open) {
|
|
2405
|
+
setMode("copy");
|
|
2406
|
+
void preflight();
|
|
2407
|
+
}
|
|
2418
2408
|
}, children: [
|
|
2419
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2420
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2424
|
-
quickVariants("copy"),
|
|
2425
|
-
visibleCopies.map((format) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
|
|
2426
|
-
visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
|
|
2427
|
-
"Copy ",
|
|
2428
|
-
adapter.label
|
|
2429
|
-
] }, adapter.id))
|
|
2430
|
-
] }) : null,
|
|
2431
|
-
!hide.includes("prepare") ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2432
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuSeparator, {}),
|
|
2433
|
-
quickVariants("ai"),
|
|
2434
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
|
|
2435
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
|
|
2436
|
-
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlchemyGlyph, {}) }) }),
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
|
|
2411
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
2437
2414
|
] }) : null,
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
] }, `download:${adapter.id}`))
|
|
2415
|
+
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
2416
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2418
|
+
visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
|
|
2419
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
2420
|
+
] }),
|
|
2421
|
+
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
2422
|
+
closePalette();
|
|
2423
|
+
void transfer("markdown", false, variant);
|
|
2424
|
+
} }) : null
|
|
2449
2425
|
] }) : null,
|
|
2450
|
-
|
|
2451
|
-
|
|
2426
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2427
|
+
visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
|
|
2428
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
2429
|
+
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
2430
|
+
] }) }) : null,
|
|
2431
|
+
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
|
|
2432
|
+
closePalette();
|
|
2433
|
+
void transfer("markdown", false, variant);
|
|
2434
|
+
}, extra: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2435
|
+
closePalette();
|
|
2436
|
+
void openWorkspace();
|
|
2437
|
+
}, children: [
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteGlyph, { ai: true }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Prepare for AI\u2026" })
|
|
2440
|
+
] }) }) : null,
|
|
2441
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2442
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2443
|
+
closePalette();
|
|
2444
|
+
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
2445
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Prepare this surface\u2026" }) }) : null,
|
|
2446
|
+
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
2447
|
+
closePalette();
|
|
2448
|
+
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
2449
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
|
|
2450
|
+
] }) }) : null,
|
|
2451
|
+
ordinaryActions.length ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
2452
|
+
closePalette();
|
|
2453
|
+
void runAction(action);
|
|
2454
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
|
|
2452
2455
|
] })
|
|
2453
2456
|
] }),
|
|
2454
2457
|
notice ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
|
|
@@ -3093,6 +3096,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
3093
3096
|
label: item.label,
|
|
3094
3097
|
supports: () => true,
|
|
3095
3098
|
...item.build && !item.onSelect ? {
|
|
3099
|
+
placement: "download",
|
|
3096
3100
|
source: make(
|
|
3097
3101
|
`export:${item.id}`,
|
|
3098
3102
|
async () => {
|
|
@@ -3173,10 +3177,11 @@ function MatrxCopyMenuSession(props) {
|
|
|
3173
3177
|
label: props.label,
|
|
3174
3178
|
variants,
|
|
3175
3179
|
actions,
|
|
3180
|
+
sourceFormats: Boolean(source),
|
|
3176
3181
|
hide: [
|
|
3177
3182
|
...!copyVisible || !source ? ["copy"] : [],
|
|
3178
3183
|
...!aiVisible || !source ? ["prepare"] : [],
|
|
3179
|
-
...!exportVisible
|
|
3184
|
+
...!exportVisible ? ["download"] : []
|
|
3180
3185
|
],
|
|
3181
3186
|
formatSources: {
|
|
3182
3187
|
...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
|
|
@@ -4236,52 +4241,12 @@ var import_url_state3 = require("@ai-matrx/kit/url-state");
|
|
|
4236
4241
|
var import_react7 = require("react");
|
|
4237
4242
|
var import_core = require("@dnd-kit/core");
|
|
4238
4243
|
|
|
4239
|
-
// src/popover.tsx
|
|
4240
|
-
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
4241
|
-
var React15 = __toESM(require("react"), 1);
|
|
4242
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4243
|
-
var Popover = PopoverPrimitive.Root;
|
|
4244
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
4245
|
-
var PopoverContent = React15.forwardRef(
|
|
4246
|
-
({
|
|
4247
|
-
className,
|
|
4248
|
-
align = "center",
|
|
4249
|
-
sideOffset = 4,
|
|
4250
|
-
container,
|
|
4251
|
-
animated = true,
|
|
4252
|
-
...props
|
|
4253
|
-
}, ref) => {
|
|
4254
|
-
const portalContainer = usePortalContainer(container);
|
|
4255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4256
|
-
PopoverPrimitive.Content,
|
|
4257
|
-
{
|
|
4258
|
-
ref,
|
|
4259
|
-
align,
|
|
4260
|
-
sideOffset,
|
|
4261
|
-
className: cn(
|
|
4262
|
-
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
4263
|
-
// than the screen must never trap the user with unreachable content.
|
|
4264
|
-
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
4265
|
-
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
4266
|
-
// above it, and a popover opened from a dialog still stacks above the
|
|
4267
|
-
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
4268
|
-
"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
|
|
4269
|
-
animated && MOTION_POPPER,
|
|
4270
|
-
className
|
|
4271
|
-
),
|
|
4272
|
-
...props
|
|
4273
|
-
}
|
|
4274
|
-
) });
|
|
4275
|
-
}
|
|
4276
|
-
);
|
|
4277
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
4278
|
-
|
|
4279
4244
|
// src/command.tsx
|
|
4280
4245
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
4281
4246
|
var import_cmdk = require("cmdk");
|
|
4282
|
-
var
|
|
4283
|
-
var
|
|
4284
|
-
var Command =
|
|
4247
|
+
var React15 = __toESM(require("react"), 1);
|
|
4248
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4249
|
+
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4285
4250
|
import_cmdk.Command,
|
|
4286
4251
|
{
|
|
4287
4252
|
ref,
|
|
@@ -4296,12 +4261,12 @@ Command.displayName = import_cmdk.Command.displayName;
|
|
|
4296
4261
|
var DIALOG_DESKTOP_CLASSES2 = `fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg`;
|
|
4297
4262
|
var DIALOG_MOBILE_SHEET_CLASSES2 = "fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain";
|
|
4298
4263
|
var DIALOG_MOBILE_SHEET_OVERRIDE2 = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
4299
|
-
var CommandDialogContent =
|
|
4264
|
+
var CommandDialogContent = React15.forwardRef(({ className, children, container, ...props }, ref) => {
|
|
4300
4265
|
const isMobile = useIsMobile();
|
|
4301
4266
|
const isModal = useRadixDialogModal();
|
|
4302
4267
|
const portalContainer = usePortalContainer(container);
|
|
4303
|
-
return /* @__PURE__ */ (0,
|
|
4304
|
-
isModal ? /* @__PURE__ */ (0,
|
|
4268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogPrimitive2.Portal, { container: portalContainer, children: [
|
|
4269
|
+
isModal ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4305
4270
|
DialogPrimitive2.Overlay,
|
|
4306
4271
|
{
|
|
4307
4272
|
className: cn(
|
|
@@ -4310,7 +4275,7 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
|
|
|
4310
4275
|
)
|
|
4311
4276
|
}
|
|
4312
4277
|
) : null,
|
|
4313
|
-
/* @__PURE__ */ (0,
|
|
4278
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4314
4279
|
DialogPrimitive2.Content,
|
|
4315
4280
|
{
|
|
4316
4281
|
ref,
|
|
@@ -4326,9 +4291,9 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
|
|
|
4326
4291
|
...props,
|
|
4327
4292
|
children: [
|
|
4328
4293
|
children,
|
|
4329
|
-
/* @__PURE__ */ (0,
|
|
4330
|
-
/* @__PURE__ */ (0,
|
|
4331
|
-
/* @__PURE__ */ (0,
|
|
4294
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogPrimitive2.Close, { className: "absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4", children: [
|
|
4295
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(XIcon, { className: "h-4 w-4" }),
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "sr-only", children: "Close" })
|
|
4332
4297
|
] })
|
|
4333
4298
|
]
|
|
4334
4299
|
}
|
|
@@ -4336,9 +4301,9 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
|
|
|
4336
4301
|
] });
|
|
4337
4302
|
});
|
|
4338
4303
|
CommandDialogContent.displayName = "CommandDialogContent";
|
|
4339
|
-
var CommandInput =
|
|
4340
|
-
/* @__PURE__ */ (0,
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4304
|
+
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
4306
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4342
4307
|
import_cmdk.Command.Input,
|
|
4343
4308
|
{
|
|
4344
4309
|
ref,
|
|
@@ -4351,7 +4316,7 @@ var CommandInput = React16.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4351
4316
|
)
|
|
4352
4317
|
] }));
|
|
4353
4318
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
4354
|
-
var CommandList =
|
|
4319
|
+
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4355
4320
|
import_cmdk.Command.List,
|
|
4356
4321
|
{
|
|
4357
4322
|
ref,
|
|
@@ -4360,7 +4325,7 @@ var CommandList = React16.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4360
4325
|
}
|
|
4361
4326
|
));
|
|
4362
4327
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
4363
|
-
var CommandEmpty =
|
|
4328
|
+
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4364
4329
|
import_cmdk.Command.Empty,
|
|
4365
4330
|
{
|
|
4366
4331
|
ref,
|
|
@@ -4369,7 +4334,7 @@ var CommandEmpty = React16.forwardRef((props, ref) => /* @__PURE__ */ (0, import
|
|
|
4369
4334
|
}
|
|
4370
4335
|
));
|
|
4371
4336
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
4372
|
-
var CommandGroup =
|
|
4337
|
+
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4373
4338
|
import_cmdk.Command.Group,
|
|
4374
4339
|
{
|
|
4375
4340
|
ref,
|
|
@@ -4381,7 +4346,7 @@ var CommandGroup = React16.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4381
4346
|
}
|
|
4382
4347
|
));
|
|
4383
4348
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
4384
|
-
var CommandSeparator =
|
|
4349
|
+
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4385
4350
|
import_cmdk.Command.Separator,
|
|
4386
4351
|
{
|
|
4387
4352
|
ref,
|
|
@@ -4390,7 +4355,7 @@ var CommandSeparator = React16.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4390
4355
|
}
|
|
4391
4356
|
));
|
|
4392
4357
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
4393
|
-
var CommandItem =
|
|
4358
|
+
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4394
4359
|
import_cmdk.Command.Item,
|
|
4395
4360
|
{
|
|
4396
4361
|
ref,
|
|
@@ -4406,7 +4371,7 @@ var CommandShortcut = ({
|
|
|
4406
4371
|
className,
|
|
4407
4372
|
...props
|
|
4408
4373
|
}) => {
|
|
4409
|
-
return /* @__PURE__ */ (0,
|
|
4374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4410
4375
|
"span",
|
|
4411
4376
|
{
|
|
4412
4377
|
className: cn(
|
|
@@ -4420,10 +4385,10 @@ var CommandShortcut = ({
|
|
|
4420
4385
|
CommandShortcut.displayName = "CommandShortcut";
|
|
4421
4386
|
|
|
4422
4387
|
// src/data-table/ColumnHeaderCell.tsx
|
|
4423
|
-
var
|
|
4388
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4424
4389
|
var HeaderButton = (0, import_react7.forwardRef)(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
|
|
4425
4390
|
const descriptions = [tooltipDescription, dragDescription].filter((value) => Boolean(value)).join(" ");
|
|
4426
|
-
return /* @__PURE__ */ (0,
|
|
4391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4427
4392
|
"button",
|
|
4428
4393
|
{
|
|
4429
4394
|
ref,
|
|
@@ -4503,7 +4468,7 @@ function ColumnHeaderCell({
|
|
|
4503
4468
|
else onFilterChange(next);
|
|
4504
4469
|
};
|
|
4505
4470
|
const menuLabel = labelText ? `Sort or filter ${labelText}` : "Sort or filter column";
|
|
4506
|
-
const menuContent = /* @__PURE__ */ (0,
|
|
4471
|
+
const menuContent = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4507
4472
|
PopoverContent,
|
|
4508
4473
|
{
|
|
4509
4474
|
align: "start",
|
|
@@ -4520,9 +4485,9 @@ function ColumnHeaderCell({
|
|
|
4520
4485
|
input.focus();
|
|
4521
4486
|
},
|
|
4522
4487
|
children: [
|
|
4523
|
-
sortable ? /* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4525
|
-
/* @__PURE__ */ (0,
|
|
4488
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-0.5 pb-2", children: [
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4526
4491
|
Button,
|
|
4527
4492
|
{
|
|
4528
4493
|
variant: isSorted && sortDirection === "asc" ? "secondary" : "ghost",
|
|
@@ -4530,12 +4495,12 @@ function ColumnHeaderCell({
|
|
|
4530
4495
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
|
|
4531
4496
|
onClick: onSortAsc,
|
|
4532
4497
|
children: [
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowUp, { className: "h-3.5 w-3.5" }),
|
|
4534
4499
|
"Sort ascending"
|
|
4535
4500
|
]
|
|
4536
4501
|
}
|
|
4537
4502
|
),
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4539
4504
|
Button,
|
|
4540
4505
|
{
|
|
4541
4506
|
variant: isSorted && sortDirection === "desc" ? "secondary" : "ghost",
|
|
@@ -4543,12 +4508,12 @@ function ColumnHeaderCell({
|
|
|
4543
4508
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
|
|
4544
4509
|
onClick: onSortDesc,
|
|
4545
4510
|
children: [
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowDown, { className: "h-3.5 w-3.5" }),
|
|
4547
4512
|
"Sort descending"
|
|
4548
4513
|
]
|
|
4549
4514
|
}
|
|
4550
4515
|
),
|
|
4551
|
-
isSorted ? /* @__PURE__ */ (0,
|
|
4516
|
+
isSorted ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4552
4517
|
Button,
|
|
4553
4518
|
{
|
|
4554
4519
|
variant: "ghost",
|
|
@@ -4556,15 +4521,15 @@ function ColumnHeaderCell({
|
|
|
4556
4521
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal text-muted-foreground",
|
|
4557
4522
|
onClick: onClearSort,
|
|
4558
4523
|
children: [
|
|
4559
|
-
/* @__PURE__ */ (0,
|
|
4524
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListX, { className: "h-3.5 w-3.5" }),
|
|
4560
4525
|
"Clear sort"
|
|
4561
4526
|
]
|
|
4562
4527
|
}
|
|
4563
4528
|
) : null
|
|
4564
4529
|
] }),
|
|
4565
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
4530
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mb-2 h-px bg-border" }) : null
|
|
4566
4531
|
] }) : null,
|
|
4567
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
4532
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4568
4533
|
FilterBody,
|
|
4569
4534
|
{
|
|
4570
4535
|
kind: filterKind,
|
|
@@ -4579,10 +4544,10 @@ function ColumnHeaderCell({
|
|
|
4579
4544
|
allowNullModes
|
|
4580
4545
|
}
|
|
4581
4546
|
) : null,
|
|
4582
|
-
filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ (0,
|
|
4583
|
-
/* @__PURE__ */ (0,
|
|
4584
|
-
/* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4547
|
+
filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
4548
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Match mode" }),
|
|
4549
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "grid grid-cols-2 gap-1 rounded-md border p-0.5", children: [
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4586
4551
|
"button",
|
|
4587
4552
|
{
|
|
4588
4553
|
type: "button",
|
|
@@ -4595,7 +4560,7 @@ function ColumnHeaderCell({
|
|
|
4595
4560
|
children: "Include"
|
|
4596
4561
|
}
|
|
4597
4562
|
),
|
|
4598
|
-
/* @__PURE__ */ (0,
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4599
4564
|
"button",
|
|
4600
4565
|
{
|
|
4601
4566
|
type: "button",
|
|
@@ -4610,11 +4575,11 @@ function ColumnHeaderCell({
|
|
|
4610
4575
|
)
|
|
4611
4576
|
] })
|
|
4612
4577
|
] }) : null,
|
|
4613
|
-
filterKind && deferredFilter ? /* @__PURE__ */ (0,
|
|
4614
|
-
filterFooterHint ? /* @__PURE__ */ (0,
|
|
4615
|
-
/* @__PURE__ */ (0,
|
|
4616
|
-
filterShowCancel ? /* @__PURE__ */ (0,
|
|
4617
|
-
/* @__PURE__ */ (0,
|
|
4578
|
+
filterKind && deferredFilter ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
4579
|
+
filterFooterHint ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mb-2 text-xs text-muted-foreground", children: filterFooterHint }) : null,
|
|
4580
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
4581
|
+
filterShowCancel ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { type: "button", variant: "ghost", size: "sm", onClick: cancelFilter, children: "Cancel" }) : null,
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { type: "button", size: "sm", onClick: applyFilter, children: filterApplyLabel ?? "Apply" })
|
|
4618
4583
|
] })
|
|
4619
4584
|
] }) : null
|
|
4620
4585
|
]
|
|
@@ -4623,10 +4588,10 @@ function ColumnHeaderCell({
|
|
|
4623
4588
|
if (compact) {
|
|
4624
4589
|
if (!sortable && !filterKind) {
|
|
4625
4590
|
if (!reorderEnabled) {
|
|
4626
|
-
return /* @__PURE__ */ (0,
|
|
4591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("flex items-center justify-center", className), children: label });
|
|
4627
4592
|
}
|
|
4628
|
-
return /* @__PURE__ */ (0,
|
|
4629
|
-
/* @__PURE__ */ (0,
|
|
4593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4630
4595
|
HeaderButton,
|
|
4631
4596
|
{
|
|
4632
4597
|
type: "button",
|
|
@@ -4638,14 +4603,14 @@ function ColumnHeaderCell({
|
|
|
4638
4603
|
children: label
|
|
4639
4604
|
}
|
|
4640
4605
|
) }),
|
|
4641
|
-
/* @__PURE__ */ (0,
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { children: [
|
|
4642
4607
|
"Drag to reorder ",
|
|
4643
4608
|
reorderLabel,
|
|
4644
4609
|
"."
|
|
4645
4610
|
] })
|
|
4646
4611
|
] }) });
|
|
4647
4612
|
}
|
|
4648
|
-
return /* @__PURE__ */ (0,
|
|
4613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4649
4614
|
"div",
|
|
4650
4615
|
{
|
|
4651
4616
|
className: cn(
|
|
@@ -4653,9 +4618,9 @@ function ColumnHeaderCell({
|
|
|
4653
4618
|
align === "right" ? "justify-end" : "justify-center",
|
|
4654
4619
|
className
|
|
4655
4620
|
),
|
|
4656
|
-
children: /* @__PURE__ */ (0,
|
|
4657
|
-
/* @__PURE__ */ (0,
|
|
4658
|
-
/* @__PURE__ */ (0,
|
|
4621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4659
4624
|
HeaderButton,
|
|
4660
4625
|
{
|
|
4661
4626
|
type: "button",
|
|
@@ -4671,8 +4636,8 @@ function ColumnHeaderCell({
|
|
|
4671
4636
|
),
|
|
4672
4637
|
children: [
|
|
4673
4638
|
label,
|
|
4674
|
-
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0,
|
|
4675
|
-
filterActive ? /* @__PURE__ */ (0,
|
|
4639
|
+
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowUp, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowDown, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : null,
|
|
4640
|
+
filterActive ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4676
4641
|
"span",
|
|
4677
4642
|
{
|
|
4678
4643
|
"aria-hidden": true,
|
|
@@ -4682,14 +4647,14 @@ function ColumnHeaderCell({
|
|
|
4682
4647
|
]
|
|
4683
4648
|
}
|
|
4684
4649
|
) }) }),
|
|
4685
|
-
/* @__PURE__ */ (0,
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { children: menuLabel })
|
|
4686
4651
|
] }),
|
|
4687
4652
|
menuContent
|
|
4688
4653
|
] })
|
|
4689
4654
|
}
|
|
4690
4655
|
);
|
|
4691
4656
|
}
|
|
4692
|
-
return /* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4693
4658
|
"div",
|
|
4694
4659
|
{
|
|
4695
4660
|
className: cn(
|
|
@@ -4699,8 +4664,8 @@ function ColumnHeaderCell({
|
|
|
4699
4664
|
className
|
|
4700
4665
|
),
|
|
4701
4666
|
children: [
|
|
4702
|
-
sortable ? /* @__PURE__ */ (0,
|
|
4703
|
-
/* @__PURE__ */ (0,
|
|
4667
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4668
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4704
4669
|
HeaderButton,
|
|
4705
4670
|
{
|
|
4706
4671
|
type: "button",
|
|
@@ -4712,14 +4677,14 @@ function ColumnHeaderCell({
|
|
|
4712
4677
|
isSorted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
4713
4678
|
),
|
|
4714
4679
|
children: [
|
|
4715
|
-
/* @__PURE__ */ (0,
|
|
4716
|
-
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0,
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate", children: label }),
|
|
4681
|
+
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowUp, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowDown, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArrowUpDown, { className: "h-3 w-3 shrink-0 opacity-40" })
|
|
4717
4682
|
]
|
|
4718
4683
|
}
|
|
4719
4684
|
) }),
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
4721
|
-
] }) : reorderEnabled ? /* @__PURE__ */ (0,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { children: reorderEnabled ? `Drag to reorder ${reorderLabel}.` : labelText ?? "Sort column" })
|
|
4686
|
+
] }) : reorderEnabled ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4687
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4723
4688
|
HeaderButton,
|
|
4724
4689
|
{
|
|
4725
4690
|
type: "button",
|
|
@@ -4731,16 +4696,16 @@ function ColumnHeaderCell({
|
|
|
4731
4696
|
children: label
|
|
4732
4697
|
}
|
|
4733
4698
|
) }),
|
|
4734
|
-
/* @__PURE__ */ (0,
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { children: [
|
|
4735
4700
|
"Drag to reorder ",
|
|
4736
4701
|
reorderLabel,
|
|
4737
4702
|
"."
|
|
4738
4703
|
] })
|
|
4739
|
-
] }) : /* @__PURE__ */ (0,
|
|
4740
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
4741
|
-
/* @__PURE__ */ (0,
|
|
4742
|
-
/* @__PURE__ */ (0,
|
|
4743
|
-
/* @__PURE__ */ (0,
|
|
4704
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
4705
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "inline-flex items-center", children: [
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4744
4709
|
"button",
|
|
4745
4710
|
{
|
|
4746
4711
|
type: "button",
|
|
@@ -4750,7 +4715,7 @@ function ColumnHeaderCell({
|
|
|
4750
4715
|
"rounded p-0.5 transition-colors",
|
|
4751
4716
|
filterActive ? "text-primary hover:text-primary/80" : "text-muted-foreground/40 hover:text-muted-foreground"
|
|
4752
4717
|
),
|
|
4753
|
-
children: /* @__PURE__ */ (0,
|
|
4718
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4754
4719
|
ListFilter,
|
|
4755
4720
|
{
|
|
4756
4721
|
className: cn("h-3 w-3", filterActive && "fill-primary/20")
|
|
@@ -4758,12 +4723,12 @@ function ColumnHeaderCell({
|
|
|
4758
4723
|
)
|
|
4759
4724
|
}
|
|
4760
4725
|
) }) }),
|
|
4761
|
-
/* @__PURE__ */ (0,
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { children: menuLabel })
|
|
4762
4727
|
] }),
|
|
4763
4728
|
menuContent
|
|
4764
4729
|
] }),
|
|
4765
|
-
filterActive ? /* @__PURE__ */ (0,
|
|
4766
|
-
/* @__PURE__ */ (0,
|
|
4730
|
+
filterActive ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4767
4732
|
"button",
|
|
4768
4733
|
{
|
|
4769
4734
|
type: "button",
|
|
@@ -4773,10 +4738,10 @@ function ColumnHeaderCell({
|
|
|
4773
4738
|
onFilterChange(void 0);
|
|
4774
4739
|
},
|
|
4775
4740
|
className: "rounded p-0.5 text-primary hover:bg-muted hover:text-foreground",
|
|
4776
|
-
children: /* @__PURE__ */ (0,
|
|
4741
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(X, { className: "h-3 w-3" })
|
|
4777
4742
|
}
|
|
4778
4743
|
) }),
|
|
4779
|
-
/* @__PURE__ */ (0,
|
|
4744
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { children: labelText ? `Clear ${labelText} filter` : "Clear this filter" })
|
|
4780
4745
|
] }) : null
|
|
4781
4746
|
] }) : null
|
|
4782
4747
|
]
|
|
@@ -4801,14 +4766,14 @@ function FilterBody({
|
|
|
4801
4766
|
onChange({ kind: "text", value: "", mode: next });
|
|
4802
4767
|
}
|
|
4803
4768
|
};
|
|
4804
|
-
return /* @__PURE__ */ (0,
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
4806
|
-
/* @__PURE__ */ (0,
|
|
4769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
4770
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-1", children: [
|
|
4807
4772
|
["contains", "Contains"],
|
|
4808
4773
|
["empty", "(empty)"],
|
|
4809
4774
|
["not_empty", "(not empty)"],
|
|
4810
4775
|
...allowNullModes ? [["null", "(null)"], ["not_null", "(not null)"]] : []
|
|
4811
|
-
].map(([m, label]) => /* @__PURE__ */ (0,
|
|
4776
|
+
].map(([m, label]) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4812
4777
|
"button",
|
|
4813
4778
|
{
|
|
4814
4779
|
type: "button",
|
|
@@ -4822,8 +4787,8 @@ function FilterBody({
|
|
|
4822
4787
|
},
|
|
4823
4788
|
m
|
|
4824
4789
|
)) }),
|
|
4825
|
-
mode === "contains" && /* @__PURE__ */ (0,
|
|
4826
|
-
/* @__PURE__ */ (0,
|
|
4790
|
+
mode === "contains" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4827
4792
|
Input,
|
|
4828
4793
|
{
|
|
4829
4794
|
"data-matrx-filter-autofocus": true,
|
|
@@ -4836,14 +4801,14 @@ function FilterBody({
|
|
|
4836
4801
|
style: { fontSize: "16px" }
|
|
4837
4802
|
}
|
|
4838
4803
|
),
|
|
4839
|
-
text ? /* @__PURE__ */ (0,
|
|
4804
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4840
4805
|
"button",
|
|
4841
4806
|
{
|
|
4842
4807
|
type: "button",
|
|
4843
4808
|
"aria-label": "Clear filter text",
|
|
4844
4809
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
4845
4810
|
onClick: () => onChange(void 0),
|
|
4846
|
-
children: /* @__PURE__ */ (0,
|
|
4811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
4847
4812
|
}
|
|
4848
4813
|
) : null
|
|
4849
4814
|
] })
|
|
@@ -4851,7 +4816,7 @@ function FilterBody({
|
|
|
4851
4816
|
}
|
|
4852
4817
|
if (kind === "select") {
|
|
4853
4818
|
const selected = value?.kind === "select" ? value.values ?? (value.value && value.value !== "__all__" ? [value.value] : []) : [];
|
|
4854
|
-
return /* @__PURE__ */ (0,
|
|
4819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4855
4820
|
SearchableSelectFilter,
|
|
4856
4821
|
{
|
|
4857
4822
|
selected,
|
|
@@ -4863,9 +4828,9 @@ function FilterBody({
|
|
|
4863
4828
|
}
|
|
4864
4829
|
if (kind === "boolean") {
|
|
4865
4830
|
const current = value?.kind === "boolean" ? value.value : "__all__";
|
|
4866
|
-
return /* @__PURE__ */ (0,
|
|
4867
|
-
/* @__PURE__ */ (0,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4869
4834
|
Select,
|
|
4870
4835
|
{
|
|
4871
4836
|
value: current === "__all__" ? "__all__" : current ? "true" : "false",
|
|
@@ -4874,18 +4839,18 @@ function FilterBody({
|
|
|
4874
4839
|
else onChange({ kind: "boolean", value: v === "true" });
|
|
4875
4840
|
},
|
|
4876
4841
|
children: [
|
|
4877
|
-
/* @__PURE__ */ (0,
|
|
4878
|
-
/* @__PURE__ */ (0,
|
|
4879
|
-
/* @__PURE__ */ (0,
|
|
4880
|
-
/* @__PURE__ */ (0,
|
|
4881
|
-
/* @__PURE__ */ (0,
|
|
4842
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectValue, {}) }),
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(SelectContent, { children: [
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectItem, { value: "__all__", children: "All" }),
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectItem, { value: "true", children: "Yes" }),
|
|
4846
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectItem, { value: "false", children: "No" })
|
|
4882
4847
|
] })
|
|
4883
4848
|
]
|
|
4884
4849
|
}
|
|
4885
4850
|
)
|
|
4886
4851
|
] });
|
|
4887
4852
|
}
|
|
4888
|
-
return /* @__PURE__ */ (0,
|
|
4853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(NumberFilterBody, { value, onChange });
|
|
4889
4854
|
}
|
|
4890
4855
|
function SearchableSelectFilter({
|
|
4891
4856
|
selected,
|
|
@@ -4913,13 +4878,13 @@ function SearchableSelectFilter({
|
|
|
4913
4878
|
next.length === 0 ? void 0 : { kind: "select", value: next[0] ?? "", values: next }
|
|
4914
4879
|
);
|
|
4915
4880
|
};
|
|
4916
|
-
return /* @__PURE__ */ (0,
|
|
4917
|
-
/* @__PURE__ */ (0,
|
|
4918
|
-
/* @__PURE__ */ (0,
|
|
4881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1 px-0", children: [
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between px-1 pb-1", children: [
|
|
4883
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: [
|
|
4919
4884
|
"Filter",
|
|
4920
4885
|
selected.length > 1 ? ` (any of ${selected.length})` : ""
|
|
4921
4886
|
] }),
|
|
4922
|
-
selected.length > 0 ? /* @__PURE__ */ (0,
|
|
4887
|
+
selected.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4923
4888
|
"button",
|
|
4924
4889
|
{
|
|
4925
4890
|
type: "button",
|
|
@@ -4929,8 +4894,8 @@ function SearchableSelectFilter({
|
|
|
4929
4894
|
}
|
|
4930
4895
|
) : null
|
|
4931
4896
|
] }),
|
|
4932
|
-
/* @__PURE__ */ (0,
|
|
4933
|
-
/* @__PURE__ */ (0,
|
|
4897
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Command, { className: "rounded-md border border-border", shouldFilter: false, children: [
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4934
4899
|
CommandInput,
|
|
4935
4900
|
{
|
|
4936
4901
|
"data-matrx-filter-autofocus": true,
|
|
@@ -4940,10 +4905,10 @@ function SearchableSelectFilter({
|
|
|
4940
4905
|
className: "h-8 text-sm"
|
|
4941
4906
|
}
|
|
4942
4907
|
),
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
4944
|
-
/* @__PURE__ */ (0,
|
|
4945
|
-
/* @__PURE__ */ (0,
|
|
4946
|
-
/* @__PURE__ */ (0,
|
|
4908
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CommandList, { className: "max-h-48", children: [
|
|
4909
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommandEmpty, { className: "py-3 text-xs text-muted-foreground", children: "No matches" }),
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CommandGroup, { children: [
|
|
4911
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4947
4912
|
CommandItem,
|
|
4948
4913
|
{
|
|
4949
4914
|
value: "__all__",
|
|
@@ -4954,7 +4919,7 @@ function SearchableSelectFilter({
|
|
|
4954
4919
|
),
|
|
4955
4920
|
filtered.map((o) => {
|
|
4956
4921
|
const active = selected.includes(o.value);
|
|
4957
|
-
return /* @__PURE__ */ (0,
|
|
4922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4958
4923
|
CommandItem,
|
|
4959
4924
|
{
|
|
4960
4925
|
value: o.value,
|
|
@@ -4964,7 +4929,7 @@ function SearchableSelectFilter({
|
|
|
4964
4929
|
active && "bg-accent text-accent-foreground"
|
|
4965
4930
|
),
|
|
4966
4931
|
children: [
|
|
4967
|
-
/* @__PURE__ */ (0,
|
|
4932
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4968
4933
|
"span",
|
|
4969
4934
|
{
|
|
4970
4935
|
className: cn(
|
|
@@ -4972,7 +4937,7 @@ function SearchableSelectFilter({
|
|
|
4972
4937
|
single ? "rounded-full" : "rounded-sm",
|
|
4973
4938
|
active ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground/40"
|
|
4974
4939
|
),
|
|
4975
|
-
children: active && /* @__PURE__ */ (0,
|
|
4940
|
+
children: active && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Check, { className: "h-2.5 w-2.5" })
|
|
4976
4941
|
}
|
|
4977
4942
|
),
|
|
4978
4943
|
o.label
|
|
@@ -5003,10 +4968,10 @@ function NumberFilterBody({
|
|
|
5003
4968
|
}
|
|
5004
4969
|
onChange({ kind: "number", min: nextMin, max: nextMax });
|
|
5005
4970
|
};
|
|
5006
|
-
return /* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5009
|
-
(min !== void 0 || max !== void 0) && /* @__PURE__ */ (0,
|
|
4971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4973
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Range" }),
|
|
4974
|
+
(min !== void 0 || max !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5010
4975
|
"button",
|
|
5011
4976
|
{
|
|
5012
4977
|
type: "button",
|
|
@@ -5020,8 +4985,8 @@ function NumberFilterBody({
|
|
|
5020
4985
|
}
|
|
5021
4986
|
)
|
|
5022
4987
|
] }),
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
4988
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5025
4990
|
Input,
|
|
5026
4991
|
{
|
|
5027
4992
|
"data-matrx-filter-autofocus": true,
|
|
@@ -5036,8 +5001,8 @@ function NumberFilterBody({
|
|
|
5036
5001
|
style: { fontSize: "16px" }
|
|
5037
5002
|
}
|
|
5038
5003
|
),
|
|
5039
|
-
/* @__PURE__ */ (0,
|
|
5040
|
-
/* @__PURE__ */ (0,
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2013" }),
|
|
5005
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5041
5006
|
Input,
|
|
5042
5007
|
{
|
|
5043
5008
|
value: maxText,
|
|
@@ -5060,10 +5025,23 @@ function parseOptionalNumber(raw) {
|
|
|
5060
5025
|
return Number.isFinite(n) ? n : void 0;
|
|
5061
5026
|
}
|
|
5062
5027
|
|
|
5028
|
+
// src/data-table/column-drag-preview.ts
|
|
5029
|
+
function projectColumnDragOrder(orderedIds, preview2) {
|
|
5030
|
+
const order = [...orderedIds];
|
|
5031
|
+
if (!preview2?.targetId || preview2.draggedId === preview2.targetId) return order;
|
|
5032
|
+
const draggedIndex = order.indexOf(preview2.draggedId);
|
|
5033
|
+
const targetIndex = order.indexOf(preview2.targetId);
|
|
5034
|
+
if (draggedIndex < 0 || targetIndex < 0) return order;
|
|
5035
|
+
order.splice(draggedIndex, 1);
|
|
5036
|
+
const insertion = order.indexOf(preview2.targetId) + (preview2.after ? 1 : 0);
|
|
5037
|
+
order.splice(insertion, 0, preview2.draggedId);
|
|
5038
|
+
return order;
|
|
5039
|
+
}
|
|
5040
|
+
|
|
5063
5041
|
// src/data-table/ColumnManager.tsx
|
|
5064
5042
|
var import_react8 = require("react");
|
|
5065
5043
|
var import_core2 = require("@dnd-kit/core");
|
|
5066
|
-
var
|
|
5044
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5067
5045
|
function ColumnManager({
|
|
5068
5046
|
open,
|
|
5069
5047
|
onOpenChange,
|
|
@@ -5137,18 +5115,18 @@ function ColumnManager({
|
|
|
5137
5115
|
if (target) moveTo(dragged, String(target));
|
|
5138
5116
|
}
|
|
5139
5117
|
});
|
|
5140
|
-
return /* @__PURE__ */ (0,
|
|
5141
|
-
/* @__PURE__ */ (0,
|
|
5142
|
-
/* @__PURE__ */ (0,
|
|
5143
|
-
/* @__PURE__ */ (0,
|
|
5118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { className: "max-w-md", children: [
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: "Columns" }),
|
|
5121
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Choose the columns to show and set their order." })
|
|
5144
5122
|
] }),
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5123
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "max-h-[55dvh] divide-y overflow-y-auto rounded-md border", children: draftOrder.map((id, index) => {
|
|
5146
5124
|
const column = byId.get(id);
|
|
5147
5125
|
if (!column) return null;
|
|
5148
5126
|
const label = typeof column.header === "string" ? column.header : id;
|
|
5149
5127
|
const hideable = column.hideable !== false;
|
|
5150
5128
|
const visible = !draftHidden.has(id);
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5152
5130
|
ColumnManagerDropTarget,
|
|
5153
5131
|
{
|
|
5154
5132
|
id,
|
|
@@ -5158,8 +5136,8 @@ function ColumnManager({
|
|
|
5158
5136
|
dropTarget === id && draggedColumnId !== id && "border-t-2 border-primary"
|
|
5159
5137
|
),
|
|
5160
5138
|
children: [
|
|
5161
|
-
/* @__PURE__ */ (0,
|
|
5162
|
-
/* @__PURE__ */ (0,
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ColumnManagerDragHandle, { id, label }),
|
|
5140
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5163
5141
|
Checkbox,
|
|
5164
5142
|
{
|
|
5165
5143
|
checked: visible,
|
|
@@ -5176,8 +5154,8 @@ function ColumnManager({
|
|
|
5176
5154
|
}
|
|
5177
5155
|
}
|
|
5178
5156
|
),
|
|
5179
|
-
/* @__PURE__ */ (0,
|
|
5180
|
-
/* @__PURE__ */ (0,
|
|
5157
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: label }),
|
|
5158
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5181
5159
|
Button,
|
|
5182
5160
|
{
|
|
5183
5161
|
type: "button",
|
|
@@ -5187,10 +5165,10 @@ function ColumnManager({
|
|
|
5187
5165
|
"aria-label": `Move ${label} earlier`,
|
|
5188
5166
|
disabled: index === 0,
|
|
5189
5167
|
onClick: () => move(id, -1),
|
|
5190
|
-
children: /* @__PURE__ */ (0,
|
|
5168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUp, { className: "h-4 w-4" })
|
|
5191
5169
|
}
|
|
5192
5170
|
),
|
|
5193
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5194
5172
|
Button,
|
|
5195
5173
|
{
|
|
5196
5174
|
type: "button",
|
|
@@ -5200,7 +5178,7 @@ function ColumnManager({
|
|
|
5200
5178
|
"aria-label": `Move ${label} later`,
|
|
5201
5179
|
disabled: index === draftOrder.length - 1,
|
|
5202
5180
|
onClick: () => move(id, 1),
|
|
5203
|
-
children: /* @__PURE__ */ (0,
|
|
5181
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowDown, { className: "h-4 w-4" })
|
|
5204
5182
|
}
|
|
5205
5183
|
)
|
|
5206
5184
|
]
|
|
@@ -5208,9 +5186,9 @@ function ColumnManager({
|
|
|
5208
5186
|
id
|
|
5209
5187
|
);
|
|
5210
5188
|
}) }),
|
|
5211
|
-
/* @__PURE__ */ (0,
|
|
5212
|
-
/* @__PURE__ */ (0,
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5189
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
5191
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5214
5192
|
Button,
|
|
5215
5193
|
{
|
|
5216
5194
|
type: "button",
|
|
@@ -5233,14 +5211,14 @@ function ColumnManagerDropTarget({
|
|
|
5233
5211
|
id: `matrx-column-manager:${id}`,
|
|
5234
5212
|
data: { matrxDragKind: "column-manager", columnId: id }
|
|
5235
5213
|
});
|
|
5236
|
-
return /* @__PURE__ */ (0,
|
|
5214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: setNodeRef, "data-matrx-column-manager-drop-target": id, className, children });
|
|
5237
5215
|
}
|
|
5238
5216
|
function ColumnManagerDragHandle({ id, label }) {
|
|
5239
5217
|
const { attributes, listeners, setNodeRef } = (0, import_core2.useDraggable)({
|
|
5240
5218
|
id: `matrx-column-manager:${id}`,
|
|
5241
5219
|
data: { matrxDragKind: "column-manager", columnId: id }
|
|
5242
5220
|
});
|
|
5243
|
-
return /* @__PURE__ */ (0,
|
|
5221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5244
5222
|
"button",
|
|
5245
5223
|
{
|
|
5246
5224
|
ref: setNodeRef,
|
|
@@ -5250,14 +5228,65 @@ function ColumnManagerDragHandle({ id, label }) {
|
|
|
5250
5228
|
title: `Drag to reorder ${label}`,
|
|
5251
5229
|
...attributes,
|
|
5252
5230
|
...listeners,
|
|
5253
|
-
children: /* @__PURE__ */ (0,
|
|
5231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GripVertical, { className: "h-4 w-4" })
|
|
5254
5232
|
}
|
|
5255
5233
|
);
|
|
5256
5234
|
}
|
|
5257
5235
|
|
|
5236
|
+
// src/data-table/saved-view-snapshot.ts
|
|
5237
|
+
var import_zod2 = require("zod");
|
|
5238
|
+
var filterSchema = import_zod2.z.union([
|
|
5239
|
+
import_zod2.z.object({ kind: import_zod2.z.literal("text"), value: import_zod2.z.string(), mode: import_zod2.z.enum(["contains", "empty", "not_empty", "null", "not_null"]).optional(), negated: import_zod2.z.boolean().optional() }),
|
|
5240
|
+
import_zod2.z.object({ kind: import_zod2.z.literal("select"), value: import_zod2.z.string(), values: import_zod2.z.array(import_zod2.z.string()).optional(), negated: import_zod2.z.boolean().optional() }),
|
|
5241
|
+
import_zod2.z.object({ kind: import_zod2.z.literal("boolean"), value: import_zod2.z.boolean(), negated: import_zod2.z.boolean().optional() }),
|
|
5242
|
+
import_zod2.z.object({ kind: import_zod2.z.literal("number"), min: import_zod2.z.number().optional(), max: import_zod2.z.number().optional(), negated: import_zod2.z.boolean().optional() })
|
|
5243
|
+
]);
|
|
5244
|
+
var layeredRuleSchema = import_zod2.z.object({ id: import_zod2.z.string().min(1), field: import_zod2.z.string().min(1), operator: import_zod2.z.enum(LAYERED_FILTER_OPERATORS), value: import_zod2.z.string(), valueTo: import_zod2.z.string().optional() });
|
|
5245
|
+
var snapshotSchema = import_zod2.z.object({
|
|
5246
|
+
__kind: import_zod2.z.literal("matrx-table-view"),
|
|
5247
|
+
version: import_zod2.z.literal(1),
|
|
5248
|
+
query: import_zod2.z.object({ pageSize: import_zod2.z.number().int().positive(), search: import_zod2.z.string(), searchMatchMode: import_zod2.z.enum(["contains", "whole_words"]).optional(), anyOf: import_zod2.z.string(), layeredFilters: import_zod2.z.array(layeredRuleSchema).optional(), columnFilters: import_zod2.z.record(import_zod2.z.string(), filterSchema.optional()), sort: import_zod2.z.object({ id: import_zod2.z.string().min(1), direction: import_zod2.z.enum(["asc", "desc"]) }).nullable() }),
|
|
5249
|
+
columns: import_zod2.z.object({
|
|
5250
|
+
order: import_zod2.z.array(import_zod2.z.string().min(1)).refine((order) => new Set(order).size === order.length, {
|
|
5251
|
+
message: "Column order must not contain duplicate IDs"
|
|
5252
|
+
}),
|
|
5253
|
+
hidden: import_zod2.z.array(import_zod2.z.string().min(1))
|
|
5254
|
+
})
|
|
5255
|
+
});
|
|
5256
|
+
function normalizeFilters(raw) {
|
|
5257
|
+
const filters = {};
|
|
5258
|
+
for (const [id, value] of Object.entries(raw)) {
|
|
5259
|
+
if (value === void 0) continue;
|
|
5260
|
+
if (value.kind === "text") filters[id] = { kind: "text", value: value.value, ...value.mode === void 0 ? {} : { mode: value.mode }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
5261
|
+
else if (value.kind === "select") filters[id] = { kind: "select", value: value.value, ...value.values === void 0 ? {} : { values: value.values }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
5262
|
+
else if (value.kind === "boolean") filters[id] = { kind: "boolean", value: value.value, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
5263
|
+
else filters[id] = { kind: "number", ...value.min === void 0 ? {} : { min: value.min }, ...value.max === void 0 ? {} : { max: value.max }, ...value.negated === void 0 ? {} : { negated: value.negated } };
|
|
5264
|
+
}
|
|
5265
|
+
return filters;
|
|
5266
|
+
}
|
|
5267
|
+
function parseTableViewSnapshot(raw) {
|
|
5268
|
+
const parsed = snapshotSchema.safeParse(raw);
|
|
5269
|
+
if (!parsed.success) return null;
|
|
5270
|
+
const { query, columns } = parsed.data;
|
|
5271
|
+
return {
|
|
5272
|
+
__kind: "matrx-table-view",
|
|
5273
|
+
version: 1,
|
|
5274
|
+
query: {
|
|
5275
|
+
pageSize: query.pageSize,
|
|
5276
|
+
search: query.search,
|
|
5277
|
+
...query.searchMatchMode === void 0 ? {} : { searchMatchMode: query.searchMatchMode },
|
|
5278
|
+
anyOf: query.anyOf,
|
|
5279
|
+
...query.layeredFilters === void 0 ? {} : { layeredFilters: query.layeredFilters },
|
|
5280
|
+
columnFilters: normalizeFilters(query.columnFilters),
|
|
5281
|
+
sort: query.sort
|
|
5282
|
+
},
|
|
5283
|
+
columns: { order: columns.order, hidden: columns.hidden }
|
|
5284
|
+
};
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5258
5287
|
// src/data-table/MatrxUuidCell.tsx
|
|
5259
5288
|
var import_react9 = require("react");
|
|
5260
|
-
var
|
|
5289
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5261
5290
|
var SHORT_LEN = 8;
|
|
5262
5291
|
function shortUuid(id, len = SHORT_LEN) {
|
|
5263
5292
|
return id.slice(0, len);
|
|
@@ -5307,7 +5336,7 @@ function MatrxUuidCell({
|
|
|
5307
5336
|
[]
|
|
5308
5337
|
);
|
|
5309
5338
|
if (!value) {
|
|
5310
|
-
return /* @__PURE__ */ (0,
|
|
5339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground/40", children: "\u2014" });
|
|
5311
5340
|
}
|
|
5312
5341
|
const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;
|
|
5313
5342
|
const resolvedHref = doors?.href ?? href ?? null;
|
|
@@ -5350,13 +5379,13 @@ function MatrxUuidCell({
|
|
|
5350
5379
|
};
|
|
5351
5380
|
const idNode = (() => {
|
|
5352
5381
|
if (forbidden) {
|
|
5353
|
-
return /* @__PURE__ */ (0,
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
|
|
5383
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 truncate", children: display }),
|
|
5384
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
|
|
5356
5385
|
] });
|
|
5357
5386
|
}
|
|
5358
5387
|
if (onOpen) {
|
|
5359
|
-
return /* @__PURE__ */ (0,
|
|
5388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5360
5389
|
"button",
|
|
5361
5390
|
{
|
|
5362
5391
|
type: "button",
|
|
@@ -5365,14 +5394,14 @@ function MatrxUuidCell({
|
|
|
5365
5394
|
disabled: opening,
|
|
5366
5395
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60",
|
|
5367
5396
|
children: [
|
|
5368
|
-
/* @__PURE__ */ (0,
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
5370
5399
|
]
|
|
5371
5400
|
}
|
|
5372
5401
|
);
|
|
5373
5402
|
}
|
|
5374
5403
|
if (resolvedHref) {
|
|
5375
|
-
return /* @__PURE__ */ (0,
|
|
5404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5376
5405
|
"a",
|
|
5377
5406
|
{
|
|
5378
5407
|
href: resolvedHref,
|
|
@@ -5382,15 +5411,15 @@ function MatrxUuidCell({
|
|
|
5382
5411
|
onClick: stop,
|
|
5383
5412
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400",
|
|
5384
5413
|
children: [
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5414
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
5415
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
5387
5416
|
]
|
|
5388
5417
|
}
|
|
5389
5418
|
);
|
|
5390
5419
|
}
|
|
5391
|
-
return /* @__PURE__ */ (0,
|
|
5420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
|
|
5392
5421
|
})();
|
|
5393
|
-
return /* @__PURE__ */ (0,
|
|
5422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5394
5423
|
"span",
|
|
5395
5424
|
{
|
|
5396
5425
|
"data-matrx-cell-control": true,
|
|
@@ -5400,12 +5429,12 @@ function MatrxUuidCell({
|
|
|
5400
5429
|
),
|
|
5401
5430
|
onClick: stop,
|
|
5402
5431
|
children: [
|
|
5403
|
-
/* @__PURE__ */ (0,
|
|
5404
|
-
/* @__PURE__ */ (0,
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5432
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
|
|
5434
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
|
|
5406
5435
|
] }),
|
|
5407
|
-
/* @__PURE__ */ (0,
|
|
5408
|
-
/* @__PURE__ */ (0,
|
|
5436
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5409
5438
|
"button",
|
|
5410
5439
|
{
|
|
5411
5440
|
type: "button",
|
|
@@ -5415,13 +5444,13 @@ function MatrxUuidCell({
|
|
|
5415
5444
|
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
5416
5445
|
copied && "text-primary"
|
|
5417
5446
|
),
|
|
5418
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
5447
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Copy, { className: "h-3 w-3" })
|
|
5419
5448
|
}
|
|
5420
5449
|
) }),
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
|
|
5422
5451
|
] }),
|
|
5423
|
-
canPeek ? /* @__PURE__ */ (0,
|
|
5424
|
-
/* @__PURE__ */ (0,
|
|
5452
|
+
canPeek ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
5453
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5425
5454
|
"button",
|
|
5426
5455
|
{
|
|
5427
5456
|
type: "button",
|
|
@@ -5431,16 +5460,16 @@ function MatrxUuidCell({
|
|
|
5431
5460
|
},
|
|
5432
5461
|
"aria-label": `Quick look at ${label ?? "record"}`,
|
|
5433
5462
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
5434
|
-
children: /* @__PURE__ */ (0,
|
|
5463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Lightbulb, { className: "h-3 w-3" })
|
|
5435
5464
|
}
|
|
5436
5465
|
) }),
|
|
5437
|
-
/* @__PURE__ */ (0,
|
|
5466
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(TooltipContent, { side: "top", children: [
|
|
5438
5467
|
"Quick look at ",
|
|
5439
5468
|
label ?? "record"
|
|
5440
5469
|
] })
|
|
5441
5470
|
] }) : null,
|
|
5442
|
-
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0,
|
|
5443
|
-
/* @__PURE__ */ (0,
|
|
5471
|
+
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
5472
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5444
5473
|
"a",
|
|
5445
5474
|
{
|
|
5446
5475
|
href: resolvedHref,
|
|
@@ -5449,10 +5478,10 @@ function MatrxUuidCell({
|
|
|
5449
5478
|
onClick: stop,
|
|
5450
5479
|
"aria-label": `Open ${label ?? "record"} in a new tab`,
|
|
5451
5480
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
5452
|
-
children: /* @__PURE__ */ (0,
|
|
5481
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ExternalLink, { className: "h-3 w-3" })
|
|
5453
5482
|
}
|
|
5454
5483
|
) }),
|
|
5455
|
-
/* @__PURE__ */ (0,
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(TooltipContent, { side: "top", children: [
|
|
5456
5485
|
"Open ",
|
|
5457
5486
|
label ?? "record",
|
|
5458
5487
|
" in a new tab"
|
|
@@ -5460,7 +5489,7 @@ function MatrxUuidCell({
|
|
|
5460
5489
|
] }) : null,
|
|
5461
5490
|
trailing,
|
|
5462
5491
|
notice,
|
|
5463
|
-
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0,
|
|
5492
|
+
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5464
5493
|
ResourcePeek,
|
|
5465
5494
|
{
|
|
5466
5495
|
kind: doors?.peekKind ?? token ?? "record",
|
|
@@ -5483,7 +5512,7 @@ function tokenFromColumnName(name) {
|
|
|
5483
5512
|
}
|
|
5484
5513
|
|
|
5485
5514
|
// src/data-table/DataRowInspector.tsx
|
|
5486
|
-
var
|
|
5515
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5487
5516
|
var noFieldToken = () => null;
|
|
5488
5517
|
function formatValue(value) {
|
|
5489
5518
|
if (value == null) return "\u2014";
|
|
@@ -5512,7 +5541,7 @@ function DataRowInspector({
|
|
|
5512
5541
|
tokenForField = noFieldToken
|
|
5513
5542
|
}) {
|
|
5514
5543
|
const entries = isPlainObject(row) ? Object.entries(row) : [["value", row]];
|
|
5515
|
-
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0,
|
|
5544
|
+
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5516
5545
|
CopyButtons,
|
|
5517
5546
|
{
|
|
5518
5547
|
size: "xs",
|
|
@@ -5527,21 +5556,21 @@ function DataRowInspector({
|
|
|
5527
5556
|
})
|
|
5528
5557
|
}
|
|
5529
5558
|
) }) : null;
|
|
5530
|
-
return /* @__PURE__ */ (0,
|
|
5559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5531
5560
|
"div",
|
|
5532
5561
|
{
|
|
5533
5562
|
className: cn("flex h-full min-h-0 flex-col overflow-hidden", className),
|
|
5534
5563
|
children: [
|
|
5535
|
-
title ? /* @__PURE__ */ (0,
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5564
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
|
|
5537
5566
|
if (isUuidValue(value)) {
|
|
5538
|
-
return /* @__PURE__ */ (0,
|
|
5567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5539
5568
|
"div",
|
|
5540
5569
|
{
|
|
5541
5570
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2",
|
|
5542
5571
|
children: [
|
|
5543
|
-
/* @__PURE__ */ (0,
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("dd", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5545
5574
|
MatrxUuidCell,
|
|
5546
5575
|
{
|
|
5547
5576
|
value,
|
|
@@ -5556,13 +5585,13 @@ function DataRowInspector({
|
|
|
5556
5585
|
}
|
|
5557
5586
|
const formatted = formatValue(value);
|
|
5558
5587
|
const multiline = formatted.includes("\n") || formatted.length > 80;
|
|
5559
|
-
return /* @__PURE__ */ (0,
|
|
5588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5560
5589
|
"div",
|
|
5561
5590
|
{
|
|
5562
5591
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 py-2 pl-2.5 pr-12",
|
|
5563
5592
|
children: [
|
|
5564
|
-
/* @__PURE__ */ (0,
|
|
5565
|
-
/* @__PURE__ */ (0,
|
|
5593
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
5594
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5566
5595
|
"dd",
|
|
5567
5596
|
{
|
|
5568
5597
|
className: cn(
|
|
@@ -5585,7 +5614,7 @@ function DataRowInspector({
|
|
|
5585
5614
|
|
|
5586
5615
|
// src/data-table/DataRowWindow.tsx
|
|
5587
5616
|
var import_react10 = require("react");
|
|
5588
|
-
var
|
|
5617
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5589
5618
|
function DataRowWindow({
|
|
5590
5619
|
isOpen,
|
|
5591
5620
|
onClose,
|
|
@@ -5611,9 +5640,9 @@ function DataRowWindow({
|
|
|
5611
5640
|
setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
|
|
5612
5641
|
}, [isOpen, windowId, hasEdit, defaultTab]);
|
|
5613
5642
|
if (!isOpen) return null;
|
|
5614
|
-
const viewBody = viewContent ?? /* @__PURE__ */ (0,
|
|
5615
|
-
const body = children ?? /* @__PURE__ */ (0,
|
|
5616
|
-
return /* @__PURE__ */ (0,
|
|
5643
|
+
const viewBody = viewContent ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DataRowInspector, { row });
|
|
5644
|
+
const body = children ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
|
|
5645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5617
5646
|
WindowPanel,
|
|
5618
5647
|
{
|
|
5619
5648
|
id: windowId,
|
|
@@ -5627,26 +5656,26 @@ function DataRowWindow({
|
|
|
5627
5656
|
bodyClassName: "flex min-h-0 flex-1 flex-col overflow-hidden p-0",
|
|
5628
5657
|
sidebarDefaultSize: 140,
|
|
5629
5658
|
sidebarMinSize: 110,
|
|
5630
|
-
sidebar: hasTabs ? /* @__PURE__ */ (0,
|
|
5659
|
+
sidebar: hasTabs ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5631
5660
|
"nav",
|
|
5632
5661
|
{
|
|
5633
5662
|
"aria-label": "Row window tabs",
|
|
5634
5663
|
className: "flex h-full flex-col gap-0.5 overflow-y-auto p-1.5",
|
|
5635
5664
|
children: [
|
|
5636
|
-
/* @__PURE__ */ (0,
|
|
5665
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5637
5666
|
TabButton,
|
|
5638
5667
|
{
|
|
5639
5668
|
active: tab === "view",
|
|
5640
|
-
icon: /* @__PURE__ */ (0,
|
|
5669
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Eye, { className: "h-4 w-4 shrink-0" }),
|
|
5641
5670
|
label: "View",
|
|
5642
5671
|
onClick: () => setTab("view")
|
|
5643
5672
|
}
|
|
5644
5673
|
),
|
|
5645
|
-
/* @__PURE__ */ (0,
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5646
5675
|
TabButton,
|
|
5647
5676
|
{
|
|
5648
5677
|
active: tab === "edit",
|
|
5649
|
-
icon: /* @__PURE__ */ (0,
|
|
5678
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Pencil, { className: "h-4 w-4 shrink-0" }),
|
|
5650
5679
|
label: "Edit",
|
|
5651
5680
|
onClick: () => setTab("edit")
|
|
5652
5681
|
}
|
|
@@ -5664,7 +5693,7 @@ function TabButton({
|
|
|
5664
5693
|
label,
|
|
5665
5694
|
onClick
|
|
5666
5695
|
}) {
|
|
5667
|
-
return /* @__PURE__ */ (0,
|
|
5696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5668
5697
|
"button",
|
|
5669
5698
|
{
|
|
5670
5699
|
type: "button",
|
|
@@ -5677,14 +5706,14 @@ function TabButton({
|
|
|
5677
5706
|
),
|
|
5678
5707
|
children: [
|
|
5679
5708
|
icon,
|
|
5680
|
-
/* @__PURE__ */ (0,
|
|
5709
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
5681
5710
|
]
|
|
5682
5711
|
}
|
|
5683
5712
|
);
|
|
5684
5713
|
}
|
|
5685
5714
|
|
|
5686
5715
|
// src/data-table/DirtySavePill.tsx
|
|
5687
|
-
var
|
|
5716
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5688
5717
|
function DirtySavePill({
|
|
5689
5718
|
changeCount,
|
|
5690
5719
|
saving,
|
|
@@ -5693,20 +5722,20 @@ function DirtySavePill({
|
|
|
5693
5722
|
className
|
|
5694
5723
|
}) {
|
|
5695
5724
|
if (changeCount <= 0) return null;
|
|
5696
|
-
return /* @__PURE__ */ (0,
|
|
5725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5697
5726
|
"div",
|
|
5698
5727
|
{
|
|
5699
5728
|
className: cn(
|
|
5700
5729
|
"pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center pb-safe",
|
|
5701
5730
|
className
|
|
5702
5731
|
),
|
|
5703
|
-
children: /* @__PURE__ */ (0,
|
|
5704
|
-
/* @__PURE__ */ (0,
|
|
5732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
|
|
5705
5734
|
changeCount,
|
|
5706
5735
|
" unsaved change",
|
|
5707
5736
|
changeCount === 1 ? "" : "s"
|
|
5708
5737
|
] }),
|
|
5709
|
-
/* @__PURE__ */ (0,
|
|
5738
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5710
5739
|
Button,
|
|
5711
5740
|
{
|
|
5712
5741
|
type: "button",
|
|
@@ -5716,12 +5745,12 @@ function DirtySavePill({
|
|
|
5716
5745
|
disabled: saving,
|
|
5717
5746
|
onClick: onCancel,
|
|
5718
5747
|
children: [
|
|
5719
|
-
/* @__PURE__ */ (0,
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
5720
5749
|
"Cancel"
|
|
5721
5750
|
]
|
|
5722
5751
|
}
|
|
5723
5752
|
),
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5725
5754
|
Button,
|
|
5726
5755
|
{
|
|
5727
5756
|
type: "button",
|
|
@@ -5730,7 +5759,7 @@ function DirtySavePill({
|
|
|
5730
5759
|
disabled: saving,
|
|
5731
5760
|
onClick: onSave,
|
|
5732
5761
|
children: [
|
|
5733
|
-
saving ? /* @__PURE__ */ (0,
|
|
5762
|
+
saving ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Save, { className: "h-3.5 w-3.5" }),
|
|
5734
5763
|
"Save"
|
|
5735
5764
|
]
|
|
5736
5765
|
}
|
|
@@ -5742,7 +5771,7 @@ function DirtySavePill({
|
|
|
5742
5771
|
|
|
5743
5772
|
// src/data-table/EditableTableCell.tsx
|
|
5744
5773
|
var import_react11 = require("react");
|
|
5745
|
-
var
|
|
5774
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5746
5775
|
function CellEditShell({
|
|
5747
5776
|
href,
|
|
5748
5777
|
display,
|
|
@@ -5751,8 +5780,8 @@ function CellEditShell({
|
|
|
5751
5780
|
editButton
|
|
5752
5781
|
}) {
|
|
5753
5782
|
const { Link: HostLink } = useMatrxDataTableHost();
|
|
5754
|
-
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0,
|
|
5755
|
-
return /* @__PURE__ */ (0,
|
|
5783
|
+
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { ...props }));
|
|
5784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5756
5785
|
"span",
|
|
5757
5786
|
{
|
|
5758
5787
|
className: cn(
|
|
@@ -5764,7 +5793,7 @@ function CellEditShell({
|
|
|
5764
5793
|
className
|
|
5765
5794
|
),
|
|
5766
5795
|
children: [
|
|
5767
|
-
href ? /* @__PURE__ */ (0,
|
|
5796
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5768
5797
|
Link,
|
|
5769
5798
|
{
|
|
5770
5799
|
href,
|
|
@@ -5772,13 +5801,13 @@ function CellEditShell({
|
|
|
5772
5801
|
className: "min-w-0 flex-1 overflow-hidden truncate rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
5773
5802
|
children: display
|
|
5774
5803
|
}
|
|
5775
|
-
) : /* @__PURE__ */ (0,
|
|
5804
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
|
|
5776
5805
|
editButton
|
|
5777
5806
|
]
|
|
5778
5807
|
}
|
|
5779
5808
|
);
|
|
5780
5809
|
}
|
|
5781
|
-
var CELL_PENCIL_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground opacity-
|
|
5810
|
+
var CELL_PENCIL_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground opacity-100 transition-opacity hover:bg-muted/60 focus-visible:opacity-100 lg:opacity-0 group-hover/cell-link:opacity-100";
|
|
5782
5811
|
function EditableTableCell({
|
|
5783
5812
|
value,
|
|
5784
5813
|
editType,
|
|
@@ -5793,7 +5822,7 @@ function EditableTableCell({
|
|
|
5793
5822
|
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
5794
5823
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
5795
5824
|
if (editType === "string") {
|
|
5796
|
-
return /* @__PURE__ */ (0,
|
|
5825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5797
5826
|
InlineStringEditor,
|
|
5798
5827
|
{
|
|
5799
5828
|
value: stringifyCellValue(value),
|
|
@@ -5806,30 +5835,30 @@ function EditableTableCell({
|
|
|
5806
5835
|
}
|
|
5807
5836
|
);
|
|
5808
5837
|
}
|
|
5809
|
-
return /* @__PURE__ */ (0,
|
|
5810
|
-
usePencil ? /* @__PURE__ */ (0,
|
|
5838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
5839
|
+
usePencil ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5811
5840
|
CellEditShell,
|
|
5812
5841
|
{
|
|
5813
5842
|
...href === void 0 ? {} : { href },
|
|
5814
5843
|
display,
|
|
5815
5844
|
...dirty === void 0 ? {} : { dirty },
|
|
5816
5845
|
...className === void 0 ? {} : { className },
|
|
5817
|
-
editButton: /* @__PURE__ */ (0,
|
|
5818
|
-
/* @__PURE__ */ (0,
|
|
5846
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tooltip, { children: [
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5819
5848
|
"button",
|
|
5820
5849
|
{
|
|
5821
5850
|
type: "button",
|
|
5822
5851
|
"aria-label": "Edit",
|
|
5823
5852
|
onClick: (e) => e.stopPropagation(),
|
|
5824
5853
|
className: CELL_PENCIL_CLASS,
|
|
5825
|
-
children: /* @__PURE__ */ (0,
|
|
5854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Pencil, { className: "h-3 w-3" })
|
|
5826
5855
|
}
|
|
5827
5856
|
) }) }),
|
|
5828
|
-
/* @__PURE__ */ (0,
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipContent, { children: "Edit" })
|
|
5829
5858
|
] })
|
|
5830
5859
|
}
|
|
5831
|
-
) : /* @__PURE__ */ (0,
|
|
5832
|
-
/* @__PURE__ */ (0,
|
|
5860
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tooltip, { children: [
|
|
5861
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5833
5862
|
"button",
|
|
5834
5863
|
{
|
|
5835
5864
|
type: "button",
|
|
@@ -5840,20 +5869,20 @@ function EditableTableCell({
|
|
|
5840
5869
|
className
|
|
5841
5870
|
),
|
|
5842
5871
|
children: [
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5844
|
-
editType === "select" ? /* @__PURE__ */ (0,
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
|
|
5873
|
+
editType === "select" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
|
|
5845
5874
|
]
|
|
5846
5875
|
}
|
|
5847
5876
|
) }) }),
|
|
5848
|
-
/* @__PURE__ */ (0,
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipContent, { children: "Edit value" })
|
|
5849
5878
|
] }),
|
|
5850
|
-
/* @__PURE__ */ (0,
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5851
5880
|
PopoverContent,
|
|
5852
5881
|
{
|
|
5853
5882
|
align: "start",
|
|
5854
5883
|
className: "w-56 p-2",
|
|
5855
5884
|
onClick: (e) => e.stopPropagation(),
|
|
5856
|
-
children: /* @__PURE__ */ (0,
|
|
5885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5857
5886
|
TypedEditor,
|
|
5858
5887
|
{
|
|
5859
5888
|
editType,
|
|
@@ -5883,15 +5912,15 @@ function InlineStringEditor({
|
|
|
5883
5912
|
const [draft, setDraft] = (0, import_react11.useState)(value);
|
|
5884
5913
|
if (!editing) {
|
|
5885
5914
|
if (usePencil) {
|
|
5886
|
-
return /* @__PURE__ */ (0,
|
|
5915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5887
5916
|
CellEditShell,
|
|
5888
5917
|
{
|
|
5889
5918
|
...href === void 0 ? {} : { href },
|
|
5890
5919
|
display,
|
|
5891
5920
|
...dirty === void 0 ? {} : { dirty },
|
|
5892
5921
|
...className === void 0 ? {} : { className },
|
|
5893
|
-
editButton: /* @__PURE__ */ (0,
|
|
5894
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tooltip, { children: [
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5895
5924
|
"button",
|
|
5896
5925
|
{
|
|
5897
5926
|
type: "button",
|
|
@@ -5902,16 +5931,16 @@ function InlineStringEditor({
|
|
|
5902
5931
|
setEditing(true);
|
|
5903
5932
|
},
|
|
5904
5933
|
className: CELL_PENCIL_CLASS,
|
|
5905
|
-
children: /* @__PURE__ */ (0,
|
|
5934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Pencil, { className: "h-3 w-3" })
|
|
5906
5935
|
}
|
|
5907
5936
|
) }),
|
|
5908
|
-
/* @__PURE__ */ (0,
|
|
5937
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipContent, { children: "Edit" })
|
|
5909
5938
|
] })
|
|
5910
5939
|
}
|
|
5911
5940
|
);
|
|
5912
5941
|
}
|
|
5913
|
-
return /* @__PURE__ */ (0,
|
|
5914
|
-
/* @__PURE__ */ (0,
|
|
5942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tooltip, { children: [
|
|
5943
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5915
5944
|
"button",
|
|
5916
5945
|
{
|
|
5917
5946
|
type: "button",
|
|
@@ -5928,10 +5957,10 @@ function InlineStringEditor({
|
|
|
5928
5957
|
children: display
|
|
5929
5958
|
}
|
|
5930
5959
|
) }),
|
|
5931
|
-
/* @__PURE__ */ (0,
|
|
5960
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipContent, { children: "Click to edit" })
|
|
5932
5961
|
] });
|
|
5933
5962
|
}
|
|
5934
|
-
return /* @__PURE__ */ (0,
|
|
5963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5935
5964
|
Input,
|
|
5936
5965
|
{
|
|
5937
5966
|
autoFocus: true,
|
|
@@ -5967,9 +5996,9 @@ function TypedEditor({
|
|
|
5967
5996
|
}) {
|
|
5968
5997
|
if (editType === "boolean") {
|
|
5969
5998
|
const checked = Boolean(value);
|
|
5970
|
-
return /* @__PURE__ */ (0,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
5972
|
-
/* @__PURE__ */ (0,
|
|
5999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs font-medium", children: "Value" }),
|
|
6001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5973
6002
|
Checkbox,
|
|
5974
6003
|
{
|
|
5975
6004
|
checked,
|
|
@@ -5979,7 +6008,7 @@ function TypedEditor({
|
|
|
5979
6008
|
] });
|
|
5980
6009
|
}
|
|
5981
6010
|
if (editType === "number") {
|
|
5982
|
-
return /* @__PURE__ */ (0,
|
|
6011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5983
6012
|
NumberEditor,
|
|
5984
6013
|
{
|
|
5985
6014
|
value: typeof value === "number" ? value : Number(value) || 0,
|
|
@@ -5989,7 +6018,7 @@ function TypedEditor({
|
|
|
5989
6018
|
);
|
|
5990
6019
|
}
|
|
5991
6020
|
if (editType === "tags") {
|
|
5992
|
-
return /* @__PURE__ */ (0,
|
|
6021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5993
6022
|
TagsEditor,
|
|
5994
6023
|
{
|
|
5995
6024
|
value: Array.isArray(value) ? value.map(String) : [],
|
|
@@ -6000,19 +6029,19 @@ function TypedEditor({
|
|
|
6000
6029
|
);
|
|
6001
6030
|
}
|
|
6002
6031
|
if (editType === "select") {
|
|
6003
|
-
return /* @__PURE__ */ (0,
|
|
6032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6004
6033
|
Select,
|
|
6005
6034
|
{
|
|
6006
6035
|
value: stringifyCellValue(value),
|
|
6007
6036
|
onValueChange: (v) => onCommit(v),
|
|
6008
6037
|
children: [
|
|
6009
|
-
/* @__PURE__ */ (0,
|
|
6010
|
-
/* @__PURE__ */ (0,
|
|
6038
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectValue, {}) }),
|
|
6039
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
6011
6040
|
]
|
|
6012
6041
|
}
|
|
6013
6042
|
);
|
|
6014
6043
|
}
|
|
6015
|
-
return /* @__PURE__ */ (0,
|
|
6044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6016
6045
|
Input,
|
|
6017
6046
|
{
|
|
6018
6047
|
type: "date",
|
|
@@ -6042,11 +6071,11 @@ function TagsEditor({
|
|
|
6042
6071
|
const matches = suggestions.filter(
|
|
6043
6072
|
(s) => !tags.includes(s.value) && s.value !== "__none__" && (!draft || s.label.toLowerCase().includes(draft.trim().toLowerCase()))
|
|
6044
6073
|
).slice(0, 6);
|
|
6045
|
-
return /* @__PURE__ */ (0,
|
|
6046
|
-
/* @__PURE__ */ (0,
|
|
6047
|
-
tags.length === 0 && /* @__PURE__ */ (0,
|
|
6048
|
-
tags.map((tag) => /* @__PURE__ */ (0,
|
|
6049
|
-
/* @__PURE__ */ (0,
|
|
6074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
|
|
6075
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
6076
|
+
tags.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
|
|
6077
|
+
tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Tooltip, { children: [
|
|
6078
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6050
6079
|
"button",
|
|
6051
6080
|
{
|
|
6052
6081
|
type: "button",
|
|
@@ -6055,17 +6084,17 @@ function TagsEditor({
|
|
|
6055
6084
|
className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] hover:border-destructive hover:text-destructive",
|
|
6056
6085
|
children: [
|
|
6057
6086
|
tag,
|
|
6058
|
-
/* @__PURE__ */ (0,
|
|
6087
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-2.5 w-2.5" })
|
|
6059
6088
|
]
|
|
6060
6089
|
}
|
|
6061
6090
|
) }),
|
|
6062
|
-
/* @__PURE__ */ (0,
|
|
6091
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TooltipContent, { children: [
|
|
6063
6092
|
"Remove ",
|
|
6064
6093
|
tag
|
|
6065
6094
|
] })
|
|
6066
6095
|
] }, tag))
|
|
6067
6096
|
] }),
|
|
6068
|
-
/* @__PURE__ */ (0,
|
|
6097
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6069
6098
|
Input,
|
|
6070
6099
|
{
|
|
6071
6100
|
autoFocus: true,
|
|
@@ -6086,7 +6115,7 @@ function TagsEditor({
|
|
|
6086
6115
|
className: "h-8 text-xs"
|
|
6087
6116
|
}
|
|
6088
6117
|
),
|
|
6089
|
-
matches.length > 0 && /* @__PURE__ */ (0,
|
|
6118
|
+
matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6090
6119
|
"button",
|
|
6091
6120
|
{
|
|
6092
6121
|
type: "button",
|
|
@@ -6099,8 +6128,8 @@ function TagsEditor({
|
|
|
6099
6128
|
},
|
|
6100
6129
|
s.value
|
|
6101
6130
|
)) }),
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6131
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-end gap-1 pt-1", children: [
|
|
6132
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6104
6133
|
Button,
|
|
6105
6134
|
{
|
|
6106
6135
|
size: "sm",
|
|
@@ -6108,17 +6137,17 @@ function TagsEditor({
|
|
|
6108
6137
|
className: "h-7 px-2",
|
|
6109
6138
|
"aria-label": "Cancel edit",
|
|
6110
6139
|
onClick: onCancel,
|
|
6111
|
-
children: /* @__PURE__ */ (0,
|
|
6140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
6112
6141
|
}
|
|
6113
6142
|
),
|
|
6114
|
-
/* @__PURE__ */ (0,
|
|
6143
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6115
6144
|
Button,
|
|
6116
6145
|
{
|
|
6117
6146
|
size: "sm",
|
|
6118
6147
|
className: "h-7 px-2",
|
|
6119
6148
|
"aria-label": "Apply tags",
|
|
6120
6149
|
onClick: () => onCommit(tags),
|
|
6121
|
-
children: /* @__PURE__ */ (0,
|
|
6150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
6122
6151
|
}
|
|
6123
6152
|
)
|
|
6124
6153
|
] })
|
|
@@ -6130,8 +6159,8 @@ function NumberEditor({
|
|
|
6130
6159
|
onCancel
|
|
6131
6160
|
}) {
|
|
6132
6161
|
const [draft, setDraft] = (0, import_react11.useState)(String(value));
|
|
6133
|
-
return /* @__PURE__ */ (0,
|
|
6134
|
-
/* @__PURE__ */ (0,
|
|
6162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6135
6164
|
Input,
|
|
6136
6165
|
{
|
|
6137
6166
|
autoFocus: true,
|
|
@@ -6148,8 +6177,8 @@ function NumberEditor({
|
|
|
6148
6177
|
}
|
|
6149
6178
|
}
|
|
6150
6179
|
),
|
|
6151
|
-
/* @__PURE__ */ (0,
|
|
6152
|
-
/* @__PURE__ */ (0,
|
|
6180
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-end gap-1", children: [
|
|
6181
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6153
6182
|
Button,
|
|
6154
6183
|
{
|
|
6155
6184
|
type: "button",
|
|
@@ -6158,10 +6187,10 @@ function NumberEditor({
|
|
|
6158
6187
|
className: "h-7",
|
|
6159
6188
|
"aria-label": "Cancel edit",
|
|
6160
6189
|
onClick: onCancel,
|
|
6161
|
-
children: /* @__PURE__ */ (0,
|
|
6190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
6162
6191
|
}
|
|
6163
6192
|
),
|
|
6164
|
-
/* @__PURE__ */ (0,
|
|
6193
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6165
6194
|
Button,
|
|
6166
6195
|
{
|
|
6167
6196
|
type: "button",
|
|
@@ -6172,7 +6201,7 @@ function NumberEditor({
|
|
|
6172
6201
|
const n = Number(draft);
|
|
6173
6202
|
if (Number.isFinite(n)) onCommit(n);
|
|
6174
6203
|
},
|
|
6175
|
-
children: /* @__PURE__ */ (0,
|
|
6204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
6176
6205
|
}
|
|
6177
6206
|
)
|
|
6178
6207
|
] })
|
|
@@ -6180,24 +6209,24 @@ function NumberEditor({
|
|
|
6180
6209
|
}
|
|
6181
6210
|
|
|
6182
6211
|
// src/data-table/ToolbarFacets.tsx
|
|
6183
|
-
var
|
|
6212
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6184
6213
|
function ToolbarFacets({ facets }) {
|
|
6185
6214
|
if (facets.length === 0) return null;
|
|
6186
|
-
return /* @__PURE__ */ (0,
|
|
6215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
|
|
6187
6216
|
if (facet.type === "custom") {
|
|
6188
|
-
return /* @__PURE__ */ (0,
|
|
6217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: facet.render() }, facet.id);
|
|
6189
6218
|
}
|
|
6190
6219
|
const defaultValue = facet.defaultValue ?? facet.options[0]?.value ?? "";
|
|
6191
6220
|
const isNonDefault = facet.value !== defaultValue;
|
|
6192
|
-
return /* @__PURE__ */ (0,
|
|
6221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6193
6222
|
"div",
|
|
6194
6223
|
{
|
|
6195
6224
|
className: "flex flex-wrap items-center gap-1.5 max-sm:grid max-sm:w-full max-sm:grid-cols-3",
|
|
6196
6225
|
children: [
|
|
6197
|
-
facet.label ? /* @__PURE__ */ (0,
|
|
6226
|
+
facet.label ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
|
|
6198
6227
|
facet.options.map((opt) => {
|
|
6199
6228
|
const active = facet.value === opt.value;
|
|
6200
|
-
return /* @__PURE__ */ (0,
|
|
6229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6201
6230
|
Button,
|
|
6202
6231
|
{
|
|
6203
6232
|
type: "button",
|
|
@@ -6211,8 +6240,8 @@ function ToolbarFacets({ facets }) {
|
|
|
6211
6240
|
children: [
|
|
6212
6241
|
opt.icon,
|
|
6213
6242
|
opt.label,
|
|
6214
|
-
active && isNonDefault ? /* @__PURE__ */ (0,
|
|
6215
|
-
/* @__PURE__ */ (0,
|
|
6243
|
+
active && isNonDefault ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Tooltip, { children: [
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6216
6245
|
"span",
|
|
6217
6246
|
{
|
|
6218
6247
|
role: "button",
|
|
@@ -6230,10 +6259,10 @@ function ToolbarFacets({ facets }) {
|
|
|
6230
6259
|
facet.onChange(defaultValue);
|
|
6231
6260
|
}
|
|
6232
6261
|
},
|
|
6233
|
-
children: /* @__PURE__ */ (0,
|
|
6262
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(X, { className: "h-3 w-3" })
|
|
6234
6263
|
}
|
|
6235
6264
|
) }),
|
|
6236
|
-
/* @__PURE__ */ (0,
|
|
6265
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipContent, { side: "top", children: "Clear this filter" })
|
|
6237
6266
|
] }) }) : null
|
|
6238
6267
|
]
|
|
6239
6268
|
},
|
|
@@ -6257,7 +6286,7 @@ function resetToolbarFacets(facets) {
|
|
|
6257
6286
|
|
|
6258
6287
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
6259
6288
|
var import_react12 = require("react");
|
|
6260
|
-
var
|
|
6289
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6261
6290
|
function moveRule(rules, from, to) {
|
|
6262
6291
|
if (from === to || to < 0 || to >= rules.length) return [...rules];
|
|
6263
6292
|
const next = [...rules];
|
|
@@ -6303,8 +6332,8 @@ function LayeredFilterBuilder({
|
|
|
6303
6332
|
const reorder = (from, to) => {
|
|
6304
6333
|
onChange(moveRule(rules, from, to));
|
|
6305
6334
|
};
|
|
6306
|
-
return /* @__PURE__ */ (0,
|
|
6307
|
-
/* @__PURE__ */ (0,
|
|
6335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6308
6337
|
Popover,
|
|
6309
6338
|
{
|
|
6310
6339
|
open,
|
|
@@ -6316,7 +6345,7 @@ function LayeredFilterBuilder({
|
|
|
6316
6345
|
}
|
|
6317
6346
|
},
|
|
6318
6347
|
children: [
|
|
6319
|
-
/* @__PURE__ */ (0,
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6320
6349
|
Button,
|
|
6321
6350
|
{
|
|
6322
6351
|
type: "button",
|
|
@@ -6325,25 +6354,25 @@ function LayeredFilterBuilder({
|
|
|
6325
6354
|
className: "h-8 gap-1.5 px-2 text-xs",
|
|
6326
6355
|
"aria-label": label,
|
|
6327
6356
|
children: [
|
|
6328
|
-
/* @__PURE__ */ (0,
|
|
6329
|
-
/* @__PURE__ */ (0,
|
|
6330
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
6357
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
|
|
6358
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
|
|
6359
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "sm:hidden", children: rules.length }) : null
|
|
6331
6360
|
]
|
|
6332
6361
|
}
|
|
6333
6362
|
) }),
|
|
6334
|
-
/* @__PURE__ */ (0,
|
|
6363
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6335
6364
|
PopoverContent,
|
|
6336
6365
|
{
|
|
6337
6366
|
align: "start",
|
|
6338
6367
|
sideOffset: 6,
|
|
6339
6368
|
className: "w-[min(46rem,calc(100vw-1rem))] p-0",
|
|
6340
6369
|
children: [
|
|
6341
|
-
/* @__PURE__ */ (0,
|
|
6342
|
-
/* @__PURE__ */ (0,
|
|
6343
|
-
/* @__PURE__ */ (0,
|
|
6344
|
-
/* @__PURE__ */ (0,
|
|
6370
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
|
|
6371
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
6372
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
|
|
6373
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
|
|
6345
6374
|
] }),
|
|
6346
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
6375
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6347
6376
|
Button,
|
|
6348
6377
|
{
|
|
6349
6378
|
type: "button",
|
|
@@ -6355,10 +6384,10 @@ function LayeredFilterBuilder({
|
|
|
6355
6384
|
}
|
|
6356
6385
|
) : null
|
|
6357
6386
|
] }),
|
|
6358
|
-
/* @__PURE__ */ (0,
|
|
6359
|
-
/* @__PURE__ */ (0,
|
|
6360
|
-
/* @__PURE__ */ (0,
|
|
6361
|
-
] }) : rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
6387
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
|
|
6388
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
|
|
6389
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
|
|
6390
|
+
] }) : rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6362
6391
|
LayeredRuleRow,
|
|
6363
6392
|
{
|
|
6364
6393
|
index,
|
|
@@ -6378,9 +6407,9 @@ function LayeredFilterBuilder({
|
|
|
6378
6407
|
},
|
|
6379
6408
|
rule.id
|
|
6380
6409
|
)) }),
|
|
6381
|
-
/* @__PURE__ */ (0,
|
|
6382
|
-
/* @__PURE__ */ (0,
|
|
6383
|
-
/* @__PURE__ */ (0,
|
|
6410
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
|
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
|
|
6412
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6384
6413
|
Button,
|
|
6385
6414
|
{
|
|
6386
6415
|
type: "button",
|
|
@@ -6390,7 +6419,7 @@ function LayeredFilterBuilder({
|
|
|
6390
6419
|
disabled: rules.length >= maxRules,
|
|
6391
6420
|
onClick: addRule,
|
|
6392
6421
|
children: [
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6422
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Plus, { className: "h-3.5 w-3.5" }),
|
|
6394
6423
|
" Add layer"
|
|
6395
6424
|
]
|
|
6396
6425
|
}
|
|
@@ -6402,7 +6431,7 @@ function LayeredFilterBuilder({
|
|
|
6402
6431
|
]
|
|
6403
6432
|
}
|
|
6404
6433
|
),
|
|
6405
|
-
rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
6434
|
+
rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6406
6435
|
"span",
|
|
6407
6436
|
{
|
|
6408
6437
|
className: cn(
|
|
@@ -6410,7 +6439,7 @@ function LayeredFilterBuilder({
|
|
|
6410
6439
|
isCompleteLayeredFilterRule(rule) ? "border-border bg-muted/50 text-foreground" : "border-dashed border-warning/50 bg-warning/10 text-warning"
|
|
6411
6440
|
),
|
|
6412
6441
|
children: [
|
|
6413
|
-
/* @__PURE__ */ (0,
|
|
6442
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6414
6443
|
"button",
|
|
6415
6444
|
{
|
|
6416
6445
|
type: "button",
|
|
@@ -6418,19 +6447,19 @@ function LayeredFilterBuilder({
|
|
|
6418
6447
|
onClick: () => setOpen(true),
|
|
6419
6448
|
title: isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : `Layer ${index + 1} needs a value`,
|
|
6420
6449
|
children: [
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6450
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
|
|
6422
6451
|
isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : "Choose a value"
|
|
6423
6452
|
]
|
|
6424
6453
|
}
|
|
6425
6454
|
),
|
|
6426
|
-
/* @__PURE__ */ (0,
|
|
6455
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6427
6456
|
"button",
|
|
6428
6457
|
{
|
|
6429
6458
|
type: "button",
|
|
6430
6459
|
className: "shrink-0 rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
6431
6460
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
6432
6461
|
onClick: () => removeRule(index),
|
|
6433
|
-
children: /* @__PURE__ */ (0,
|
|
6462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(X, { className: "h-3 w-3" })
|
|
6434
6463
|
}
|
|
6435
6464
|
)
|
|
6436
6465
|
]
|
|
@@ -6460,7 +6489,7 @@ function LayeredRuleRow({
|
|
|
6460
6489
|
event.preventDefault();
|
|
6461
6490
|
onKeyboardMove(event.key === "ArrowUp" ? -1 : 1);
|
|
6462
6491
|
};
|
|
6463
|
-
return /* @__PURE__ */ (0,
|
|
6492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6464
6493
|
"div",
|
|
6465
6494
|
{
|
|
6466
6495
|
className: cn(
|
|
@@ -6473,7 +6502,7 @@ function LayeredRuleRow({
|
|
|
6473
6502
|
onDrop(index);
|
|
6474
6503
|
},
|
|
6475
6504
|
children: [
|
|
6476
|
-
/* @__PURE__ */ (0,
|
|
6505
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6477
6506
|
"button",
|
|
6478
6507
|
{
|
|
6479
6508
|
type: "button",
|
|
@@ -6487,10 +6516,10 @@ function LayeredRuleRow({
|
|
|
6487
6516
|
},
|
|
6488
6517
|
onDragEnd,
|
|
6489
6518
|
onKeyDown: handleMoveKey,
|
|
6490
|
-
children: /* @__PURE__ */ (0,
|
|
6519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
6491
6520
|
}
|
|
6492
6521
|
),
|
|
6493
|
-
/* @__PURE__ */ (0,
|
|
6522
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6494
6523
|
Select,
|
|
6495
6524
|
{
|
|
6496
6525
|
value: field.id,
|
|
@@ -6508,16 +6537,16 @@ function LayeredRuleRow({
|
|
|
6508
6537
|
});
|
|
6509
6538
|
},
|
|
6510
6539
|
children: [
|
|
6511
|
-
/* @__PURE__ */ (0,
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6512
6541
|
SelectTrigger,
|
|
6513
6542
|
{
|
|
6514
6543
|
size: "sm",
|
|
6515
6544
|
className: "h-7 w-full text-xs max-sm:col-span-1",
|
|
6516
6545
|
"aria-label": `Filter layer ${index + 1} field`,
|
|
6517
|
-
children: /* @__PURE__ */ (0,
|
|
6546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectValue, {})
|
|
6518
6547
|
}
|
|
6519
6548
|
),
|
|
6520
|
-
/* @__PURE__ */ (0,
|
|
6549
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6521
6550
|
SelectItem,
|
|
6522
6551
|
{
|
|
6523
6552
|
value: candidate.id,
|
|
@@ -6529,7 +6558,7 @@ function LayeredRuleRow({
|
|
|
6529
6558
|
]
|
|
6530
6559
|
}
|
|
6531
6560
|
),
|
|
6532
|
-
/* @__PURE__ */ (0,
|
|
6561
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6533
6562
|
Select,
|
|
6534
6563
|
{
|
|
6535
6564
|
value: rule.operator,
|
|
@@ -6541,35 +6570,35 @@ function LayeredRuleRow({
|
|
|
6541
6570
|
});
|
|
6542
6571
|
},
|
|
6543
6572
|
children: [
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6573
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6545
6574
|
SelectTrigger,
|
|
6546
6575
|
{
|
|
6547
6576
|
size: "sm",
|
|
6548
6577
|
className: "h-7 w-full text-xs max-sm:col-start-2",
|
|
6549
6578
|
"aria-label": `Filter layer ${index + 1} operator`,
|
|
6550
|
-
children: /* @__PURE__ */ (0,
|
|
6579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectValue, {})
|
|
6551
6580
|
}
|
|
6552
6581
|
),
|
|
6553
|
-
/* @__PURE__ */ (0,
|
|
6582
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
|
|
6554
6583
|
]
|
|
6555
6584
|
}
|
|
6556
6585
|
),
|
|
6557
|
-
/* @__PURE__ */ (0,
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
6558
6587
|
Select,
|
|
6559
6588
|
{
|
|
6560
6589
|
value: rule.value,
|
|
6561
6590
|
onValueChange: (value) => onChange({ value }),
|
|
6562
6591
|
children: [
|
|
6563
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6564
6593
|
SelectTrigger,
|
|
6565
6594
|
{
|
|
6566
6595
|
size: "sm",
|
|
6567
6596
|
className: "h-7 w-full text-xs",
|
|
6568
6597
|
"aria-label": `Filter layer ${index + 1} value`,
|
|
6569
|
-
children: /* @__PURE__ */ (0,
|
|
6598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectValue, {})
|
|
6570
6599
|
}
|
|
6571
6600
|
),
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6573
6602
|
SelectItem,
|
|
6574
6603
|
{
|
|
6575
6604
|
value: option.value,
|
|
@@ -6580,8 +6609,8 @@ function LayeredRuleRow({
|
|
|
6580
6609
|
)) })
|
|
6581
6610
|
]
|
|
6582
6611
|
}
|
|
6583
|
-
) : /* @__PURE__ */ (0,
|
|
6584
|
-
/* @__PURE__ */ (0,
|
|
6612
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
6613
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6585
6614
|
Input,
|
|
6586
6615
|
{
|
|
6587
6616
|
value: rule.value,
|
|
@@ -6592,9 +6621,9 @@ function LayeredRuleRow({
|
|
|
6592
6621
|
"aria-label": `Filter layer ${index + 1} value`
|
|
6593
6622
|
}
|
|
6594
6623
|
),
|
|
6595
|
-
rule.operator === "between" ? /* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
/* @__PURE__ */ (0,
|
|
6624
|
+
rule.operator === "between" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6598
6627
|
Input,
|
|
6599
6628
|
{
|
|
6600
6629
|
value: rule.valueTo ?? "",
|
|
@@ -6607,7 +6636,7 @@ function LayeredRuleRow({
|
|
|
6607
6636
|
)
|
|
6608
6637
|
] }) : null
|
|
6609
6638
|
] }) }),
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6639
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6611
6640
|
Button,
|
|
6612
6641
|
{
|
|
6613
6642
|
type: "button",
|
|
@@ -6616,7 +6645,7 @@ function LayeredRuleRow({
|
|
|
6616
6645
|
className: "h-7 w-7 p-0 text-muted-foreground hover:text-destructive max-sm:col-start-3 max-sm:row-start-1",
|
|
6617
6646
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
6618
6647
|
onClick: onRemove,
|
|
6619
|
-
children: /* @__PURE__ */ (0,
|
|
6648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Trash2, { className: "h-3.5 w-3.5" })
|
|
6620
6649
|
}
|
|
6621
6650
|
)
|
|
6622
6651
|
]
|
|
@@ -6715,28 +6744,10 @@ function safeQueryPage(requestedPage, totalItems, pageSize) {
|
|
|
6715
6744
|
}
|
|
6716
6745
|
|
|
6717
6746
|
// src/data-table/MatrxDataTable.tsx
|
|
6718
|
-
var
|
|
6747
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6719
6748
|
function hasSameRowReferences(previous, next) {
|
|
6720
6749
|
return previous.length === next.length && previous.every((row, index) => row === next[index]);
|
|
6721
6750
|
}
|
|
6722
|
-
function forwardUnboundedVerticalWheel(event) {
|
|
6723
|
-
const tableScroller = event.currentTarget;
|
|
6724
|
-
const isVerticalGesture = !event.shiftKey && Math.abs(event.deltaY) > Math.abs(event.deltaX);
|
|
6725
|
-
const tableOwnsVerticalScroll = tableScroller.scrollHeight > tableScroller.clientHeight + 1;
|
|
6726
|
-
if (!isVerticalGesture || tableOwnsVerticalScroll || event.deltaY === 0) return;
|
|
6727
|
-
let ancestor = tableScroller.parentElement;
|
|
6728
|
-
while (ancestor) {
|
|
6729
|
-
const overflowY = window.getComputedStyle(ancestor).overflowY;
|
|
6730
|
-
const canScroll = (overflowY === "auto" || overflowY === "scroll") && ancestor.scrollHeight > ancestor.clientHeight + 1;
|
|
6731
|
-
if (canScroll) {
|
|
6732
|
-
const scale = event.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : event.deltaMode === WheelEvent.DOM_DELTA_PAGE ? ancestor.clientHeight : 1;
|
|
6733
|
-
event.preventDefault();
|
|
6734
|
-
ancestor.scrollTop += event.deltaY * scale;
|
|
6735
|
-
return;
|
|
6736
|
-
}
|
|
6737
|
-
ancestor = ancestor.parentElement;
|
|
6738
|
-
}
|
|
6739
|
-
}
|
|
6740
6751
|
function TableRowCopyControl({
|
|
6741
6752
|
copy,
|
|
6742
6753
|
row,
|
|
@@ -6744,7 +6755,7 @@ function TableRowCopyControl({
|
|
|
6744
6755
|
sourceId,
|
|
6745
6756
|
defaultColumns
|
|
6746
6757
|
}) {
|
|
6747
|
-
return /* @__PURE__ */ (0,
|
|
6758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6748
6759
|
CopyButtons,
|
|
6749
6760
|
{
|
|
6750
6761
|
size,
|
|
@@ -6766,8 +6777,8 @@ function isStringArray(value) {
|
|
|
6766
6777
|
}
|
|
6767
6778
|
var activeUrlTableIds = /* @__PURE__ */ new Set();
|
|
6768
6779
|
function MatrxDataTable(props) {
|
|
6769
|
-
if (!props.urlState) return /* @__PURE__ */ (0,
|
|
6770
|
-
return /* @__PURE__ */ (0,
|
|
6780
|
+
if (!props.urlState) return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MatrxDataTableCore, { ...props });
|
|
6781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
|
|
6771
6782
|
}
|
|
6772
6783
|
function MatrxDataTableWithUrlState({
|
|
6773
6784
|
urlState,
|
|
@@ -6822,7 +6833,7 @@ function MatrxDataTableWithUrlState({
|
|
|
6822
6833
|
props.selection?.onSelectedIdsChange(ids);
|
|
6823
6834
|
}
|
|
6824
6835
|
} : props.selection;
|
|
6825
|
-
return /* @__PURE__ */ (0,
|
|
6836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6826
6837
|
MatrxDataTableCore,
|
|
6827
6838
|
{
|
|
6828
6839
|
...props,
|
|
@@ -6858,8 +6869,10 @@ var COLUMN_REORDER_ACTIVATION_DISTANCE = 6;
|
|
|
6858
6869
|
function MatrxDataTableCore({
|
|
6859
6870
|
data: suppliedData,
|
|
6860
6871
|
columns,
|
|
6872
|
+
tableId,
|
|
6873
|
+
defaultViewSnapshot,
|
|
6861
6874
|
columnState,
|
|
6862
|
-
reorderableColumns =
|
|
6875
|
+
reorderableColumns = true,
|
|
6863
6876
|
columnManager: controlledColumnManager,
|
|
6864
6877
|
getRowId,
|
|
6865
6878
|
searchText,
|
|
@@ -6907,9 +6920,14 @@ function MatrxDataTableCore({
|
|
|
6907
6920
|
const isLoading = appendQuery ? appendQuery.pagination.loading : suppliedLoading;
|
|
6908
6921
|
const isFetching = appendQuery ? appendQuery.pagination.isFetchingNextPage : suppliedFetching;
|
|
6909
6922
|
const host = useMatrxDataTableHost();
|
|
6923
|
+
const SavedViews = host.SavedViews;
|
|
6910
6924
|
const Link = host.Link ?? DefaultTableLink;
|
|
6911
6925
|
const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
|
|
6912
6926
|
const { notify: toast, notice } = useTableNotice();
|
|
6927
|
+
const [savedViewError, setSavedViewError] = (0, import_react13.useState)(null);
|
|
6928
|
+
const [toolbarActionError, setToolbarActionError] = (0, import_react13.useState)(null);
|
|
6929
|
+
const [toolbarActionPending, setToolbarActionPending] = (0, import_react13.useState)({ refresh: false, add: false });
|
|
6930
|
+
const toolbarActionPendingRef = (0, import_react13.useRef)({ refresh: false, add: false });
|
|
6913
6931
|
const CHECKBOX_TAP_AREA = "relative max-lg:before:absolute max-lg:before:left-1/2 max-lg:before:top-1/2 max-lg:before:h-11 max-lg:before:w-11 max-lg:before:-translate-x-1/2 max-lg:before:-translate-y-1/2 max-lg:before:content-['']";
|
|
6914
6932
|
const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
|
|
6915
6933
|
const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
|
|
@@ -7180,11 +7198,12 @@ function MatrxDataTableCore({
|
|
|
7180
7198
|
const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react13.useState)(
|
|
7181
7199
|
() => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
|
|
7182
7200
|
);
|
|
7201
|
+
const knownColumnIds = (0, import_react13.useRef)(new Set(columns.map(columnId)));
|
|
7183
7202
|
const draggedColumnId = (0, import_react13.useRef)(null);
|
|
7184
7203
|
const columnDragActive = (0, import_react13.useRef)(false);
|
|
7185
7204
|
const columnDragRaf = (0, import_react13.useRef)(null);
|
|
7186
7205
|
const columnDragScrollDirection = (0, import_react13.useRef)(0);
|
|
7187
|
-
const [
|
|
7206
|
+
const [columnDragPreview, setColumnDragPreview] = (0, import_react13.useState)(null);
|
|
7188
7207
|
const stopColumnDragScroll = (0, import_react13.useCallback)(() => {
|
|
7189
7208
|
if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
|
|
7190
7209
|
columnDragRaf.current = null;
|
|
@@ -7237,6 +7256,7 @@ function MatrxDataTableCore({
|
|
|
7237
7256
|
(0, import_react13.useEffect)(() => {
|
|
7238
7257
|
const ids = columns.map(columnId);
|
|
7239
7258
|
if (columnState) return;
|
|
7259
|
+
const previousIds = knownColumnIds.current;
|
|
7240
7260
|
setColumnOrder((current) => [
|
|
7241
7261
|
...current.filter((id) => ids.includes(id)),
|
|
7242
7262
|
...ids.filter((id) => !current.includes(id))
|
|
@@ -7244,17 +7264,23 @@ function MatrxDataTableCore({
|
|
|
7244
7264
|
setHiddenColumnIds((current) => {
|
|
7245
7265
|
const next = new Set([...current].filter((id) => ids.includes(id)));
|
|
7246
7266
|
for (const column of columns) {
|
|
7247
|
-
|
|
7267
|
+
const id = columnId(column);
|
|
7268
|
+
if (column.hidden && !previousIds.has(id)) next.add(id);
|
|
7248
7269
|
}
|
|
7249
7270
|
return next;
|
|
7250
7271
|
});
|
|
7272
|
+
knownColumnIds.current = new Set(ids);
|
|
7251
7273
|
}, [columns, columnState]);
|
|
7274
|
+
const previewColumnOrder = (0, import_react13.useMemo)(
|
|
7275
|
+
() => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
7276
|
+
[columnDragPreview, effectiveColumnOrder]
|
|
7277
|
+
);
|
|
7252
7278
|
const visibleColumns = (0, import_react13.useMemo)(() => {
|
|
7253
7279
|
const byId = new Map(columns.map((column) => [columnId(column), column]));
|
|
7254
|
-
return
|
|
7280
|
+
return previewColumnOrder.map((id) => byId.get(id)).filter(
|
|
7255
7281
|
(column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
|
|
7256
7282
|
);
|
|
7257
|
-
}, [columns,
|
|
7283
|
+
}, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
|
|
7258
7284
|
const declaredVisibleCopyColumns = (0, import_react13.useMemo)(
|
|
7259
7285
|
() => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
|
|
7260
7286
|
[visibleColumns]
|
|
@@ -7791,7 +7817,121 @@ function MatrxDataTableCore({
|
|
|
7791
7817
|
}
|
|
7792
7818
|
} : facet
|
|
7793
7819
|
) : toolbar?.facets;
|
|
7794
|
-
|
|
7820
|
+
const renderRecordCell = (row, col, index) => {
|
|
7821
|
+
const id = getRowId(row);
|
|
7822
|
+
const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
|
|
7823
|
+
const rowEdits = edits[id];
|
|
7824
|
+
const display = renderCell(applyRowEdits(row, rowEdits), col, index);
|
|
7825
|
+
const href = col.href?.(row) ?? void 0;
|
|
7826
|
+
if (editEnabled && col.editable && (col.editableIf?.(row) ?? true)) {
|
|
7827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7828
|
+
EditableTableCell,
|
|
7829
|
+
{
|
|
7830
|
+
value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
|
|
7831
|
+
editType: col.editable,
|
|
7832
|
+
...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
|
|
7833
|
+
display,
|
|
7834
|
+
dirty: Boolean(rowEdits && field in rowEdits),
|
|
7835
|
+
onCommit: (next) => commitCell(id, field, next),
|
|
7836
|
+
...href === void 0 ? {} : { href },
|
|
7837
|
+
...col.editTrigger === void 0 ? {} : { editTrigger: col.editTrigger }
|
|
7838
|
+
}
|
|
7839
|
+
);
|
|
7840
|
+
}
|
|
7841
|
+
return href ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
|
|
7842
|
+
};
|
|
7843
|
+
const currentViewSnapshot = (0, import_react13.useMemo)(
|
|
7844
|
+
() => ({
|
|
7845
|
+
__kind: "matrx-table-view",
|
|
7846
|
+
version: 1,
|
|
7847
|
+
query: {
|
|
7848
|
+
pageSize,
|
|
7849
|
+
search: searchValue,
|
|
7850
|
+
...searchMatchMode === "contains" ? {} : { searchMatchMode },
|
|
7851
|
+
anyOf: anyOfValue,
|
|
7852
|
+
...layeredFilters.length ? { layeredFilters } : {},
|
|
7853
|
+
columnFilters,
|
|
7854
|
+
sort
|
|
7855
|
+
},
|
|
7856
|
+
columns: {
|
|
7857
|
+
order: effectiveColumnOrder,
|
|
7858
|
+
hidden: [...effectiveHiddenColumnIds]
|
|
7859
|
+
}
|
|
7860
|
+
}),
|
|
7861
|
+
[
|
|
7862
|
+
anyOfValue,
|
|
7863
|
+
columnFilters,
|
|
7864
|
+
effectiveColumnOrder,
|
|
7865
|
+
effectiveHiddenColumnIds,
|
|
7866
|
+
layeredFilters,
|
|
7867
|
+
pageSize,
|
|
7868
|
+
searchMatchMode,
|
|
7869
|
+
searchValue,
|
|
7870
|
+
sort
|
|
7871
|
+
]
|
|
7872
|
+
);
|
|
7873
|
+
const declaredDefaultViewSnapshot = (0, import_react13.useMemo)(
|
|
7874
|
+
() => defaultViewSnapshot ?? {
|
|
7875
|
+
__kind: "matrx-table-view",
|
|
7876
|
+
version: 1,
|
|
7877
|
+
query: {
|
|
7878
|
+
pageSize: defaultPageSize,
|
|
7879
|
+
search: "",
|
|
7880
|
+
anyOf: "",
|
|
7881
|
+
layeredFilters: [],
|
|
7882
|
+
columnFilters: {},
|
|
7883
|
+
sort: defaultSort
|
|
7884
|
+
},
|
|
7885
|
+
columns: {
|
|
7886
|
+
order: columns.map(columnId),
|
|
7887
|
+
hidden: columns.filter((column) => column.hidden).map(columnId)
|
|
7888
|
+
}
|
|
7889
|
+
},
|
|
7890
|
+
[columns, defaultPageSize, defaultSort, defaultViewSnapshot]
|
|
7891
|
+
);
|
|
7892
|
+
const applySavedView = (0, import_react13.useCallback)(
|
|
7893
|
+
(rawSnapshot) => {
|
|
7894
|
+
const snapshot = parseTableViewSnapshot(rawSnapshot);
|
|
7895
|
+
if (!snapshot) {
|
|
7896
|
+
const message = "This saved view has an unsupported format. The current table was left unchanged.";
|
|
7897
|
+
setSavedViewError(message);
|
|
7898
|
+
throw new Error(message);
|
|
7899
|
+
}
|
|
7900
|
+
const knownColumns = new Set(columns.map(columnId));
|
|
7901
|
+
const unknown = [
|
|
7902
|
+
...snapshot.columns.order,
|
|
7903
|
+
...snapshot.columns.hidden,
|
|
7904
|
+
...Object.keys(snapshot.query.columnFilters),
|
|
7905
|
+
...snapshot.query.sort ? [snapshot.query.sort.id] : [],
|
|
7906
|
+
...snapshot.query.layeredFilters?.map((rule) => rule.field) ?? []
|
|
7907
|
+
].filter((id, index, values) => !knownColumns.has(id) && values.indexOf(id) === index);
|
|
7908
|
+
if (unknown.length > 0) {
|
|
7909
|
+
const message = `This saved view refers to unavailable columns: ${unknown.join(", ")}. The current table was left unchanged.`;
|
|
7910
|
+
setSavedViewError(message);
|
|
7911
|
+
throw new Error(message);
|
|
7912
|
+
}
|
|
7913
|
+
setSavedViewError(null);
|
|
7914
|
+
const nextQuery = { ...snapshot.query, page: 1 };
|
|
7915
|
+
const nextOrder = [...snapshot.columns.order, ...columns.map(columnId).filter((id) => !snapshot.columns.order.includes(id))];
|
|
7916
|
+
if (controlledQuery) {
|
|
7917
|
+
controlledQuery.onStateChange(nextQuery);
|
|
7918
|
+
toolbar?.onSearchChange?.(nextQuery.search);
|
|
7919
|
+
toolbar?.anyOf?.onChange?.(nextQuery.anyOf);
|
|
7920
|
+
} else {
|
|
7921
|
+
setSearchValue(nextQuery.search);
|
|
7922
|
+
setInternalSearchMatchMode(nextQuery.searchMatchMode ?? "contains");
|
|
7923
|
+
setAnyOfValue(nextQuery.anyOf);
|
|
7924
|
+
setInternalLayeredFilters(nextQuery.layeredFilters ?? []);
|
|
7925
|
+
setInternalColumnFilters(nextQuery.columnFilters);
|
|
7926
|
+
setInternalSort(nextQuery.sort);
|
|
7927
|
+
setInternalPageSize(nextQuery.pageSize);
|
|
7928
|
+
setInternalPage(1);
|
|
7929
|
+
}
|
|
7930
|
+
commitColumnState(nextOrder, new Set(snapshot.columns.hidden));
|
|
7931
|
+
},
|
|
7932
|
+
[columns, commitColumnState, controlledQuery, toolbar]
|
|
7933
|
+
);
|
|
7934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7795
7935
|
import_core3.DndContext,
|
|
7796
7936
|
{
|
|
7797
7937
|
id: tableDndContextId,
|
|
@@ -7806,8 +7946,10 @@ function MatrxDataTableCore({
|
|
|
7806
7946
|
onDragStart: (event) => {
|
|
7807
7947
|
const kind = event.active.data.current?.matrxDragKind;
|
|
7808
7948
|
if (kind === "column-header") {
|
|
7809
|
-
|
|
7949
|
+
const draggedId = String(event.active.data.current?.columnId);
|
|
7950
|
+
draggedColumnId.current = draggedId;
|
|
7810
7951
|
columnDragActive.current = true;
|
|
7952
|
+
setColumnDragPreview({ draggedId, targetId: null, after: false });
|
|
7811
7953
|
return;
|
|
7812
7954
|
}
|
|
7813
7955
|
if (kind === "column-manager") return;
|
|
@@ -7820,13 +7962,18 @@ function MatrxDataTableCore({
|
|
|
7820
7962
|
const activeRect = event.active.rect.current.translated;
|
|
7821
7963
|
const overRect = event.over?.rect;
|
|
7822
7964
|
if (!overId || !activeRect || !overRect) {
|
|
7823
|
-
|
|
7965
|
+
setColumnDragPreview(
|
|
7966
|
+
(current) => current?.targetId === null ? current : current ? { ...current, targetId: null } : current
|
|
7967
|
+
);
|
|
7824
7968
|
columnDragScrollDirection.current = 0;
|
|
7825
7969
|
stopColumnDragScroll();
|
|
7826
7970
|
return;
|
|
7827
7971
|
}
|
|
7828
7972
|
const after = activeRect.left + activeRect.width / 2 >= overRect.left + overRect.width / 2;
|
|
7829
|
-
|
|
7973
|
+
setColumnDragPreview((current) => {
|
|
7974
|
+
if (!current) return current;
|
|
7975
|
+
return current.targetId === overId && current.after === after ? current : { ...current, targetId: String(overId), after };
|
|
7976
|
+
});
|
|
7830
7977
|
const scroll = scrollRef.current;
|
|
7831
7978
|
if (!scroll) return;
|
|
7832
7979
|
const bounds = scroll.getBoundingClientRect();
|
|
@@ -7838,7 +7985,7 @@ function MatrxDataTableCore({
|
|
|
7838
7985
|
onDragCancel: () => {
|
|
7839
7986
|
columnDragActive.current = false;
|
|
7840
7987
|
draggedColumnId.current = null;
|
|
7841
|
-
|
|
7988
|
+
setColumnDragPreview(null);
|
|
7842
7989
|
stopColumnDragScroll();
|
|
7843
7990
|
setDraggedRowId(null);
|
|
7844
7991
|
},
|
|
@@ -7856,8 +8003,15 @@ function MatrxDataTableCore({
|
|
|
7856
8003
|
const overRect = event.over?.rect;
|
|
7857
8004
|
columnDragActive.current = false;
|
|
7858
8005
|
draggedColumnId.current = null;
|
|
7859
|
-
|
|
8006
|
+
setColumnDragPreview(null);
|
|
7860
8007
|
stopColumnDragScroll();
|
|
8008
|
+
if (columnDragPreview?.draggedId === from && columnDragPreview.targetId !== null && columnDragPreview.targetId !== from) {
|
|
8009
|
+
commitColumnState(
|
|
8010
|
+
projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
|
|
8011
|
+
effectiveHiddenColumnIds
|
|
8012
|
+
);
|
|
8013
|
+
return;
|
|
8014
|
+
}
|
|
7861
8015
|
if (!target || from === target || !activeRect || !overRect) return;
|
|
7862
8016
|
const order = [...effectiveColumnOrder];
|
|
7863
8017
|
const fromIndex = order.indexOf(from);
|
|
@@ -7870,10 +8024,11 @@ function MatrxDataTableCore({
|
|
|
7870
8024
|
commitColumnState(order, effectiveHiddenColumnIds);
|
|
7871
8025
|
},
|
|
7872
8026
|
children: [
|
|
7873
|
-
/* @__PURE__ */ (0,
|
|
8027
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7874
8028
|
"div",
|
|
7875
8029
|
{
|
|
7876
8030
|
ref: rootRef,
|
|
8031
|
+
"data-matrx-table": true,
|
|
7877
8032
|
"data-url-state-table": urlState?.id,
|
|
7878
8033
|
className: cn(
|
|
7879
8034
|
// The touch-target floor deliberately SKIPS checkboxes, radios and
|
|
@@ -7888,11 +8043,22 @@ function MatrxDataTableCore({
|
|
|
7888
8043
|
),
|
|
7889
8044
|
children: [
|
|
7890
8045
|
notice,
|
|
7891
|
-
|
|
8046
|
+
savedViewError ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
|
|
8047
|
+
toolbarActionError ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
|
|
8048
|
+
!hideToolbar && (toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7892
8049
|
TableTitleRow,
|
|
7893
8050
|
{
|
|
7894
8051
|
...toolbar?.title === void 0 ? {} : { title: toolbar.title },
|
|
7895
|
-
|
|
8052
|
+
context: tableId && SavedViews ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8053
|
+
SavedViews,
|
|
8054
|
+
{
|
|
8055
|
+
tableId,
|
|
8056
|
+
snapshot: currentViewSnapshot,
|
|
8057
|
+
defaultSnapshot: declaredDefaultViewSnapshot,
|
|
8058
|
+
onApply: applySavedView
|
|
8059
|
+
}
|
|
8060
|
+
) : void 0,
|
|
8061
|
+
search: showSearch ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7896
8062
|
"div",
|
|
7897
8063
|
{
|
|
7898
8064
|
"data-matrx-table-search": true,
|
|
@@ -7901,9 +8067,9 @@ function MatrxDataTableCore({
|
|
|
7901
8067
|
toolbar?.searchMatch ? "sm:max-w-md" : "sm:max-w-xs"
|
|
7902
8068
|
),
|
|
7903
8069
|
children: [
|
|
7904
|
-
/* @__PURE__ */ (0,
|
|
7905
|
-
/* @__PURE__ */ (0,
|
|
7906
|
-
/* @__PURE__ */ (0,
|
|
8070
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
8071
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
8072
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7907
8073
|
Input,
|
|
7908
8074
|
{
|
|
7909
8075
|
value: searchValue,
|
|
@@ -7916,22 +8082,22 @@ function MatrxDataTableCore({
|
|
|
7916
8082
|
style: { fontSize: "16px" }
|
|
7917
8083
|
}
|
|
7918
8084
|
),
|
|
7919
|
-
searchValue ? /* @__PURE__ */ (0,
|
|
7920
|
-
/* @__PURE__ */ (0,
|
|
8085
|
+
searchValue ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8086
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7921
8087
|
"button",
|
|
7922
8088
|
{
|
|
7923
8089
|
type: "button",
|
|
7924
8090
|
"aria-label": "Clear search",
|
|
7925
8091
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
7926
8092
|
onClick: () => setSearchValue(""),
|
|
7927
|
-
children: /* @__PURE__ */ (0,
|
|
8093
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
7928
8094
|
}
|
|
7929
8095
|
) }),
|
|
7930
|
-
/* @__PURE__ */ (0,
|
|
8096
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "Clear search" })
|
|
7931
8097
|
] }) : null
|
|
7932
8098
|
] }),
|
|
7933
|
-
toolbar?.searchMatch ? /* @__PURE__ */ (0,
|
|
7934
|
-
/* @__PURE__ */ (0,
|
|
8099
|
+
toolbar?.searchMatch ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8100
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7935
8101
|
Button,
|
|
7936
8102
|
{
|
|
7937
8103
|
type: "button",
|
|
@@ -7944,18 +8110,18 @@ function MatrxDataTableCore({
|
|
|
7944
8110
|
searchMatchMode === "whole_words" ? "contains" : "whole_words"
|
|
7945
8111
|
),
|
|
7946
8112
|
children: [
|
|
7947
|
-
/* @__PURE__ */ (0,
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(WholeWord, { className: "h-3.5 w-3.5" }),
|
|
7948
8114
|
searchMatchMode === "whole_words" ? "Whole words" : "Contains"
|
|
7949
8115
|
]
|
|
7950
8116
|
}
|
|
7951
8117
|
) }),
|
|
7952
|
-
/* @__PURE__ */ (0,
|
|
8118
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
|
|
7953
8119
|
] }) : null
|
|
7954
8120
|
]
|
|
7955
8121
|
}
|
|
7956
8122
|
) : null,
|
|
7957
8123
|
children: [
|
|
7958
|
-
toolbar?.layeredFilters ? /* @__PURE__ */ (0,
|
|
8124
|
+
toolbar?.layeredFilters ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7959
8125
|
LayeredFilterBuilder,
|
|
7960
8126
|
{
|
|
7961
8127
|
fields: toolbar.layeredFilters.fields,
|
|
@@ -7965,9 +8131,9 @@ function MatrxDataTableCore({
|
|
|
7965
8131
|
label: toolbar.layeredFilters.label
|
|
7966
8132
|
}
|
|
7967
8133
|
) : null,
|
|
7968
|
-
toolbar?.anyOf ? /* @__PURE__ */ (0,
|
|
7969
|
-
/* @__PURE__ */ (0,
|
|
7970
|
-
/* @__PURE__ */ (0,
|
|
8134
|
+
toolbar?.anyOf ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative w-full max-w-xs", children: [
|
|
8135
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
8136
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7971
8137
|
Input,
|
|
7972
8138
|
{
|
|
7973
8139
|
value: anyOfValue,
|
|
@@ -7977,29 +8143,29 @@ function MatrxDataTableCore({
|
|
|
7977
8143
|
style: { fontSize: "16px" }
|
|
7978
8144
|
}
|
|
7979
8145
|
),
|
|
7980
|
-
anyOfValue ? /* @__PURE__ */ (0,
|
|
7981
|
-
/* @__PURE__ */ (0,
|
|
8146
|
+
anyOfValue ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8147
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7982
8148
|
"button",
|
|
7983
8149
|
{
|
|
7984
8150
|
type: "button",
|
|
7985
8151
|
"aria-label": "Clear match-any search",
|
|
7986
8152
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
7987
8153
|
onClick: () => setAnyOfValue(""),
|
|
7988
|
-
children: /* @__PURE__ */ (0,
|
|
8154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
7989
8155
|
}
|
|
7990
8156
|
) }),
|
|
7991
|
-
/* @__PURE__ */ (0,
|
|
8157
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "Clear match-any search" })
|
|
7992
8158
|
] }) : null
|
|
7993
8159
|
] }) : null,
|
|
7994
|
-
renderedFacets ? /* @__PURE__ */ (0,
|
|
8160
|
+
renderedFacets ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ToolbarFacets, { facets: renderedFacets }) : null,
|
|
7995
8161
|
toolbar?.leading,
|
|
7996
|
-
/* @__PURE__ */ (0,
|
|
8162
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7997
8163
|
"div",
|
|
7998
8164
|
{
|
|
7999
8165
|
"data-matrx-table-actions": true,
|
|
8000
8166
|
className: "ml-auto flex min-w-0 flex-wrap items-center gap-2",
|
|
8001
8167
|
children: [
|
|
8002
|
-
sourceTotal !== void 0 ? /* @__PURE__ */ (0,
|
|
8168
|
+
sourceTotal !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8003
8169
|
"span",
|
|
8004
8170
|
{
|
|
8005
8171
|
"data-matrx-table-source-total": true,
|
|
@@ -8016,8 +8182,8 @@ function MatrxDataTableCore({
|
|
|
8016
8182
|
]
|
|
8017
8183
|
}
|
|
8018
8184
|
) : null,
|
|
8019
|
-
|
|
8020
|
-
/* @__PURE__ */ (0,
|
|
8185
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8186
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8021
8187
|
Button,
|
|
8022
8188
|
{
|
|
8023
8189
|
type: "button",
|
|
@@ -8025,16 +8191,17 @@ function MatrxDataTableCore({
|
|
|
8025
8191
|
size: "sm",
|
|
8026
8192
|
className: "h-7 gap-1 px-2 text-xs text-muted-foreground",
|
|
8027
8193
|
onClick: clearAllFilters,
|
|
8194
|
+
disabled: !hasActiveFilters,
|
|
8028
8195
|
"aria-label": "Clear all filters",
|
|
8029
8196
|
children: [
|
|
8030
|
-
/* @__PURE__ */ (0,
|
|
8031
|
-
/* @__PURE__ */ (0,
|
|
8197
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Eraser, { className: "h-3.5 w-3.5" }),
|
|
8198
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "max-sm:sr-only", children: "Clear all" })
|
|
8032
8199
|
]
|
|
8033
8200
|
}
|
|
8034
|
-
) }),
|
|
8035
|
-
/* @__PURE__ */ (0,
|
|
8036
|
-
] })
|
|
8037
|
-
showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
8201
|
+
) }) }),
|
|
8202
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: hasActiveFilters ? "Clear search and filters; keep columns and sort" : "No search or filters to clear" })
|
|
8203
|
+
] }),
|
|
8204
|
+
showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8038
8205
|
CopyButtons,
|
|
8039
8206
|
{
|
|
8040
8207
|
size: "icon",
|
|
@@ -8074,8 +8241,8 @@ function MatrxDataTableCore({
|
|
|
8074
8241
|
}
|
|
8075
8242
|
}
|
|
8076
8243
|
) : null,
|
|
8077
|
-
columns.length > 0 ? /* @__PURE__ */ (0,
|
|
8078
|
-
/* @__PURE__ */ (0,
|
|
8244
|
+
columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8245
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8079
8246
|
Button,
|
|
8080
8247
|
{
|
|
8081
8248
|
type: "button",
|
|
@@ -8085,15 +8252,80 @@ function MatrxDataTableCore({
|
|
|
8085
8252
|
className: "h-8 w-8",
|
|
8086
8253
|
onClick: () => setColumnManagerOpen(true),
|
|
8087
8254
|
children: [
|
|
8088
|
-
/* @__PURE__ */ (0,
|
|
8089
|
-
effectiveHiddenColumnIds.size > 0 ? /* @__PURE__ */ (0,
|
|
8255
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SlidersHorizontal, { className: "h-4 w-4" }),
|
|
8256
|
+
effectiveHiddenColumnIds.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "sr-only", children: [
|
|
8090
8257
|
effectiveHiddenColumnIds.size,
|
|
8091
8258
|
" hidden"
|
|
8092
8259
|
] }) : null
|
|
8093
8260
|
]
|
|
8094
8261
|
}
|
|
8095
8262
|
) }),
|
|
8096
|
-
/* @__PURE__ */ (0,
|
|
8263
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "Show, hide, or reorder columns" })
|
|
8264
|
+
] }) : null,
|
|
8265
|
+
toolbar?.refresh ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8266
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8267
|
+
Button,
|
|
8268
|
+
{
|
|
8269
|
+
type: "button",
|
|
8270
|
+
variant: "ghost",
|
|
8271
|
+
size: "icon",
|
|
8272
|
+
className: "h-8 w-8",
|
|
8273
|
+
"aria-label": toolbar.refresh.label ?? "Refresh",
|
|
8274
|
+
disabled: isFetching || toolbarActionPending.refresh,
|
|
8275
|
+
onClick: () => {
|
|
8276
|
+
if (toolbarActionPendingRef.current.refresh) return;
|
|
8277
|
+
toolbarActionPendingRef.current.refresh = true;
|
|
8278
|
+
setToolbarActionPending((current) => ({ ...current, refresh: true }));
|
|
8279
|
+
setToolbarActionError(null);
|
|
8280
|
+
void Promise.resolve().then(() => toolbar.refresh?.onRefresh()).catch((cause) => {
|
|
8281
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8282
|
+
setToolbarActionError(`Refresh failed: ${message}`);
|
|
8283
|
+
toast.error(`Refresh failed: ${message}`);
|
|
8284
|
+
}).finally(() => {
|
|
8285
|
+
toolbarActionPendingRef.current.refresh = false;
|
|
8286
|
+
setToolbarActionPending((current) => ({ ...current, refresh: false }));
|
|
8287
|
+
});
|
|
8288
|
+
},
|
|
8289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8290
|
+
Loader2,
|
|
8291
|
+
{
|
|
8292
|
+
className: cn(
|
|
8293
|
+
"h-4 w-4",
|
|
8294
|
+
(isFetching || toolbarActionPending.refresh) && "animate-spin"
|
|
8295
|
+
)
|
|
8296
|
+
}
|
|
8297
|
+
)
|
|
8298
|
+
}
|
|
8299
|
+
) }) }),
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: isFetching ? "Refreshing table data" : toolbar.refresh.label ?? "Refresh" })
|
|
8301
|
+
] }) : null,
|
|
8302
|
+
toolbar?.add ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8303
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8304
|
+
Button,
|
|
8305
|
+
{
|
|
8306
|
+
type: "button",
|
|
8307
|
+
size: "icon",
|
|
8308
|
+
className: "h-8 w-8",
|
|
8309
|
+
"aria-label": "Add",
|
|
8310
|
+
disabled: toolbar.add.disabled || toolbarActionPending.add,
|
|
8311
|
+
onClick: () => {
|
|
8312
|
+
if (toolbarActionPendingRef.current.add) return;
|
|
8313
|
+
toolbarActionPendingRef.current.add = true;
|
|
8314
|
+
setToolbarActionPending((current) => ({ ...current, add: true }));
|
|
8315
|
+
setToolbarActionError(null);
|
|
8316
|
+
void Promise.resolve().then(() => toolbar.add?.onAdd()).catch((cause) => {
|
|
8317
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8318
|
+
setToolbarActionError(`Add failed: ${message}`);
|
|
8319
|
+
toast.error(`Add failed: ${message}`);
|
|
8320
|
+
}).finally(() => {
|
|
8321
|
+
toolbarActionPendingRef.current.add = false;
|
|
8322
|
+
setToolbarActionPending((current) => ({ ...current, add: false }));
|
|
8323
|
+
});
|
|
8324
|
+
},
|
|
8325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Plus, { className: "h-4 w-4" })
|
|
8326
|
+
}
|
|
8327
|
+
) }) }),
|
|
8328
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: toolbar.add.disabled ? toolbar.add.disabledReason ?? "Add unavailable" : "Add" })
|
|
8097
8329
|
] }) : null,
|
|
8098
8330
|
toolbar?.actions
|
|
8099
8331
|
]
|
|
@@ -8102,15 +8334,15 @@ function MatrxDataTableCore({
|
|
|
8102
8334
|
]
|
|
8103
8335
|
}
|
|
8104
8336
|
),
|
|
8105
|
-
selection && selectionCount > 0 ? /* @__PURE__ */ (0,
|
|
8106
|
-
/* @__PURE__ */ (0,
|
|
8337
|
+
selection && selectionCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
|
|
8338
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-xs font-medium text-foreground", children: [
|
|
8107
8339
|
selectionCount.toLocaleString(),
|
|
8108
8340
|
" ",
|
|
8109
8341
|
selectionNoun,
|
|
8110
8342
|
selectionCount === 1 ? "" : "s",
|
|
8111
8343
|
" selected"
|
|
8112
8344
|
] }),
|
|
8113
|
-
/* @__PURE__ */ (0,
|
|
8345
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8114
8346
|
Button,
|
|
8115
8347
|
{
|
|
8116
8348
|
type: "button",
|
|
@@ -8122,13 +8354,13 @@ function MatrxDataTableCore({
|
|
|
8122
8354
|
selection.onSelectedIdsChange([]);
|
|
8123
8355
|
},
|
|
8124
8356
|
children: [
|
|
8125
|
-
/* @__PURE__ */ (0,
|
|
8357
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
8126
8358
|
"Clear"
|
|
8127
8359
|
]
|
|
8128
8360
|
}
|
|
8129
8361
|
),
|
|
8130
|
-
/* @__PURE__ */ (0,
|
|
8131
|
-
effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0,
|
|
8362
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
|
|
8363
|
+
effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8132
8364
|
CopyButtons,
|
|
8133
8365
|
{
|
|
8134
8366
|
size: "icon",
|
|
@@ -8158,9 +8390,9 @@ function MatrxDataTableCore({
|
|
|
8158
8390
|
selection.actions?.(selectedRows, selection.selectedIds)
|
|
8159
8391
|
] })
|
|
8160
8392
|
] }) : null,
|
|
8161
|
-
/* @__PURE__ */ (0,
|
|
8162
|
-
/* @__PURE__ */ (0,
|
|
8163
|
-
mobileCards ? /* @__PURE__ */ (0,
|
|
8393
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
8394
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
|
|
8395
|
+
mobileCards ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8164
8396
|
"div",
|
|
8165
8397
|
{
|
|
8166
8398
|
ref: cardsScrollRef,
|
|
@@ -8172,33 +8404,37 @@ function MatrxDataTableCore({
|
|
|
8172
8404
|
mobileCardsClass
|
|
8173
8405
|
),
|
|
8174
8406
|
children: [
|
|
8175
|
-
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0,
|
|
8407
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8176
8408
|
"div",
|
|
8177
8409
|
{
|
|
8178
8410
|
role: "status",
|
|
8179
8411
|
className: "h-0.5 shrink-0 overflow-hidden rounded-full bg-primary/15",
|
|
8180
8412
|
children: [
|
|
8181
|
-
/* @__PURE__ */ (0,
|
|
8182
|
-
/* @__PURE__ */ (0,
|
|
8413
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
8414
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
8183
8415
|
]
|
|
8184
8416
|
}
|
|
8185
8417
|
) : null,
|
|
8186
|
-
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0,
|
|
8418
|
+
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8187
8419
|
Skeleton,
|
|
8188
8420
|
{
|
|
8189
8421
|
className: "h-52 w-full shrink-0 rounded-lg"
|
|
8190
8422
|
},
|
|
8191
8423
|
`mobile-card-sk-${index}`
|
|
8192
|
-
)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
8424
|
+
)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
|
|
8193
8425
|
emptyState?.icon,
|
|
8194
|
-
/* @__PURE__ */ (0,
|
|
8195
|
-
emptyState?.description ? /* @__PURE__ */ (0,
|
|
8426
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
|
|
8427
|
+
emptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
|
|
8196
8428
|
emptyState?.action
|
|
8197
8429
|
] }) }) : paginated.map((row, index) => {
|
|
8198
8430
|
const id = getRowId(row);
|
|
8199
8431
|
const displayRow = applyRowEdits(row, edits[id]);
|
|
8200
8432
|
const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
|
|
8201
|
-
return /* @__PURE__ */ (0,
|
|
8433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react13.Fragment, { children: mobileCards(displayRow, index, {
|
|
8434
|
+
renderCell: (columnKey) => {
|
|
8435
|
+
const column = columns.find((candidate) => columnId(candidate) === columnKey);
|
|
8436
|
+
return column ? renderRecordCell(row, column, index) : null;
|
|
8437
|
+
},
|
|
8202
8438
|
selected: selectedIdSet.has(id),
|
|
8203
8439
|
selectable,
|
|
8204
8440
|
onSelectedChange: (nextSelected) => {
|
|
@@ -8210,13 +8446,13 @@ function MatrxDataTableCore({
|
|
|
8210
8446
|
else next.delete(id);
|
|
8211
8447
|
setSelectedIds(next);
|
|
8212
8448
|
},
|
|
8213
|
-
actions: showRowCopy || rowActions ? /* @__PURE__ */ (0,
|
|
8449
|
+
actions: showRowCopy || rowActions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8214
8450
|
"div",
|
|
8215
8451
|
{
|
|
8216
8452
|
className: "inline-flex items-center gap-1",
|
|
8217
8453
|
onClick: (event) => event.stopPropagation(),
|
|
8218
8454
|
children: [
|
|
8219
|
-
showRowCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
8455
|
+
showRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8220
8456
|
TableRowCopyControl,
|
|
8221
8457
|
{
|
|
8222
8458
|
size: "xs",
|
|
@@ -8239,7 +8475,7 @@ function MatrxDataTableCore({
|
|
|
8239
8475
|
) : null
|
|
8240
8476
|
}) }, id);
|
|
8241
8477
|
}),
|
|
8242
|
-
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
8478
|
+
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8243
8479
|
"div",
|
|
8244
8480
|
{
|
|
8245
8481
|
"data-matrx-table-append-loading-card": true,
|
|
@@ -8247,7 +8483,7 @@ function MatrxDataTableCore({
|
|
|
8247
8483
|
"aria-live": "polite",
|
|
8248
8484
|
className: "sticky bottom-0 z-20 flex h-16 w-full max-w-[100cqw] shrink-0 items-center justify-center gap-2 rounded-md border border-border bg-card/95 px-3 text-sm font-medium text-foreground shadow-sm backdrop-blur-sm",
|
|
8249
8485
|
children: [
|
|
8250
|
-
/* @__PURE__ */ (0,
|
|
8486
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8251
8487
|
Loader2,
|
|
8252
8488
|
{
|
|
8253
8489
|
"aria-hidden": "true",
|
|
@@ -8261,13 +8497,12 @@ function MatrxDataTableCore({
|
|
|
8261
8497
|
]
|
|
8262
8498
|
}
|
|
8263
8499
|
) : null,
|
|
8264
|
-
/* @__PURE__ */ (0,
|
|
8500
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8265
8501
|
"div",
|
|
8266
8502
|
{
|
|
8267
8503
|
ref: scrollRef,
|
|
8268
8504
|
"data-matrx-table-scroll": true,
|
|
8269
8505
|
onScroll: updateScrollHint,
|
|
8270
|
-
onWheel: forwardUnboundedVerticalWheel,
|
|
8271
8506
|
"aria-busy": isLoading || isFetching,
|
|
8272
8507
|
...appendQuery === null ? {} : { style: { containerType: "inline-size" } },
|
|
8273
8508
|
className: cn(
|
|
@@ -8276,34 +8511,34 @@ function MatrxDataTableCore({
|
|
|
8276
8511
|
tableClassName
|
|
8277
8512
|
),
|
|
8278
8513
|
children: [
|
|
8279
|
-
hierarchy && draggedRow ? /* @__PURE__ */ (0,
|
|
8514
|
+
hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8280
8515
|
HierarchyRootDropTarget,
|
|
8281
8516
|
{
|
|
8282
8517
|
label: hierarchy.rootDropLabel ?? "Drop here to move to the top level",
|
|
8283
8518
|
draggedLabel: hierarchy.itemLabel?.(draggedRow) ?? "Moving row"
|
|
8284
8519
|
}
|
|
8285
8520
|
) : null,
|
|
8286
|
-
hierarchy && draggedRowId ? /* @__PURE__ */ (0,
|
|
8521
|
+
hierarchy && draggedRowId ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8287
8522
|
HierarchyDragIndicatorLayer,
|
|
8288
8523
|
{
|
|
8289
8524
|
scrollRef,
|
|
8290
8525
|
resolve: resolveHierarchyMove
|
|
8291
8526
|
}
|
|
8292
8527
|
) : null,
|
|
8293
|
-
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0,
|
|
8528
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8294
8529
|
"div",
|
|
8295
8530
|
{
|
|
8296
8531
|
role: "status",
|
|
8297
8532
|
className: "sticky left-0 top-0 z-20 h-0.5 w-full overflow-hidden bg-primary/15",
|
|
8298
8533
|
children: [
|
|
8299
|
-
/* @__PURE__ */ (0,
|
|
8300
|
-
/* @__PURE__ */ (0,
|
|
8534
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
8535
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
8301
8536
|
]
|
|
8302
8537
|
}
|
|
8303
8538
|
) : null,
|
|
8304
|
-
/* @__PURE__ */ (0,
|
|
8305
|
-
/* @__PURE__ */ (0,
|
|
8306
|
-
selection ? /* @__PURE__ */ (0,
|
|
8539
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("table", { className: "table w-max min-w-full max-w-none caption-bottom overflow-visible text-sm sm:w-full sm:min-w-0 sm:max-w-full", children: [
|
|
8540
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("thead", { className: "sticky top-0 z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("tr", { children: [
|
|
8541
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("th", { className: "h-9 w-9 px-2 text-left align-middle", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8307
8542
|
Checkbox,
|
|
8308
8543
|
{
|
|
8309
8544
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -8319,9 +8554,11 @@ function MatrxDataTableCore({
|
|
|
8319
8554
|
const isSorted = sort?.id === id;
|
|
8320
8555
|
const headerLabel = col.label ?? (typeof col.header === "string" ? col.header : id);
|
|
8321
8556
|
const defaultSortDirection = col.defaultSortDirection ?? "asc";
|
|
8322
|
-
|
|
8557
|
+
const isColumnDragShadow = columnDragPreview?.draggedId === id && columnDragPreview.targetId !== null;
|
|
8558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8323
8559
|
"th",
|
|
8324
8560
|
{
|
|
8561
|
+
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
8325
8562
|
"aria-sort": isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : void 0,
|
|
8326
8563
|
className: cn(
|
|
8327
8564
|
"h-9 text-left align-middle max-sm:whitespace-nowrap",
|
|
@@ -8341,12 +8578,12 @@ function MatrxDataTableCore({
|
|
|
8341
8578
|
// horizontal-scroll surface.
|
|
8342
8579
|
col.width !== void 0 && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)]",
|
|
8343
8580
|
col.headerClassName,
|
|
8344
|
-
|
|
8581
|
+
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
8345
8582
|
col.align === "center" && "text-center",
|
|
8346
8583
|
col.align === "right" && "text-right"
|
|
8347
8584
|
),
|
|
8348
8585
|
style: columnWidthVar(col.width),
|
|
8349
|
-
children: /* @__PURE__ */ (0,
|
|
8586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8350
8587
|
ColumnHeaderCell,
|
|
8351
8588
|
{
|
|
8352
8589
|
label: col.header,
|
|
@@ -8387,12 +8624,12 @@ function MatrxDataTableCore({
|
|
|
8387
8624
|
id
|
|
8388
8625
|
);
|
|
8389
8626
|
}),
|
|
8390
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
8627
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("th", { className: "h-9 w-28 px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Actions" })
|
|
8391
8628
|
] }) }),
|
|
8392
|
-
/* @__PURE__ */ (0,
|
|
8393
|
-
isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0,
|
|
8394
|
-
selection ? /* @__PURE__ */ (0,
|
|
8395
|
-
visibleColumns.map((col) => /* @__PURE__ */ (0,
|
|
8629
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("tbody", { children: [
|
|
8630
|
+
isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("tr", { className: "border-b border-border/60", children: [
|
|
8631
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("td", { className: "px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
|
|
8632
|
+
visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8396
8633
|
"td",
|
|
8397
8634
|
{
|
|
8398
8635
|
className: cn(
|
|
@@ -8400,20 +8637,20 @@ function MatrxDataTableCore({
|
|
|
8400
8637
|
col.compact ? "px-1" : "px-2",
|
|
8401
8638
|
col.mobileHidden && "max-sm:hidden"
|
|
8402
8639
|
),
|
|
8403
|
-
children: /* @__PURE__ */ (0,
|
|
8640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { className: "h-5 w-full" })
|
|
8404
8641
|
},
|
|
8405
8642
|
columnId(col)
|
|
8406
8643
|
)),
|
|
8407
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
8408
|
-
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
8644
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("td", { className: "px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { className: "ml-auto h-5 w-10" }) })
|
|
8645
|
+
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8409
8646
|
"td",
|
|
8410
8647
|
{
|
|
8411
8648
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
8412
8649
|
className: "px-4 py-12 text-center",
|
|
8413
|
-
children: /* @__PURE__ */ (0,
|
|
8650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2", children: [
|
|
8414
8651
|
emptyState?.icon,
|
|
8415
|
-
/* @__PURE__ */ (0,
|
|
8416
|
-
emptyState?.description ? /* @__PURE__ */ (0,
|
|
8652
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
|
|
8653
|
+
emptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
|
|
8417
8654
|
emptyState?.action
|
|
8418
8655
|
] })
|
|
8419
8656
|
}
|
|
@@ -8423,7 +8660,7 @@ function MatrxDataTableCore({
|
|
|
8423
8660
|
const rowEdits = edits[id];
|
|
8424
8661
|
const displayRow = applyRowEdits(row, rowEdits);
|
|
8425
8662
|
const isChecked = selectedIdSet.has(id);
|
|
8426
|
-
const rowNode = /* @__PURE__ */ (0,
|
|
8663
|
+
const rowNode = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8427
8664
|
"tr",
|
|
8428
8665
|
{
|
|
8429
8666
|
"data-row-id": id,
|
|
@@ -8446,12 +8683,12 @@ function MatrxDataTableCore({
|
|
|
8446
8683
|
zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20"
|
|
8447
8684
|
),
|
|
8448
8685
|
children: [
|
|
8449
|
-
selection ? /* @__PURE__ */ (0,
|
|
8686
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8450
8687
|
"td",
|
|
8451
8688
|
{
|
|
8452
8689
|
className: "px-2 py-1.5 align-middle lg:py-0.5",
|
|
8453
8690
|
onClick: (e) => e.stopPropagation(),
|
|
8454
|
-
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0,
|
|
8691
|
+
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8455
8692
|
Checkbox,
|
|
8456
8693
|
{
|
|
8457
8694
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -8463,18 +8700,11 @@ function MatrxDataTableCore({
|
|
|
8463
8700
|
}
|
|
8464
8701
|
) : null,
|
|
8465
8702
|
visibleColumns.map((col, colIdx) => {
|
|
8466
|
-
const
|
|
8467
|
-
|
|
8468
|
-
const editable = Boolean(
|
|
8469
|
-
editEnabled && col.editable && (col.editableIf?.(row) ?? true)
|
|
8470
|
-
);
|
|
8471
|
-
const dirty = Boolean(
|
|
8472
|
-
rowEdits && field in rowEdits
|
|
8473
|
-
);
|
|
8474
|
-
const cellHref = col.href?.(row) ?? void 0;
|
|
8475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8703
|
+
const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
|
|
8704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8476
8705
|
"td",
|
|
8477
8706
|
{
|
|
8707
|
+
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
8478
8708
|
className: cn(
|
|
8479
8709
|
"py-1.5 align-middle lg:py-0.5",
|
|
8480
8710
|
col.compact ? "px-1" : "px-2",
|
|
@@ -8484,18 +8714,19 @@ function MatrxDataTableCore({
|
|
|
8484
8714
|
col.mobileHidden && "max-sm:hidden",
|
|
8485
8715
|
col.width !== void 0 && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
|
|
8486
8716
|
col.className,
|
|
8717
|
+
isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
|
|
8487
8718
|
col.align === "center" && "text-center",
|
|
8488
8719
|
col.align === "right" && "text-right"
|
|
8489
8720
|
),
|
|
8490
8721
|
style: columnWidthVar(col.width),
|
|
8491
|
-
children: /* @__PURE__ */ (0,
|
|
8722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8492
8723
|
"div",
|
|
8493
8724
|
{
|
|
8494
8725
|
className: cn(
|
|
8495
8726
|
colIdx === 0 && hierarchy && "flex min-w-0 items-center"
|
|
8496
8727
|
),
|
|
8497
8728
|
children: [
|
|
8498
|
-
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0,
|
|
8729
|
+
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8499
8730
|
HierarchyDragHandle,
|
|
8500
8731
|
{
|
|
8501
8732
|
id,
|
|
@@ -8503,32 +8734,12 @@ function MatrxDataTableCore({
|
|
|
8503
8734
|
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
8504
8735
|
}
|
|
8505
8736
|
) : null,
|
|
8506
|
-
/* @__PURE__ */ (0,
|
|
8737
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8507
8738
|
"div",
|
|
8508
8739
|
{
|
|
8509
8740
|
"data-matrx-cell-content": true,
|
|
8510
8741
|
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:max-w-full sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal]",
|
|
8511
|
-
children:
|
|
8512
|
-
EditableTableCell,
|
|
8513
|
-
{
|
|
8514
|
-
value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
|
|
8515
|
-
editType: col.editable,
|
|
8516
|
-
...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
|
|
8517
|
-
display,
|
|
8518
|
-
dirty,
|
|
8519
|
-
onCommit: (next) => commitCell(id, field, next),
|
|
8520
|
-
...cellHref === void 0 ? {} : { href: cellHref },
|
|
8521
|
-
...col.editTrigger === void 0 ? {} : { editTrigger: col.editTrigger }
|
|
8522
|
-
}
|
|
8523
|
-
) : cellHref ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8524
|
-
Link,
|
|
8525
|
-
{
|
|
8526
|
-
href: cellHref,
|
|
8527
|
-
onClick: (e) => e.stopPropagation(),
|
|
8528
|
-
className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
8529
|
-
children: display
|
|
8530
|
-
}
|
|
8531
|
-
) : display
|
|
8742
|
+
children: renderRecordCell(row, col, index)
|
|
8532
8743
|
}
|
|
8533
8744
|
)
|
|
8534
8745
|
]
|
|
@@ -8538,13 +8749,13 @@ function MatrxDataTableCore({
|
|
|
8538
8749
|
columnId(col)
|
|
8539
8750
|
);
|
|
8540
8751
|
}),
|
|
8541
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
8752
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("td", { className: "px-2 py-1.5 text-right align-middle lg:py-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8542
8753
|
"div",
|
|
8543
8754
|
{
|
|
8544
8755
|
className: "inline-flex items-center justify-end gap-0.5",
|
|
8545
8756
|
onClick: (e) => e.stopPropagation(),
|
|
8546
8757
|
children: [
|
|
8547
|
-
showRowCopy && effectiveCopy ? /* @__PURE__ */ (0,
|
|
8758
|
+
showRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8548
8759
|
TableRowCopyControl,
|
|
8549
8760
|
{
|
|
8550
8761
|
size: "xs",
|
|
@@ -8562,8 +8773,8 @@ function MatrxDataTableCore({
|
|
|
8562
8773
|
hasPendingEdits: Boolean(rowEdits),
|
|
8563
8774
|
discardPendingEdits: () => discardRowEdits(id)
|
|
8564
8775
|
}),
|
|
8565
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
8566
|
-
/* @__PURE__ */ (0,
|
|
8776
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8777
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8567
8778
|
Button,
|
|
8568
8779
|
{
|
|
8569
8780
|
type: "button",
|
|
@@ -8579,10 +8790,10 @@ function MatrxDataTableCore({
|
|
|
8579
8790
|
openWindow(row);
|
|
8580
8791
|
}
|
|
8581
8792
|
},
|
|
8582
|
-
children: opensWindowOnRowClick ? /* @__PURE__ */ (0,
|
|
8793
|
+
children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRightOpen, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { className: "h-3.5 w-3.5" })
|
|
8583
8794
|
}
|
|
8584
8795
|
) }),
|
|
8585
|
-
/* @__PURE__ */ (0,
|
|
8796
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: opensWindowOnRowClick ? "Open in side panel" : "Open in window" })
|
|
8586
8797
|
] }) : null
|
|
8587
8798
|
]
|
|
8588
8799
|
}
|
|
@@ -8592,7 +8803,7 @@ function MatrxDataTableCore({
|
|
|
8592
8803
|
id
|
|
8593
8804
|
);
|
|
8594
8805
|
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
8595
|
-
return hierarchy ? /* @__PURE__ */ (0,
|
|
8806
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8596
8807
|
HierarchyDroppableRow,
|
|
8597
8808
|
{
|
|
8598
8809
|
id,
|
|
@@ -8600,21 +8811,21 @@ function MatrxDataTableCore({
|
|
|
8600
8811
|
children: wrappedRow
|
|
8601
8812
|
},
|
|
8602
8813
|
id
|
|
8603
|
-
) : /* @__PURE__ */ (0,
|
|
8814
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react13.Fragment, { children: wrappedRow }, id);
|
|
8604
8815
|
}),
|
|
8605
|
-
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
8816
|
+
appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8606
8817
|
"td",
|
|
8607
8818
|
{
|
|
8608
8819
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
8609
8820
|
className: "sticky bottom-0 z-20 h-16 border-y border-border bg-card/95 px-0 py-0 text-left shadow-sm backdrop-blur-sm",
|
|
8610
|
-
children: /* @__PURE__ */ (0,
|
|
8821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8611
8822
|
"div",
|
|
8612
8823
|
{
|
|
8613
8824
|
role: "status",
|
|
8614
8825
|
"aria-live": "polite",
|
|
8615
8826
|
className: "sticky left-0 flex h-16 w-fit max-w-[100cqw] items-center justify-center gap-2 px-3 text-sm font-medium text-foreground",
|
|
8616
8827
|
children: [
|
|
8617
|
-
/* @__PURE__ */ (0,
|
|
8828
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8618
8829
|
Loader2,
|
|
8619
8830
|
{
|
|
8620
8831
|
"aria-hidden": "true",
|
|
@@ -8628,9 +8839,9 @@ function MatrxDataTableCore({
|
|
|
8628
8839
|
}
|
|
8629
8840
|
) }) : null
|
|
8630
8841
|
] }),
|
|
8631
|
-
footerRows.length > 0 ? /* @__PURE__ */ (0,
|
|
8632
|
-
selection ? /* @__PURE__ */ (0,
|
|
8633
|
-
visibleColumns.map((column) => /* @__PURE__ */ (0,
|
|
8842
|
+
footerRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("tr", { children: [
|
|
8843
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("td", { className: "px-2 py-2" }) : null,
|
|
8844
|
+
visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8634
8845
|
"td",
|
|
8635
8846
|
{
|
|
8636
8847
|
className: cn(
|
|
@@ -8645,14 +8856,14 @@ function MatrxDataTableCore({
|
|
|
8645
8856
|
},
|
|
8646
8857
|
columnId(column)
|
|
8647
8858
|
)),
|
|
8648
|
-
showActionsCol ? /* @__PURE__ */ (0,
|
|
8859
|
+
showActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("td", { className: "px-2 py-2" }) : null
|
|
8649
8860
|
] }, `footer-${index}`)) }) : null
|
|
8650
8861
|
] })
|
|
8651
8862
|
]
|
|
8652
8863
|
}
|
|
8653
8864
|
),
|
|
8654
|
-
scrollHintLeft ? /* @__PURE__ */ (0,
|
|
8655
|
-
/* @__PURE__ */ (0,
|
|
8865
|
+
scrollHintLeft ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8866
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8656
8867
|
Button,
|
|
8657
8868
|
{
|
|
8658
8869
|
type: "button",
|
|
@@ -8662,13 +8873,13 @@ function MatrxDataTableCore({
|
|
|
8662
8873
|
"data-matrx-table-scroll-control": "left",
|
|
8663
8874
|
className: "absolute left-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
8664
8875
|
onClick: () => scrollTableHorizontally("left"),
|
|
8665
|
-
children: /* @__PURE__ */ (0,
|
|
8876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronLeft, { className: "h-5 w-5" })
|
|
8666
8877
|
}
|
|
8667
8878
|
) }),
|
|
8668
|
-
/* @__PURE__ */ (0,
|
|
8879
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "More columns to the left" })
|
|
8669
8880
|
] }) : null,
|
|
8670
|
-
scrollHintRight ? /* @__PURE__ */ (0,
|
|
8671
|
-
/* @__PURE__ */ (0,
|
|
8881
|
+
scrollHintRight ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
8882
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8672
8883
|
Button,
|
|
8673
8884
|
{
|
|
8674
8885
|
type: "button",
|
|
@@ -8678,26 +8889,26 @@ function MatrxDataTableCore({
|
|
|
8678
8889
|
"data-matrx-table-scroll-control": "right",
|
|
8679
8890
|
className: "absolute right-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
8680
8891
|
onClick: () => scrollTableHorizontally("right"),
|
|
8681
|
-
children: /* @__PURE__ */ (0,
|
|
8892
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronRight, { className: "h-5 w-5" })
|
|
8682
8893
|
}
|
|
8683
8894
|
) }),
|
|
8684
|
-
/* @__PURE__ */ (0,
|
|
8895
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "More columns to the right" })
|
|
8685
8896
|
] }) : null
|
|
8686
8897
|
] }),
|
|
8687
|
-
appendQuery ? /* @__PURE__ */ (0,
|
|
8898
|
+
appendQuery ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8688
8899
|
"div",
|
|
8689
8900
|
{
|
|
8690
8901
|
"data-matrx-table-footer": true,
|
|
8691
8902
|
className: "flex min-h-16 shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border px-3 py-2",
|
|
8692
8903
|
"aria-busy": isLoading || isFetching,
|
|
8693
8904
|
children: [
|
|
8694
|
-
/* @__PURE__ */ (0,
|
|
8905
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8695
8906
|
"div",
|
|
8696
8907
|
{
|
|
8697
8908
|
...isFetching && !isLoading ? {} : { role: "status", "aria-live": "polite" },
|
|
8698
8909
|
className: "flex w-full min-w-0 flex-none items-center gap-2 text-xs text-muted-foreground sm:w-auto sm:flex-1",
|
|
8699
8910
|
children: [
|
|
8700
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
8911
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8701
8912
|
Loader2,
|
|
8702
8913
|
{
|
|
8703
8914
|
"data-matrx-table-append-loader": true,
|
|
@@ -8705,40 +8916,40 @@ function MatrxDataTableCore({
|
|
|
8705
8916
|
className: "h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none"
|
|
8706
8917
|
}
|
|
8707
8918
|
) : null,
|
|
8708
|
-
/* @__PURE__ */ (0,
|
|
8709
|
-
/* @__PURE__ */ (0,
|
|
8710
|
-
appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0,
|
|
8919
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "min-w-0", children: [
|
|
8920
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : `${data.length.toLocaleString()} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${appendQuery.pagination.totalItems.toLocaleString()}`}` }),
|
|
8921
|
+
appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { children: [
|
|
8711
8922
|
"Source fixed through",
|
|
8712
8923
|
" ",
|
|
8713
8924
|
new Date(appendQuery.pagination.sourceUntil).toLocaleString(),
|
|
8714
8925
|
"."
|
|
8715
8926
|
] }) : null,
|
|
8716
|
-
!isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0,
|
|
8717
|
-
scrollPagination.error ? /* @__PURE__ */ (0,
|
|
8927
|
+
!isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "All source rows are loaded." }) : appendUsesLocalProcessing ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: "Local search and filters cover loaded rows." }) : null,
|
|
8928
|
+
scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { role: "alert", className: "break-words text-destructive", children: scrollPagination.error.message }) : null
|
|
8718
8929
|
] })
|
|
8719
8930
|
]
|
|
8720
8931
|
}
|
|
8721
8932
|
),
|
|
8722
|
-
appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0,
|
|
8933
|
+
appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8723
8934
|
Select,
|
|
8724
8935
|
{
|
|
8725
8936
|
value: String(appendQuery.pagination.sourcePageSize.value),
|
|
8726
8937
|
onValueChange: (value) => appendQuery.pagination.sourcePageSize?.onChange(Number(value)),
|
|
8727
8938
|
children: [
|
|
8728
|
-
/* @__PURE__ */ (0,
|
|
8939
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8729
8940
|
SelectTrigger,
|
|
8730
8941
|
{
|
|
8731
8942
|
"aria-label": "Rows per load",
|
|
8732
8943
|
className: "h-8 w-20 shrink-0 text-xs sm:w-24",
|
|
8733
8944
|
disabled: isLoading || isFetching || appendQuery.pagination.loadAll?.isLoading,
|
|
8734
|
-
children: /* @__PURE__ */ (0,
|
|
8945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectValue, {})
|
|
8735
8946
|
}
|
|
8736
8947
|
),
|
|
8737
|
-
/* @__PURE__ */ (0,
|
|
8948
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectItem, { value: String(size), children: size }, size)) })
|
|
8738
8949
|
]
|
|
8739
8950
|
}
|
|
8740
8951
|
) : null,
|
|
8741
|
-
appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0,
|
|
8952
|
+
appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8742
8953
|
Button,
|
|
8743
8954
|
{
|
|
8744
8955
|
type: "button",
|
|
@@ -8746,7 +8957,7 @@ function MatrxDataTableCore({
|
|
|
8746
8957
|
onClick: appendQuery.pagination.loadAll.stop,
|
|
8747
8958
|
children: "Stop loading"
|
|
8748
8959
|
}
|
|
8749
|
-
) : scrollPagination.error ? /* @__PURE__ */ (0,
|
|
8960
|
+
) : scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8750
8961
|
Button,
|
|
8751
8962
|
{
|
|
8752
8963
|
type: "button",
|
|
@@ -8754,8 +8965,8 @@ function MatrxDataTableCore({
|
|
|
8754
8965
|
onClick: appendQuery.pagination.retrySource ?? (appendQuery.pagination.hasNextPage ? appendQuery.pagination.loadNextPage : appendQuery.pagination.refresh),
|
|
8755
8966
|
children: appendQuery.pagination.retrySource ? "Retry source" : appendQuery.pagination.hasNextPage ? "Retry" : "Reload rows"
|
|
8756
8967
|
}
|
|
8757
|
-
) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0,
|
|
8758
|
-
/* @__PURE__ */ (0,
|
|
8968
|
+
) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
8969
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8759
8970
|
Button,
|
|
8760
8971
|
{
|
|
8761
8972
|
type: "button",
|
|
@@ -8766,7 +8977,7 @@ function MatrxDataTableCore({
|
|
|
8766
8977
|
children: "Load more"
|
|
8767
8978
|
}
|
|
8768
8979
|
),
|
|
8769
|
-
appendQuery.pagination.loadAll ? /* @__PURE__ */ (0,
|
|
8980
|
+
appendQuery.pagination.loadAll ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8770
8981
|
Button,
|
|
8771
8982
|
{
|
|
8772
8983
|
type: "button",
|
|
@@ -8777,10 +8988,10 @@ function MatrxDataTableCore({
|
|
|
8777
8988
|
children: "Load all"
|
|
8778
8989
|
}
|
|
8779
8990
|
) : null
|
|
8780
|
-
] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0,
|
|
8991
|
+
] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-xs text-muted-foreground", children: "All rows loaded" }) : null
|
|
8781
8992
|
]
|
|
8782
8993
|
}
|
|
8783
|
-
) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ (0,
|
|
8994
|
+
) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8784
8995
|
GenericTablePagination,
|
|
8785
8996
|
{
|
|
8786
8997
|
totalItems,
|
|
@@ -8800,7 +9011,7 @@ function MatrxDataTableCore({
|
|
|
8800
9011
|
}
|
|
8801
9012
|
) }) : null
|
|
8802
9013
|
] }),
|
|
8803
|
-
/* @__PURE__ */ (0,
|
|
9014
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8804
9015
|
ColumnManager,
|
|
8805
9016
|
{
|
|
8806
9017
|
open: columnManagerOpen,
|
|
@@ -8811,7 +9022,7 @@ function MatrxDataTableCore({
|
|
|
8811
9022
|
onApply: commitColumnState
|
|
8812
9023
|
}
|
|
8813
9024
|
),
|
|
8814
|
-
detailEnabled && selectedRow ? /* @__PURE__ */ (0,
|
|
9025
|
+
detailEnabled && selectedRow ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8815
9026
|
SidePanelSurface,
|
|
8816
9027
|
{
|
|
8817
9028
|
title: resolveStringTitle(
|
|
@@ -8822,8 +9033,8 @@ function MatrxDataTableCore({
|
|
|
8822
9033
|
description: detail?.description?.(selectedRow),
|
|
8823
9034
|
onClose: () => setSelectedId(null),
|
|
8824
9035
|
defaultWidth: detail?.defaultWidth ?? 480,
|
|
8825
|
-
headerActions: /* @__PURE__ */ (0,
|
|
8826
|
-
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0,
|
|
9036
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
9037
|
+
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8827
9038
|
TableRowCopyControl,
|
|
8828
9039
|
{
|
|
8829
9040
|
size: "icon",
|
|
@@ -8834,8 +9045,8 @@ function MatrxDataTableCore({
|
|
|
8834
9045
|
}
|
|
8835
9046
|
) : null,
|
|
8836
9047
|
detail?.headerActions?.(selectedRow),
|
|
8837
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
8838
|
-
/* @__PURE__ */ (0,
|
|
9048
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
9049
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8839
9050
|
Button,
|
|
8840
9051
|
{
|
|
8841
9052
|
type: "button",
|
|
@@ -8844,10 +9055,10 @@ function MatrxDataTableCore({
|
|
|
8844
9055
|
className: "h-7 w-7",
|
|
8845
9056
|
"aria-label": "Open in window",
|
|
8846
9057
|
onClick: () => openWindow(selectedRow),
|
|
8847
|
-
children: /* @__PURE__ */ (0,
|
|
9058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { className: "h-3.5 w-3.5" })
|
|
8848
9059
|
}
|
|
8849
9060
|
) }),
|
|
8850
|
-
/* @__PURE__ */ (0,
|
|
9061
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "Open in window" })
|
|
8851
9062
|
] }) : null
|
|
8852
9063
|
] }),
|
|
8853
9064
|
children: detail?.render ? (
|
|
@@ -8858,7 +9069,7 @@ function MatrxDataTableCore({
|
|
|
8858
9069
|
// fixes the whole class at once — a custom body that already
|
|
8859
9070
|
// scrolls (`h-full` + `overflow-y-auto` root) still resolves to
|
|
8860
9071
|
// this container's height, so no second scrollbar appears.
|
|
8861
|
-
/* @__PURE__ */ (0,
|
|
9072
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
|
|
8862
9073
|
closeDetail: () => setSelectedId(null),
|
|
8863
9074
|
openDetail: () => openDetail(selectedRow),
|
|
8864
9075
|
openWindow: () => openWindow(selectedRow),
|
|
@@ -8866,7 +9077,7 @@ function MatrxDataTableCore({
|
|
|
8866
9077
|
hasPendingEdits: Boolean(edits[getRowId(selectedRow)]),
|
|
8867
9078
|
discardPendingEdits: () => discardRowEdits(getRowId(selectedRow))
|
|
8868
9079
|
}) })
|
|
8869
|
-
) : /* @__PURE__ */ (0,
|
|
9080
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8870
9081
|
DataRowInspector,
|
|
8871
9082
|
{
|
|
8872
9083
|
row: selectedRow,
|
|
@@ -8878,7 +9089,7 @@ function MatrxDataTableCore({
|
|
|
8878
9089
|
)
|
|
8879
9090
|
}
|
|
8880
9091
|
) : null,
|
|
8881
|
-
windowRow ? /* @__PURE__ */ (0,
|
|
9092
|
+
windowRow ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8882
9093
|
DataRowWindow,
|
|
8883
9094
|
{
|
|
8884
9095
|
isOpen: true,
|
|
@@ -8889,9 +9100,9 @@ function MatrxDataTableCore({
|
|
|
8889
9100
|
height: windowConfig?.height,
|
|
8890
9101
|
windowId: `matrx-data-row-${urlState?.id ?? "local"}-${getRowId(windowRow)}`,
|
|
8891
9102
|
defaultTab: windowConfig?.defaultTab,
|
|
8892
|
-
headerActions: /* @__PURE__ */ (0,
|
|
8893
|
-
opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ (0,
|
|
8894
|
-
/* @__PURE__ */ (0,
|
|
9103
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
9104
|
+
opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
|
|
9105
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8895
9106
|
Button,
|
|
8896
9107
|
{
|
|
8897
9108
|
type: "button",
|
|
@@ -8903,12 +9114,12 @@ function MatrxDataTableCore({
|
|
|
8903
9114
|
closeWindow();
|
|
8904
9115
|
openDetail(windowRow);
|
|
8905
9116
|
},
|
|
8906
|
-
children: /* @__PURE__ */ (0,
|
|
9117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRightOpen, { className: "h-3.5 w-3.5" })
|
|
8907
9118
|
}
|
|
8908
9119
|
) }),
|
|
8909
|
-
/* @__PURE__ */ (0,
|
|
9120
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { children: "Open in side panel" })
|
|
8910
9121
|
] }) : null,
|
|
8911
|
-
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0,
|
|
9122
|
+
effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8912
9123
|
TableRowCopyControl,
|
|
8913
9124
|
{
|
|
8914
9125
|
size: "icon",
|
|
@@ -8926,7 +9137,7 @@ function MatrxDataTableCore({
|
|
|
8926
9137
|
closeWindow,
|
|
8927
9138
|
hasPendingEdits: Boolean(edits[getRowId(windowRow)]),
|
|
8928
9139
|
discardPendingEdits: () => discardRowEdits(getRowId(windowRow))
|
|
8929
|
-
}) ?? /* @__PURE__ */ (0,
|
|
9140
|
+
}) ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8930
9141
|
DataRowInspector,
|
|
8931
9142
|
{
|
|
8932
9143
|
row: windowRow,
|
|
@@ -8962,15 +9173,15 @@ function MatrxDataTableCore({
|
|
|
8962
9173
|
})
|
|
8963
9174
|
}
|
|
8964
9175
|
) : null,
|
|
8965
|
-
editEnabled ? /* @__PURE__ */ (0,
|
|
8966
|
-
foreignDrafts.length > 0 ? /* @__PURE__ */ (0,
|
|
9176
|
+
editEnabled ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
9177
|
+
foreignDrafts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8967
9178
|
"div",
|
|
8968
9179
|
{
|
|
8969
9180
|
"data-matrx-foreign-drafts": true,
|
|
8970
9181
|
className: "fixed inset-x-3 bottom-20 z-50 flex flex-wrap items-center justify-center gap-2 rounded-lg border border-amber-500/40 bg-card px-3 py-2 text-xs shadow-lg sm:inset-x-auto sm:left-1/2 sm:-translate-x-1/2 sm:flex-nowrap",
|
|
8971
9182
|
children: [
|
|
8972
|
-
/* @__PURE__ */ (0,
|
|
8973
|
-
/* @__PURE__ */ (0,
|
|
9183
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Unsaved edits from previous results" }),
|
|
9184
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8974
9185
|
CopyButtons,
|
|
8975
9186
|
{
|
|
8976
9187
|
size: "xs",
|
|
@@ -8979,11 +9190,11 @@ function MatrxDataTableCore({
|
|
|
8979
9190
|
json: () => foreignDraftPayload
|
|
8980
9191
|
}
|
|
8981
9192
|
),
|
|
8982
|
-
/* @__PURE__ */ (0,
|
|
9193
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
|
|
8983
9194
|
]
|
|
8984
9195
|
}
|
|
8985
9196
|
) : null,
|
|
8986
|
-
/* @__PURE__ */ (0,
|
|
9197
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8987
9198
|
ConfirmDialog,
|
|
8988
9199
|
{
|
|
8989
9200
|
open: confirmForeignDraftDiscard,
|
|
@@ -9003,7 +9214,7 @@ function MatrxDataTableCore({
|
|
|
9003
9214
|
}
|
|
9004
9215
|
}
|
|
9005
9216
|
),
|
|
9006
|
-
/* @__PURE__ */ (0,
|
|
9217
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9007
9218
|
DirtySavePill,
|
|
9008
9219
|
{
|
|
9009
9220
|
changeCount,
|
|
@@ -9016,11 +9227,11 @@ function MatrxDataTableCore({
|
|
|
9016
9227
|
]
|
|
9017
9228
|
}
|
|
9018
9229
|
),
|
|
9019
|
-
/* @__PURE__ */ (0,
|
|
9230
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_core3.DragOverlay, { children: draggedRow ? (
|
|
9020
9231
|
// w-max: the overlay inherits the ACTIVE node's size, and the active
|
|
9021
9232
|
// node is the 16px grip handle — without it the label wraps to one
|
|
9022
9233
|
// character per line.
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9234
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
|
|
9024
9235
|
) : null })
|
|
9025
9236
|
]
|
|
9026
9237
|
}
|
|
@@ -9035,7 +9246,7 @@ function HierarchyDragHandle({
|
|
|
9035
9246
|
id,
|
|
9036
9247
|
disabled
|
|
9037
9248
|
});
|
|
9038
|
-
return /* @__PURE__ */ (0,
|
|
9249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9039
9250
|
"button",
|
|
9040
9251
|
{
|
|
9041
9252
|
ref: setNodeRef,
|
|
@@ -9047,7 +9258,7 @@ function HierarchyDragHandle({
|
|
|
9047
9258
|
onClick: (event) => event.stopPropagation(),
|
|
9048
9259
|
...attributes,
|
|
9049
9260
|
...listeners,
|
|
9050
|
-
children: /* @__PURE__ */ (0,
|
|
9261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
9051
9262
|
}
|
|
9052
9263
|
);
|
|
9053
9264
|
}
|
|
@@ -9056,7 +9267,7 @@ function HierarchyRootDropTarget({
|
|
|
9056
9267
|
draggedLabel
|
|
9057
9268
|
}) {
|
|
9058
9269
|
const { isOver, setNodeRef } = (0, import_core3.useDroppable)({ id: "__root__" });
|
|
9059
|
-
return /* @__PURE__ */ (0,
|
|
9270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
9060
9271
|
"div",
|
|
9061
9272
|
{
|
|
9062
9273
|
ref: setNodeRef,
|
|
@@ -9066,8 +9277,8 @@ function HierarchyRootDropTarget({
|
|
|
9066
9277
|
isOver && "border-solid bg-primary/20 shadow-md shadow-primary/25"
|
|
9067
9278
|
),
|
|
9068
9279
|
children: [
|
|
9069
|
-
/* @__PURE__ */ (0,
|
|
9070
|
-
/* @__PURE__ */ (0,
|
|
9280
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "truncate", children: draggedLabel }),
|
|
9281
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-primary/75", children: label })
|
|
9071
9282
|
]
|
|
9072
9283
|
}
|
|
9073
9284
|
);
|
|
@@ -9116,7 +9327,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
9116
9327
|
const { preview: preview2 } = indicator;
|
|
9117
9328
|
const indent = indicator.left + 10 + preview2.depth * 12;
|
|
9118
9329
|
if (preview2.position === "inside") {
|
|
9119
|
-
return /* @__PURE__ */ (0,
|
|
9330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9120
9331
|
"div",
|
|
9121
9332
|
{
|
|
9122
9333
|
"aria-hidden": "true",
|
|
@@ -9128,7 +9339,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
9128
9339
|
width: Math.max(0, indicator.width - 4),
|
|
9129
9340
|
height: indicator.height
|
|
9130
9341
|
},
|
|
9131
|
-
children: /* @__PURE__ */ (0,
|
|
9342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
9132
9343
|
"span",
|
|
9133
9344
|
{
|
|
9134
9345
|
className: "absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-card/95 px-1.5 py-0.5 text-[10px] font-medium text-primary",
|
|
@@ -9143,7 +9354,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
9143
9354
|
);
|
|
9144
9355
|
}
|
|
9145
9356
|
const lineTop = preview2.position === "before" ? indicator.top - 1 : indicator.top + indicator.height - 1;
|
|
9146
|
-
return /* @__PURE__ */ (0,
|
|
9357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9147
9358
|
"div",
|
|
9148
9359
|
{
|
|
9149
9360
|
"aria-hidden": "true",
|
|
@@ -9154,9 +9365,9 @@ function HierarchyDragIndicatorLayer({
|
|
|
9154
9365
|
left: indent,
|
|
9155
9366
|
width: Math.max(0, indicator.left + indicator.width - indent - 8)
|
|
9156
9367
|
},
|
|
9157
|
-
children: /* @__PURE__ */ (0,
|
|
9158
|
-
/* @__PURE__ */ (0,
|
|
9159
|
-
/* @__PURE__ */ (0,
|
|
9368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
|
|
9369
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
|
|
9370
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
9160
9371
|
"span",
|
|
9161
9372
|
{
|
|
9162
9373
|
className: cn(
|
|
@@ -9197,7 +9408,7 @@ function ColumnHeaderDropZone({
|
|
|
9197
9408
|
disabled: !enabled,
|
|
9198
9409
|
data: { matrxDragKind: "column-header", columnId: id }
|
|
9199
9410
|
});
|
|
9200
|
-
return /* @__PURE__ */ (0,
|
|
9411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
|
|
9201
9412
|
}
|
|
9202
9413
|
function columnWidthVar(width) {
|
|
9203
9414
|
if (width === void 0) return void 0;
|
|
@@ -9213,7 +9424,7 @@ function renderCell(row, col, index) {
|
|
|
9213
9424
|
if (asUuid && typeof raw === "string") {
|
|
9214
9425
|
const forbidden = typeof col.fk?.forbidden === "function" ? col.fk.forbidden(raw, row) : Boolean(col.fk?.forbidden);
|
|
9215
9426
|
const declaredToken = typeof col.fk?.token === "function" ? col.fk.token(row) : col.fk?.token;
|
|
9216
|
-
return /* @__PURE__ */ (0,
|
|
9427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
9217
9428
|
MatrxUuidCell,
|
|
9218
9429
|
{
|
|
9219
9430
|
value: raw,
|
|
@@ -9225,7 +9436,7 @@ function renderCell(row, col, index) {
|
|
|
9225
9436
|
}
|
|
9226
9437
|
);
|
|
9227
9438
|
}
|
|
9228
|
-
return /* @__PURE__ */ (0,
|
|
9439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-foreground", children: stringifyCellValue(raw) || "\u2014" });
|
|
9229
9440
|
}
|
|
9230
9441
|
function defaultRowTitle(row, columns) {
|
|
9231
9442
|
for (const col of columns) {
|
|
@@ -9240,6 +9451,236 @@ function resolveStringTitle(title, fallback) {
|
|
|
9240
9451
|
return fallback;
|
|
9241
9452
|
}
|
|
9242
9453
|
|
|
9454
|
+
// src/data-table/SavedViewsControl.tsx
|
|
9455
|
+
var import_react14 = require("react");
|
|
9456
|
+
|
|
9457
|
+
// src/dropdown-menu.tsx
|
|
9458
|
+
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
9459
|
+
var React16 = __toESM(require("react"), 1);
|
|
9460
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9461
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
9462
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
9463
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
9464
|
+
var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
|
|
9465
|
+
var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
9466
|
+
var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
9467
|
+
var DropdownMenuSubTrigger = React16.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
9468
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
9469
|
+
{
|
|
9470
|
+
ref,
|
|
9471
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
9472
|
+
className: cn(
|
|
9473
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
9474
|
+
inset && "pl-8",
|
|
9475
|
+
className
|
|
9476
|
+
),
|
|
9477
|
+
...props,
|
|
9478
|
+
children: [
|
|
9479
|
+
children,
|
|
9480
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
9481
|
+
]
|
|
9482
|
+
}
|
|
9483
|
+
));
|
|
9484
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
9485
|
+
var DropdownMenuSubContent = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9486
|
+
DropdownMenuPrimitive.SubContent,
|
|
9487
|
+
{
|
|
9488
|
+
ref,
|
|
9489
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
9490
|
+
className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
|
|
9491
|
+
...props
|
|
9492
|
+
}
|
|
9493
|
+
));
|
|
9494
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
9495
|
+
var DropdownMenuContent = React16.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
|
|
9496
|
+
const portalContainer = usePortalContainer(container);
|
|
9497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9498
|
+
DropdownMenuPrimitive.Content,
|
|
9499
|
+
{
|
|
9500
|
+
ref,
|
|
9501
|
+
"data-slot": "dropdown-menu-content",
|
|
9502
|
+
sideOffset,
|
|
9503
|
+
className: cn(
|
|
9504
|
+
MENU_SURFACE_CLASS,
|
|
9505
|
+
"shadow-md",
|
|
9506
|
+
MOTION_POPPER,
|
|
9507
|
+
className
|
|
9508
|
+
),
|
|
9509
|
+
...props
|
|
9510
|
+
}
|
|
9511
|
+
) });
|
|
9512
|
+
});
|
|
9513
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
9514
|
+
var DropdownMenuItem = React16.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9515
|
+
DropdownMenuPrimitive.Item,
|
|
9516
|
+
{
|
|
9517
|
+
ref,
|
|
9518
|
+
"data-slot": "dropdown-menu-item",
|
|
9519
|
+
className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
|
|
9520
|
+
...props
|
|
9521
|
+
}
|
|
9522
|
+
));
|
|
9523
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
9524
|
+
var DropdownMenuCheckboxItem = React16.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
9525
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
9526
|
+
{
|
|
9527
|
+
ref,
|
|
9528
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
9529
|
+
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
9530
|
+
...props,
|
|
9531
|
+
children: [
|
|
9532
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
9533
|
+
children
|
|
9534
|
+
]
|
|
9535
|
+
}
|
|
9536
|
+
));
|
|
9537
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
9538
|
+
var DropdownMenuRadioItem = React16.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
9539
|
+
DropdownMenuPrimitive.RadioItem,
|
|
9540
|
+
{
|
|
9541
|
+
ref,
|
|
9542
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
9543
|
+
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
9544
|
+
...props,
|
|
9545
|
+
children: [
|
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
9547
|
+
children
|
|
9548
|
+
]
|
|
9549
|
+
}
|
|
9550
|
+
));
|
|
9551
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
9552
|
+
var DropdownMenuLabel = React16.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9553
|
+
DropdownMenuPrimitive.Label,
|
|
9554
|
+
{
|
|
9555
|
+
ref,
|
|
9556
|
+
"data-slot": "dropdown-menu-label",
|
|
9557
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
9558
|
+
...props
|
|
9559
|
+
}
|
|
9560
|
+
));
|
|
9561
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
9562
|
+
var DropdownMenuSeparator = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9563
|
+
DropdownMenuPrimitive.Separator,
|
|
9564
|
+
{
|
|
9565
|
+
ref,
|
|
9566
|
+
"data-slot": "dropdown-menu-separator",
|
|
9567
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
9568
|
+
...props
|
|
9569
|
+
}
|
|
9570
|
+
));
|
|
9571
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
9572
|
+
var DropdownMenuShortcut = ({
|
|
9573
|
+
className,
|
|
9574
|
+
...props
|
|
9575
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9576
|
+
"span",
|
|
9577
|
+
{
|
|
9578
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
9579
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
9580
|
+
...props
|
|
9581
|
+
}
|
|
9582
|
+
);
|
|
9583
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
9584
|
+
|
|
9585
|
+
// src/data-table/SavedViewsControl.tsx
|
|
9586
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9587
|
+
function SavedViewsControl({
|
|
9588
|
+
views,
|
|
9589
|
+
activeId = null,
|
|
9590
|
+
loading = false,
|
|
9591
|
+
error,
|
|
9592
|
+
dirty = false,
|
|
9593
|
+
onSelect,
|
|
9594
|
+
onSaveNew,
|
|
9595
|
+
onUpdate,
|
|
9596
|
+
onReload
|
|
9597
|
+
}) {
|
|
9598
|
+
const [saveOpen, setSaveOpen] = (0, import_react14.useState)(false);
|
|
9599
|
+
const [name, setName] = (0, import_react14.useState)("");
|
|
9600
|
+
const [saving, setSaving] = (0, import_react14.useState)(false);
|
|
9601
|
+
const [actionError, setActionError] = (0, import_react14.useState)(null);
|
|
9602
|
+
const visibleError = actionError ?? error;
|
|
9603
|
+
const save = async () => {
|
|
9604
|
+
const next = name.trim();
|
|
9605
|
+
if (!next) return;
|
|
9606
|
+
setSaving(true);
|
|
9607
|
+
setActionError(null);
|
|
9608
|
+
try {
|
|
9609
|
+
await onSaveNew(next);
|
|
9610
|
+
setName("");
|
|
9611
|
+
setSaveOpen(false);
|
|
9612
|
+
} catch (cause) {
|
|
9613
|
+
setActionError(cause instanceof Error ? cause.message : String(cause));
|
|
9614
|
+
} finally {
|
|
9615
|
+
setSaving(false);
|
|
9616
|
+
}
|
|
9617
|
+
};
|
|
9618
|
+
const update = async () => {
|
|
9619
|
+
if (!onUpdate) return;
|
|
9620
|
+
setSaving(true);
|
|
9621
|
+
setActionError(null);
|
|
9622
|
+
try {
|
|
9623
|
+
await onUpdate();
|
|
9624
|
+
} catch (cause) {
|
|
9625
|
+
setActionError(cause instanceof Error ? cause.message : String(cause));
|
|
9626
|
+
} finally {
|
|
9627
|
+
setSaving(false);
|
|
9628
|
+
}
|
|
9629
|
+
};
|
|
9630
|
+
const reload = async () => {
|
|
9631
|
+
if (!onReload) return;
|
|
9632
|
+
setSaving(true);
|
|
9633
|
+
setActionError(null);
|
|
9634
|
+
try {
|
|
9635
|
+
await onReload();
|
|
9636
|
+
} catch (cause) {
|
|
9637
|
+
setActionError(cause instanceof Error ? cause.message : String(cause));
|
|
9638
|
+
} finally {
|
|
9639
|
+
setSaving(false);
|
|
9640
|
+
}
|
|
9641
|
+
};
|
|
9642
|
+
const activeName = activeId ? views.find((view) => view.id === activeId)?.name : void 0;
|
|
9643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex items-center gap-1", "data-matrx-table-saved-views": true, children: [
|
|
9644
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(DropdownMenu, { children: [
|
|
9645
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
|
|
9646
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", variant: "outline", size: "sm", className: "h-8 max-w-40 truncate text-xs", "aria-label": "Saved views", disabled: saving, children: loading ? "Loading views\u2026" : `${activeName ?? "Default view"}${dirty ? " \u2022" : ""}` }) }) }),
|
|
9647
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipContent, { children: "Choose or save a table view" })
|
|
9648
|
+
] }),
|
|
9649
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
9650
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuLabel, { children: "Views" }),
|
|
9651
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(DropdownMenuRadioGroup, { value: activeId ?? "__default__", onValueChange: (value) => onSelect(value === "__default__" ? null : value), children: [
|
|
9652
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuRadioItem, { value: "__default__", children: "Default view" }),
|
|
9653
|
+
views.map((view) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuRadioItem, { value: view.id, children: view.name }, view.id))
|
|
9654
|
+
] }),
|
|
9655
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuSeparator, {}),
|
|
9656
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => {
|
|
9657
|
+
setActionError(null);
|
|
9658
|
+
setSaveOpen(true);
|
|
9659
|
+
}, children: "Save current view\u2026" }),
|
|
9660
|
+
activeId && onUpdate ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => void update(), children: "Update current view" }) : null,
|
|
9661
|
+
onReload ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuItem, { disabled: saving || loading, onSelect: () => void reload(), children: "Reload views" }) : null
|
|
9662
|
+
] })
|
|
9663
|
+
] }),
|
|
9664
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
|
|
9665
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: "h-8 w-8", "aria-label": "Save current view", disabled: saving, onClick: () => {
|
|
9666
|
+
setActionError(null);
|
|
9667
|
+
setSaveOpen(true);
|
|
9668
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Save, { className: "h-4 w-4" }) }) }),
|
|
9669
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipContent, { children: "Save current view" })
|
|
9670
|
+
] }),
|
|
9671
|
+
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "basis-full text-xs text-destructive", children: visibleError }) : null,
|
|
9672
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(DialogContent, { children: [
|
|
9673
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DialogTitle, { children: "Save current view" }) }),
|
|
9674
|
+
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
|
|
9675
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Input, { "aria-label": "View name", value: name, onChange: (event) => setName(event.target.value), placeholder: "View name", autoFocus: true }),
|
|
9676
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(DialogFooter, { children: [
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", variant: "outline", onClick: () => setSaveOpen(false), children: "Cancel" }),
|
|
9678
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", disabled: !name.trim() || saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save view" })
|
|
9679
|
+
] })
|
|
9680
|
+
] }) })
|
|
9681
|
+
] });
|
|
9682
|
+
}
|
|
9683
|
+
|
|
9243
9684
|
// src/data-table/tableXlsx.ts
|
|
9244
9685
|
var XLSX = __toESM(require("xlsx"), 1);
|
|
9245
9686
|
function downloadTableAsXlsx({
|