@ai-matrx/design-system 0.21.8 → 0.21.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 +12 -0
- package/dist/data-table/copy-helpers.cjs.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/copy-helpers.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.cjs +8 -3
- package/dist/data-table/filter-engine.cjs.map +1 -1
- package/dist/data-table/filter-engine.d.cts +4 -2
- package/dist/data-table/filter-engine.d.ts +4 -2
- package/dist/data-table/filter-engine.js +8 -3
- package/dist/data-table/filter-engine.js.map +1 -1
- package/dist/data-table/host.d.cts +1 -1
- package/dist/data-table/host.d.ts +1 -1
- package/dist/data-table/index.cjs +107 -32
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +107 -32
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.cjs +16 -6
- package/dist/data-table/infer-filter.cjs.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/infer-filter.js +16 -6
- package/dist/data-table/infer-filter.js.map +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 +28 -14
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.d.cts +7 -1
- package/dist/data-table/pagination.d.ts +7 -1
- package/dist/data-table/pagination.js +28 -14
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.cjs +16 -6
- package/dist/data-table/query-control.cjs.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/query-control.js +16 -6
- package/dist/data-table/query-control.js.map +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/xlsx.cjs.map +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/data-table/xlsx.js.map +1 -1
- package/dist/{types-DsmrqJHN.d.cts → types-BAJiOaQL.d.cts} +8 -1
- package/dist/{types-Dpl8OW_m.d.ts → types-Da781-Wq.d.ts} +8 -1
- package/package.json +1 -1
|
@@ -1991,6 +1991,7 @@ function PageNavigationControl({
|
|
|
1991
1991
|
}
|
|
1992
1992
|
function PaginationAction({
|
|
1993
1993
|
HostAction,
|
|
1994
|
+
compact = false,
|
|
1994
1995
|
active = false,
|
|
1995
1996
|
disabledHint,
|
|
1996
1997
|
visibilityClassName = "inline-flex",
|
|
@@ -2019,6 +2020,7 @@ function PaginationAction({
|
|
|
2019
2020
|
onClick: props.onClick,
|
|
2020
2021
|
className: cn(
|
|
2021
2022
|
PAGINATION_ACTION_CLASS,
|
|
2023
|
+
compact && "h-8 w-8 min-h-8 min-w-8",
|
|
2022
2024
|
active && PAGINATION_ACTIVE_CLASS,
|
|
2023
2025
|
fallbackClassName
|
|
2024
2026
|
),
|
|
@@ -2032,6 +2034,8 @@ var PAGINATION_ACTION_CLASS = "h-11 w-11 min-h-11 min-w-11 rounded-md border bor
|
|
|
2032
2034
|
var PAGINATION_ACTIVE_CLASS = "border-primary bg-primary text-primary-foreground hover:bg-primary/90";
|
|
2033
2035
|
function GenericTablePagination({
|
|
2034
2036
|
totalItems,
|
|
2037
|
+
unknownTotal,
|
|
2038
|
+
isFetching = false,
|
|
2035
2039
|
itemsPerPage,
|
|
2036
2040
|
currentPage,
|
|
2037
2041
|
onPageChange,
|
|
@@ -2072,11 +2076,12 @@ function GenericTablePagination({
|
|
|
2072
2076
|
(_, i) => startPage + i
|
|
2073
2077
|
);
|
|
2074
2078
|
};
|
|
2075
|
-
const isFirstPageDisabled = currentPage <= 1;
|
|
2076
|
-
const isLastPageDisabled = currentPage >= totalPages;
|
|
2079
|
+
const isFirstPageDisabled = isFetching || currentPage <= 1;
|
|
2080
|
+
const isLastPageDisabled = isFetching || (unknownTotal ? !unknownTotal.hasNextPage : currentPage >= totalPages);
|
|
2077
2081
|
const startItem = totalItems === 0 ? 0 : progressive ? 1 : (currentPage - 1) * effectiveItemsPerPage + 1;
|
|
2078
2082
|
const endItem = Math.min(progressive?.shownCount ?? currentPage * effectiveItemsPerPage, totalItems);
|
|
2079
2083
|
const defaultLabelFormat = (start, end, total) => {
|
|
2084
|
+
if (unknownTotal) return `${unknownTotal.pageRowCount.toLocaleString()} on page ${currentPage.toLocaleString()}`;
|
|
2080
2085
|
if (progressive) return progressive.loadedCount !== void 0 && progressive.loadedCount !== total ? `${end} shown / ${total} matching \xB7 ${progressive.loadedCount} loaded` : `${end} shown / ${total} loaded`;
|
|
2081
2086
|
return compact ? `${start}-${end} of ${total}` : `Showing ${start} to ${end} of ${total} entries`;
|
|
2082
2087
|
};
|
|
@@ -2101,6 +2106,7 @@ function GenericTablePagination({
|
|
|
2101
2106
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2102
2107
|
Select,
|
|
2103
2108
|
{
|
|
2109
|
+
disabled: isFetching,
|
|
2104
2110
|
value: itemsPerPage.toString(),
|
|
2105
2111
|
onValueChange: (value) => onItemsPerPageChange(parseInt(value)),
|
|
2106
2112
|
children: [
|
|
@@ -2117,7 +2123,7 @@ function GenericTablePagination({
|
|
|
2117
2123
|
),
|
|
2118
2124
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(SelectContent, { children: [
|
|
2119
2125
|
availablePageSizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectItem, { value: size.toString(), children: size }, size)),
|
|
2120
|
-
showAllOption ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectItem, { value: allValue.toString(), children: allOptionLabel }) : null
|
|
2126
|
+
showAllOption && !unknownTotal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SelectItem, { value: allValue.toString(), children: allOptionLabel }) : null
|
|
2121
2127
|
] })
|
|
2122
2128
|
]
|
|
2123
2129
|
}
|
|
@@ -2129,7 +2135,7 @@ function GenericTablePagination({
|
|
|
2129
2135
|
{
|
|
2130
2136
|
className: cn("flex min-w-0 justify-center", infoContainerClassName),
|
|
2131
2137
|
children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2132
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-xs tabular-nums text-muted-foreground sm:hidden", children: progressive ? `${endItem}/${totalItems} ${progressive.loadedCount !== void 0 && progressive.loadedCount !== totalItems ? "matching" : "loaded"}` : `${startItem}-${endItem} / ${totalItems}` }),
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate text-xs tabular-nums text-muted-foreground sm:hidden", children: labelFormat ? formatLabel(startItem, endItem, totalItems) : unknownTotal ? defaultLabelFormat(startItem, endItem, totalItems) : progressive ? `${endItem}/${totalItems} ${progressive.loadedCount !== void 0 && progressive.loadedCount !== totalItems ? "matching" : "loaded"}` : `${startItem}-${endItem} / ${totalItems}` }),
|
|
2133
2139
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2134
2140
|
"span",
|
|
2135
2141
|
{
|
|
@@ -2154,7 +2160,7 @@ function GenericTablePagination({
|
|
|
2154
2160
|
}
|
|
2155
2161
|
) }),
|
|
2156
2162
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { children: "Show more already-loaded rows" })
|
|
2157
|
-
] }) : null : showPageControls && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2163
|
+
] }) : null : showPageControls && (unknownTotal ? currentPage > 1 || unknownTotal.hasNextPage : totalPages > 1) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2158
2164
|
"div",
|
|
2159
2165
|
{
|
|
2160
2166
|
className: cn(
|
|
@@ -2167,8 +2173,9 @@ function GenericTablePagination({
|
|
|
2167
2173
|
PaginationAction,
|
|
2168
2174
|
{
|
|
2169
2175
|
HostAction: host.ToolbarAction,
|
|
2176
|
+
compact,
|
|
2170
2177
|
ariaLabel: "First page",
|
|
2171
|
-
disabledHint: "Already on the first page",
|
|
2178
|
+
disabledHint: isFetching ? "Loading source page" : "Already on the first page",
|
|
2172
2179
|
visibilityClassName: "hidden sm:inline-flex",
|
|
2173
2180
|
fallbackClassName: navButtonClassName,
|
|
2174
2181
|
onClick: () => onPageChange(1),
|
|
@@ -2180,41 +2187,46 @@ function GenericTablePagination({
|
|
|
2180
2187
|
PaginationAction,
|
|
2181
2188
|
{
|
|
2182
2189
|
HostAction: host.ToolbarAction,
|
|
2190
|
+
compact,
|
|
2183
2191
|
ariaLabel: "Previous page",
|
|
2184
|
-
disabledHint: "Already on the first page",
|
|
2192
|
+
disabledHint: isFetching ? "Loading source page" : "Already on the first page",
|
|
2185
2193
|
fallbackClassName: navButtonClassName,
|
|
2186
2194
|
onClick: () => onPageChange(currentPage - 1),
|
|
2187
2195
|
disabled: isFirstPageDisabled,
|
|
2188
2196
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronLeft, { className: "h-5 w-5" })
|
|
2189
2197
|
}
|
|
2190
2198
|
),
|
|
2191
|
-
getPageNumbers(3).map((page) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2199
|
+
!unknownTotal && getPageNumbers(3).map((page) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2192
2200
|
PaginationAction,
|
|
2193
2201
|
{
|
|
2194
2202
|
HostAction: host.ToolbarAction,
|
|
2203
|
+
compact,
|
|
2195
2204
|
ariaLabel: `Page ${page}`,
|
|
2196
2205
|
active: currentPage === page,
|
|
2197
|
-
disabledHint: `Already on page ${page}`,
|
|
2206
|
+
disabledHint: isFetching ? "Loading source page" : `Already on page ${page}`,
|
|
2198
2207
|
visibilityClassName: cn(
|
|
2199
2208
|
"sm:hidden",
|
|
2200
2209
|
page === currentPage ? "inline-flex" : "hidden min-[360px]:inline-flex"
|
|
2201
2210
|
),
|
|
2202
2211
|
fallbackClassName: page === currentPage ? pageActiveButtonClassName : pageButtonClassName,
|
|
2203
2212
|
onClick: () => onPageChange(page),
|
|
2213
|
+
disabled: isFetching,
|
|
2204
2214
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: page })
|
|
2205
2215
|
},
|
|
2206
2216
|
`mobile-${page}`
|
|
2207
2217
|
)),
|
|
2208
|
-
getPageNumbers().map((page) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2218
|
+
!unknownTotal && getPageNumbers().map((page) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2209
2219
|
PaginationAction,
|
|
2210
2220
|
{
|
|
2211
2221
|
HostAction: host.ToolbarAction,
|
|
2222
|
+
compact,
|
|
2212
2223
|
ariaLabel: `Page ${page}`,
|
|
2213
2224
|
active: currentPage === page,
|
|
2214
|
-
disabledHint: `Already on page ${page}`,
|
|
2225
|
+
disabledHint: isFetching ? "Loading source page" : `Already on page ${page}`,
|
|
2215
2226
|
visibilityClassName: "hidden sm:inline-flex",
|
|
2216
2227
|
fallbackClassName: currentPage === page ? pageActiveButtonClassName : pageButtonClassName,
|
|
2217
2228
|
onClick: () => onPageChange(page),
|
|
2229
|
+
disabled: isFetching,
|
|
2218
2230
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: page })
|
|
2219
2231
|
},
|
|
2220
2232
|
`desktop-${page}`
|
|
@@ -2223,20 +2235,22 @@ function GenericTablePagination({
|
|
|
2223
2235
|
PaginationAction,
|
|
2224
2236
|
{
|
|
2225
2237
|
HostAction: host.ToolbarAction,
|
|
2238
|
+
compact,
|
|
2226
2239
|
ariaLabel: "Next page",
|
|
2227
|
-
disabledHint: "Already on the last page",
|
|
2240
|
+
disabledHint: isFetching ? "Loading source page" : "Already on the last page",
|
|
2228
2241
|
fallbackClassName: navButtonClassName,
|
|
2229
2242
|
onClick: () => onPageChange(currentPage + 1),
|
|
2230
2243
|
disabled: isLastPageDisabled,
|
|
2231
2244
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronRight, { className: "h-5 w-5" })
|
|
2232
2245
|
}
|
|
2233
2246
|
),
|
|
2234
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2247
|
+
!unknownTotal && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2235
2248
|
PaginationAction,
|
|
2236
2249
|
{
|
|
2237
2250
|
HostAction: host.ToolbarAction,
|
|
2251
|
+
compact,
|
|
2238
2252
|
ariaLabel: "Last page",
|
|
2239
|
-
disabledHint: "Already on the last page",
|
|
2253
|
+
disabledHint: isFetching ? "Loading source page" : "Already on the last page",
|
|
2240
2254
|
visibilityClassName: "hidden sm:inline-flex",
|
|
2241
2255
|
fallbackClassName: navButtonClassName,
|
|
2242
2256
|
onClick: () => onPageChange(totalPages),
|
|
@@ -5035,6 +5049,7 @@ function layeredFilterRuleSummary(rule, fields) {
|
|
|
5035
5049
|
// src/data-table/filter-engine.ts
|
|
5036
5050
|
var SELECT_EMPTY_VALUE = "__empty__";
|
|
5037
5051
|
var SELECT_NOT_EMPTY_VALUE = "__not_empty__";
|
|
5052
|
+
var SELECT_NULL_VALUE = "__null__";
|
|
5038
5053
|
function columnId(col) {
|
|
5039
5054
|
if (col.id) return col.id;
|
|
5040
5055
|
if (col.accessorKey) return String(col.accessorKey);
|
|
@@ -5109,11 +5124,14 @@ function passesColumnFilter(value, filter) {
|
|
|
5109
5124
|
return s.toLowerCase().includes(q);
|
|
5110
5125
|
}
|
|
5111
5126
|
case "select": {
|
|
5127
|
+
if (filter.values !== void 0 && filter.values.length === 0) {
|
|
5128
|
+
return false;
|
|
5129
|
+
}
|
|
5112
5130
|
const selected = filter.values ?? (filter.value && filter.value !== "__all__" ? [filter.value] : []);
|
|
5113
5131
|
if (selected.length === 0) return true;
|
|
5114
5132
|
const values = selectCellValues(value);
|
|
5115
5133
|
return selected.some(
|
|
5116
|
-
(v) => v === SELECT_EMPTY_VALUE ? values.length === 0 : v === SELECT_NOT_EMPTY_VALUE ? values.length > 0 : values.includes(v)
|
|
5134
|
+
(v) => v === SELECT_NULL_VALUE ? value == null : v === SELECT_EMPTY_VALUE ? values.length === 0 : v === SELECT_NOT_EMPTY_VALUE ? values.length > 0 : v === "" ? value === "" || Array.isArray(value) && value.includes("") : values.includes(v)
|
|
5117
5135
|
);
|
|
5118
5136
|
}
|
|
5119
5137
|
case "boolean": {
|
|
@@ -5194,7 +5212,7 @@ function countActiveColumnFilters(filters) {
|
|
|
5194
5212
|
if (f.value.trim() || f.mode && f.mode !== "contains") n += 1;
|
|
5195
5213
|
break;
|
|
5196
5214
|
case "select":
|
|
5197
|
-
if (f.values
|
|
5215
|
+
if (f.values !== void 0 || f.value && f.value !== "__all__")
|
|
5198
5216
|
n += 1;
|
|
5199
5217
|
break;
|
|
5200
5218
|
case "boolean":
|
|
@@ -5213,7 +5231,7 @@ function isColumnFilterActive(filter) {
|
|
|
5213
5231
|
case "text":
|
|
5214
5232
|
return filter.value.trim().length > 0 || filter.mode !== void 0 && filter.mode !== "contains";
|
|
5215
5233
|
case "select":
|
|
5216
|
-
return filter.values
|
|
5234
|
+
return filter.values !== void 0 ? true : Boolean(filter.value) && filter.value !== "__all__";
|
|
5217
5235
|
case "boolean":
|
|
5218
5236
|
return true;
|
|
5219
5237
|
case "number":
|
|
@@ -6350,14 +6368,12 @@ function SearchableSelectFilter({
|
|
|
6350
6368
|
const toggle = (v) => {
|
|
6351
6369
|
if (single) {
|
|
6352
6370
|
onChange(
|
|
6353
|
-
selected.length === 1 && selected[0] === v ? void 0 : { kind: "select", value: v }
|
|
6371
|
+
selected.length === 1 && selected[0] === v ? void 0 : { kind: "select", value: v, ...v === "" ? { values: [v] } : {} }
|
|
6354
6372
|
);
|
|
6355
6373
|
return;
|
|
6356
6374
|
}
|
|
6357
6375
|
const next = selected.includes(v) ? selected.filter((x) => x !== v) : [...selected, v];
|
|
6358
|
-
onChange(
|
|
6359
|
-
next.length === 0 ? void 0 : { kind: "select", value: next[0] ?? "", values: next }
|
|
6360
|
-
);
|
|
6376
|
+
onChange({ kind: "select", value: next[0] ?? "", values: next });
|
|
6361
6377
|
};
|
|
6362
6378
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-1 px-0", children: [
|
|
6363
6379
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between px-1 pb-1", children: [
|
|
@@ -6393,7 +6409,17 @@ function SearchableSelectFilter({
|
|
|
6393
6409
|
CommandItem,
|
|
6394
6410
|
{
|
|
6395
6411
|
value: "__all__",
|
|
6396
|
-
onSelect: () => onChange(void 0)
|
|
6412
|
+
onSelect: () => single ? onChange(void 0) : onChange({
|
|
6413
|
+
kind: "select",
|
|
6414
|
+
value: options.find(
|
|
6415
|
+
(option) => option.value !== SELECT_NOT_EMPTY_VALUE
|
|
6416
|
+
)?.value ?? "",
|
|
6417
|
+
// `(not empty)` matches every populated value. Including
|
|
6418
|
+
// it would make unchecking a concrete value ineffective.
|
|
6419
|
+
values: options.filter(
|
|
6420
|
+
(option) => option.value !== SELECT_NOT_EMPTY_VALUE
|
|
6421
|
+
).map((option) => option.value)
|
|
6422
|
+
}),
|
|
6397
6423
|
className: "text-xs",
|
|
6398
6424
|
children: "All"
|
|
6399
6425
|
}
|
|
@@ -6413,6 +6439,9 @@ function SearchableSelectFilter({
|
|
|
6413
6439
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
6414
6440
|
"span",
|
|
6415
6441
|
{
|
|
6442
|
+
role: single ? "radio" : "checkbox",
|
|
6443
|
+
"aria-label": o.label,
|
|
6444
|
+
"aria-checked": active,
|
|
6416
6445
|
className: cn(
|
|
6417
6446
|
"flex h-3.5 w-3.5 shrink-0 items-center justify-center border",
|
|
6418
6447
|
single ? "rounded-full" : "rounded-sm",
|
|
@@ -8442,10 +8471,13 @@ function collectSelectOptions(col, rows) {
|
|
|
8442
8471
|
const seen = /* @__PURE__ */ new Set();
|
|
8443
8472
|
const options = [];
|
|
8444
8473
|
let hasEmpty = false;
|
|
8474
|
+
let hasEmptyCollection = false;
|
|
8445
8475
|
for (const row of rows) {
|
|
8446
|
-
const
|
|
8476
|
+
const cell = getCellValue(row, col);
|
|
8477
|
+
const values = selectCellValues(cell);
|
|
8447
8478
|
if (values.length === 0) {
|
|
8448
8479
|
hasEmpty = true;
|
|
8480
|
+
if (Array.isArray(cell)) hasEmptyCollection = true;
|
|
8449
8481
|
continue;
|
|
8450
8482
|
}
|
|
8451
8483
|
for (const value of values) {
|
|
@@ -8454,12 +8486,18 @@ function collectSelectOptions(col, rows) {
|
|
|
8454
8486
|
options.push({ value, label: value });
|
|
8455
8487
|
}
|
|
8456
8488
|
}
|
|
8457
|
-
const base = col.filterOptions?.length ?
|
|
8489
|
+
const base = col.filterOptions?.length ? col.filterOptions.map((option) => ({
|
|
8490
|
+
...option,
|
|
8491
|
+
label: option.label.trim() ? option.label : option.value === "" ? "(empty string)" : option.value.trim() ? option.value : "(whitespace)"
|
|
8492
|
+
})) : options.sort((a, b) => a.label.localeCompare(b.label));
|
|
8458
8493
|
if (hasEmpty) {
|
|
8459
|
-
base.
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
)
|
|
8494
|
+
const emptyOption = !hasEmptyCollection && base.some((option) => option.value === "") ? { value: SELECT_NULL_VALUE, label: "(null)" } : { value: SELECT_EMPTY_VALUE, label: "(empty)" };
|
|
8495
|
+
const additions = [];
|
|
8496
|
+
if (!base.some((option) => option.value === emptyOption.value)) additions.push(emptyOption);
|
|
8497
|
+
if (!base.some((option) => option.value === SELECT_NOT_EMPTY_VALUE)) {
|
|
8498
|
+
additions.push({ value: SELECT_NOT_EMPTY_VALUE, label: "(not empty)" });
|
|
8499
|
+
}
|
|
8500
|
+
base.unshift(...additions);
|
|
8463
8501
|
}
|
|
8464
8502
|
return base;
|
|
8465
8503
|
}
|
|
@@ -8670,6 +8708,24 @@ function MatrxDataTableWithUrlState({
|
|
|
8670
8708
|
);
|
|
8671
8709
|
}
|
|
8672
8710
|
var COLUMN_REORDER_ACTIVATION_DISTANCE = 6;
|
|
8711
|
+
var ROW_INTERACTIVE_DESCENDANT_SELECTOR = [
|
|
8712
|
+
"a",
|
|
8713
|
+
"button",
|
|
8714
|
+
"input",
|
|
8715
|
+
"select",
|
|
8716
|
+
"textarea",
|
|
8717
|
+
'[role="button"]',
|
|
8718
|
+
'[role="combobox"]',
|
|
8719
|
+
'[contenteditable="true"]',
|
|
8720
|
+
"[data-matrx-cell-control]"
|
|
8721
|
+
].join(", ");
|
|
8722
|
+
function rowEventTargetsInteractiveDescendant(target) {
|
|
8723
|
+
const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
|
|
8724
|
+
return element?.closest(ROW_INTERACTIVE_DESCENDANT_SELECTOR) !== null;
|
|
8725
|
+
}
|
|
8726
|
+
function opensRowHref(event) {
|
|
8727
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1;
|
|
8728
|
+
}
|
|
8673
8729
|
function TableContextPassthrough({ children }) {
|
|
8674
8730
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
|
|
8675
8731
|
}
|
|
@@ -8724,6 +8780,7 @@ function MatrxDataTableCore({
|
|
|
8724
8780
|
tableClassName,
|
|
8725
8781
|
mobileCards,
|
|
8726
8782
|
mobileCardsBreakpoint = "sm",
|
|
8783
|
+
getRowHref,
|
|
8727
8784
|
onRowOpen,
|
|
8728
8785
|
density
|
|
8729
8786
|
}) {
|
|
@@ -9202,7 +9259,12 @@ function MatrxDataTableCore({
|
|
|
9202
9259
|
0,
|
|
9203
9260
|
...visibleActionStrips.map((element) => Math.ceil(element.scrollWidth))
|
|
9204
9261
|
);
|
|
9205
|
-
const
|
|
9262
|
+
const actionsHeader = table?.querySelector("th[data-matrx-table-actions-column]");
|
|
9263
|
+
const actionsLabel = actionsHeader?.querySelector("[data-matrx-table-actions-label]");
|
|
9264
|
+
const headerPadding = actionsHeader ? getComputedStyle(actionsHeader) : void 0;
|
|
9265
|
+
const measuredLabelWidth = actionsLabel?.getBoundingClientRect().width ?? 0;
|
|
9266
|
+
const labelWidth = measuredLabelWidth > 0 ? Math.ceil(measuredLabelWidth + (Number.parseFloat(headerPadding?.paddingLeft ?? "0") || 0) + (Number.parseFloat(headerPadding?.paddingRight ?? "0") || 0)) : 0;
|
|
9267
|
+
const actionsWidth = Math.max(actionContentWidth, labelWidth) || headerActionsWidth;
|
|
9206
9268
|
return {
|
|
9207
9269
|
...headerTotal > 0 ? { tableWidth: Math.ceil(headerTotal) } : {},
|
|
9208
9270
|
...selectionWidth === void 0 ? {} : { selectionWidth },
|
|
@@ -10831,9 +10893,9 @@ function MatrxDataTableCore({
|
|
|
10831
10893
|
"th",
|
|
10832
10894
|
{
|
|
10833
10895
|
"data-matrx-table-actions-column": true,
|
|
10834
|
-
className: "h-9 w-px px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
10896
|
+
className: "h-9 w-px whitespace-nowrap px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
10835
10897
|
style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
|
|
10836
|
-
children: "Actions"
|
|
10898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-matrx-table-actions-label": true, className: "inline-block whitespace-nowrap", children: "Actions" })
|
|
10837
10899
|
}
|
|
10838
10900
|
)
|
|
10839
10901
|
] })
|
|
@@ -10879,9 +10941,22 @@ function MatrxDataTableCore({
|
|
|
10879
10941
|
"data-row-id": id,
|
|
10880
10942
|
"data-state": isSelected ? "selected" : void 0,
|
|
10881
10943
|
onClick: (e) => {
|
|
10882
|
-
if (e.target
|
|
10944
|
+
if (rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
10945
|
+
if (opensRowHref(e)) {
|
|
10946
|
+
const href = getRowHref?.(row);
|
|
10947
|
+
if (href) window.open(href, "_blank", "noopener");
|
|
10948
|
+
return;
|
|
10949
|
+
}
|
|
10883
10950
|
openRow(row);
|
|
10884
10951
|
},
|
|
10952
|
+
onAuxClick: (e) => {
|
|
10953
|
+
if (e.button !== 1 || rowEventTargetsInteractiveDescendant(e.target)) return;
|
|
10954
|
+
const href = getRowHref?.(row);
|
|
10955
|
+
if (href) {
|
|
10956
|
+
e.preventDefault();
|
|
10957
|
+
window.open(href, "_blank", "noopener");
|
|
10958
|
+
}
|
|
10959
|
+
},
|
|
10885
10960
|
className: cn(
|
|
10886
10961
|
// Keep the mobile row opaque while the complete row scrolls
|
|
10887
10962
|
// horizontally. The translucent zebra/hover tints remain
|