@upbound/monarch-blocks 0.13.0 → 0.13.2
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/dist/data-table.d.ts +2 -3
- package/dist/data-table.js +344 -316
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view--jBQ7evg.d.ts → empty-view-BgEn71l5.d.ts} +31 -51
- package/dist/graph.d.ts +1 -2
- package/dist/graph.js +207 -168
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +489 -478
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/data-table.js
CHANGED
|
@@ -696,7 +696,7 @@ function TimestampCell({ timestamp }) {
|
|
|
696
696
|
}
|
|
697
697
|
|
|
698
698
|
// src/data-table/data-table.tsx
|
|
699
|
-
import * as
|
|
699
|
+
import * as React10 from "react";
|
|
700
700
|
import {
|
|
701
701
|
useTable
|
|
702
702
|
} from "@tanstack/react-table";
|
|
@@ -2350,10 +2350,6 @@ function CelDateValueEditor({
|
|
|
2350
2350
|
] });
|
|
2351
2351
|
}
|
|
2352
2352
|
|
|
2353
|
-
// src/data-table/data-table.tsx
|
|
2354
|
-
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
2355
|
-
import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
|
|
2356
|
-
|
|
2357
2353
|
// src/lib/data-table/features.ts
|
|
2358
2354
|
import {
|
|
2359
2355
|
columnFacetingFeature,
|
|
@@ -2496,21 +2492,6 @@ function getColumnFilterCount(filterValue, filter) {
|
|
|
2496
2492
|
return 0;
|
|
2497
2493
|
}
|
|
2498
2494
|
|
|
2499
|
-
// src/lib/search-input.ts
|
|
2500
|
-
var SEARCH_INPUT_PROPS = {
|
|
2501
|
-
type: "search",
|
|
2502
|
-
autoComplete: "off",
|
|
2503
|
-
"data-1p-ignore": true,
|
|
2504
|
-
// 1Password
|
|
2505
|
-
"data-lpignore": "true",
|
|
2506
|
-
// LastPass
|
|
2507
|
-
"data-bwignore": true,
|
|
2508
|
-
// Bitwarden
|
|
2509
|
-
"data-form-type": "other"
|
|
2510
|
-
// Dashlane
|
|
2511
|
-
};
|
|
2512
|
-
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
2513
|
-
|
|
2514
2495
|
// src/hooks/use-table-column-resizing.ts
|
|
2515
2496
|
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
2516
2497
|
var RESIZE_MIN = 40;
|
|
@@ -3025,13 +3006,84 @@ function useFilterVisibility(filterVisibility) {
|
|
|
3025
3006
|
return { showFilterToggle, filterRowVisible, setFilterRowVisible };
|
|
3026
3007
|
}
|
|
3027
3008
|
|
|
3009
|
+
// src/data-table/data-table-search.tsx
|
|
3010
|
+
import * as React6 from "react";
|
|
3011
|
+
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
3012
|
+
import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
|
|
3013
|
+
|
|
3014
|
+
// src/lib/search-input.ts
|
|
3015
|
+
var SEARCH_INPUT_PROPS = {
|
|
3016
|
+
type: "search",
|
|
3017
|
+
autoComplete: "off",
|
|
3018
|
+
"data-1p-ignore": true,
|
|
3019
|
+
// 1Password
|
|
3020
|
+
"data-lpignore": "true",
|
|
3021
|
+
// LastPass
|
|
3022
|
+
"data-bwignore": true,
|
|
3023
|
+
// Bitwarden
|
|
3024
|
+
"data-form-type": "other"
|
|
3025
|
+
// Dashlane
|
|
3026
|
+
};
|
|
3027
|
+
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
3028
|
+
|
|
3029
|
+
// src/data-table/data-table-search.tsx
|
|
3030
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3031
|
+
function DataTableSearch({
|
|
3032
|
+
value,
|
|
3033
|
+
onValueChange,
|
|
3034
|
+
placeholder = "Search\u2026",
|
|
3035
|
+
className,
|
|
3036
|
+
disabled = false
|
|
3037
|
+
}) {
|
|
3038
|
+
const id = `table-search-${React6.useId()}`;
|
|
3039
|
+
const inputRef = React6.useRef(null);
|
|
3040
|
+
const [draft, setDraft] = React6.useState(value);
|
|
3041
|
+
const [isPending, startTransition] = React6.useTransition();
|
|
3042
|
+
if (!isPending && draft !== value) {
|
|
3043
|
+
setDraft(value);
|
|
3044
|
+
}
|
|
3045
|
+
const commit = (next) => {
|
|
3046
|
+
setDraft(next);
|
|
3047
|
+
startTransition(() => onValueChange(next));
|
|
3048
|
+
};
|
|
3049
|
+
return /* @__PURE__ */ jsxs5(InputGroup2, { className: cn("w-70", className), children: [
|
|
3050
|
+
/* @__PURE__ */ jsx6(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx6(Icon4, { name: "magnifying-glass" }) }),
|
|
3051
|
+
/* @__PURE__ */ jsx6(
|
|
3052
|
+
InputGroupInput2,
|
|
3053
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
3054
|
+
id,
|
|
3055
|
+
className: SEARCH_INPUT_CLASS,
|
|
3056
|
+
"aria-label": "Search",
|
|
3057
|
+
placeholder,
|
|
3058
|
+
disabled,
|
|
3059
|
+
ref: inputRef,
|
|
3060
|
+
value: draft,
|
|
3061
|
+
onChange: (e) => commit(e.target.value)
|
|
3062
|
+
})
|
|
3063
|
+
),
|
|
3064
|
+
!!draft && !disabled && /* @__PURE__ */ jsx6(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx6(
|
|
3065
|
+
InputGroupButton,
|
|
3066
|
+
{
|
|
3067
|
+
size: "icon-xs",
|
|
3068
|
+
"aria-label": "Clear search",
|
|
3069
|
+
onClick: () => {
|
|
3070
|
+
var _a;
|
|
3071
|
+
commit("");
|
|
3072
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
3073
|
+
},
|
|
3074
|
+
children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark" })
|
|
3075
|
+
}
|
|
3076
|
+
) })
|
|
3077
|
+
] });
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3028
3080
|
// src/data-table/empty-view.tsx
|
|
3029
3081
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
3030
3082
|
import { Button as Button4 } from "@upbound/monarch-core";
|
|
3031
3083
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
3032
|
-
import { Icon as
|
|
3084
|
+
import { Icon as Icon5 } from "@upbound/monarch-core";
|
|
3033
3085
|
import { IconTile } from "@upbound/monarch-core";
|
|
3034
|
-
import { jsx as
|
|
3086
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3035
3087
|
var defaultErrorConfig = {
|
|
3036
3088
|
icon: "circle-exclamation",
|
|
3037
3089
|
header: "Something went wrong",
|
|
@@ -3062,37 +3114,37 @@ function DataTableEmptyView({
|
|
|
3062
3114
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
3063
3115
|
const config = tableState === "error" ? mergeConfig(defaultErrorConfig, emptyView == null ? void 0 : emptyView.error) : tableState === "empty" ? isFilteredEmpty ? mergeConfig(defaultNoFilterFoundConfig, emptyView == null ? void 0 : emptyView.filter) : mergeConfig(defaultEmptyConfig, emptyView == null ? void 0 : emptyView.empty) : null;
|
|
3064
3116
|
const wrapperClassName = tableState === "error" ? (_c = (_a = emptyView == null ? void 0 : emptyView.error) == null ? void 0 : _a.wrapperClassName) != null ? _c : (_b = emptyView == null ? void 0 : emptyView.empty) == null ? void 0 : _b.wrapperClassName : config == null ? void 0 : config.wrapperClassName;
|
|
3065
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3117
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs6(Button4, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
3118
|
+
/* @__PURE__ */ jsx7(Icon5, { name: "xmark" }),
|
|
3067
3119
|
"Clear filters"
|
|
3068
3120
|
] }) : null;
|
|
3069
|
-
return /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
config.icon && /* @__PURE__ */
|
|
3072
|
-
config.header && /* @__PURE__ */
|
|
3073
|
-
config.subheader && /* @__PURE__ */
|
|
3121
|
+
return /* @__PURE__ */ jsx7("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs6(Empty, { className: cn("border border-dashed", config.className), children: [
|
|
3122
|
+
/* @__PURE__ */ jsxs6(EmptyHeader, { children: [
|
|
3123
|
+
config.icon && /* @__PURE__ */ jsx7(EmptyMedia, { children: /* @__PURE__ */ jsx7(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx7(Icon5, { name: config.icon }) }) }),
|
|
3124
|
+
config.header && /* @__PURE__ */ jsx7(EmptyTitle, { children: config.header }),
|
|
3125
|
+
config.subheader && /* @__PURE__ */ jsx7(EmptyDescription, { children: config.subheader })
|
|
3074
3126
|
] }),
|
|
3075
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
3076
|
-
config.details && /* @__PURE__ */
|
|
3127
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs6(EmptyContent, { children: [
|
|
3128
|
+
config.details && /* @__PURE__ */ jsx7(Alert, { children: /* @__PURE__ */ jsx7(AlertDescription, { children: config.details }) }),
|
|
3077
3129
|
(_d = config.action) != null ? _d : defaultAction
|
|
3078
3130
|
] })
|
|
3079
3131
|
] }) });
|
|
3080
3132
|
}
|
|
3081
3133
|
|
|
3082
3134
|
// src/data-table/filter-toggle.tsx
|
|
3083
|
-
import { Badge as Badge2, Button as Button5, Icon as
|
|
3084
|
-
import { jsx as
|
|
3135
|
+
import { Badge as Badge2, Button as Button5, Icon as Icon6 } from "@upbound/monarch-core";
|
|
3136
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3085
3137
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
3086
|
-
return /* @__PURE__ */
|
|
3087
|
-
/* @__PURE__ */
|
|
3138
|
+
return /* @__PURE__ */ jsxs7(Button5, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
3139
|
+
/* @__PURE__ */ jsx8(Icon6, { name: "filter", "data-icon": "inline-start" }),
|
|
3088
3140
|
pressed ? "Hide filters" : "Show filters",
|
|
3089
|
-
!!count && /* @__PURE__ */
|
|
3141
|
+
!!count && /* @__PURE__ */ jsx8(Badge2, { variant: "secondary", className: "tabular-nums", children: count })
|
|
3090
3142
|
] });
|
|
3091
3143
|
}
|
|
3092
3144
|
|
|
3093
3145
|
// src/data-table/pagination.tsx
|
|
3094
3146
|
import { Button as Button6 } from "@upbound/monarch-core";
|
|
3095
|
-
import { Icon as
|
|
3147
|
+
import { Icon as Icon7 } from "@upbound/monarch-core";
|
|
3096
3148
|
import { Label as Label2 } from "@upbound/monarch-core";
|
|
3097
3149
|
import {
|
|
3098
3150
|
Pagination,
|
|
@@ -3103,7 +3155,7 @@ import {
|
|
|
3103
3155
|
} from "@upbound/monarch-core";
|
|
3104
3156
|
import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
|
|
3105
3157
|
import { Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@upbound/monarch-core";
|
|
3106
|
-
import { jsx as
|
|
3158
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3107
3159
|
var DEFAULT_PAGINATION_CONFIG = {
|
|
3108
3160
|
summary: true,
|
|
3109
3161
|
arrows: true,
|
|
@@ -3142,36 +3194,36 @@ function DataTablePagination({
|
|
|
3142
3194
|
const currentPage = pageIndex + 1;
|
|
3143
3195
|
const mounted = useMounted();
|
|
3144
3196
|
const locale = mounted ? void 0 : "en-US";
|
|
3145
|
-
return /* @__PURE__ */
|
|
3146
|
-
resolved.summary ? /* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ jsxs8("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
|
|
3198
|
+
resolved.summary ? /* @__PURE__ */ jsxs8("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
|
|
3147
3199
|
"Showing ",
|
|
3148
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
|
|
3149
3201
|
" to",
|
|
3150
3202
|
" ",
|
|
3151
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
|
|
3152
3204
|
" of",
|
|
3153
3205
|
" ",
|
|
3154
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-foreground font-medium", children: [
|
|
3155
3207
|
rowCount.toLocaleString(locale),
|
|
3156
3208
|
!isRowCountExact && "+"
|
|
3157
3209
|
] }),
|
|
3158
3210
|
" ",
|
|
3159
3211
|
"results",
|
|
3160
|
-
!isRowCountExact && /* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3212
|
+
!isRowCountExact && /* @__PURE__ */ jsxs8(Tooltip2, { children: [
|
|
3213
|
+
/* @__PURE__ */ jsx9(TooltipTrigger2, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx9(Icon7, { name: "circle-info", size: "sm" }) }),
|
|
3214
|
+
/* @__PURE__ */ jsx9(TooltipContent2, { children: "Add filters or refine your search to reduce the result set." })
|
|
3163
3215
|
] })
|
|
3164
|
-
] }) : /* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
resolved.pageSizeSelector && /* @__PURE__ */
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3216
|
+
] }) : /* @__PURE__ */ jsx9("div", {}),
|
|
3217
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
|
|
3218
|
+
resolved.pageSizeSelector && /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
3219
|
+
/* @__PURE__ */ jsx9(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
|
|
3220
|
+
/* @__PURE__ */ jsxs8(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
3221
|
+
/* @__PURE__ */ jsx9(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx9(SelectValue2, {}) }),
|
|
3222
|
+
/* @__PURE__ */ jsx9(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx9(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx9(SelectItem2, { value: String(option), children: option }, option)) }) })
|
|
3171
3223
|
] })
|
|
3172
3224
|
] }),
|
|
3173
|
-
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */
|
|
3174
|
-
resolved.arrows && /* @__PURE__ */
|
|
3225
|
+
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx9(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs8(PaginationContent, { children: [
|
|
3226
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3175
3227
|
Button6,
|
|
3176
3228
|
{
|
|
3177
3229
|
variant: "outline",
|
|
@@ -3179,10 +3231,10 @@ function DataTablePagination({
|
|
|
3179
3231
|
"aria-label": "Go to first page",
|
|
3180
3232
|
disabled: currentPage <= 1,
|
|
3181
3233
|
onClick: () => onPageChange(1),
|
|
3182
|
-
children: /* @__PURE__ */
|
|
3234
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevrons-left", className: "cn-rtl-flip" })
|
|
3183
3235
|
}
|
|
3184
3236
|
) }),
|
|
3185
|
-
resolved.arrows && /* @__PURE__ */
|
|
3237
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3186
3238
|
Button6,
|
|
3187
3239
|
{
|
|
3188
3240
|
variant: "outline",
|
|
@@ -3190,11 +3242,11 @@ function DataTablePagination({
|
|
|
3190
3242
|
"aria-label": "Go to previous page",
|
|
3191
3243
|
disabled: currentPage <= 1,
|
|
3192
3244
|
onClick: () => onPageChange(currentPage - 1),
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3245
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevron-left", className: "cn-rtl-flip" })
|
|
3194
3246
|
}
|
|
3195
3247
|
) }),
|
|
3196
3248
|
resolved.numbers && visiblePages.map(
|
|
3197
|
-
(page, index) => page === void 0 ? /* @__PURE__ */
|
|
3249
|
+
(page, index) => page === void 0 ? /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3198
3250
|
PaginationLink,
|
|
3199
3251
|
{
|
|
3200
3252
|
href: "#",
|
|
@@ -3208,7 +3260,7 @@ function DataTablePagination({
|
|
|
3208
3260
|
}
|
|
3209
3261
|
) }, page)
|
|
3210
3262
|
),
|
|
3211
|
-
resolved.arrows && /* @__PURE__ */
|
|
3263
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3212
3264
|
Button6,
|
|
3213
3265
|
{
|
|
3214
3266
|
variant: "outline",
|
|
@@ -3216,10 +3268,10 @@ function DataTablePagination({
|
|
|
3216
3268
|
"aria-label": "Go to next page",
|
|
3217
3269
|
disabled: currentPage >= pageCount,
|
|
3218
3270
|
onClick: () => onPageChange(currentPage + 1),
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3271
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevron-right", className: "cn-rtl-flip" })
|
|
3220
3272
|
}
|
|
3221
3273
|
) }),
|
|
3222
|
-
resolved.arrows && /* @__PURE__ */
|
|
3274
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3223
3275
|
Button6,
|
|
3224
3276
|
{
|
|
3225
3277
|
variant: "outline",
|
|
@@ -3227,7 +3279,7 @@ function DataTablePagination({
|
|
|
3227
3279
|
"aria-label": "Go to last page",
|
|
3228
3280
|
disabled: currentPage >= pageCount,
|
|
3229
3281
|
onClick: () => onPageChange(pageCount),
|
|
3230
|
-
children: /* @__PURE__ */
|
|
3282
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevrons-right", className: "cn-rtl-flip" })
|
|
3231
3283
|
}
|
|
3232
3284
|
) })
|
|
3233
3285
|
] }) })
|
|
@@ -3236,7 +3288,7 @@ function DataTablePagination({
|
|
|
3236
3288
|
}
|
|
3237
3289
|
|
|
3238
3290
|
// src/data-table/table-primitives.tsx
|
|
3239
|
-
import * as
|
|
3291
|
+
import * as React7 from "react";
|
|
3240
3292
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
3241
3293
|
import { ContextMenu, ContextMenuTrigger } from "@upbound/monarch-core";
|
|
3242
3294
|
import {
|
|
@@ -3246,7 +3298,7 @@ import {
|
|
|
3246
3298
|
DropdownMenuSeparator,
|
|
3247
3299
|
DropdownMenuTrigger as DropdownMenuTrigger3
|
|
3248
3300
|
} from "@upbound/monarch-core";
|
|
3249
|
-
import { Icon as
|
|
3301
|
+
import { Icon as Icon8 } from "@upbound/monarch-core";
|
|
3250
3302
|
import { Skeleton } from "@upbound/monarch-core";
|
|
3251
3303
|
import {
|
|
3252
3304
|
Table as BaseTable,
|
|
@@ -3257,7 +3309,7 @@ import {
|
|
|
3257
3309
|
TableRow as BaseTableRow
|
|
3258
3310
|
} from "@upbound/monarch-core";
|
|
3259
3311
|
import { Tooltip as Tooltip3, TooltipContent as TooltipContent3, TooltipTrigger as TooltipTrigger3 } from "@upbound/monarch-core";
|
|
3260
|
-
import { Fragment as Fragment5, jsx as
|
|
3312
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3261
3313
|
var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
|
|
3262
3314
|
var TABLE_HEAD_CLASSES = "text-body-sm text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
3263
3315
|
var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
@@ -3271,7 +3323,7 @@ function DataTableRoot({
|
|
|
3271
3323
|
children
|
|
3272
3324
|
}) {
|
|
3273
3325
|
if (layout === "grid") {
|
|
3274
|
-
return /* @__PURE__ */
|
|
3326
|
+
return /* @__PURE__ */ jsx10(
|
|
3275
3327
|
"div",
|
|
3276
3328
|
{
|
|
3277
3329
|
ref: gridRootRef,
|
|
@@ -3282,7 +3334,7 @@ function DataTableRoot({
|
|
|
3282
3334
|
}
|
|
3283
3335
|
);
|
|
3284
3336
|
}
|
|
3285
|
-
return /* @__PURE__ */
|
|
3337
|
+
return /* @__PURE__ */ jsx10(BaseTable, { className, style, children });
|
|
3286
3338
|
}
|
|
3287
3339
|
function getColumnPinningProps(column, surface = "body") {
|
|
3288
3340
|
const isPinned = column.getIsPinned();
|
|
@@ -3305,8 +3357,8 @@ function getColumnPinningProps(column, surface = "body") {
|
|
|
3305
3357
|
}
|
|
3306
3358
|
function DataTableSortIcon({ sortOrder }) {
|
|
3307
3359
|
if (!sortOrder) return null;
|
|
3308
|
-
return /* @__PURE__ */
|
|
3309
|
-
|
|
3360
|
+
return /* @__PURE__ */ jsx10(
|
|
3361
|
+
Icon8,
|
|
3310
3362
|
{
|
|
3311
3363
|
size: "xs",
|
|
3312
3364
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
@@ -3325,57 +3377,57 @@ function ColumnActionsMenuItems({
|
|
|
3325
3377
|
const canResize = header.column.getCanResize();
|
|
3326
3378
|
const canHide = header.column.getCanHide();
|
|
3327
3379
|
const canPin = !isGrid && header.column.getCanPin();
|
|
3328
|
-
return /* @__PURE__ */
|
|
3329
|
-
canSort && /* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsxs9(DropdownMenuContent3, { align: "start", className: "w-45", children: [
|
|
3381
|
+
canSort && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3382
|
+
/* @__PURE__ */ jsxs9(
|
|
3331
3383
|
DropdownMenuItem3,
|
|
3332
3384
|
{
|
|
3333
3385
|
disabled: header.column.getIsSorted() === "asc",
|
|
3334
3386
|
onClick: () => header.column.toggleSorting(false),
|
|
3335
3387
|
children: [
|
|
3336
|
-
/* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrow-up" }),
|
|
3337
3389
|
"Sort ascending"
|
|
3338
3390
|
]
|
|
3339
3391
|
}
|
|
3340
3392
|
),
|
|
3341
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsxs9(
|
|
3342
3394
|
DropdownMenuItem3,
|
|
3343
3395
|
{
|
|
3344
3396
|
disabled: header.column.getIsSorted() === "desc",
|
|
3345
3397
|
onClick: () => header.column.toggleSorting(true),
|
|
3346
3398
|
children: [
|
|
3347
|
-
/* @__PURE__ */
|
|
3399
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrow-down" }),
|
|
3348
3400
|
"Sort descending"
|
|
3349
3401
|
]
|
|
3350
3402
|
}
|
|
3351
3403
|
),
|
|
3352
|
-
!!header.column.getIsSorted() && /* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3404
|
+
!!header.column.getIsSorted() && /* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => header.column.clearSorting(), children: [
|
|
3405
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "xmark" }),
|
|
3354
3406
|
"Remove sorting"
|
|
3355
3407
|
] })
|
|
3356
3408
|
] }),
|
|
3357
|
-
canResize && /* @__PURE__ */
|
|
3358
|
-
canSort && /* @__PURE__ */
|
|
3359
|
-
!isGrid && /* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */
|
|
3409
|
+
canResize && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3410
|
+
canSort && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3411
|
+
!isGrid && /* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => onAutosizeColumn(header.column.id), children: [
|
|
3412
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrows-left-right" }),
|
|
3361
3413
|
"Autosize column"
|
|
3362
3414
|
] }),
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => onAutosizeAll(), children: [
|
|
3416
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "table-columns" }),
|
|
3365
3417
|
isGrid ? "Reset all columns" : "Autosize all columns"
|
|
3366
3418
|
] })
|
|
3367
3419
|
] }),
|
|
3368
|
-
(canHide || canPin) && /* @__PURE__ */
|
|
3369
|
-
(canSort || canResize) && /* @__PURE__ */
|
|
3370
|
-
canHide && /* @__PURE__ */
|
|
3371
|
-
/* @__PURE__ */
|
|
3420
|
+
(canHide || canPin) && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3421
|
+
(canSort || canResize) && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3422
|
+
canHide && /* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => header.column.toggleVisibility(), children: [
|
|
3423
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "eye-slash" }),
|
|
3372
3424
|
"Hide column"
|
|
3373
3425
|
] }),
|
|
3374
|
-
canPin && (header.column.getIsPinned() ? /* @__PURE__ */
|
|
3375
|
-
/* @__PURE__ */
|
|
3426
|
+
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
|
|
3427
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3376
3428
|
"Unpin column"
|
|
3377
|
-
] }) : /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3429
|
+
] }) : /* @__PURE__ */ jsxs9(DropdownMenuItem3, { onClick: () => header.column.pin("start"), children: [
|
|
3430
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3379
3431
|
"Pin column"
|
|
3380
3432
|
] }))
|
|
3381
3433
|
] })
|
|
@@ -3395,7 +3447,7 @@ function HeaderCellContent({
|
|
|
3395
3447
|
const resizeHandler = header.getResizeHandler();
|
|
3396
3448
|
const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
|
|
3397
3449
|
const sorted = header.column.getIsSorted();
|
|
3398
|
-
const labelButton = /* @__PURE__ */
|
|
3450
|
+
const labelButton = /* @__PURE__ */ jsxs9(
|
|
3399
3451
|
"button",
|
|
3400
3452
|
{
|
|
3401
3453
|
type: "button",
|
|
@@ -3406,10 +3458,10 @@ function HeaderCellContent({
|
|
|
3406
3458
|
shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
3407
3459
|
),
|
|
3408
3460
|
children: [
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3411
|
-
shouldShowActionsMenu && /* @__PURE__ */
|
|
3412
|
-
|
|
3461
|
+
/* @__PURE__ */ jsx10(DataTableSortIcon, { sortOrder: sorted }),
|
|
3462
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
|
|
3463
|
+
shouldShowActionsMenu && /* @__PURE__ */ jsx10(
|
|
3464
|
+
Icon8,
|
|
3413
3465
|
{
|
|
3414
3466
|
size: "sm",
|
|
3415
3467
|
name: "ellipsis",
|
|
@@ -3419,9 +3471,9 @@ function HeaderCellContent({
|
|
|
3419
3471
|
]
|
|
3420
3472
|
}
|
|
3421
3473
|
);
|
|
3422
|
-
const label = shouldShowActionsMenu ? /* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3474
|
+
const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs9(DropdownMenu3, { children: [
|
|
3475
|
+
/* @__PURE__ */ jsx10(DropdownMenuTrigger3, { asChild: true, children: labelButton }),
|
|
3476
|
+
/* @__PURE__ */ jsx10(
|
|
3425
3477
|
ColumnActionsMenuItems,
|
|
3426
3478
|
{
|
|
3427
3479
|
header,
|
|
@@ -3431,12 +3483,12 @@ function HeaderCellContent({
|
|
|
3431
3483
|
}
|
|
3432
3484
|
)
|
|
3433
3485
|
] }) : labelButton;
|
|
3434
|
-
return /* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3487
|
+
/* @__PURE__ */ jsx10("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: /* @__PURE__ */ jsx10("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs9(Tooltip3, { children: [
|
|
3488
|
+
/* @__PURE__ */ jsx10(TooltipTrigger3, { asChild: true, children: label }),
|
|
3489
|
+
/* @__PURE__ */ jsx10(TooltipContent3, { children: headerTitle })
|
|
3438
3490
|
] }) : label) }) }),
|
|
3439
|
-
canResize && /* @__PURE__ */
|
|
3491
|
+
canResize && /* @__PURE__ */ jsx10(
|
|
3440
3492
|
"button",
|
|
3441
3493
|
{
|
|
3442
3494
|
type: "button",
|
|
@@ -3480,7 +3532,7 @@ function DataTableHeader({
|
|
|
3480
3532
|
const stickyTopPx = stickyHeader ? stickyHeaderOffset + headerGroupIndex * stickyHeaderRowHeight : void 0;
|
|
3481
3533
|
const isPinned = !isGrid && header.column.getIsPinned();
|
|
3482
3534
|
const pinning = isGrid ? { className: "", style: {} } : getColumnPinningProps(header.column, "header");
|
|
3483
|
-
const content = /* @__PURE__ */
|
|
3535
|
+
const content = /* @__PURE__ */ jsx10(
|
|
3484
3536
|
HeaderCellContent,
|
|
3485
3537
|
{
|
|
3486
3538
|
header,
|
|
@@ -3501,7 +3553,7 @@ function DataTableHeader({
|
|
|
3501
3553
|
isPinned && "z-30"
|
|
3502
3554
|
);
|
|
3503
3555
|
if (isGrid) {
|
|
3504
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsx10(
|
|
3505
3557
|
"div",
|
|
3506
3558
|
{
|
|
3507
3559
|
role: "columnheader",
|
|
@@ -3514,7 +3566,7 @@ function DataTableHeader({
|
|
|
3514
3566
|
header.id
|
|
3515
3567
|
);
|
|
3516
3568
|
}
|
|
3517
|
-
return /* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsx10(
|
|
3518
3570
|
BaseTableHead,
|
|
3519
3571
|
{
|
|
3520
3572
|
className: cn(cellClassName, "whitespace-normal"),
|
|
@@ -3529,19 +3581,19 @@ function DataTableHeader({
|
|
|
3529
3581
|
});
|
|
3530
3582
|
};
|
|
3531
3583
|
if (isGrid) {
|
|
3532
|
-
return /* @__PURE__ */
|
|
3584
|
+
return /* @__PURE__ */ jsx10(
|
|
3533
3585
|
"div",
|
|
3534
3586
|
{
|
|
3535
3587
|
role: "rowgroup",
|
|
3536
3588
|
className: cn("col-span-full grid grid-cols-subgrid", HEADER_SURFACE_BG, !!stickyHeader && "sticky z-20"),
|
|
3537
3589
|
style: stickyHeader ? { top: stickyHeaderOffset } : void 0,
|
|
3538
|
-
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */
|
|
3590
|
+
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx10("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
|
|
3539
3591
|
}
|
|
3540
3592
|
);
|
|
3541
3593
|
}
|
|
3542
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsx10(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx10(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
|
|
3543
3595
|
}
|
|
3544
|
-
var DataTableRow =
|
|
3596
|
+
var DataTableRow = React7.forwardRef(
|
|
3545
3597
|
(_a, ref) => {
|
|
3546
3598
|
var _b = _a, { hoverable, disabled, className, layout = "auto" } = _b, props = __objRest(_b, ["hoverable", "disabled", "className", "layout"]);
|
|
3547
3599
|
const classes = cn(
|
|
@@ -3551,7 +3603,7 @@ var DataTableRow = React6.forwardRef(
|
|
|
3551
3603
|
className
|
|
3552
3604
|
);
|
|
3553
3605
|
if (layout === "grid") {
|
|
3554
|
-
return /* @__PURE__ */
|
|
3606
|
+
return /* @__PURE__ */ jsx10(
|
|
3555
3607
|
"div",
|
|
3556
3608
|
__spreadValues({
|
|
3557
3609
|
ref,
|
|
@@ -3560,7 +3612,7 @@ var DataTableRow = React6.forwardRef(
|
|
|
3560
3612
|
}, props)
|
|
3561
3613
|
);
|
|
3562
3614
|
}
|
|
3563
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, __spreadValues({ ref, className: classes }, props));
|
|
3564
3616
|
}
|
|
3565
3617
|
);
|
|
3566
3618
|
DataTableRow.displayName = "DataTableRow";
|
|
@@ -3591,7 +3643,7 @@ function DataTableCell({
|
|
|
3591
3643
|
isPinned && "z-10",
|
|
3592
3644
|
className
|
|
3593
3645
|
);
|
|
3594
|
-
const cellElement = isGrid ? /* @__PURE__ */
|
|
3646
|
+
const cellElement = isGrid ? /* @__PURE__ */ jsx10(
|
|
3595
3647
|
"div",
|
|
3596
3648
|
{
|
|
3597
3649
|
role: "cell",
|
|
@@ -3599,7 +3651,7 @@ function DataTableCell({
|
|
|
3599
3651
|
style: { minWidth: cell.column.columnDef.minSize },
|
|
3600
3652
|
children: content
|
|
3601
3653
|
}
|
|
3602
|
-
) : /* @__PURE__ */
|
|
3654
|
+
) : /* @__PURE__ */ jsx10(
|
|
3603
3655
|
BaseTableCell,
|
|
3604
3656
|
{
|
|
3605
3657
|
className: cellClassName,
|
|
@@ -3611,9 +3663,9 @@ function DataTableCell({
|
|
|
3611
3663
|
}
|
|
3612
3664
|
);
|
|
3613
3665
|
if (!shouldShowContextualMenu || !onContextCell) return cellElement;
|
|
3614
|
-
return /* @__PURE__ */
|
|
3615
|
-
/* @__PURE__ */
|
|
3616
|
-
/* @__PURE__ */
|
|
3666
|
+
return /* @__PURE__ */ jsxs9(ContextMenu, { children: [
|
|
3667
|
+
/* @__PURE__ */ jsx10(ContextMenuTrigger, { asChild: true, children: cellElement }),
|
|
3668
|
+
/* @__PURE__ */ jsx10(
|
|
3617
3669
|
CellContextualFilter,
|
|
3618
3670
|
{
|
|
3619
3671
|
filter: contextualFilter,
|
|
@@ -3632,7 +3684,7 @@ function DataTableGroupRow({
|
|
|
3632
3684
|
layout = "auto"
|
|
3633
3685
|
}) {
|
|
3634
3686
|
if (layout === "grid") {
|
|
3635
|
-
return /* @__PURE__ */
|
|
3687
|
+
return /* @__PURE__ */ jsx10("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx10(
|
|
3636
3688
|
"div",
|
|
3637
3689
|
{
|
|
3638
3690
|
role: "cell",
|
|
@@ -3642,7 +3694,7 @@ function DataTableGroupRow({
|
|
|
3642
3694
|
}
|
|
3643
3695
|
) });
|
|
3644
3696
|
}
|
|
3645
|
-
return /* @__PURE__ */
|
|
3697
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx10(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
|
|
3646
3698
|
}
|
|
3647
3699
|
function DataTableSkeletonBody({
|
|
3648
3700
|
rowCount = 10,
|
|
@@ -3651,32 +3703,32 @@ function DataTableSkeletonBody({
|
|
|
3651
3703
|
layout = "auto"
|
|
3652
3704
|
}) {
|
|
3653
3705
|
const isGrid = layout === "grid";
|
|
3654
|
-
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */
|
|
3706
|
+
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx10(DataTableRow, { layout, children: columns.map(
|
|
3655
3707
|
(col) => {
|
|
3656
3708
|
var _a, _b;
|
|
3657
|
-
return isGrid ? /* @__PURE__ */
|
|
3709
|
+
return isGrid ? /* @__PURE__ */ jsx10(
|
|
3658
3710
|
"div",
|
|
3659
3711
|
{
|
|
3660
3712
|
role: "cell",
|
|
3661
3713
|
className: cn(TABLE_CELL_CLASSES, "flex items-center overflow-hidden"),
|
|
3662
3714
|
style: { minWidth: col.minSize },
|
|
3663
|
-
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */
|
|
3715
|
+
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx10(Skeleton, { className: "h-4 w-full" })
|
|
3664
3716
|
},
|
|
3665
3717
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
3666
|
-
) : /* @__PURE__ */
|
|
3718
|
+
) : /* @__PURE__ */ jsx10(
|
|
3667
3719
|
BaseTableCell,
|
|
3668
3720
|
{
|
|
3669
3721
|
style: { width: col.size, minWidth: col.minSize, maxWidth: col.maxSize },
|
|
3670
|
-
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */
|
|
3722
|
+
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx10(Skeleton, { className: "h-4 w-full" })
|
|
3671
3723
|
},
|
|
3672
3724
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
3673
3725
|
);
|
|
3674
3726
|
}
|
|
3675
3727
|
) }, `skeleton-row-${rowIndex}`));
|
|
3676
3728
|
if (isGrid) {
|
|
3677
|
-
return /* @__PURE__ */
|
|
3729
|
+
return /* @__PURE__ */ jsx10("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
|
|
3678
3730
|
}
|
|
3679
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ jsx10(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
|
|
3680
3732
|
}
|
|
3681
3733
|
function DataTableExpandedRow({
|
|
3682
3734
|
colSpan,
|
|
@@ -3686,9 +3738,9 @@ function DataTableExpandedRow({
|
|
|
3686
3738
|
}) {
|
|
3687
3739
|
if (!show) return null;
|
|
3688
3740
|
if (layout === "grid") {
|
|
3689
|
-
return /* @__PURE__ */
|
|
3741
|
+
return /* @__PURE__ */ jsx10("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx10("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
3690
3742
|
}
|
|
3691
|
-
return /* @__PURE__ */
|
|
3743
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx10(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
3692
3744
|
}
|
|
3693
3745
|
function DataTableBody({
|
|
3694
3746
|
tableRows,
|
|
@@ -3714,7 +3766,7 @@ function DataTableBody({
|
|
|
3714
3766
|
minSize: c.columnDef.minSize,
|
|
3715
3767
|
maxSize: c.columnDef.maxSize
|
|
3716
3768
|
}));
|
|
3717
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsx10(
|
|
3718
3770
|
DataTableSkeletonBody,
|
|
3719
3771
|
{
|
|
3720
3772
|
columns: skeletonColumns,
|
|
@@ -3728,18 +3780,18 @@ function DataTableBody({
|
|
|
3728
3780
|
var _a, _b, _c, _d, _e;
|
|
3729
3781
|
if ((_a = row.getIsGrouped) == null ? void 0 : _a.call(row)) {
|
|
3730
3782
|
const groupLabel = (_c = row.groupingValue) != null ? _c : row.groupingColumnId ? (_b = row.getGroupingValue) == null ? void 0 : _b.call(row, row.groupingColumnId) : void 0;
|
|
3731
|
-
return /* @__PURE__ */
|
|
3783
|
+
return /* @__PURE__ */ jsx10(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
|
|
3732
3784
|
}
|
|
3733
3785
|
const isExpanded = !!(((_d = row.getCanExpand) == null ? void 0 : _d.call(row)) && ((_e = row.getIsExpanded) == null ? void 0 : _e.call(row)));
|
|
3734
3786
|
const expandedRow = renderExpandedRow && isExpanded ? renderExpandedRow(row.original) : null;
|
|
3735
|
-
return /* @__PURE__ */
|
|
3736
|
-
/* @__PURE__ */
|
|
3787
|
+
return /* @__PURE__ */ jsxs9(React7.Fragment, { children: [
|
|
3788
|
+
/* @__PURE__ */ jsx10(
|
|
3737
3789
|
DataTableRow,
|
|
3738
3790
|
__spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original, row) : {}), {
|
|
3739
3791
|
"data-expanded": isExpanded || void 0,
|
|
3740
3792
|
"data-depth": row.depth || void 0,
|
|
3741
3793
|
layout,
|
|
3742
|
-
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */
|
|
3794
|
+
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx10(
|
|
3743
3795
|
DataTableCell,
|
|
3744
3796
|
{
|
|
3745
3797
|
cell,
|
|
@@ -3753,21 +3805,21 @@ function DataTableBody({
|
|
|
3753
3805
|
))
|
|
3754
3806
|
})
|
|
3755
3807
|
),
|
|
3756
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsx10(DataTableExpandedRow, { colSpan, show: expandedRow != null, layout, children: expandedRow })
|
|
3757
3809
|
] }, row.id);
|
|
3758
3810
|
});
|
|
3759
3811
|
if (isGrid) {
|
|
3760
|
-
return /* @__PURE__ */
|
|
3812
|
+
return /* @__PURE__ */ jsx10("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
|
|
3761
3813
|
}
|
|
3762
|
-
return /* @__PURE__ */
|
|
3814
|
+
return /* @__PURE__ */ jsx10(BaseTableBody, { children: rows });
|
|
3763
3815
|
}
|
|
3764
3816
|
|
|
3765
3817
|
// src/data-table/view-filter.tsx
|
|
3766
|
-
import * as
|
|
3818
|
+
import * as React9 from "react";
|
|
3767
3819
|
|
|
3768
3820
|
// src/filter-bar/filter-bar.tsx
|
|
3769
|
-
import * as
|
|
3770
|
-
import { Icon as
|
|
3821
|
+
import * as React8 from "react";
|
|
3822
|
+
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
3771
3823
|
import { Badge as Badge3 } from "@upbound/monarch-core";
|
|
3772
3824
|
import { Button as Button7 } from "@upbound/monarch-core";
|
|
3773
3825
|
import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
|
|
@@ -3797,7 +3849,7 @@ import {
|
|
|
3797
3849
|
import { Input as Input2 } from "@upbound/monarch-core";
|
|
3798
3850
|
import { Label as Label3 } from "@upbound/monarch-core";
|
|
3799
3851
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
|
|
3800
|
-
import { Fragment as Fragment6, jsx as
|
|
3852
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3801
3853
|
function asCheckboxValue(value) {
|
|
3802
3854
|
return Array.isArray(value) ? value : [];
|
|
3803
3855
|
}
|
|
@@ -3866,13 +3918,13 @@ function FilterBar(_a) {
|
|
|
3866
3918
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
3867
3919
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
3868
3920
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
3869
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
3921
|
+
const [pendingOpenKey, setPendingOpenKey] = React8.useState(null);
|
|
3870
3922
|
function handleAddFilter(key) {
|
|
3871
3923
|
onAddFilter(key);
|
|
3872
3924
|
setPendingOpenKey(key);
|
|
3873
3925
|
}
|
|
3874
|
-
const containerRef =
|
|
3875
|
-
return /* @__PURE__ */
|
|
3926
|
+
const containerRef = React8.useRef(null);
|
|
3927
|
+
return /* @__PURE__ */ jsxs10(
|
|
3876
3928
|
"div",
|
|
3877
3929
|
__spreadProps(__spreadValues({
|
|
3878
3930
|
"data-slot": "filter-bar",
|
|
@@ -3881,7 +3933,7 @@ function FilterBar(_a) {
|
|
|
3881
3933
|
ref: composeRefs(containerRef, ref)
|
|
3882
3934
|
}, props), {
|
|
3883
3935
|
children: [
|
|
3884
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
3936
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs10(
|
|
3885
3937
|
Combobox2,
|
|
3886
3938
|
{
|
|
3887
3939
|
items: availableFilters,
|
|
@@ -3892,14 +3944,14 @@ function FilterBar(_a) {
|
|
|
3892
3944
|
if (filter) handleAddFilter(filter.key);
|
|
3893
3945
|
},
|
|
3894
3946
|
children: [
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3947
|
+
/* @__PURE__ */ jsxs10(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx11(Button7, { variant: "outline" }), children: [
|
|
3948
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "plus", "data-icon": "inline-start" }),
|
|
3897
3949
|
"Add filter"
|
|
3898
3950
|
] }),
|
|
3899
|
-
/* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3951
|
+
/* @__PURE__ */ jsxs10(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
|
|
3952
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
3953
|
+
/* @__PURE__ */ jsx11(ComboboxEmpty2, { children: "No filters found." }),
|
|
3954
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx11(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
|
|
3903
3955
|
] })
|
|
3904
3956
|
]
|
|
3905
3957
|
}
|
|
@@ -3907,7 +3959,7 @@ function FilterBar(_a) {
|
|
|
3907
3959
|
activeFilters.map((active) => {
|
|
3908
3960
|
const definition = filters.find((f) => f.key === active.key);
|
|
3909
3961
|
if (!definition) return null;
|
|
3910
|
-
return /* @__PURE__ */
|
|
3962
|
+
return /* @__PURE__ */ jsx11(
|
|
3911
3963
|
FilterChip,
|
|
3912
3964
|
{
|
|
3913
3965
|
definition,
|
|
@@ -3930,7 +3982,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3930
3982
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
3931
3983
|
switch (type) {
|
|
3932
3984
|
case "checkbox":
|
|
3933
|
-
return /* @__PURE__ */
|
|
3985
|
+
return /* @__PURE__ */ jsx11(
|
|
3934
3986
|
CheckboxFilterChip,
|
|
3935
3987
|
{
|
|
3936
3988
|
definition,
|
|
@@ -3942,7 +3994,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3942
3994
|
}
|
|
3943
3995
|
);
|
|
3944
3996
|
case "radio":
|
|
3945
|
-
return /* @__PURE__ */
|
|
3997
|
+
return /* @__PURE__ */ jsx11(
|
|
3946
3998
|
RadioFilterChip,
|
|
3947
3999
|
{
|
|
3948
4000
|
definition,
|
|
@@ -3954,7 +4006,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3954
4006
|
}
|
|
3955
4007
|
);
|
|
3956
4008
|
case "text":
|
|
3957
|
-
return /* @__PURE__ */
|
|
4009
|
+
return /* @__PURE__ */ jsx11(
|
|
3958
4010
|
TextFilterChip,
|
|
3959
4011
|
{
|
|
3960
4012
|
definition,
|
|
@@ -3965,7 +4017,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3965
4017
|
}
|
|
3966
4018
|
);
|
|
3967
4019
|
case "multiText":
|
|
3968
|
-
return /* @__PURE__ */
|
|
4020
|
+
return /* @__PURE__ */ jsx11(
|
|
3969
4021
|
MultiTextFilterChip,
|
|
3970
4022
|
{
|
|
3971
4023
|
definition,
|
|
@@ -3976,7 +4028,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3976
4028
|
}
|
|
3977
4029
|
);
|
|
3978
4030
|
case "date":
|
|
3979
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx11(
|
|
3980
4032
|
DateFilterChip,
|
|
3981
4033
|
{
|
|
3982
4034
|
definition,
|
|
@@ -3989,7 +4041,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3989
4041
|
}
|
|
3990
4042
|
}
|
|
3991
4043
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
3992
|
-
return /* @__PURE__ */
|
|
4044
|
+
return /* @__PURE__ */ jsx11(Button7, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx11(Icon9, { name: "xmark" }) });
|
|
3993
4045
|
}
|
|
3994
4046
|
function CheckboxFilterChip({
|
|
3995
4047
|
definition,
|
|
@@ -4008,9 +4060,9 @@ function CheckboxFilterChip({
|
|
|
4008
4060
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
4009
4061
|
onChangeValue(next);
|
|
4010
4062
|
}
|
|
4011
|
-
return /* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4013
|
-
searchable ? /* @__PURE__ */
|
|
4063
|
+
return /* @__PURE__ */ jsxs10(ButtonGroup2, { children: [
|
|
4064
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4065
|
+
searchable ? /* @__PURE__ */ jsxs10(
|
|
4014
4066
|
Combobox2,
|
|
4015
4067
|
{
|
|
4016
4068
|
items: options,
|
|
@@ -4020,34 +4072,34 @@ function CheckboxFilterChip({
|
|
|
4020
4072
|
value: options.filter((o) => values.includes(o.value)),
|
|
4021
4073
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
4022
4074
|
children: [
|
|
4023
|
-
/* @__PURE__ */
|
|
4075
|
+
/* @__PURE__ */ jsx11(
|
|
4024
4076
|
ComboboxTrigger2,
|
|
4025
4077
|
{
|
|
4026
|
-
render: /* @__PURE__ */
|
|
4027
|
-
children: /* @__PURE__ */
|
|
4078
|
+
render: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4079
|
+
children: /* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
4028
4080
|
}
|
|
4029
4081
|
),
|
|
4030
|
-
/* @__PURE__ */
|
|
4082
|
+
/* @__PURE__ */ jsxs10(
|
|
4031
4083
|
ComboboxContent2,
|
|
4032
4084
|
{
|
|
4033
4085
|
container,
|
|
4034
4086
|
className: "min-w-64",
|
|
4035
4087
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4036
4088
|
children: [
|
|
4037
|
-
/* @__PURE__ */
|
|
4038
|
-
values.length > 0 && /* @__PURE__ */
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4089
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4090
|
+
values.length > 0 && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4091
|
+
/* @__PURE__ */ jsxs10(ComboboxSelectedChips2, { children: [
|
|
4092
|
+
/* @__PURE__ */ jsx11(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx11(Fragment6, { children: selected.map((item) => /* @__PURE__ */ jsx11(ComboboxChip2, { children: item.label }, item.value)) }) }),
|
|
4093
|
+
/* @__PURE__ */ jsx11(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
|
|
4042
4094
|
] }),
|
|
4043
|
-
/* @__PURE__ */
|
|
4095
|
+
/* @__PURE__ */ jsx11(ComboboxSeparator2, {})
|
|
4044
4096
|
] }),
|
|
4045
|
-
/* @__PURE__ */
|
|
4097
|
+
/* @__PURE__ */ jsxs10(ComboboxEmpty2, { children: [
|
|
4046
4098
|
"No ",
|
|
4047
4099
|
label.toLowerCase(),
|
|
4048
4100
|
" found."
|
|
4049
4101
|
] }),
|
|
4050
|
-
/* @__PURE__ */
|
|
4102
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs10(ComboboxItem2, { value: item, children: [
|
|
4051
4103
|
item.icon,
|
|
4052
4104
|
item.label
|
|
4053
4105
|
] }, item.value) })
|
|
@@ -4056,12 +4108,12 @@ function CheckboxFilterChip({
|
|
|
4056
4108
|
)
|
|
4057
4109
|
]
|
|
4058
4110
|
}
|
|
4059
|
-
) : /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4111
|
+
) : /* @__PURE__ */ jsxs10(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4112
|
+
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs10(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4113
|
+
/* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
4114
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4063
4115
|
] }) }),
|
|
4064
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs10(
|
|
4065
4117
|
DropdownMenuCheckboxItem2,
|
|
4066
4118
|
{
|
|
4067
4119
|
checked: values.includes(opt.value),
|
|
@@ -4074,7 +4126,7 @@ function CheckboxFilterChip({
|
|
|
4074
4126
|
opt.value
|
|
4075
4127
|
)) })
|
|
4076
4128
|
] }),
|
|
4077
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4078
4130
|
] });
|
|
4079
4131
|
}
|
|
4080
4132
|
function RadioFilterChip({
|
|
@@ -4091,9 +4143,9 @@ function RadioFilterChip({
|
|
|
4091
4143
|
const selectedValue = asRadioValue(value);
|
|
4092
4144
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
4093
4145
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
4094
|
-
return /* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
searchable ? /* @__PURE__ */
|
|
4146
|
+
return /* @__PURE__ */ jsxs10(ButtonGroup2, { children: [
|
|
4147
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4148
|
+
searchable ? /* @__PURE__ */ jsxs10(
|
|
4097
4149
|
Combobox2,
|
|
4098
4150
|
{
|
|
4099
4151
|
items: options,
|
|
@@ -4105,27 +4157,27 @@ function RadioFilterChip({
|
|
|
4105
4157
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
4106
4158
|
},
|
|
4107
4159
|
children: [
|
|
4108
|
-
/* @__PURE__ */
|
|
4160
|
+
/* @__PURE__ */ jsx11(
|
|
4109
4161
|
ComboboxTrigger2,
|
|
4110
4162
|
{
|
|
4111
|
-
render: /* @__PURE__ */
|
|
4112
|
-
children: /* @__PURE__ */
|
|
4163
|
+
render: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4164
|
+
children: /* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
4113
4165
|
}
|
|
4114
4166
|
),
|
|
4115
|
-
/* @__PURE__ */
|
|
4167
|
+
/* @__PURE__ */ jsxs10(
|
|
4116
4168
|
ComboboxContent2,
|
|
4117
4169
|
{
|
|
4118
4170
|
container,
|
|
4119
4171
|
className: "min-w-64",
|
|
4120
4172
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4121
4173
|
children: [
|
|
4122
|
-
/* @__PURE__ */
|
|
4123
|
-
/* @__PURE__ */
|
|
4174
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4175
|
+
/* @__PURE__ */ jsxs10(ComboboxEmpty2, { children: [
|
|
4124
4176
|
"No ",
|
|
4125
4177
|
label.toLowerCase(),
|
|
4126
4178
|
" found."
|
|
4127
4179
|
] }),
|
|
4128
|
-
/* @__PURE__ */
|
|
4180
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs10(ComboboxItem2, { value: item, children: [
|
|
4129
4181
|
item.icon,
|
|
4130
4182
|
item.label
|
|
4131
4183
|
] }, item.value) })
|
|
@@ -4134,17 +4186,17 @@ function RadioFilterChip({
|
|
|
4134
4186
|
)
|
|
4135
4187
|
]
|
|
4136
4188
|
}
|
|
4137
|
-
) : /* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4139
|
-
/* @__PURE__ */
|
|
4140
|
-
/* @__PURE__ */
|
|
4189
|
+
) : /* @__PURE__ */ jsxs10(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4190
|
+
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs10(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4191
|
+
/* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
4192
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4141
4193
|
] }) }),
|
|
4142
|
-
/* @__PURE__ */
|
|
4194
|
+
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx11(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs10(DropdownMenuRadioItem, { value: opt.value, children: [
|
|
4143
4195
|
opt.icon,
|
|
4144
4196
|
opt.label
|
|
4145
4197
|
] }, opt.value)) }) })
|
|
4146
4198
|
] }),
|
|
4147
|
-
/* @__PURE__ */
|
|
4199
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4148
4200
|
] });
|
|
4149
4201
|
}
|
|
4150
4202
|
function TextFilterChip({
|
|
@@ -4156,12 +4208,12 @@ function TextFilterChip({
|
|
|
4156
4208
|
}) {
|
|
4157
4209
|
const { label, placeholder } = definition;
|
|
4158
4210
|
const text = asTextValue(value);
|
|
4159
|
-
const [open, setOpen] =
|
|
4160
|
-
return /* @__PURE__ */
|
|
4161
|
-
/* @__PURE__ */
|
|
4162
|
-
/* @__PURE__ */
|
|
4163
|
-
/* @__PURE__ */
|
|
4164
|
-
/* @__PURE__ */
|
|
4211
|
+
const [open, setOpen] = React8.useState(!!autoOpen);
|
|
4212
|
+
return /* @__PURE__ */ jsxs10(ButtonGroup2, { children: [
|
|
4213
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4214
|
+
/* @__PURE__ */ jsxs10(Popover2, { open, onOpenChange: setOpen, children: [
|
|
4215
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
4216
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx11(
|
|
4165
4217
|
Input2,
|
|
4166
4218
|
{
|
|
4167
4219
|
autoFocus: true,
|
|
@@ -4174,7 +4226,7 @@ function TextFilterChip({
|
|
|
4174
4226
|
}
|
|
4175
4227
|
) })
|
|
4176
4228
|
] }),
|
|
4177
|
-
/* @__PURE__ */
|
|
4229
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4178
4230
|
] });
|
|
4179
4231
|
}
|
|
4180
4232
|
function MultiTextFilterChip({
|
|
@@ -4186,7 +4238,7 @@ function MultiTextFilterChip({
|
|
|
4186
4238
|
}) {
|
|
4187
4239
|
const { label, placeholder } = definition;
|
|
4188
4240
|
const tokens = asMultiTextValue(value);
|
|
4189
|
-
const [draft, setDraft] =
|
|
4241
|
+
const [draft, setDraft] = React8.useState("");
|
|
4190
4242
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
4191
4243
|
function addToken() {
|
|
4192
4244
|
const token = draft.trim();
|
|
@@ -4200,25 +4252,25 @@ function MultiTextFilterChip({
|
|
|
4200
4252
|
function removeToken(token) {
|
|
4201
4253
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
4202
4254
|
}
|
|
4203
|
-
return /* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4208
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
4255
|
+
return /* @__PURE__ */ jsxs10(ButtonGroup2, { children: [
|
|
4256
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4257
|
+
/* @__PURE__ */ jsxs10(Popover2, { defaultOpen: autoOpen, children: [
|
|
4258
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
4259
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2", children: [
|
|
4260
|
+
tokens.length > 0 && /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs10(Badge3, { variant: "secondary", className: "gap-1", children: [
|
|
4209
4261
|
token,
|
|
4210
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ jsx11(
|
|
4211
4263
|
"button",
|
|
4212
4264
|
{
|
|
4213
4265
|
type: "button",
|
|
4214
4266
|
"aria-label": `Remove ${token}`,
|
|
4215
4267
|
onClick: () => removeToken(token),
|
|
4216
4268
|
className: "cursor-pointer",
|
|
4217
|
-
children: /* @__PURE__ */
|
|
4269
|
+
children: /* @__PURE__ */ jsx11(Icon9, { name: "xmark", size: "xs" })
|
|
4218
4270
|
}
|
|
4219
4271
|
)
|
|
4220
4272
|
] }, token)) }),
|
|
4221
|
-
/* @__PURE__ */
|
|
4273
|
+
/* @__PURE__ */ jsx11(
|
|
4222
4274
|
Input2,
|
|
4223
4275
|
{
|
|
4224
4276
|
autoFocus: true,
|
|
@@ -4237,7 +4289,7 @@ function MultiTextFilterChip({
|
|
|
4237
4289
|
)
|
|
4238
4290
|
] }) })
|
|
4239
4291
|
] }),
|
|
4240
|
-
/* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4241
4293
|
] });
|
|
4242
4294
|
}
|
|
4243
4295
|
function DateFilterChip({
|
|
@@ -4267,12 +4319,12 @@ function DateFilterChip({
|
|
|
4267
4319
|
if (!endDate) return;
|
|
4268
4320
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
4269
4321
|
}
|
|
4270
|
-
return /* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4274
|
-
/* @__PURE__ */
|
|
4275
|
-
/* @__PURE__ */
|
|
4322
|
+
return /* @__PURE__ */ jsxs10(ButtonGroup2, { children: [
|
|
4323
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4324
|
+
/* @__PURE__ */ jsxs10(Popover2, { defaultOpen: autoOpen, children: [
|
|
4325
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
4326
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2", children: [
|
|
4327
|
+
/* @__PURE__ */ jsx11(
|
|
4276
4328
|
Calendar2,
|
|
4277
4329
|
{
|
|
4278
4330
|
mode: "range",
|
|
@@ -4280,9 +4332,9 @@ function DateFilterChip({
|
|
|
4280
4332
|
onSelect: pickRange
|
|
4281
4333
|
}
|
|
4282
4334
|
),
|
|
4283
|
-
showTimeInputs && /* @__PURE__ */
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4335
|
+
showTimeInputs && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2", children: [
|
|
4336
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center gap-2", children: [
|
|
4337
|
+
/* @__PURE__ */ jsx11(
|
|
4286
4338
|
Label3,
|
|
4287
4339
|
{
|
|
4288
4340
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -4290,7 +4342,7 @@ function DateFilterChip({
|
|
|
4290
4342
|
children: "Start"
|
|
4291
4343
|
}
|
|
4292
4344
|
),
|
|
4293
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsx11(
|
|
4294
4346
|
Input2,
|
|
4295
4347
|
{
|
|
4296
4348
|
id: `${definition.key}-start-time`,
|
|
@@ -4302,8 +4354,8 @@ function DateFilterChip({
|
|
|
4302
4354
|
}
|
|
4303
4355
|
)
|
|
4304
4356
|
] }),
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center gap-2", children: [
|
|
4358
|
+
/* @__PURE__ */ jsx11(
|
|
4307
4359
|
Label3,
|
|
4308
4360
|
{
|
|
4309
4361
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -4311,7 +4363,7 @@ function DateFilterChip({
|
|
|
4311
4363
|
children: "End"
|
|
4312
4364
|
}
|
|
4313
4365
|
),
|
|
4314
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx11(
|
|
4315
4367
|
Input2,
|
|
4316
4368
|
{
|
|
4317
4369
|
id: `${definition.key}-end-time`,
|
|
@@ -4326,7 +4378,7 @@ function DateFilterChip({
|
|
|
4326
4378
|
] })
|
|
4327
4379
|
] }) })
|
|
4328
4380
|
] }),
|
|
4329
|
-
/* @__PURE__ */
|
|
4381
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4330
4382
|
] });
|
|
4331
4383
|
}
|
|
4332
4384
|
|
|
@@ -4337,7 +4389,7 @@ var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
|
4337
4389
|
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
4338
4390
|
|
|
4339
4391
|
// src/data-table/view-filter.tsx
|
|
4340
|
-
import { jsx as
|
|
4392
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4341
4393
|
function toFilterOption(opt) {
|
|
4342
4394
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
4343
4395
|
}
|
|
@@ -4380,7 +4432,7 @@ function ViewFilter({
|
|
|
4380
4432
|
onColumnFiltersChange,
|
|
4381
4433
|
className
|
|
4382
4434
|
}) {
|
|
4383
|
-
const filterableColumns =
|
|
4435
|
+
const filterableColumns = React9.useMemo(
|
|
4384
4436
|
() => columns.filter((column) => !isFilterOnlyColumn(column) && column.getCanFilter()).flatMap((column) => {
|
|
4385
4437
|
var _a;
|
|
4386
4438
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
@@ -4388,7 +4440,7 @@ function ViewFilter({
|
|
|
4388
4440
|
}),
|
|
4389
4441
|
[columns]
|
|
4390
4442
|
);
|
|
4391
|
-
const filterDefinitions =
|
|
4443
|
+
const filterDefinitions = React9.useMemo(
|
|
4392
4444
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
4393
4445
|
if (a.order == null && b.order == null) return 0;
|
|
4394
4446
|
if (a.order == null) return 1;
|
|
@@ -4397,15 +4449,15 @@ function ViewFilter({
|
|
|
4397
4449
|
}),
|
|
4398
4450
|
[filterableColumns]
|
|
4399
4451
|
);
|
|
4400
|
-
const emptyValueByKey =
|
|
4452
|
+
const emptyValueByKey = React9.useMemo(
|
|
4401
4453
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
4402
4454
|
[filterableColumns]
|
|
4403
4455
|
);
|
|
4404
|
-
const activeFilters =
|
|
4456
|
+
const activeFilters = React9.useMemo(
|
|
4405
4457
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
4406
4458
|
[columnFilters]
|
|
4407
4459
|
);
|
|
4408
|
-
return /* @__PURE__ */
|
|
4460
|
+
return /* @__PURE__ */ jsx12(
|
|
4409
4461
|
FilterBar,
|
|
4410
4462
|
{
|
|
4411
4463
|
className,
|
|
@@ -4419,10 +4471,10 @@ function ViewFilter({
|
|
|
4419
4471
|
}
|
|
4420
4472
|
|
|
4421
4473
|
// src/section-header.tsx
|
|
4422
|
-
import { jsx as
|
|
4474
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
4423
4475
|
function SectionHeader(_a) {
|
|
4424
4476
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
4425
|
-
return /* @__PURE__ */
|
|
4477
|
+
return /* @__PURE__ */ jsx13(
|
|
4426
4478
|
"div",
|
|
4427
4479
|
__spreadProps(__spreadValues({
|
|
4428
4480
|
"data-slot": "section-header",
|
|
@@ -4434,19 +4486,19 @@ function SectionHeader(_a) {
|
|
|
4434
4486
|
}
|
|
4435
4487
|
function SectionHeaderContent(_a) {
|
|
4436
4488
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4437
|
-
return /* @__PURE__ */
|
|
4489
|
+
return /* @__PURE__ */ jsx13("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
4438
4490
|
}
|
|
4439
4491
|
function SectionHeaderTitle(_a) {
|
|
4440
4492
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4441
|
-
return /* @__PURE__ */
|
|
4493
|
+
return /* @__PURE__ */ jsx13("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
4442
4494
|
}
|
|
4443
4495
|
function SectionHeaderDescription(_a) {
|
|
4444
4496
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4445
|
-
return /* @__PURE__ */
|
|
4497
|
+
return /* @__PURE__ */ jsx13("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
4446
4498
|
}
|
|
4447
4499
|
|
|
4448
4500
|
// src/data-table/data-table.tsx
|
|
4449
|
-
import { Fragment as Fragment7, jsx as
|
|
4501
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4450
4502
|
var DEFAULT_PAGE_SIZE = 20;
|
|
4451
4503
|
var noop = () => {
|
|
4452
4504
|
};
|
|
@@ -4504,23 +4556,21 @@ function DataTable({
|
|
|
4504
4556
|
celFilterConfig,
|
|
4505
4557
|
filterVisibility
|
|
4506
4558
|
}) {
|
|
4507
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
4559
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4508
4560
|
const isGrid = layout === "grid";
|
|
4509
|
-
const
|
|
4510
|
-
const
|
|
4511
|
-
const
|
|
4512
|
-
const [
|
|
4513
|
-
const [
|
|
4514
|
-
const [
|
|
4515
|
-
const [
|
|
4516
|
-
const [innerColumnPinning, setInnerColumnPinning] = React9.useState({ start: [], end: [] });
|
|
4517
|
-
const [innerPagination, setInnerPagination] = React9.useState({
|
|
4561
|
+
const tableBodyScrollRef = React10.useRef(null);
|
|
4562
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React10.useState("");
|
|
4563
|
+
const [innerColumnOrdering, setInnerColumnOrdering] = React10.useState([]);
|
|
4564
|
+
const [innerColumnFilters, setInnerColumnFilters] = React10.useState([]);
|
|
4565
|
+
const [innerSorting, setInnerSorting] = React10.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
|
|
4566
|
+
const [innerColumnPinning, setInnerColumnPinning] = React10.useState({ start: [], end: [] });
|
|
4567
|
+
const [innerPagination, setInnerPagination] = React10.useState({
|
|
4518
4568
|
pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
|
|
4519
4569
|
pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
|
|
4520
4570
|
});
|
|
4521
|
-
const [innerGrouping, setInnerGrouping] =
|
|
4522
|
-
const [innerColumnVisibility, setInnerColumnVisibility] =
|
|
4523
|
-
const [innerExpanded, setInnerExpanded] =
|
|
4571
|
+
const [innerGrouping, setInnerGrouping] = React10.useState([]);
|
|
4572
|
+
const [innerColumnVisibility, setInnerColumnVisibility] = React10.useState({});
|
|
4573
|
+
const [innerExpanded, setInnerExpanded] = React10.useState({});
|
|
4524
4574
|
const {
|
|
4525
4575
|
columnSizing,
|
|
4526
4576
|
handleColumnSizingChange,
|
|
@@ -4537,6 +4587,9 @@ function DataTable({
|
|
|
4537
4587
|
filterRowVisible,
|
|
4538
4588
|
setFilterRowVisible
|
|
4539
4589
|
} = useFilterVisibility(filterVisibility);
|
|
4590
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
4591
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
4592
|
+
}
|
|
4540
4593
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
4541
4594
|
const applyGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
4542
4595
|
const columnFilters = parentColumnFilters || innerColumnFilters;
|
|
@@ -4544,25 +4597,25 @@ function DataTable({
|
|
|
4544
4597
|
const pagination = parentPagination || innerPagination;
|
|
4545
4598
|
const setPagination = parentSetPagination != null ? parentSetPagination : setInnerPagination;
|
|
4546
4599
|
const shouldDisablePagination = paginationConfig === false;
|
|
4547
|
-
const resetPageIndexOnFilterChange =
|
|
4600
|
+
const resetPageIndexOnFilterChange = React10.useCallback(() => {
|
|
4548
4601
|
if (!serverSidePagination || pagination.pageIndex === 0) return;
|
|
4549
4602
|
setPagination((prev) => __spreadProps(__spreadValues({}, prev), { pageIndex: 0 }));
|
|
4550
4603
|
}, [serverSidePagination, pagination.pageIndex, setPagination]);
|
|
4551
|
-
const setGlobalFilter =
|
|
4604
|
+
const setGlobalFilter = React10.useCallback(
|
|
4552
4605
|
(value) => {
|
|
4553
4606
|
applyGlobalFilter(value);
|
|
4554
4607
|
resetPageIndexOnFilterChange();
|
|
4555
4608
|
},
|
|
4556
4609
|
[applyGlobalFilter, resetPageIndexOnFilterChange]
|
|
4557
4610
|
);
|
|
4558
|
-
const setColumnFilters =
|
|
4611
|
+
const setColumnFilters = React10.useCallback(
|
|
4559
4612
|
(value) => {
|
|
4560
4613
|
applyColumnFilters(value);
|
|
4561
4614
|
resetPageIndexOnFilterChange();
|
|
4562
4615
|
},
|
|
4563
4616
|
[applyColumnFilters, resetPageIndexOnFilterChange]
|
|
4564
4617
|
);
|
|
4565
|
-
|
|
4618
|
+
React10.useLayoutEffect(() => {
|
|
4566
4619
|
var _a2;
|
|
4567
4620
|
if (shouldDisablePagination) return;
|
|
4568
4621
|
(_a2 = tableBodyScrollRef.current) == null ? void 0 : _a2.scrollTo({ top: 0 });
|
|
@@ -4644,7 +4697,7 @@ function DataTable({
|
|
|
4644
4697
|
const orderedVisibleColumns = table.getVisibleLeafColumns().filter((col) => !isFilterOnlyColumn(col));
|
|
4645
4698
|
const hasFilters = !!celFilterConfig || hasFilterableColumns(flatColumns);
|
|
4646
4699
|
const showFilterToggle = filterToggleRequested && !disableFilters && hasFilters;
|
|
4647
|
-
const [gridMeasuredMins, setGridMeasuredMins] =
|
|
4700
|
+
const [gridMeasuredMins, setGridMeasuredMins] = React10.useState({});
|
|
4648
4701
|
const { gridTemplateColumns, gridRootRef, handleAutosizeAll, handleAutosizeColumn, handleResetColumnSize } = useGridLayout({
|
|
4649
4702
|
layout,
|
|
4650
4703
|
table,
|
|
@@ -4658,7 +4711,7 @@ function DataTable({
|
|
|
4658
4711
|
rawHandleAutosizeColumn,
|
|
4659
4712
|
rawHandleResetColumnSize
|
|
4660
4713
|
});
|
|
4661
|
-
const handleContextCell =
|
|
4714
|
+
const handleContextCell = React10.useCallback(
|
|
4662
4715
|
(filter, cell) => {
|
|
4663
4716
|
var _a2, _b2;
|
|
4664
4717
|
if (celFilterConfig == null ? void 0 : celFilterConfig.onContextualFilter) {
|
|
@@ -4675,13 +4728,13 @@ function DataTable({
|
|
|
4675
4728
|
},
|
|
4676
4729
|
[celFilterConfig, onContextCell, setColumnFilters, table]
|
|
4677
4730
|
);
|
|
4678
|
-
const handleContextSearch =
|
|
4731
|
+
const handleContextSearch = React10.useCallback(
|
|
4679
4732
|
(searchTerm) => {
|
|
4680
4733
|
setGlobalFilter(searchTerm);
|
|
4681
4734
|
},
|
|
4682
4735
|
[setGlobalFilter]
|
|
4683
4736
|
);
|
|
4684
|
-
const totalTableWidth =
|
|
4737
|
+
const totalTableWidth = React10.useMemo(() => {
|
|
4685
4738
|
if (isGrid) return 0;
|
|
4686
4739
|
const firstGroup = headerGroups[0];
|
|
4687
4740
|
if (!firstGroup) return 0;
|
|
@@ -4705,12 +4758,7 @@ function DataTable({
|
|
|
4705
4758
|
}
|
|
4706
4759
|
setGlobalFilter("");
|
|
4707
4760
|
};
|
|
4708
|
-
|
|
4709
|
-
if (parentGlobalFilter !== void 0) {
|
|
4710
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
4711
|
-
}
|
|
4712
|
-
}, [parentGlobalFilter]);
|
|
4713
|
-
React9.useEffect(() => {
|
|
4761
|
+
React10.useEffect(() => {
|
|
4714
4762
|
if (disableColumnReordering) return;
|
|
4715
4763
|
const allColumnIds = flatColumns.map((col) => col.id);
|
|
4716
4764
|
const normalizedColumnOrdering = normalizeColumnOrdering(columnOrdering, allColumnIds);
|
|
@@ -4719,38 +4767,18 @@ function DataTable({
|
|
|
4719
4767
|
}
|
|
4720
4768
|
}, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
|
|
4721
4769
|
const showViewHeader = !!title || !!Actions;
|
|
4722
|
-
const showClearSearchButton = globalFilter && !shouldDisable;
|
|
4723
4770
|
const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
|
|
4724
|
-
const toolbarSearch = !disableSearch && /* @__PURE__ */
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
value: globalFilter,
|
|
4736
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
4737
|
-
})
|
|
4738
|
-
),
|
|
4739
|
-
!!showClearSearchButton && /* @__PURE__ */ jsx13(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx13(
|
|
4740
|
-
InputGroupButton,
|
|
4741
|
-
{
|
|
4742
|
-
size: "icon-xs",
|
|
4743
|
-
"aria-label": "Clear search",
|
|
4744
|
-
onClick: () => {
|
|
4745
|
-
var _a2;
|
|
4746
|
-
setGlobalFilter("");
|
|
4747
|
-
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
4748
|
-
},
|
|
4749
|
-
children: /* @__PURE__ */ jsx13(Icon9, { name: "xmark" })
|
|
4750
|
-
}
|
|
4751
|
-
) })
|
|
4752
|
-
] });
|
|
4753
|
-
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx13(
|
|
4771
|
+
const toolbarSearch = !disableSearch && /* @__PURE__ */ jsx14(
|
|
4772
|
+
DataTableSearch,
|
|
4773
|
+
{
|
|
4774
|
+
value: globalFilter,
|
|
4775
|
+
onValueChange: setGlobalFilter,
|
|
4776
|
+
placeholder: search == null ? void 0 : search.placeholder,
|
|
4777
|
+
className: search == null ? void 0 : search.className,
|
|
4778
|
+
disabled: shouldDisable
|
|
4779
|
+
}
|
|
4780
|
+
);
|
|
4781
|
+
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx14(
|
|
4754
4782
|
ColumnOptions,
|
|
4755
4783
|
{
|
|
4756
4784
|
columns: flatColumns,
|
|
@@ -4759,7 +4787,7 @@ function DataTable({
|
|
|
4759
4787
|
disableColumnOrdering: disableColumnReordering
|
|
4760
4788
|
}
|
|
4761
4789
|
);
|
|
4762
|
-
return /* @__PURE__ */
|
|
4790
|
+
return /* @__PURE__ */ jsxs11(
|
|
4763
4791
|
"div",
|
|
4764
4792
|
{
|
|
4765
4793
|
id: `table-${id}`,
|
|
@@ -4770,19 +4798,19 @@ function DataTable({
|
|
|
4770
4798
|
className
|
|
4771
4799
|
),
|
|
4772
4800
|
children: [
|
|
4773
|
-
showViewHeader && /* @__PURE__ */
|
|
4774
|
-
!!title && /* @__PURE__ */
|
|
4775
|
-
!!description && /* @__PURE__ */
|
|
4801
|
+
showViewHeader && /* @__PURE__ */ jsx14(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs11(SectionHeaderContent, { children: [
|
|
4802
|
+
!!title && /* @__PURE__ */ jsx14(SectionHeaderTitle, { children: title }),
|
|
4803
|
+
!!description && /* @__PURE__ */ jsx14(SectionHeaderDescription, { children: description })
|
|
4776
4804
|
] }) }),
|
|
4777
|
-
/* @__PURE__ */
|
|
4805
|
+
/* @__PURE__ */ jsxs11("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
4778
4806
|
toolbarSearch,
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
showFilterToggle && /* @__PURE__ */
|
|
4781
|
-
!!Actions && /* @__PURE__ */
|
|
4807
|
+
/* @__PURE__ */ jsxs11("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
4808
|
+
showFilterToggle && /* @__PURE__ */ jsx14(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
|
|
4809
|
+
!!Actions && /* @__PURE__ */ jsx14(Actions, { state: tableState }),
|
|
4782
4810
|
toolbarColumns
|
|
4783
4811
|
] })
|
|
4784
4812
|
] }),
|
|
4785
|
-
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */
|
|
4813
|
+
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */ jsx14("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx14("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx14(
|
|
4786
4814
|
CelFilterBar,
|
|
4787
4815
|
{
|
|
4788
4816
|
schema: celFilterConfig.schema,
|
|
@@ -4792,7 +4820,7 @@ function DataTable({
|
|
|
4792
4820
|
onRestrictedOptionSelect: celFilterConfig.onRestrictedOptionSelect,
|
|
4793
4821
|
showClearButton: celFilterConfig.showClearButton
|
|
4794
4822
|
}
|
|
4795
|
-
) }) : /* @__PURE__ */
|
|
4823
|
+
) }) : /* @__PURE__ */ jsx14(
|
|
4796
4824
|
ViewFilter,
|
|
4797
4825
|
{
|
|
4798
4826
|
columns: flatColumns,
|
|
@@ -4801,8 +4829,8 @@ function DataTable({
|
|
|
4801
4829
|
className: "data-[visible-filters=true]:mb-4"
|
|
4802
4830
|
}
|
|
4803
4831
|
) }),
|
|
4804
|
-
shouldRenderTableContent ? /* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4832
|
+
shouldRenderTableContent ? /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
4833
|
+
/* @__PURE__ */ jsx14("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx14(
|
|
4806
4834
|
"div",
|
|
4807
4835
|
{
|
|
4808
4836
|
ref: tableBodyScrollRef,
|
|
@@ -4811,7 +4839,7 @@ function DataTable({
|
|
|
4811
4839
|
"min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
|
|
4812
4840
|
!!stickyHeader && !fitContent && STICKY_HEADER_MAX_HEIGHT_CLASS
|
|
4813
4841
|
),
|
|
4814
|
-
children: /* @__PURE__ */
|
|
4842
|
+
children: /* @__PURE__ */ jsxs11(
|
|
4815
4843
|
DataTableRoot,
|
|
4816
4844
|
{
|
|
4817
4845
|
layout,
|
|
@@ -4819,7 +4847,7 @@ function DataTable({
|
|
|
4819
4847
|
gridRootRef,
|
|
4820
4848
|
style: isGrid ? { width: "100%" } : totalTableWidth > 0 ? { width: `max(100%, ${totalTableWidth}px)`, minWidth: "100%" } : { width: "100%" },
|
|
4821
4849
|
children: [
|
|
4822
|
-
/* @__PURE__ */
|
|
4850
|
+
/* @__PURE__ */ jsx14(
|
|
4823
4851
|
DataTableHeader,
|
|
4824
4852
|
{
|
|
4825
4853
|
headerGroups,
|
|
@@ -4830,7 +4858,7 @@ function DataTable({
|
|
|
4830
4858
|
layout
|
|
4831
4859
|
}
|
|
4832
4860
|
),
|
|
4833
|
-
/* @__PURE__ */
|
|
4861
|
+
/* @__PURE__ */ jsx14(
|
|
4834
4862
|
DataTableBody,
|
|
4835
4863
|
{
|
|
4836
4864
|
tableRows,
|
|
@@ -4852,11 +4880,11 @@ function DataTable({
|
|
|
4852
4880
|
)
|
|
4853
4881
|
}
|
|
4854
4882
|
) }),
|
|
4855
|
-
!shouldDisablePagination && !!pagination && /* @__PURE__ */
|
|
4883
|
+
!shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx14(
|
|
4856
4884
|
DataTablePagination,
|
|
4857
4885
|
{
|
|
4858
4886
|
rowCount,
|
|
4859
|
-
rowCountRelation: (
|
|
4887
|
+
rowCountRelation: (_g = config.rowCountRelation) != null ? _g : "eq",
|
|
4860
4888
|
paginationConfig,
|
|
4861
4889
|
pageSize: pagination.pageSize,
|
|
4862
4890
|
pageIndex: pagination.pageIndex,
|
|
@@ -4864,7 +4892,7 @@ function DataTable({
|
|
|
4864
4892
|
onPageSizeChange: (nextPageSize) => setPagination((prev) => __spreadProps(__spreadValues({}, prev || pagination), { pageIndex: 0, pageSize: nextPageSize }))
|
|
4865
4893
|
}
|
|
4866
4894
|
)
|
|
4867
|
-
] }) : /* @__PURE__ */
|
|
4895
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
4868
4896
|
DataTableEmptyView,
|
|
4869
4897
|
{
|
|
4870
4898
|
emptyView,
|