@dynostack/react-grid 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1089 -1028
- package/dist/index.cjs +175 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -10
- package/dist/index.d.ts +71 -10
- package/dist/index.js +175 -104
- package/dist/index.js.map +1 -1
- package/dist/styles.css +274 -220
- package/dist/tailwind-content.js +3 -0
- package/package.json +87 -81
package/dist/index.cjs
CHANGED
|
@@ -283,15 +283,21 @@ function PopoverContent({
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
// src/export.ts
|
|
286
|
+
function sanitizeSpreadsheetValue(value) {
|
|
287
|
+
if (value == null) return "";
|
|
288
|
+
const text = String(value);
|
|
289
|
+
if (typeof value === "string" && (/^[\s\u0000-\u001f]*[=+\-@=+-@]/u.test(text) || /^[\t\r\n]/.test(text))) return `'${text}`;
|
|
290
|
+
return text;
|
|
291
|
+
}
|
|
286
292
|
function escapeCsv(value) {
|
|
287
293
|
if (value === null || value === void 0) return "";
|
|
288
|
-
const s =
|
|
294
|
+
const s = sanitizeSpreadsheetValue(value);
|
|
289
295
|
if (/[",\n\r]/.test(s)) return `"${s.replace(/"/g, '""')}"`;
|
|
290
296
|
return s;
|
|
291
297
|
}
|
|
292
298
|
function escapeHtml(value) {
|
|
293
299
|
if (value === null || value === void 0) return "";
|
|
294
|
-
return
|
|
300
|
+
return sanitizeSpreadsheetValue(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
295
301
|
}
|
|
296
302
|
function getExportRows(table) {
|
|
297
303
|
const visible = table.getVisibleLeafColumns().filter((c) => {
|
|
@@ -1901,7 +1907,7 @@ function EditableCell({
|
|
|
1901
1907
|
if (typeof flag === "function") return flag(row.original);
|
|
1902
1908
|
return flag;
|
|
1903
1909
|
})();
|
|
1904
|
-
if (!isEditing) {
|
|
1910
|
+
if (!isEditing || !isEditable) {
|
|
1905
1911
|
const display = renderDisplay(initial, editor, meta);
|
|
1906
1912
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1907
1913
|
"div",
|
|
@@ -1918,7 +1924,9 @@ function EditableCell({
|
|
|
1918
1924
|
}
|
|
1919
1925
|
);
|
|
1920
1926
|
}
|
|
1921
|
-
const commit = (value) =>
|
|
1927
|
+
const commit = (value) => {
|
|
1928
|
+
if (isEditable) onCommit(value);
|
|
1929
|
+
};
|
|
1922
1930
|
const handleKey = (e) => {
|
|
1923
1931
|
if (e.key === "Enter") commit(local);
|
|
1924
1932
|
else if (e.key === "Escape") onCancel();
|
|
@@ -2048,6 +2056,9 @@ var TOKEN_TO_VAR = {
|
|
|
2048
2056
|
radius: "--radius",
|
|
2049
2057
|
fontFamily: "--font-family"
|
|
2050
2058
|
};
|
|
2059
|
+
function isSafeToken(value) {
|
|
2060
|
+
return typeof value === "string" && !/[;{}<>@\\\u0000-\u001f]/.test(value) && !/\/\*|\*\/|url\s*\(|expression\s*\(/i.test(value);
|
|
2061
|
+
}
|
|
2051
2062
|
function isModed(theme) {
|
|
2052
2063
|
if (!theme) return false;
|
|
2053
2064
|
return "light" in theme || "dark" in theme;
|
|
@@ -2056,8 +2067,8 @@ function tokensToStyle(tokens) {
|
|
|
2056
2067
|
if (!tokens) return {};
|
|
2057
2068
|
const out = {};
|
|
2058
2069
|
for (const [k, v] of Object.entries(tokens)) {
|
|
2059
|
-
if (v
|
|
2060
|
-
const cssVar = TOKEN_TO_VAR[k];
|
|
2070
|
+
if (!isSafeToken(v)) continue;
|
|
2071
|
+
const cssVar = Object.prototype.hasOwnProperty.call(TOKEN_TO_VAR, k) ? TOKEN_TO_VAR[k] : void 0;
|
|
2061
2072
|
if (cssVar) out[cssVar] = v;
|
|
2062
2073
|
}
|
|
2063
2074
|
return out;
|
|
@@ -2096,7 +2107,7 @@ function buildPreset(hue, chroma = 0.03) {
|
|
|
2096
2107
|
border: `oklch(0.9 ${c * 0.8} ${hue})`,
|
|
2097
2108
|
input: `oklch(0.9 ${c * 0.8} ${hue})`,
|
|
2098
2109
|
ring: `oklch(0.55 0.2 ${hue} / 0.5)`,
|
|
2099
|
-
radius: "0.
|
|
2110
|
+
radius: "0.375rem"
|
|
2100
2111
|
},
|
|
2101
2112
|
dark: {
|
|
2102
2113
|
background: `oklch(0.16 ${c * 0.6} ${hue})`,
|
|
@@ -2118,7 +2129,7 @@ function buildPreset(hue, chroma = 0.03) {
|
|
|
2118
2129
|
border: `oklch(0.27 ${c * 0.8} ${hue})`,
|
|
2119
2130
|
input: `oklch(0.27 ${c * 0.8} ${hue})`,
|
|
2120
2131
|
ring: `oklch(0.7 0.18 ${hue} / 0.5)`,
|
|
2121
|
-
radius: "0.
|
|
2132
|
+
radius: "0.375rem"
|
|
2122
2133
|
}
|
|
2123
2134
|
};
|
|
2124
2135
|
}
|
|
@@ -2131,8 +2142,8 @@ function tokensToCssBlock(tokens) {
|
|
|
2131
2142
|
if (!tokens) return "";
|
|
2132
2143
|
const parts = [];
|
|
2133
2144
|
for (const [k, v] of Object.entries(tokens)) {
|
|
2134
|
-
if (v
|
|
2135
|
-
const cssVar = TOKEN_TO_VAR[k];
|
|
2145
|
+
if (!isSafeToken(v)) continue;
|
|
2146
|
+
const cssVar = Object.prototype.hasOwnProperty.call(TOKEN_TO_VAR, k) ? TOKEN_TO_VAR[k] : void 0;
|
|
2136
2147
|
if (cssVar) parts.push(`${cssVar}:${v}`);
|
|
2137
2148
|
}
|
|
2138
2149
|
return parts.join(";");
|
|
@@ -2158,7 +2169,7 @@ var neutral = {
|
|
|
2158
2169
|
border: "oklch(0.922 0 0)",
|
|
2159
2170
|
input: "oklch(0.922 0 0)",
|
|
2160
2171
|
ring: "oklch(0.708 0 0)",
|
|
2161
|
-
radius: "0.
|
|
2172
|
+
radius: "0.375rem"
|
|
2162
2173
|
},
|
|
2163
2174
|
dark: {
|
|
2164
2175
|
background: "oklch(0.145 0 0)",
|
|
@@ -2180,11 +2191,38 @@ var neutral = {
|
|
|
2180
2191
|
border: "oklch(0.269 0 0)",
|
|
2181
2192
|
input: "oklch(0.269 0 0)",
|
|
2182
2193
|
ring: "oklch(0.439 0 0)",
|
|
2183
|
-
radius: "0.
|
|
2194
|
+
radius: "0.375rem"
|
|
2184
2195
|
}
|
|
2185
2196
|
};
|
|
2186
2197
|
var themePresets = {
|
|
2187
2198
|
neutral,
|
|
2199
|
+
graphite: {
|
|
2200
|
+
light: {
|
|
2201
|
+
...neutral.light,
|
|
2202
|
+
background: "#fafafa",
|
|
2203
|
+
card: "#ffffff",
|
|
2204
|
+
border: "#e5e5e5",
|
|
2205
|
+
radius: "0.375rem",
|
|
2206
|
+
fontFamily: "'Geist', sans-serif"
|
|
2207
|
+
},
|
|
2208
|
+
dark: {
|
|
2209
|
+
...neutral.dark,
|
|
2210
|
+
background: "#101112",
|
|
2211
|
+
card: "#101112",
|
|
2212
|
+
popover: "#17191b",
|
|
2213
|
+
border: "#292c2f",
|
|
2214
|
+
input: "#303438",
|
|
2215
|
+
muted: "#1b1e21",
|
|
2216
|
+
mutedForeground: "#9ba2aa",
|
|
2217
|
+
accent: "#24282d",
|
|
2218
|
+
primary: "#edf0f3",
|
|
2219
|
+
primaryForeground: "#101112",
|
|
2220
|
+
ring: "#84b8ff",
|
|
2221
|
+
destructive: "#fb7185",
|
|
2222
|
+
radius: "0.375rem",
|
|
2223
|
+
fontFamily: "'Geist', sans-serif"
|
|
2224
|
+
}
|
|
2225
|
+
},
|
|
2188
2226
|
light: { light: neutral.light },
|
|
2189
2227
|
dark: { light: neutral.dark },
|
|
2190
2228
|
violet: buildPreset(285),
|
|
@@ -2548,22 +2586,18 @@ function getPinningStyles(column) {
|
|
|
2548
2586
|
boxShadow: isLast ? "1px 0 0 0 var(--border)" : isFirst ? "-1px 0 0 0 var(--border)" : void 0
|
|
2549
2587
|
};
|
|
2550
2588
|
}
|
|
2551
|
-
var DataTableEditingContext = react.createContext(
|
|
2552
|
-
null
|
|
2553
|
-
);
|
|
2589
|
+
var DataTableEditingContext = react.createContext(null);
|
|
2554
2590
|
function useEditingContext() {
|
|
2555
2591
|
const ctx = react.useContext(DataTableEditingContext);
|
|
2556
2592
|
if (!ctx) throw new Error("DataTable editing context missing");
|
|
2557
2593
|
return ctx;
|
|
2558
2594
|
}
|
|
2595
|
+
function DefaultCellHost(ctx) {
|
|
2596
|
+
const value = ctx.getValue();
|
|
2597
|
+
return value == null ? null : String(value);
|
|
2598
|
+
}
|
|
2559
2599
|
function EditableCellHost(ctx) {
|
|
2560
|
-
const {
|
|
2561
|
-
editingCell,
|
|
2562
|
-
editingRowId,
|
|
2563
|
-
setEditingCell,
|
|
2564
|
-
setRowDraft,
|
|
2565
|
-
onCellEdit
|
|
2566
|
-
} = useEditingContext();
|
|
2600
|
+
const { editingCell, editingRowId, setEditingCell, setRowDraft, onCellEdit } = useEditingContext();
|
|
2567
2601
|
const colId = ctx.column.id;
|
|
2568
2602
|
const rowId = ctx.row.id;
|
|
2569
2603
|
const isCellEdit = editingCell?.rowId === rowId && editingCell.colId === colId;
|
|
@@ -2677,6 +2711,7 @@ var DENSITY_CLASS = {
|
|
|
2677
2711
|
default: "",
|
|
2678
2712
|
comfortable: "[&_tbody_td]:py-2"
|
|
2679
2713
|
};
|
|
2714
|
+
var EMPTY_DATA = [];
|
|
2680
2715
|
function DataTable({
|
|
2681
2716
|
data,
|
|
2682
2717
|
columns,
|
|
@@ -2700,6 +2735,12 @@ function DataTable({
|
|
|
2700
2735
|
pageSizeOptions,
|
|
2701
2736
|
initialColumnPinning,
|
|
2702
2737
|
initialColumnVisibility,
|
|
2738
|
+
initialSorting,
|
|
2739
|
+
onSelectionChange,
|
|
2740
|
+
ariaLabel = "Data table",
|
|
2741
|
+
striped = false,
|
|
2742
|
+
stickyHeader = false,
|
|
2743
|
+
maxHeight,
|
|
2703
2744
|
globalFilter: globalFilterProp,
|
|
2704
2745
|
onGlobalFilterChange,
|
|
2705
2746
|
className,
|
|
@@ -2733,12 +2774,13 @@ function DataTable({
|
|
|
2733
2774
|
() => `dyno-grid-${rawInstanceId.replace(/[^a-zA-Z0-9]/g, "")}`,
|
|
2734
2775
|
[rawInstanceId]
|
|
2735
2776
|
);
|
|
2736
|
-
const { lightStyle, darkCss } = react.useMemo(() => {
|
|
2777
|
+
const { lightStyle, lightCss, darkCss } = react.useMemo(() => {
|
|
2737
2778
|
const { light, dark } = splitTheme(theme);
|
|
2738
2779
|
const lightTokens = isolate ? { ...ISOLATE_LIGHT_TOKENS, ...light ?? {} } : light;
|
|
2739
2780
|
const darkTokens = isolate ? { ...ISOLATE_DARK_TOKENS, ...dark ?? light ?? {} } : dark;
|
|
2740
2781
|
return {
|
|
2741
2782
|
lightStyle: tokensToStyle(lightTokens),
|
|
2783
|
+
lightCss: tokensToCssBlock(lightTokens),
|
|
2742
2784
|
darkCss: darkTokens ? tokensToCssBlock(darkTokens) : null
|
|
2743
2785
|
};
|
|
2744
2786
|
}, [theme, isolate]);
|
|
@@ -2776,7 +2818,7 @@ function DataTable({
|
|
|
2776
2818
|
}
|
|
2777
2819
|
setConfirmCtx(null);
|
|
2778
2820
|
};
|
|
2779
|
-
const [sorting, setSorting] = react.useState([]);
|
|
2821
|
+
const [sorting, setSorting] = react.useState(initialSorting ?? []);
|
|
2780
2822
|
const [columnFilters, setColumnFilters] = react.useState([]);
|
|
2781
2823
|
const [internalGlobalFilter, setInternalGlobalFilter] = react.useState("");
|
|
2782
2824
|
const isControlledFilter = globalFilterProp !== void 0;
|
|
@@ -2788,19 +2830,17 @@ function DataTable({
|
|
|
2788
2830
|
const [columnVisibility, setColumnVisibility] = react.useState(
|
|
2789
2831
|
initialColumnVisibility ?? {}
|
|
2790
2832
|
);
|
|
2791
|
-
const [columnPinning, setColumnPinning] = react.useState(
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
left.splice(idx + 1, 0, "__expand");
|
|
2800
|
-
}
|
|
2801
|
-
return { left, right };
|
|
2833
|
+
const [columnPinning, setColumnPinning] = react.useState(() => {
|
|
2834
|
+
const base = initialColumnPinning ?? { left: [], right: [] };
|
|
2835
|
+
const left = [...base.left ?? []];
|
|
2836
|
+
const right = [...base.right ?? []];
|
|
2837
|
+
const hasExpandColumn = !!(renderSubRow || getSubRows);
|
|
2838
|
+
if (hasExpandColumn && left.includes("__select") && !left.includes("__expand")) {
|
|
2839
|
+
const idx = left.indexOf("__select");
|
|
2840
|
+
left.splice(idx + 1, 0, "__expand");
|
|
2802
2841
|
}
|
|
2803
|
-
|
|
2842
|
+
return { left, right };
|
|
2843
|
+
});
|
|
2804
2844
|
const [columnSizing, setColumnSizing] = react.useState({});
|
|
2805
2845
|
const [rowSelection, setRowSelection] = react.useState({});
|
|
2806
2846
|
const [expanded, setExpanded] = react.useState({});
|
|
@@ -2872,7 +2912,7 @@ function DataTable({
|
|
|
2872
2912
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2873
2913
|
...dataSourceDeps
|
|
2874
2914
|
]);
|
|
2875
|
-
const baseData = dataSourceEnabled ? sourceRows : data ??
|
|
2915
|
+
const baseData = dataSourceEnabled ? sourceRows : data ?? EMPTY_DATA;
|
|
2876
2916
|
const effectiveIsLoading = dataSourceEnabled ? sourceLoading : isLoading;
|
|
2877
2917
|
const effectiveIsFetching = dataSourceEnabled ? sourceFetching : isFetching;
|
|
2878
2918
|
const effectiveOnRefresh = dataSourceEnabled ? () => setSourceRefreshKey((key) => key + 1) : onRefresh;
|
|
@@ -2916,7 +2956,7 @@ function DataTable({
|
|
|
2916
2956
|
title: headerLabel
|
|
2917
2957
|
}
|
|
2918
2958
|
),
|
|
2919
|
-
cell: hasEditor ? EditableCellHost : original
|
|
2959
|
+
cell: hasEditor ? EditableCellHost : original ?? DefaultCellHost
|
|
2920
2960
|
};
|
|
2921
2961
|
};
|
|
2922
2962
|
const built = columns.map(wrap);
|
|
@@ -2986,7 +3026,9 @@ function DataTable({
|
|
|
2986
3026
|
customRowActions?.length
|
|
2987
3027
|
]);
|
|
2988
3028
|
const [columnOrder, setColumnOrder] = react.useState(
|
|
2989
|
-
() => augmentedColumns.map(
|
|
3029
|
+
() => augmentedColumns.map(
|
|
3030
|
+
(c) => c.id ?? c.accessorKey ?? ""
|
|
3031
|
+
)
|
|
2990
3032
|
);
|
|
2991
3033
|
react.useEffect(() => {
|
|
2992
3034
|
const next = augmentedColumns.map(
|
|
@@ -3028,10 +3070,10 @@ function DataTable({
|
|
|
3028
3070
|
enableColumnFilters: f.filtering,
|
|
3029
3071
|
enableColumnResizing: f.resizing,
|
|
3030
3072
|
columnResizeMode: "onChange",
|
|
3031
|
-
enableRowSelection:
|
|
3073
|
+
enableRowSelection: enableSelection,
|
|
3032
3074
|
enableExpanding: !!(renderSubRow || getSubRows),
|
|
3033
3075
|
enablePinning: f.pinning,
|
|
3034
|
-
manualPagination: isServerSideDataSource,
|
|
3076
|
+
manualPagination: isServerSideDataSource || !f.pagination,
|
|
3035
3077
|
manualSorting: isServerSideDataSource,
|
|
3036
3078
|
manualFiltering: isServerSideDataSource,
|
|
3037
3079
|
pageCount: isServerSideDataSource ? Math.max(1, Math.ceil(effectiveTotalRecords / pagination.pageSize)) : void 0,
|
|
@@ -3121,6 +3163,13 @@ function DataTable({
|
|
|
3121
3163
|
setEditingRowId(tempId);
|
|
3122
3164
|
} : void 0;
|
|
3123
3165
|
const rows = table.getRowModel().rows;
|
|
3166
|
+
const selectionCallback = react.useRef(onSelectionChange);
|
|
3167
|
+
selectionCallback.current = onSelectionChange;
|
|
3168
|
+
react.useEffect(() => {
|
|
3169
|
+
selectionCallback.current?.(
|
|
3170
|
+
table.getSelectedRowModel().flatRows.map((row) => row.original)
|
|
3171
|
+
);
|
|
3172
|
+
}, [rowSelection, mergedData, table]);
|
|
3124
3173
|
const visibleLeafCount = table.getVisibleLeafColumns().length;
|
|
3125
3174
|
const editingContextValue = react.useMemo(
|
|
3126
3175
|
() => ({
|
|
@@ -3171,12 +3220,15 @@ function DataTable({
|
|
|
3171
3220
|
DENSITY_CLASS[density],
|
|
3172
3221
|
className
|
|
3173
3222
|
),
|
|
3174
|
-
style: lightStyle,
|
|
3223
|
+
style: darkCss ? void 0 : lightStyle,
|
|
3175
3224
|
children: [
|
|
3176
3225
|
darkCss && /* @__PURE__ */ jsxRuntime.jsxs("style", { children: [
|
|
3226
|
+
`[data-dyno-grid="${instanceId}"]{${lightCss}}`,
|
|
3177
3227
|
`@media (prefers-color-scheme: dark){[data-dyno-grid="${instanceId}"]{${darkCss}}}`,
|
|
3178
3228
|
`.dark [data-dyno-grid="${instanceId}"]{${darkCss}}`,
|
|
3179
|
-
|
|
3229
|
+
`.light [data-dyno-grid="${instanceId}"]{${lightCss}}`,
|
|
3230
|
+
`[data-dyno-grid="${instanceId}"].dark{${darkCss}}`,
|
|
3231
|
+
`[data-dyno-grid="${instanceId}"].light{${lightCss}}`
|
|
3180
3232
|
] }),
|
|
3181
3233
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3182
3234
|
DataTableToolbar,
|
|
@@ -3198,75 +3250,88 @@ function DataTable({
|
|
|
3198
3250
|
labels
|
|
3199
3251
|
}
|
|
3200
3252
|
),
|
|
3201
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full overflow-auto", children: [
|
|
3253
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full overflow-auto", style: { maxHeight }, children: [
|
|
3202
3254
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3203
3255
|
"table",
|
|
3204
3256
|
{
|
|
3205
|
-
|
|
3257
|
+
"aria-label": ariaLabel,
|
|
3258
|
+
className: cn(
|
|
3259
|
+
"w-full caption-bottom text-sm",
|
|
3260
|
+
striped && "[&_tbody>tr:nth-child(even)]:bg-muted/25"
|
|
3261
|
+
),
|
|
3206
3262
|
style: {
|
|
3207
3263
|
width: table.getCenterTotalSize() ? void 0 : "100%",
|
|
3208
3264
|
minWidth: "100%"
|
|
3209
3265
|
},
|
|
3210
3266
|
children: [
|
|
3211
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
lucideReact.GripVerticalIcon,
|
|
3244
|
-
{
|
|
3245
|
-
className: "-ml-1 size-3 shrink-0 text-muted-foreground/40 opacity-0 transition group-hover/th:opacity-100",
|
|
3246
|
-
"aria-hidden": "true"
|
|
3247
|
-
}
|
|
3267
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3268
|
+
"thead",
|
|
3269
|
+
{
|
|
3270
|
+
className: cn("bg-card", stickyHeader && "sticky top-0 z-10"),
|
|
3271
|
+
children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b", children: hg.headers.map((header) => {
|
|
3272
|
+
const meta = header.column.columnDef.meta;
|
|
3273
|
+
const isUtility = header.column.id === "__select" || header.column.id === "__expand" || header.column.id === "__actions";
|
|
3274
|
+
const isPinned = !!header.column.getIsPinned();
|
|
3275
|
+
const canReorder = !isUtility && f.reordering;
|
|
3276
|
+
const isDropTarget = canReorder && dragOverColId === header.column.id;
|
|
3277
|
+
const isBeingDragged = canReorder && activeReorderId === header.column.id;
|
|
3278
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3279
|
+
"th",
|
|
3280
|
+
{
|
|
3281
|
+
colSpan: header.colSpan,
|
|
3282
|
+
"data-col-id": header.column.id,
|
|
3283
|
+
onPointerDown: canReorder ? onHeaderPointerDown(header.column.id) : void 0,
|
|
3284
|
+
onPointerMove: canReorder ? onHeaderPointerMove : void 0,
|
|
3285
|
+
onPointerUp: canReorder ? onHeaderPointerUp : void 0,
|
|
3286
|
+
onPointerCancel: canReorder ? onHeaderPointerUp : void 0,
|
|
3287
|
+
style: {
|
|
3288
|
+
width: header.getSize(),
|
|
3289
|
+
...getPinningStyles(header.column),
|
|
3290
|
+
...isPinned ? { zIndex: 2 } : {}
|
|
3291
|
+
},
|
|
3292
|
+
className: cn(
|
|
3293
|
+
"group/th relative h-9 px-2 text-left align-middle text-xs font-medium text-muted-foreground select-none",
|
|
3294
|
+
canReorder && "cursor-grab active:cursor-grabbing",
|
|
3295
|
+
isPinned && "bg-card",
|
|
3296
|
+
isBeingDragged && "opacity-50",
|
|
3297
|
+
isDropTarget && "bg-primary/10 ring-2 ring-primary/40 ring-inset",
|
|
3298
|
+
meta?.headerClassName
|
|
3248
3299
|
),
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3300
|
+
children: [
|
|
3301
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
3302
|
+
canReorder && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
|
+
lucideReact.GripVerticalIcon,
|
|
3304
|
+
{
|
|
3305
|
+
className: "-ml-1 size-3 shrink-0 text-muted-foreground/40 opacity-0 transition group-hover/th:opacity-100",
|
|
3306
|
+
"aria-hidden": "true"
|
|
3307
|
+
}
|
|
3308
|
+
),
|
|
3309
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
3310
|
+
header.column.columnDef.header,
|
|
3311
|
+
header.getContext()
|
|
3312
|
+
) })
|
|
3313
|
+
] }),
|
|
3314
|
+
header.column.getCanResize() && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3315
|
+
"span",
|
|
3316
|
+
{
|
|
3317
|
+
"data-no-drag": true,
|
|
3318
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
3319
|
+
onMouseDown: header.getResizeHandler(),
|
|
3320
|
+
onTouchStart: header.getResizeHandler(),
|
|
3321
|
+
onDoubleClick: () => header.column.resetSize(),
|
|
3322
|
+
className: cn(
|
|
3323
|
+
"absolute top-0 right-0 h-full w-1 cursor-col-resize touch-none bg-transparent transition-colors select-none hover:bg-primary/40",
|
|
3324
|
+
header.column.getIsResizing() && "bg-primary"
|
|
3325
|
+
)
|
|
3326
|
+
}
|
|
3262
3327
|
)
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3328
|
+
]
|
|
3329
|
+
},
|
|
3330
|
+
header.id
|
|
3331
|
+
);
|
|
3332
|
+
}) }, hg.id))
|
|
3333
|
+
}
|
|
3334
|
+
),
|
|
3270
3335
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: effectiveIsLoading ? renderSkeleton(visibleLeafCount, pagination.pageSize) : sourceError && rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3271
3336
|
"td",
|
|
3272
3337
|
{
|
|
@@ -3310,7 +3375,13 @@ function DataTable({
|
|
|
3310
3375
|
labels.refreshing
|
|
3311
3376
|
] })
|
|
3312
3377
|
] }),
|
|
3313
|
-
f.pagination && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3378
|
+
f.pagination && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3379
|
+
DataTablePagination,
|
|
3380
|
+
{
|
|
3381
|
+
table,
|
|
3382
|
+
pageSizeOptions
|
|
3383
|
+
}
|
|
3384
|
+
),
|
|
3314
3385
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3315
3386
|
DataTableViewSheet,
|
|
3316
3387
|
{
|
|
@@ -3401,6 +3472,7 @@ exports.exportToCsv = exportToCsv;
|
|
|
3401
3472
|
exports.exportToExcel = exportToExcel;
|
|
3402
3473
|
exports.isFilterActive = isFilterActive;
|
|
3403
3474
|
exports.numberFilterFn = numberFilterFn;
|
|
3475
|
+
exports.sanitizeSpreadsheetValue = sanitizeSpreadsheetValue;
|
|
3404
3476
|
exports.setFilterFn = setFilterFn;
|
|
3405
3477
|
exports.splitTheme = splitTheme;
|
|
3406
3478
|
exports.textFilterFn = textFilterFn;
|