@upbound/monarch-blocks 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-table.d.ts +33 -38
- package/dist/data-table.js +110 -86
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-CjRwaITk.d.ts → empty-view--jBQ7evg.d.ts} +80 -8
- package/dist/graph.d.ts +5 -4
- package/dist/graph.js +52 -10
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +121 -106
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/data-table.js
CHANGED
|
@@ -150,9 +150,9 @@ function isSameColumnOrdering(left, right) {
|
|
|
150
150
|
}
|
|
151
151
|
function splitColumnOrderByPinning(fullColumnOrder, getColumnPinning2) {
|
|
152
152
|
return {
|
|
153
|
-
|
|
153
|
+
startPinnedColumns: fullColumnOrder.filter((columnId) => getColumnPinning2(columnId) === "start"),
|
|
154
154
|
unpinnedColumns: fullColumnOrder.filter((columnId) => getColumnPinning2(columnId) === false),
|
|
155
|
-
|
|
155
|
+
endPinnedColumns: fullColumnOrder.filter((columnId) => getColumnPinning2(columnId) === "end")
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
function mergeUnpinnedColumnOrder(fullColumnOrder, nextUnpinnedOrder, getColumnPinning2) {
|
|
@@ -299,7 +299,7 @@ function ColumnOptions({
|
|
|
299
299
|
(columnId) => getColumnPinning(allColumnById.get(columnId)),
|
|
300
300
|
[allColumnById]
|
|
301
301
|
);
|
|
302
|
-
const {
|
|
302
|
+
const { startPinnedColumns, unpinnedColumns, endPinnedColumns } = splitColumnOrderByPinning(
|
|
303
303
|
fullColumnOrder,
|
|
304
304
|
getColumnPinningFor
|
|
305
305
|
);
|
|
@@ -375,9 +375,9 @@ function ColumnOptions({
|
|
|
375
375
|
var _a;
|
|
376
376
|
return column.getIsPinned() === false && !((_a = column.columnDef.meta) == null ? void 0 : _a.pinning);
|
|
377
377
|
}
|
|
378
|
-
const
|
|
378
|
+
const startPinned = orderedColumns(startPinnedColumns);
|
|
379
379
|
const unpinned = orderedColumns(unpinnedColumns);
|
|
380
|
-
const
|
|
380
|
+
const endPinned = orderedColumns(endPinnedColumns);
|
|
381
381
|
return /* @__PURE__ */ jsxs2(DropdownMenu, { children: [
|
|
382
382
|
/* @__PURE__ */ jsx2(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { variant: "outline", className: "shrink-0", children: [
|
|
383
383
|
/* @__PURE__ */ jsx2(Icon, { name: "table-columns", "data-icon": "inline-start" }),
|
|
@@ -385,7 +385,7 @@ function ColumnOptions({
|
|
|
385
385
|
/* @__PURE__ */ jsx2(Icon, { name: "chevron-down", "data-icon": "inline-end" })
|
|
386
386
|
] }) }),
|
|
387
387
|
/* @__PURE__ */ jsx2(DropdownMenuContent, { className: "w-58 p-0", children: /* @__PURE__ */ jsxs2("div", { className: "p-1", children: [
|
|
388
|
-
[...
|
|
388
|
+
[...startPinned, ...unpinned].map((column) => /* @__PURE__ */ jsx2(
|
|
389
389
|
ColumnOptionsItem,
|
|
390
390
|
{
|
|
391
391
|
column,
|
|
@@ -414,7 +414,7 @@ function ColumnOptions({
|
|
|
414
414
|
)
|
|
415
415
|
}
|
|
416
416
|
),
|
|
417
|
-
|
|
417
|
+
endPinned.map((column) => /* @__PURE__ */ jsx2(
|
|
418
418
|
ColumnOptionsItem,
|
|
419
419
|
{
|
|
420
420
|
column,
|
|
@@ -628,7 +628,7 @@ function getActionsColumnDefinition({
|
|
|
628
628
|
enableGlobalFilter: false,
|
|
629
629
|
enableSorting: false,
|
|
630
630
|
enableHiding: false,
|
|
631
|
-
meta: { pinning: "
|
|
631
|
+
meta: { pinning: "end", actions: true },
|
|
632
632
|
cell
|
|
633
633
|
};
|
|
634
634
|
}
|
|
@@ -662,7 +662,7 @@ function getExpandColumnDefinition(options) {
|
|
|
662
662
|
enableGlobalFilter: false,
|
|
663
663
|
enableSorting: false,
|
|
664
664
|
enableHiding: false,
|
|
665
|
-
meta: { pinning: "
|
|
665
|
+
meta: { pinning: "end", actions: true },
|
|
666
666
|
cell: (_a = options == null ? void 0 : options.cell) != null ? _a : (({ row }) => /* @__PURE__ */ jsx4(ExpandButton, { row }))
|
|
667
667
|
};
|
|
668
668
|
}
|
|
@@ -698,16 +698,7 @@ function TimestampCell({ timestamp }) {
|
|
|
698
698
|
// src/data-table/data-table.tsx
|
|
699
699
|
import * as React9 from "react";
|
|
700
700
|
import {
|
|
701
|
-
|
|
702
|
-
getExpandedRowModel,
|
|
703
|
-
getFacetedRowModel,
|
|
704
|
-
getFacetedUniqueValues,
|
|
705
|
-
getFilteredRowModel,
|
|
706
|
-
getGroupedRowModel,
|
|
707
|
-
getPaginationRowModel,
|
|
708
|
-
getSortedRowModel,
|
|
709
|
-
noop,
|
|
710
|
-
useReactTable
|
|
701
|
+
useTable
|
|
711
702
|
} from "@tanstack/react-table";
|
|
712
703
|
|
|
713
704
|
// src/cel-filter-bar/cel-filter-bar.tsx
|
|
@@ -2363,6 +2354,55 @@ function CelDateValueEditor({
|
|
|
2363
2354
|
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
2364
2355
|
import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
|
|
2365
2356
|
|
|
2357
|
+
// src/lib/data-table/features.ts
|
|
2358
|
+
import {
|
|
2359
|
+
columnFacetingFeature,
|
|
2360
|
+
columnFilteringFeature,
|
|
2361
|
+
columnGroupingFeature,
|
|
2362
|
+
columnOrderingFeature,
|
|
2363
|
+
columnPinningFeature,
|
|
2364
|
+
columnResizingFeature,
|
|
2365
|
+
columnSizingFeature,
|
|
2366
|
+
columnVisibilityFeature,
|
|
2367
|
+
createExpandedRowModel,
|
|
2368
|
+
createFacetedRowModel,
|
|
2369
|
+
createFacetedUniqueValues,
|
|
2370
|
+
createFilteredRowModel,
|
|
2371
|
+
createGroupedRowModel,
|
|
2372
|
+
createPaginatedRowModel,
|
|
2373
|
+
createSortedRowModel,
|
|
2374
|
+
filterFns,
|
|
2375
|
+
globalFilteringFeature,
|
|
2376
|
+
rowExpandingFeature,
|
|
2377
|
+
rowPaginationFeature,
|
|
2378
|
+
rowSortingFeature,
|
|
2379
|
+
sortFns,
|
|
2380
|
+
tableFeatures
|
|
2381
|
+
} from "@tanstack/react-table";
|
|
2382
|
+
var dataTableFeatures = tableFeatures({
|
|
2383
|
+
columnFilteringFeature,
|
|
2384
|
+
globalFilteringFeature,
|
|
2385
|
+
columnFacetingFeature,
|
|
2386
|
+
rowSortingFeature,
|
|
2387
|
+
rowPaginationFeature,
|
|
2388
|
+
rowExpandingFeature,
|
|
2389
|
+
columnGroupingFeature,
|
|
2390
|
+
columnOrderingFeature,
|
|
2391
|
+
columnPinningFeature,
|
|
2392
|
+
columnVisibilityFeature,
|
|
2393
|
+
columnSizingFeature,
|
|
2394
|
+
columnResizingFeature,
|
|
2395
|
+
filteredRowModel: createFilteredRowModel(),
|
|
2396
|
+
facetedRowModel: createFacetedRowModel(),
|
|
2397
|
+
facetedUniqueValues: createFacetedUniqueValues(),
|
|
2398
|
+
sortedRowModel: createSortedRowModel(),
|
|
2399
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
2400
|
+
groupedRowModel: createGroupedRowModel(),
|
|
2401
|
+
expandedRowModel: createExpandedRowModel(),
|
|
2402
|
+
filterFns,
|
|
2403
|
+
sortFns
|
|
2404
|
+
});
|
|
2405
|
+
|
|
2366
2406
|
// src/lib/data-table/contextual-filters.ts
|
|
2367
2407
|
function valueToString(value) {
|
|
2368
2408
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -2809,7 +2849,7 @@ function useGridLayout({
|
|
|
2809
2849
|
React4.useLayoutEffect(() => {
|
|
2810
2850
|
if (gridTemplate) gridVisualColumnOrder.current = gridTemplate.visualOrder;
|
|
2811
2851
|
}, [gridTemplate]);
|
|
2812
|
-
const resizingColumn = table.
|
|
2852
|
+
const resizingColumn = table.state.columnResizing.isResizingColumn;
|
|
2813
2853
|
React4.useLayoutEffect(() => {
|
|
2814
2854
|
var _a;
|
|
2815
2855
|
if (resizingColumn && !prevResizingColumn.current) {
|
|
@@ -2868,7 +2908,7 @@ function useGridLayout({
|
|
|
2868
2908
|
const scrollEl = tableBodyScrollRef.current;
|
|
2869
2909
|
if (!scrollEl) return;
|
|
2870
2910
|
const observer = new ResizeObserver(() => {
|
|
2871
|
-
if (!table.
|
|
2911
|
+
if (!table.atoms.columnResizing.get().isResizingColumn) {
|
|
2872
2912
|
measureContentMins();
|
|
2873
2913
|
}
|
|
2874
2914
|
});
|
|
@@ -2879,7 +2919,7 @@ function useGridLayout({
|
|
|
2879
2919
|
if (!isGrid) return;
|
|
2880
2920
|
const tableEl = gridRootRef.current;
|
|
2881
2921
|
if (!tableEl) return;
|
|
2882
|
-
const { isResizingColumn, deltaOffset } = table.
|
|
2922
|
+
const { isResizingColumn, deltaOffset } = table.atoms.columnResizing.get();
|
|
2883
2923
|
if (isResizingColumn && deltaOffset != null) {
|
|
2884
2924
|
const nextFr = computeGridResizeFrValues({
|
|
2885
2925
|
resizingColumnId: isResizingColumn,
|
|
@@ -2896,7 +2936,7 @@ function useGridLayout({
|
|
|
2896
2936
|
gridPersistedFr.current = resolveGridPersistedFr({
|
|
2897
2937
|
visualOrder: gridVisualColumnOrder.current,
|
|
2898
2938
|
persistedFr: gridPersistedFr.current,
|
|
2899
|
-
columnSizing: table.
|
|
2939
|
+
columnSizing: table.atoms.columnSizing.get(),
|
|
2900
2940
|
measuredMins: gridMeasuredMins,
|
|
2901
2941
|
getGridSizing: (colId) => {
|
|
2902
2942
|
var _a, _b;
|
|
@@ -3040,32 +3080,18 @@ function DataTableEmptyView({
|
|
|
3040
3080
|
}
|
|
3041
3081
|
|
|
3042
3082
|
// src/data-table/filter-toggle.tsx
|
|
3043
|
-
import { Icon as Icon5
|
|
3083
|
+
import { Badge as Badge2, Button as Button5, Icon as Icon5 } from "@upbound/monarch-core";
|
|
3044
3084
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3045
3085
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
3046
|
-
return /* @__PURE__ */ jsxs6(
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
onPressedChange,
|
|
3052
|
-
"aria-label": "Toggle filters",
|
|
3053
|
-
className: "shrink-0 gap-1.5",
|
|
3054
|
-
children: [
|
|
3055
|
-
/* @__PURE__ */ jsx7(Icon5, { name: "filter", "data-icon": "inline-start" }),
|
|
3056
|
-
"Filter",
|
|
3057
|
-
!!count && /* @__PURE__ */ jsxs6("span", { className: "tabular-nums", children: [
|
|
3058
|
-
"(",
|
|
3059
|
-
count,
|
|
3060
|
-
")"
|
|
3061
|
-
] })
|
|
3062
|
-
]
|
|
3063
|
-
}
|
|
3064
|
-
);
|
|
3086
|
+
return /* @__PURE__ */ jsxs6(Button5, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
3087
|
+
/* @__PURE__ */ jsx7(Icon5, { name: "filter", "data-icon": "inline-start" }),
|
|
3088
|
+
pressed ? "Hide filters" : "Show filters",
|
|
3089
|
+
!!count && /* @__PURE__ */ jsx7(Badge2, { variant: "secondary", className: "tabular-nums", children: count })
|
|
3090
|
+
] });
|
|
3065
3091
|
}
|
|
3066
3092
|
|
|
3067
3093
|
// src/data-table/pagination.tsx
|
|
3068
|
-
import { Button as
|
|
3094
|
+
import { Button as Button6 } from "@upbound/monarch-core";
|
|
3069
3095
|
import { Icon as Icon6 } from "@upbound/monarch-core";
|
|
3070
3096
|
import { Label as Label2 } from "@upbound/monarch-core";
|
|
3071
3097
|
import {
|
|
@@ -3146,7 +3172,7 @@ function DataTablePagination({
|
|
|
3146
3172
|
] }),
|
|
3147
3173
|
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx8(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs7(PaginationContent, { children: [
|
|
3148
3174
|
resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
|
|
3149
|
-
|
|
3175
|
+
Button6,
|
|
3150
3176
|
{
|
|
3151
3177
|
variant: "outline",
|
|
3152
3178
|
size: "icon",
|
|
@@ -3157,7 +3183,7 @@ function DataTablePagination({
|
|
|
3157
3183
|
}
|
|
3158
3184
|
) }),
|
|
3159
3185
|
resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
|
|
3160
|
-
|
|
3186
|
+
Button6,
|
|
3161
3187
|
{
|
|
3162
3188
|
variant: "outline",
|
|
3163
3189
|
size: "icon",
|
|
@@ -3183,7 +3209,7 @@ function DataTablePagination({
|
|
|
3183
3209
|
) }, page)
|
|
3184
3210
|
),
|
|
3185
3211
|
resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
|
|
3186
|
-
|
|
3212
|
+
Button6,
|
|
3187
3213
|
{
|
|
3188
3214
|
variant: "outline",
|
|
3189
3215
|
size: "icon",
|
|
@@ -3194,7 +3220,7 @@ function DataTablePagination({
|
|
|
3194
3220
|
}
|
|
3195
3221
|
) }),
|
|
3196
3222
|
resolved.arrows && /* @__PURE__ */ jsx8(PaginationItem, { children: /* @__PURE__ */ jsx8(
|
|
3197
|
-
|
|
3223
|
+
Button6,
|
|
3198
3224
|
{
|
|
3199
3225
|
variant: "outline",
|
|
3200
3226
|
size: "icon",
|
|
@@ -3211,9 +3237,7 @@ function DataTablePagination({
|
|
|
3211
3237
|
|
|
3212
3238
|
// src/data-table/table-primitives.tsx
|
|
3213
3239
|
import * as React6 from "react";
|
|
3214
|
-
import {
|
|
3215
|
-
flexRender as flexRender2
|
|
3216
|
-
} from "@tanstack/react-table";
|
|
3240
|
+
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
3217
3241
|
import { ContextMenu, ContextMenuTrigger } from "@upbound/monarch-core";
|
|
3218
3242
|
import {
|
|
3219
3243
|
DropdownMenu as DropdownMenu3,
|
|
@@ -3263,18 +3287,18 @@ function DataTableRoot({
|
|
|
3263
3287
|
function getColumnPinningProps(column, surface = "body") {
|
|
3264
3288
|
const isPinned = column.getIsPinned();
|
|
3265
3289
|
if (!isPinned) return { className: "", style: {} };
|
|
3266
|
-
const
|
|
3267
|
-
const
|
|
3290
|
+
const isLastStart = isPinned === "start" && column.getIsLastColumn("start");
|
|
3291
|
+
const isFirstEnd = isPinned === "end" && column.getIsFirstColumn("end");
|
|
3268
3292
|
return {
|
|
3269
3293
|
className: cn(
|
|
3270
3294
|
"sticky",
|
|
3271
3295
|
surface === "header" ? HEADER_SURFACE_BG : "bg-card",
|
|
3272
|
-
|
|
3273
|
-
|
|
3296
|
+
isLastStart && "border-e-2 border-e-border",
|
|
3297
|
+
isFirstEnd && "border-s-2 border-s-border"
|
|
3274
3298
|
),
|
|
3275
3299
|
style: {
|
|
3276
|
-
|
|
3277
|
-
|
|
3300
|
+
insetInlineStart: isPinned === "start" ? `${column.getStart("start")}px` : void 0,
|
|
3301
|
+
insetInlineEnd: isPinned === "end" ? `${column.getAfter("end")}px` : void 0,
|
|
3278
3302
|
width: column.getSize()
|
|
3279
3303
|
}
|
|
3280
3304
|
};
|
|
@@ -3350,7 +3374,7 @@ function ColumnActionsMenuItems({
|
|
|
3350
3374
|
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
|
|
3351
3375
|
/* @__PURE__ */ jsx9(Icon7, { name: "thumbtack" }),
|
|
3352
3376
|
"Unpin column"
|
|
3353
|
-
] }) : /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.pin("
|
|
3377
|
+
] }) : /* @__PURE__ */ jsxs8(DropdownMenuItem3, { onClick: () => header.column.pin("start"), children: [
|
|
3354
3378
|
/* @__PURE__ */ jsx9(Icon7, { name: "thumbtack" }),
|
|
3355
3379
|
"Pin column"
|
|
3356
3380
|
] }))
|
|
@@ -3744,8 +3768,8 @@ import * as React8 from "react";
|
|
|
3744
3768
|
// src/filter-bar/filter-bar.tsx
|
|
3745
3769
|
import * as React7 from "react";
|
|
3746
3770
|
import { Icon as Icon8 } from "@upbound/monarch-core";
|
|
3747
|
-
import { Badge as
|
|
3748
|
-
import { Button as
|
|
3771
|
+
import { Badge as Badge3 } from "@upbound/monarch-core";
|
|
3772
|
+
import { Button as Button7 } from "@upbound/monarch-core";
|
|
3749
3773
|
import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
|
|
3750
3774
|
import { Calendar as Calendar2 } from "@upbound/monarch-core";
|
|
3751
3775
|
import {
|
|
@@ -3868,7 +3892,7 @@ function FilterBar(_a) {
|
|
|
3868
3892
|
if (filter) handleAddFilter(filter.key);
|
|
3869
3893
|
},
|
|
3870
3894
|
children: [
|
|
3871
|
-
/* @__PURE__ */ jsxs9(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx10(
|
|
3895
|
+
/* @__PURE__ */ jsxs9(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx10(Button7, { variant: "outline" }), children: [
|
|
3872
3896
|
/* @__PURE__ */ jsx10(Icon8, { name: "plus", "data-icon": "inline-start" }),
|
|
3873
3897
|
"Add filter"
|
|
3874
3898
|
] }),
|
|
@@ -3965,7 +3989,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3965
3989
|
}
|
|
3966
3990
|
}
|
|
3967
3991
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
3968
|
-
return /* @__PURE__ */ jsx10(
|
|
3992
|
+
return /* @__PURE__ */ jsx10(Button7, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx10(Icon8, { name: "xmark" }) });
|
|
3969
3993
|
}
|
|
3970
3994
|
function CheckboxFilterChip({
|
|
3971
3995
|
definition,
|
|
@@ -3999,7 +4023,7 @@ function CheckboxFilterChip({
|
|
|
3999
4023
|
/* @__PURE__ */ jsx10(
|
|
4000
4024
|
ComboboxTrigger2,
|
|
4001
4025
|
{
|
|
4002
|
-
render: /* @__PURE__ */ jsx10(
|
|
4026
|
+
render: /* @__PURE__ */ jsx10(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4003
4027
|
children: /* @__PURE__ */ jsx10("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
4004
4028
|
}
|
|
4005
4029
|
),
|
|
@@ -4033,7 +4057,7 @@ function CheckboxFilterChip({
|
|
|
4033
4057
|
]
|
|
4034
4058
|
}
|
|
4035
4059
|
) : /* @__PURE__ */ jsxs9(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4036
|
-
/* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
4060
|
+
/* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4037
4061
|
/* @__PURE__ */ jsx10("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
4038
4062
|
/* @__PURE__ */ jsx10(Icon8, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4039
4063
|
] }) }),
|
|
@@ -4084,7 +4108,7 @@ function RadioFilterChip({
|
|
|
4084
4108
|
/* @__PURE__ */ jsx10(
|
|
4085
4109
|
ComboboxTrigger2,
|
|
4086
4110
|
{
|
|
4087
|
-
render: /* @__PURE__ */ jsx10(
|
|
4111
|
+
render: /* @__PURE__ */ jsx10(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4088
4112
|
children: /* @__PURE__ */ jsx10("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
4089
4113
|
}
|
|
4090
4114
|
),
|
|
@@ -4111,7 +4135,7 @@ function RadioFilterChip({
|
|
|
4111
4135
|
]
|
|
4112
4136
|
}
|
|
4113
4137
|
) : /* @__PURE__ */ jsxs9(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4114
|
-
/* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(
|
|
4138
|
+
/* @__PURE__ */ jsx10(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs9(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4115
4139
|
/* @__PURE__ */ jsx10("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
4116
4140
|
/* @__PURE__ */ jsx10(Icon8, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4117
4141
|
] }) }),
|
|
@@ -4136,7 +4160,7 @@ function TextFilterChip({
|
|
|
4136
4160
|
return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
|
|
4137
4161
|
/* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
|
|
4138
4162
|
/* @__PURE__ */ jsxs9(Popover2, { open, onOpenChange: setOpen, children: [
|
|
4139
|
-
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(
|
|
4163
|
+
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
4140
4164
|
/* @__PURE__ */ jsx10(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx10(
|
|
4141
4165
|
Input2,
|
|
4142
4166
|
{
|
|
@@ -4179,9 +4203,9 @@ function MultiTextFilterChip({
|
|
|
4179
4203
|
return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
|
|
4180
4204
|
/* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
|
|
4181
4205
|
/* @__PURE__ */ jsxs9(Popover2, { defaultOpen: autoOpen, children: [
|
|
4182
|
-
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(
|
|
4206
|
+
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
4183
4207
|
/* @__PURE__ */ jsx10(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
|
|
4184
|
-
tokens.length > 0 && /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs9(
|
|
4208
|
+
tokens.length > 0 && /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs9(Badge3, { variant: "secondary", className: "gap-1", children: [
|
|
4185
4209
|
token,
|
|
4186
4210
|
/* @__PURE__ */ jsx10(
|
|
4187
4211
|
"button",
|
|
@@ -4246,7 +4270,7 @@ function DateFilterChip({
|
|
|
4246
4270
|
return /* @__PURE__ */ jsxs9(ButtonGroup2, { children: [
|
|
4247
4271
|
/* @__PURE__ */ jsx10(ButtonGroupText2, { children: label }),
|
|
4248
4272
|
/* @__PURE__ */ jsxs9(Popover2, { defaultOpen: autoOpen, children: [
|
|
4249
|
-
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(
|
|
4273
|
+
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx10(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx10("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
4250
4274
|
/* @__PURE__ */ jsx10(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2", children: [
|
|
4251
4275
|
/* @__PURE__ */ jsx10(
|
|
4252
4276
|
Calendar2,
|
|
@@ -4424,6 +4448,8 @@ function SectionHeaderDescription(_a) {
|
|
|
4424
4448
|
// src/data-table/data-table.tsx
|
|
4425
4449
|
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4426
4450
|
var DEFAULT_PAGE_SIZE = 20;
|
|
4451
|
+
var noop = () => {
|
|
4452
|
+
};
|
|
4427
4453
|
var STICKY_HEADER_MAX_HEIGHT_CLASS = "max-h-[calc(100svh-250px)]";
|
|
4428
4454
|
function DataTable({
|
|
4429
4455
|
id,
|
|
@@ -4487,7 +4513,7 @@ function DataTable({
|
|
|
4487
4513
|
const [innerColumnOrdering, setInnerColumnOrdering] = React9.useState([]);
|
|
4488
4514
|
const [innerColumnFilters, setInnerColumnFilters] = React9.useState([]);
|
|
4489
4515
|
const [innerSorting, setInnerSorting] = React9.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
|
|
4490
|
-
const [innerColumnPinning, setInnerColumnPinning] = React9.useState({
|
|
4516
|
+
const [innerColumnPinning, setInnerColumnPinning] = React9.useState({ start: [], end: [] });
|
|
4491
4517
|
const [innerPagination, setInnerPagination] = React9.useState({
|
|
4492
4518
|
pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
|
|
4493
4519
|
pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
|
|
@@ -4560,18 +4586,18 @@ function DataTable({
|
|
|
4560
4586
|
const hasExternalSearch = parentGlobalFilter !== void 0;
|
|
4561
4587
|
const hasExternalFilters = parentColumnFilters !== void 0;
|
|
4562
4588
|
const shouldDisableFiltersModels = !!disableFilters && !!disableSearch && !hasExternalSearch && !hasExternalFilters;
|
|
4563
|
-
const table =
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
}), !!renderExpandedRow && { getRowCanExpand: () => true }), hasExpansion && { paginateExpandedRows: false }), {
|
|
4571
|
-
getGroupedRowModel: hasGrouping ? getGroupedRowModel() : void 0,
|
|
4589
|
+
const table = useTable(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, config), {
|
|
4590
|
+
features: dataTableFeatures,
|
|
4591
|
+
// Row models are registered statically in `dataTableFeatures`, so a disabled stage is switched
|
|
4592
|
+
// off with its `manual*` option (the stage then passes rows through untouched).
|
|
4593
|
+
manualSorting: serverSidePagination || disableSorting,
|
|
4594
|
+
manualFiltering: serverSidePagination || shouldDisableFiltersModels,
|
|
4595
|
+
manualPagination: serverSidePagination || shouldDisablePagination,
|
|
4572
4596
|
// Only grouping and `getSubRows` put extra rows in the row model; `renderExpandedRow`
|
|
4573
4597
|
// content renders outside it (see `DataTableBody`).
|
|
4574
|
-
|
|
4598
|
+
manualGrouping: !hasGrouping,
|
|
4599
|
+
manualExpanding: !hasGrouping && !hasSubRows
|
|
4600
|
+
}), !!renderExpandedRow && { getRowCanExpand: () => true }), hasExpansion && { paginateExpandedRows: false }), {
|
|
4575
4601
|
groupedColumnMode: hasGrouping ? "reorder" : void 0,
|
|
4576
4602
|
enableFilters: !shouldDisableFiltersModels,
|
|
4577
4603
|
enableGlobalFilter: !shouldDisableFiltersModels,
|
|
@@ -4593,13 +4619,10 @@ function DataTable({
|
|
|
4593
4619
|
columnOrder: disableColumnReordering ? [] : columnOrdering,
|
|
4594
4620
|
columnVisibility: disableColumnVisibility ? {} : columnVisibility,
|
|
4595
4621
|
columnSizing: disableColumnResizing ? {} : columnSizing,
|
|
4596
|
-
columnPinning: disableColumnPinning ? {
|
|
4622
|
+
columnPinning: disableColumnPinning ? { start: [], end: [] } : columnPinning
|
|
4597
4623
|
}, hasExpansion && { expanded }), {
|
|
4598
4624
|
grouping
|
|
4599
4625
|
}), hasGrouping && { expanded: true }),
|
|
4600
|
-
manualSorting: serverSidePagination,
|
|
4601
|
-
manualFiltering: serverSidePagination,
|
|
4602
|
-
manualPagination: serverSidePagination,
|
|
4603
4626
|
onSortingChange: disableSorting ? noop : setSorting,
|
|
4604
4627
|
onColumnFiltersChange: shouldDisableFiltersModels ? noop : setColumnFilters,
|
|
4605
4628
|
onGlobalFilterChange: shouldDisableFiltersModels ? noop : setGlobalFilter,
|
|
@@ -4665,7 +4688,7 @@ function DataTable({
|
|
|
4665
4688
|
const displayableIds = new Set(displayableColumns.map((c) => c.id));
|
|
4666
4689
|
return firstGroup.headers.filter((h) => displayableIds.has(h.column.id)).reduce((sum, h) => sum + h.column.getSize(), 0);
|
|
4667
4690
|
}, [isGrid, headerGroups, displayableColumns]);
|
|
4668
|
-
const filterCount = celFilterConfig ? celFilterConfig.activeFilterCount : table.
|
|
4691
|
+
const filterCount = celFilterConfig ? celFilterConfig.activeFilterCount : table.state.columnFilters.map(
|
|
4669
4692
|
({ id: columnFilterId, value }) => {
|
|
4670
4693
|
var _a2, _b2;
|
|
4671
4694
|
return getColumnFilterCount(value, (_b2 = (_a2 = table.getColumn(columnFilterId)) == null ? void 0 : _a2.columnDef.meta) == null ? void 0 : _b2.filter);
|
|
@@ -4873,6 +4896,7 @@ export {
|
|
|
4873
4896
|
RowActions,
|
|
4874
4897
|
TimestampCell,
|
|
4875
4898
|
ViewFilter,
|
|
4899
|
+
dataTableFeatures,
|
|
4876
4900
|
defaultEmptyConfig,
|
|
4877
4901
|
defaultErrorConfig,
|
|
4878
4902
|
defaultNoFilterFoundConfig,
|