@jmruthers/pace-core 0.2.5 → 0.2.7
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/{DataTable-BHlzyKZP.d.ts → DataTable-C1AEm9Cx.d.ts} +1 -1
- package/dist/{DataTable-GEY5U7OI.js → DataTable-EEUDXPE5.js} +2 -8
- package/dist/{api-T6CBS7IO.js → api-ETQ6YJ3C.js} +2 -3
- package/dist/{chunk-DY5E3AT7.js → chunk-BEZRLNK3.js} +13 -3
- package/dist/chunk-BEZRLNK3.js.map +1 -0
- package/dist/{chunk-ANE4PDC2.js → chunk-C5G2A4PO.js} +159 -6
- package/dist/chunk-C5G2A4PO.js.map +1 -0
- package/dist/{chunk-WYB6MBZA.js → chunk-EWKPTNPO.js} +579 -973
- package/dist/chunk-EWKPTNPO.js.map +1 -0
- package/dist/{chunk-TMRLB2LA.js → chunk-HEMJ4SUJ.js} +2 -2
- package/dist/{chunk-O4T53L7X.js → chunk-HNDFPXUU.js} +5 -5
- package/dist/{chunk-UY7AM4QG.js → chunk-RRUYHORU.js} +161 -74
- package/dist/chunk-RRUYHORU.js.map +1 -0
- package/dist/{chunk-PFRRIDYA.js → chunk-TIVL4UQ7.js} +2 -2
- package/dist/{chunk-2MKP6IYD.js → chunk-VYG4AXYW.js} +2 -2
- package/dist/components.d.ts +2 -2
- package/dist/components.js +15 -16
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -17
- package/dist/index.js.map +1 -1
- package/dist/providers.js +2 -2
- package/dist/rbac/index.js +25 -20
- package/dist/rbac/index.js.map +1 -1
- package/dist/styles/core.css +83 -62
- package/dist/{types-CInEi-ng.d.ts → types-DiRQsGJs.d.ts} +0 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +33 -33
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +10 -10
- package/docs/architecture/README.md +1 -1
- package/package.json +1 -1
- package/src/__tests__/shared/testUtils.optimized.tsx +65 -7
- package/src/components/DataTable/DataTable.tsx +1 -3
- package/src/components/DataTable/__tests__/DataTable.errorHandling.test.tsx +0 -8
- package/src/components/DataTable/__tests__/DataTable.hierarchical.test.tsx +17 -12
- package/src/components/DataTable/__tests__/DataTable.infinite-loop.test.tsx +0 -1
- package/src/components/DataTable/__tests__/DataTable.integration.test.tsx +4 -12
- package/src/components/DataTable/__tests__/DataTable.performance.test.tsx +0 -8
- package/src/components/DataTable/__tests__/DataTable.permissions.test.tsx +21 -11
- package/src/components/DataTable/__tests__/DataTable.sorting.test.tsx +321 -0
- package/src/components/DataTable/__tests__/DataTable.userWorkflows.test.tsx +21 -11
- package/src/components/DataTable/__tests__/DataTable.workflowValidation.test.tsx +94 -0
- package/src/components/DataTable/__tests__/DataTable.workflows.test.tsx +25 -15
- package/src/components/DataTable/__tests__/README.md +11 -2
- package/src/components/DataTable/__tests__/performance-regression.test.tsx +0 -11
- package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +0 -1
- package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +2 -2
- package/src/components/DataTable/components/DataTableBody.tsx +34 -35
- package/src/components/DataTable/components/DataTableCore.tsx +205 -133
- package/src/components/DataTable/components/DataTableToolbar.tsx +9 -10
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +3 -7
- package/src/components/DataTable/components/EditableRow.tsx +6 -7
- package/src/components/DataTable/components/FilterRow.tsx +0 -1
- package/src/components/DataTable/components/GroupingDropdown.tsx +2 -2
- package/src/components/DataTable/components/UnifiedTableBody.tsx +83 -281
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +9 -89
- package/src/components/DataTable/components/__tests__/DataTable.accessibility.test.tsx +111 -5
- package/src/components/DataTable/components/__tests__/DataTable.integration.test.tsx +82 -13
- package/src/components/DataTable/components/__tests__/DataTable.performance.test.tsx +0 -1
- package/src/components/DataTable/components/__tests__/DataTable.real.test.tsx +2 -2
- package/src/components/DataTable/components/__tests__/DataTable.security.test.tsx +0 -1
- package/src/components/DataTable/components/__tests__/DataTable.unit.test.tsx +2 -2
- package/src/components/DataTable/components/__tests__/FilteringToggle.unit.test.tsx +3 -0
- package/src/components/DataTable/components/index.ts +0 -1
- package/src/components/DataTable/core/DataTableContext.tsx +0 -1
- package/src/components/DataTable/index.ts +0 -2
- package/src/components/DataTable/types.ts +0 -2
- package/src/components/Input/Input.tsx +2 -2
- package/src/components/Input/__tests__/Input.unit.test.tsx +4 -4
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.integration.test.tsx +6 -2
- package/src/components/RBAC/PagePermissionGuard.tsx +13 -0
- package/src/components/RBAC/__tests__/PagePermissionGuard.unit.test.tsx +10 -1
- package/src/components/Select/Select.tsx +7 -1
- package/src/components/__tests__/EdgeCaseTesting.enhanced.test.tsx +2 -1
- package/src/hooks/__tests__/useRBAC.unit.test.ts +32 -24
- package/src/providers/RBACProvider.tsx +14 -2
- package/src/providers/__tests__/UnifiedAuthProvider.unit.test.tsx +11 -3
- package/src/rbac/__tests__/cache-invalidation.test.ts +2 -2
- package/src/rbac/__tests__/cache.test.ts +3 -3
- package/src/rbac/hooks.ts +15 -7
- package/src/styles/core.css +83 -62
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +13 -18
- package/src/utils/storage/__tests__/helpers.unit.test.ts +9 -7
- package/dist/cache-I72HKDOA.js +0 -12
- package/dist/cache-I72HKDOA.js.map +0 -1
- package/dist/chunk-ANE4PDC2.js.map +0 -1
- package/dist/chunk-DY5E3AT7.js.map +0 -1
- package/dist/chunk-MRRFJ6SA.js +0 -161
- package/dist/chunk-MRRFJ6SA.js.map +0 -1
- package/dist/chunk-UY7AM4QG.js.map +0 -1
- package/dist/chunk-WYB6MBZA.js.map +0 -1
- package/src/components/DataTable/__tests__/DataTable.autoSizing.test.tsx +0 -526
- package/src/components/DataTable/components/DataTableHeader.tsx +0 -31
- package/src/components/DataTable/components/__tests__/DataTableHeader.unit.test.tsx +0 -143
- package/src/components/DataTable/examples/AutoSizingExample.tsx +0 -180
- package/src/components/DataTable/examples/ColumnSizingComparison.tsx +0 -235
- package/src/components/DataTable/utils/__tests__/columnSizing.test.ts +0 -237
- package/src/components/DataTable/utils/columnSizing.ts +0 -125
- /package/dist/{DataTable-GEY5U7OI.js.map → DataTable-EEUDXPE5.js.map} +0 -0
- /package/dist/{api-T6CBS7IO.js.map → api-ETQ6YJ3C.js.map} +0 -0
- /package/dist/{chunk-TMRLB2LA.js.map → chunk-HEMJ4SUJ.js.map} +0 -0
- /package/dist/{chunk-O4T53L7X.js.map → chunk-HNDFPXUU.js.map} +0 -0
- /package/dist/{chunk-PFRRIDYA.js.map → chunk-TIVL4UQ7.js.map} +0 -0
- /package/dist/{chunk-2MKP6IYD.js.map → chunk-VYG4AXYW.js.map} +0 -0
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
} from "./chunk-OHXGNT3K.js";
|
|
17
17
|
|
|
18
18
|
// src/components/DataTable/DataTable.tsx
|
|
19
|
-
import
|
|
19
|
+
import React10 from "react";
|
|
20
20
|
|
|
21
21
|
// src/components/DataTable/components/DataTableCore.tsx
|
|
22
22
|
init_cn();
|
|
23
|
-
import
|
|
23
|
+
import React9, { useMemo as useMemo6, useCallback as useCallback5, useEffect as useEffect5, useState as useState6, useRef as useRef4 } from "react";
|
|
24
24
|
import {
|
|
25
25
|
useReactTable,
|
|
26
26
|
getCoreRowModel,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
getGroupedRowModel,
|
|
31
31
|
getExpandedRowModel
|
|
32
32
|
} from "@tanstack/react-table";
|
|
33
|
-
import { Edit, Trash } from "lucide-react";
|
|
33
|
+
import { Edit, Trash, ChevronUp as ChevronUp2, ChevronDown as ChevronDown3, ChevronsUpDown } from "lucide-react";
|
|
34
34
|
|
|
35
35
|
// src/components/Checkbox/Checkbox.tsx
|
|
36
36
|
init_cn();
|
|
@@ -58,6 +58,9 @@ var Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
58
58
|
));
|
|
59
59
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
60
60
|
|
|
61
|
+
// src/components/DataTable/components/DataTableCore.tsx
|
|
62
|
+
init_Button();
|
|
63
|
+
|
|
61
64
|
// src/components/DataTable/styles.ts
|
|
62
65
|
init_cn();
|
|
63
66
|
var tableStyles = {
|
|
@@ -116,25 +119,13 @@ var getTableClasses = (options = {}) => {
|
|
|
116
119
|
);
|
|
117
120
|
};
|
|
118
121
|
|
|
119
|
-
// src/components/DataTable/components/DataTableHeader.tsx
|
|
120
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
121
|
-
function DataTableHeader({ title, description }) {
|
|
122
|
-
const hasTitle = !!title && title.trim().length > 0;
|
|
123
|
-
const hasDescription = !!description && description.trim().length > 0;
|
|
124
|
-
if (!hasTitle && !hasDescription) return null;
|
|
125
|
-
return /* @__PURE__ */ jsxs("div", { className: "pb-4", children: [
|
|
126
|
-
hasTitle && /* @__PURE__ */ jsx2("h2", { className: "text-2xl font-bold tracking-tight break-words", children: title }),
|
|
127
|
-
hasDescription && /* @__PURE__ */ jsx2("p", { className: "text-muted-foreground mt-2 break-words", children: description })
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
|
|
131
122
|
// src/components/Input/Input.tsx
|
|
132
123
|
init_cn();
|
|
133
124
|
import * as React2 from "react";
|
|
134
|
-
import { jsx as
|
|
125
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
135
126
|
var Input = React2.forwardRef(
|
|
136
127
|
({ className, variant = "default", size = "md", error, type, ...props }, ref) => {
|
|
137
|
-
return /* @__PURE__ */
|
|
128
|
+
return /* @__PURE__ */ jsx2(
|
|
138
129
|
"input",
|
|
139
130
|
{
|
|
140
131
|
type,
|
|
@@ -149,8 +140,8 @@ var Input = React2.forwardRef(
|
|
|
149
140
|
// Size styles
|
|
150
141
|
{
|
|
151
142
|
"h-8 px-2 py-1 text-xs": size === "sm",
|
|
152
|
-
"h-
|
|
153
|
-
"h-
|
|
143
|
+
"h-9 px-3 py-2 text-sm": size === "md",
|
|
144
|
+
"h-10 px-4 py-3 text-base": size === "lg"
|
|
154
145
|
},
|
|
155
146
|
className
|
|
156
147
|
),
|
|
@@ -168,7 +159,7 @@ var InputGroup = React2.forwardRef(
|
|
|
168
159
|
md: orientation === "horizontal" ? "space-x-4" : "space-y-4",
|
|
169
160
|
lg: orientation === "horizontal" ? "space-x-6" : "space-y-6"
|
|
170
161
|
};
|
|
171
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ jsx2(
|
|
172
163
|
"div",
|
|
173
164
|
{
|
|
174
165
|
ref,
|
|
@@ -188,7 +179,7 @@ InputGroup.displayName = "InputGroup";
|
|
|
188
179
|
|
|
189
180
|
// src/components/DataTable/components/DataTableToolbar.tsx
|
|
190
181
|
init_Button();
|
|
191
|
-
import {
|
|
182
|
+
import { Plus, Upload, Download, Filter, Trash2 } from "lucide-react";
|
|
192
183
|
|
|
193
184
|
// src/components/DataTable/components/GroupingDropdown.tsx
|
|
194
185
|
init_Button();
|
|
@@ -198,7 +189,7 @@ init_Button();
|
|
|
198
189
|
init_cn();
|
|
199
190
|
import * as React3 from "react";
|
|
200
191
|
import { Search, X, ChevronDown, Check as Check2 } from "lucide-react";
|
|
201
|
-
import { jsx as
|
|
192
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
202
193
|
var SelectContext = React3.createContext(null);
|
|
203
194
|
var useSelectContext = () => {
|
|
204
195
|
const context = React3.useContext(SelectContext);
|
|
@@ -281,14 +272,19 @@ var Select = React3.forwardRef(
|
|
|
281
272
|
}, [controlledOpen, onOpenChange, selectRef]);
|
|
282
273
|
React3.useEffect(() => {
|
|
283
274
|
let timeoutId = null;
|
|
275
|
+
let isMounted = true;
|
|
284
276
|
const handleSelectItemMouseDown = () => {
|
|
277
|
+
if (!isMounted) return;
|
|
285
278
|
setIsSelecting(true);
|
|
286
279
|
timeoutId = setTimeout(() => {
|
|
287
|
-
|
|
280
|
+
if (isMounted) {
|
|
281
|
+
setIsSelecting(false);
|
|
282
|
+
}
|
|
288
283
|
}, 150);
|
|
289
284
|
};
|
|
290
285
|
document.addEventListener("selectItemMouseDown", handleSelectItemMouseDown);
|
|
291
286
|
return () => {
|
|
287
|
+
isMounted = false;
|
|
292
288
|
document.removeEventListener("selectItemMouseDown", handleSelectItemMouseDown);
|
|
293
289
|
if (timeoutId) {
|
|
294
290
|
clearTimeout(timeoutId);
|
|
@@ -336,7 +332,7 @@ var Select = React3.forwardRef(
|
|
|
336
332
|
onOpenChange: handleOpenChange,
|
|
337
333
|
disabled
|
|
338
334
|
}), [value, controlledSelectedText, internalSelectedText, handleValueChange, open, handleOpenChange, disabled]);
|
|
339
|
-
return /* @__PURE__ */
|
|
335
|
+
return /* @__PURE__ */ jsx3(
|
|
340
336
|
"form",
|
|
341
337
|
{
|
|
342
338
|
ref: selectRef,
|
|
@@ -344,7 +340,7 @@ var Select = React3.forwardRef(
|
|
|
344
340
|
"data-value": value,
|
|
345
341
|
"data-testid": "select-root",
|
|
346
342
|
...restProps,
|
|
347
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ jsx3(SelectContext.Provider, { value: contextValue, children })
|
|
348
344
|
}
|
|
349
345
|
);
|
|
350
346
|
}
|
|
@@ -408,7 +404,7 @@ var SelectTrigger = React3.forwardRef(
|
|
|
408
404
|
...triggerProps,
|
|
409
405
|
children: hasChevron ? childChildren : [
|
|
410
406
|
...childChildren,
|
|
411
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ jsx3(
|
|
412
408
|
ChevronDown,
|
|
413
409
|
{
|
|
414
410
|
className: cn(
|
|
@@ -421,7 +417,7 @@ var SelectTrigger = React3.forwardRef(
|
|
|
421
417
|
]
|
|
422
418
|
});
|
|
423
419
|
}
|
|
424
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ jsxs(
|
|
425
421
|
Button,
|
|
426
422
|
{
|
|
427
423
|
ref,
|
|
@@ -451,7 +447,7 @@ var SelectTrigger = React3.forwardRef(
|
|
|
451
447
|
...props,
|
|
452
448
|
children: [
|
|
453
449
|
children,
|
|
454
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ jsx3(
|
|
455
451
|
ChevronDown,
|
|
456
452
|
{
|
|
457
453
|
className: cn(
|
|
@@ -469,7 +465,7 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
469
465
|
var SelectValue = React3.forwardRef(
|
|
470
466
|
({ placeholder = "Select an option...", children }, ref) => {
|
|
471
467
|
const { selectedText } = useSelectContext();
|
|
472
|
-
return /* @__PURE__ */
|
|
468
|
+
return /* @__PURE__ */ jsx3("span", { ref, "data-testid": "select-value", children: children || (selectedText ? selectedText : placeholder) });
|
|
473
469
|
}
|
|
474
470
|
);
|
|
475
471
|
SelectValue.displayName = "SelectValue";
|
|
@@ -523,7 +519,7 @@ var SelectContent = React3.forwardRef(
|
|
|
523
519
|
if (!open) {
|
|
524
520
|
return null;
|
|
525
521
|
}
|
|
526
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsxs(
|
|
527
523
|
"ul",
|
|
528
524
|
{
|
|
529
525
|
ref,
|
|
@@ -544,9 +540,9 @@ var SelectContent = React3.forwardRef(
|
|
|
544
540
|
"data-testid": "select-content",
|
|
545
541
|
role: "listbox",
|
|
546
542
|
children: [
|
|
547
|
-
searchable && /* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
543
|
+
searchable && /* @__PURE__ */ jsx3("div", { className: "p-2 border-b border-main-200", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
544
|
+
/* @__PURE__ */ jsx3(Search, { className: "absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-main-400" }),
|
|
545
|
+
/* @__PURE__ */ jsx3(
|
|
550
546
|
"input",
|
|
551
547
|
{
|
|
552
548
|
ref: searchInputRef,
|
|
@@ -565,7 +561,7 @@ var SelectContent = React3.forwardRef(
|
|
|
565
561
|
"aria-label": "Search options"
|
|
566
562
|
}
|
|
567
563
|
),
|
|
568
|
-
searchTerm && /* @__PURE__ */
|
|
564
|
+
searchTerm && /* @__PURE__ */ jsx3(
|
|
569
565
|
"button",
|
|
570
566
|
{
|
|
571
567
|
type: "button",
|
|
@@ -573,7 +569,7 @@ var SelectContent = React3.forwardRef(
|
|
|
573
569
|
className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-main-400 hover:text-main-600",
|
|
574
570
|
"data-testid": "select-clear-search",
|
|
575
571
|
"aria-label": "Clear search",
|
|
576
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ jsx3(X, { className: "h-4 w-4" })
|
|
577
573
|
}
|
|
578
574
|
)
|
|
579
575
|
] }) }),
|
|
@@ -627,7 +623,7 @@ var SelectItem = React3.forwardRef(
|
|
|
627
623
|
break;
|
|
628
624
|
}
|
|
629
625
|
};
|
|
630
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ jsxs(
|
|
631
627
|
"li",
|
|
632
628
|
{
|
|
633
629
|
ref,
|
|
@@ -649,7 +645,7 @@ var SelectItem = React3.forwardRef(
|
|
|
649
645
|
"aria-selected": isSelected,
|
|
650
646
|
children: [
|
|
651
647
|
children,
|
|
652
|
-
isSelected && /* @__PURE__ */
|
|
648
|
+
isSelected && /* @__PURE__ */ jsx3(Check2, { className: "absolute right-2 h-4 w-4 flex-shrink-0 mt-0.5" })
|
|
653
649
|
]
|
|
654
650
|
}
|
|
655
651
|
);
|
|
@@ -658,19 +654,19 @@ var SelectItem = React3.forwardRef(
|
|
|
658
654
|
SelectItem.displayName = "SelectItem";
|
|
659
655
|
var SelectGroup = React3.forwardRef(
|
|
660
656
|
({ children, className }, ref) => {
|
|
661
|
-
return /* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("p-1", className), "data-testid": "select-group", children });
|
|
662
658
|
}
|
|
663
659
|
);
|
|
664
660
|
SelectGroup.displayName = "SelectGroup";
|
|
665
661
|
var SelectLabel = React3.forwardRef(
|
|
666
662
|
({ children, className }, ref) => {
|
|
667
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx3("div", { ref, className: cn("px-2 py-1.5 text-sm font-semibold", className), "data-testid": "select-label", children });
|
|
668
664
|
}
|
|
669
665
|
);
|
|
670
666
|
SelectLabel.displayName = "SelectLabel";
|
|
671
667
|
var SelectSeparator = React3.forwardRef(
|
|
672
668
|
({ className }, ref) => {
|
|
673
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsx3(
|
|
674
670
|
"div",
|
|
675
671
|
{
|
|
676
672
|
ref,
|
|
@@ -684,7 +680,7 @@ SelectSeparator.displayName = "SelectSeparator";
|
|
|
684
680
|
|
|
685
681
|
// src/components/DataTable/components/GroupingDropdown.tsx
|
|
686
682
|
import { Group } from "lucide-react";
|
|
687
|
-
import { jsx as
|
|
683
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
688
684
|
function GroupingDropdown({
|
|
689
685
|
columns,
|
|
690
686
|
currentGroupBy,
|
|
@@ -717,20 +713,20 @@ function GroupingDropdown({
|
|
|
717
713
|
if (groupableColumns.length === 0) {
|
|
718
714
|
return null;
|
|
719
715
|
}
|
|
720
|
-
return /* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsxs2(Select, { className: "w-40", children: [
|
|
717
|
+
/* @__PURE__ */ jsx4(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs2(
|
|
722
718
|
Button,
|
|
723
719
|
{
|
|
724
720
|
variant: "outline",
|
|
725
721
|
className: className || "",
|
|
726
722
|
children: [
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ jsx4(Group, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
724
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate", children: "Grouping" })
|
|
729
725
|
]
|
|
730
726
|
}
|
|
731
727
|
) }),
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ jsxs2(SelectContent, { children: [
|
|
729
|
+
/* @__PURE__ */ jsx4(
|
|
734
730
|
SelectItem,
|
|
735
731
|
{
|
|
736
732
|
value: "no-grouping",
|
|
@@ -743,7 +739,7 @@ function GroupingDropdown({
|
|
|
743
739
|
const columnId = String(column.accessorKey);
|
|
744
740
|
const isSelected = currentGroupBy === columnId;
|
|
745
741
|
const displayName = column.header || String(column.accessorKey);
|
|
746
|
-
return /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ jsx4(
|
|
747
743
|
SelectItem,
|
|
748
744
|
{
|
|
749
745
|
value: columnId,
|
|
@@ -761,7 +757,7 @@ function GroupingDropdown({
|
|
|
761
757
|
// src/components/DataTable/components/ColumnVisibilityDropdown.tsx
|
|
762
758
|
init_Button();
|
|
763
759
|
import { Settings2, Eye, EyeOff } from "lucide-react";
|
|
764
|
-
import { jsx as
|
|
760
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
765
761
|
function ColumnVisibilityDropdown({
|
|
766
762
|
columns,
|
|
767
763
|
onColumnVisibilityChange
|
|
@@ -769,20 +765,20 @@ function ColumnVisibilityDropdown({
|
|
|
769
765
|
const toggleableColumns = columns.filter(
|
|
770
766
|
(column) => column.getCanHide() && column.id !== "actions"
|
|
771
767
|
);
|
|
772
|
-
return /* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
768
|
+
return /* @__PURE__ */ jsxs3(Select, { className: "w-52", children: [
|
|
769
|
+
/* @__PURE__ */ jsx5(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
774
770
|
Button,
|
|
775
771
|
{
|
|
776
772
|
variant: "outline",
|
|
777
773
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ jsx5(Settings2, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
775
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate", children: "Columns" })
|
|
780
776
|
]
|
|
781
777
|
}
|
|
782
778
|
) }),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ jsx5(SelectContent, { children: /* @__PURE__ */ jsxs3("div", { className: "p-2 space-y-1", children: [
|
|
780
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-1 mb-2", children: [
|
|
781
|
+
/* @__PURE__ */ jsxs3(
|
|
786
782
|
Button,
|
|
787
783
|
{
|
|
788
784
|
variant: "ghost",
|
|
@@ -796,12 +792,12 @@ function ColumnVisibilityDropdown({
|
|
|
796
792
|
});
|
|
797
793
|
},
|
|
798
794
|
children: [
|
|
799
|
-
/* @__PURE__ */
|
|
795
|
+
/* @__PURE__ */ jsx5(Eye, { className: "h-3 w-3 mr-1" }),
|
|
800
796
|
"Show All"
|
|
801
797
|
]
|
|
802
798
|
}
|
|
803
799
|
),
|
|
804
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsxs3(
|
|
805
801
|
Button,
|
|
806
802
|
{
|
|
807
803
|
variant: "ghost",
|
|
@@ -815,21 +811,21 @@ function ColumnVisibilityDropdown({
|
|
|
815
811
|
});
|
|
816
812
|
},
|
|
817
813
|
children: [
|
|
818
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ jsx5(EyeOff, { className: "h-3 w-3 mr-1" }),
|
|
819
815
|
"Hide All"
|
|
820
816
|
]
|
|
821
817
|
}
|
|
822
818
|
)
|
|
823
819
|
] }),
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
toggleableColumns.map((column) => /* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsx5(SelectSeparator, {}),
|
|
821
|
+
toggleableColumns.map((column) => /* @__PURE__ */ jsxs3(
|
|
826
822
|
SelectItem,
|
|
827
823
|
{
|
|
828
824
|
value: column.id,
|
|
829
825
|
className: "flex items-center space-x-2 cursor-pointer px-3 py-2 text-sm hover:bg-sec-50",
|
|
830
826
|
onClick: (e) => e.preventDefault(),
|
|
831
827
|
children: [
|
|
832
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsx5(
|
|
833
829
|
Checkbox,
|
|
834
830
|
{
|
|
835
831
|
id: column.id,
|
|
@@ -837,7 +833,7 @@ function ColumnVisibilityDropdown({
|
|
|
837
833
|
onCheckedChange: (checked) => onColumnVisibilityChange(column.id, !!checked)
|
|
838
834
|
}
|
|
839
835
|
),
|
|
840
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ jsx5(
|
|
841
837
|
"label",
|
|
842
838
|
{
|
|
843
839
|
htmlFor: column.id,
|
|
@@ -854,7 +850,7 @@ function ColumnVisibilityDropdown({
|
|
|
854
850
|
}
|
|
855
851
|
|
|
856
852
|
// src/components/DataTable/components/DataTableToolbar.tsx
|
|
857
|
-
import { jsx as
|
|
853
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
858
854
|
function DataTableToolbar({
|
|
859
855
|
features,
|
|
860
856
|
globalFilter,
|
|
@@ -873,190 +869,104 @@ function DataTableToolbar({
|
|
|
873
869
|
showFilterRow = false
|
|
874
870
|
}) {
|
|
875
871
|
const currentGroupBy = grouping.length > 0 ? grouping[0] : null;
|
|
876
|
-
return /* @__PURE__ */
|
|
877
|
-
features.search && /* @__PURE__ */
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
className: "flex-1"
|
|
889
|
-
}
|
|
890
|
-
)
|
|
891
|
-
] }),
|
|
892
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 flex-wrap justify-end sm:justify-end min-w-0", children: [
|
|
893
|
-
features.grouping && /* @__PURE__ */ jsx7(
|
|
894
|
-
GroupingDropdown,
|
|
895
|
-
{
|
|
896
|
-
columns,
|
|
897
|
-
currentGroupBy,
|
|
898
|
-
onGroupByChange
|
|
899
|
-
}
|
|
900
|
-
),
|
|
901
|
-
features.columnVisibility && /* @__PURE__ */ jsx7(
|
|
902
|
-
ColumnVisibilityDropdown,
|
|
903
|
-
{
|
|
904
|
-
columns: tableColumns,
|
|
905
|
-
onColumnVisibilityChange
|
|
906
|
-
}
|
|
907
|
-
),
|
|
908
|
-
features.filtering && onToggleFilterRow && /* @__PURE__ */ jsxs5(
|
|
909
|
-
Button,
|
|
910
|
-
{
|
|
911
|
-
variant: "outline",
|
|
912
|
-
onClick: onToggleFilterRow,
|
|
913
|
-
children: [
|
|
914
|
-
/* @__PURE__ */ jsx7(Filter, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
915
|
-
/* @__PURE__ */ jsx7("span", { className: "truncate", children: showFilterRow ? "Hide Filters" : "Show Filters" })
|
|
916
|
-
]
|
|
917
|
-
}
|
|
918
|
-
),
|
|
919
|
-
features.creation && onCreateRow && /* @__PURE__ */ jsxs5(
|
|
920
|
-
Button,
|
|
921
|
-
{
|
|
922
|
-
variant: "outline",
|
|
923
|
-
onClick: onCreateRow,
|
|
924
|
-
children: [
|
|
925
|
-
/* @__PURE__ */ jsx7(Plus, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
926
|
-
/* @__PURE__ */ jsx7("span", { className: "truncate", children: "Add Row" })
|
|
927
|
-
]
|
|
928
|
-
}
|
|
929
|
-
),
|
|
930
|
-
features.import && /* @__PURE__ */ jsxs5(
|
|
931
|
-
Button,
|
|
932
|
-
{
|
|
933
|
-
variant: "outline",
|
|
934
|
-
onClick: onImportClick,
|
|
935
|
-
children: [
|
|
936
|
-
/* @__PURE__ */ jsx7(Upload, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
937
|
-
/* @__PURE__ */ jsx7("span", { className: "truncate", children: "Import" })
|
|
938
|
-
]
|
|
939
|
-
}
|
|
940
|
-
),
|
|
941
|
-
features.export && /* @__PURE__ */ jsxs5(
|
|
942
|
-
Button,
|
|
943
|
-
{
|
|
944
|
-
variant: "outline",
|
|
945
|
-
onClick: onExport,
|
|
946
|
-
children: [
|
|
947
|
-
/* @__PURE__ */ jsx7(Download, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
948
|
-
/* @__PURE__ */ jsx7("span", { className: "truncate", children: "Export" })
|
|
949
|
-
]
|
|
950
|
-
}
|
|
951
|
-
),
|
|
952
|
-
features.deleteSelected && features.deletion && features.selection && /* @__PURE__ */ jsxs5(
|
|
953
|
-
Button,
|
|
954
|
-
{
|
|
955
|
-
variant: "destructive",
|
|
956
|
-
onClick: () => onDeleteSelected?.(rowSelection),
|
|
957
|
-
disabled: Object.values(rowSelection).filter(Boolean).length === 0,
|
|
958
|
-
children: [
|
|
959
|
-
/* @__PURE__ */ jsx7(Trash2, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
960
|
-
/* @__PURE__ */ jsx7("span", { className: "truncate", children: "Delete" })
|
|
961
|
-
]
|
|
962
|
-
}
|
|
963
|
-
)
|
|
964
|
-
] })
|
|
965
|
-
] });
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
// src/components/DataTable/components/UnifiedTableBody.tsx
|
|
969
|
-
import React6, { useLayoutEffect, useState as useState3, useRef as useRef2 } from "react";
|
|
970
|
-
import { flexRender } from "@tanstack/react-table";
|
|
971
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
972
|
-
|
|
973
|
-
// src/components/Table/Table.tsx
|
|
974
|
-
init_cn();
|
|
975
|
-
import * as React4 from "react";
|
|
976
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
977
|
-
var Table = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
978
|
-
"table",
|
|
979
|
-
{
|
|
980
|
-
ref,
|
|
981
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
982
|
-
...props
|
|
983
|
-
}
|
|
984
|
-
));
|
|
985
|
-
Table.displayName = "Table";
|
|
986
|
-
var TableHeader = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
987
|
-
TableHeader.displayName = "TableHeader";
|
|
988
|
-
var TableBody = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
989
|
-
"tbody",
|
|
990
|
-
{
|
|
991
|
-
ref,
|
|
992
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
993
|
-
...props
|
|
994
|
-
}
|
|
995
|
-
));
|
|
996
|
-
TableBody.displayName = "TableBody";
|
|
997
|
-
var TableFooter = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
998
|
-
"tfoot",
|
|
999
|
-
{
|
|
1000
|
-
ref,
|
|
1001
|
-
className: cn(
|
|
1002
|
-
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
1003
|
-
className
|
|
872
|
+
return /* @__PURE__ */ jsxs4("nav", { className: "flex justify-end flex-wrap gap-2", children: [
|
|
873
|
+
features.search && /* @__PURE__ */ jsx6(
|
|
874
|
+
Input,
|
|
875
|
+
{
|
|
876
|
+
id: "table-search",
|
|
877
|
+
placeholder: "Search...",
|
|
878
|
+
value: globalFilter,
|
|
879
|
+
onChange: (e) => onGlobalFilterChange(e.target.value),
|
|
880
|
+
"aria-label": "Search table",
|
|
881
|
+
tabIndex: 0,
|
|
882
|
+
className: "justify-self-start w-50 flex-1"
|
|
883
|
+
}
|
|
1004
884
|
),
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
ref,
|
|
1013
|
-
className: cn(
|
|
1014
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
1015
|
-
className
|
|
885
|
+
features.grouping && /* @__PURE__ */ jsx6(
|
|
886
|
+
GroupingDropdown,
|
|
887
|
+
{
|
|
888
|
+
columns,
|
|
889
|
+
currentGroupBy,
|
|
890
|
+
onGroupByChange
|
|
891
|
+
}
|
|
1016
892
|
),
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
{
|
|
1024
|
-
ref,
|
|
1025
|
-
className: cn(
|
|
1026
|
-
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
1027
|
-
className
|
|
893
|
+
features.columnVisibility && /* @__PURE__ */ jsx6(
|
|
894
|
+
ColumnVisibilityDropdown,
|
|
895
|
+
{
|
|
896
|
+
columns: tableColumns,
|
|
897
|
+
onColumnVisibilityChange
|
|
898
|
+
}
|
|
1028
899
|
),
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
900
|
+
features.filtering && onToggleFilterRow && /* @__PURE__ */ jsxs4(
|
|
901
|
+
Button,
|
|
902
|
+
{
|
|
903
|
+
variant: "outline",
|
|
904
|
+
onClick: onToggleFilterRow,
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsx6(Filter, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
907
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: showFilterRow ? "Hide Filters" : "Show Filters" })
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
),
|
|
911
|
+
features.creation && onCreateRow && /* @__PURE__ */ jsxs4(
|
|
912
|
+
Button,
|
|
913
|
+
{
|
|
914
|
+
variant: "outline",
|
|
915
|
+
onClick: onCreateRow,
|
|
916
|
+
children: [
|
|
917
|
+
/* @__PURE__ */ jsx6(Plus, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
918
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: "Add Row" })
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
features.import && /* @__PURE__ */ jsxs4(
|
|
923
|
+
Button,
|
|
924
|
+
{
|
|
925
|
+
variant: "outline",
|
|
926
|
+
onClick: onImportClick,
|
|
927
|
+
children: [
|
|
928
|
+
/* @__PURE__ */ jsx6(Upload, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
929
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: "Import" })
|
|
930
|
+
]
|
|
931
|
+
}
|
|
932
|
+
),
|
|
933
|
+
features.export && /* @__PURE__ */ jsxs4(
|
|
934
|
+
Button,
|
|
935
|
+
{
|
|
936
|
+
variant: "outline",
|
|
937
|
+
onClick: onExport,
|
|
938
|
+
children: [
|
|
939
|
+
/* @__PURE__ */ jsx6(Download, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
940
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: "Export" })
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
),
|
|
944
|
+
features.deleteSelected && features.deletion && features.selection && /* @__PURE__ */ jsxs4(
|
|
945
|
+
Button,
|
|
946
|
+
{
|
|
947
|
+
variant: "destructive",
|
|
948
|
+
onClick: () => onDeleteSelected?.(rowSelection),
|
|
949
|
+
disabled: Object.values(rowSelection).filter(Boolean).length === 0,
|
|
950
|
+
children: [
|
|
951
|
+
/* @__PURE__ */ jsx6(Trash2, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
952
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: "Delete" })
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
] });
|
|
957
|
+
}
|
|
1051
958
|
|
|
1052
959
|
// src/components/DataTable/components/UnifiedTableBody.tsx
|
|
1053
960
|
init_Button();
|
|
1054
|
-
import {
|
|
961
|
+
import React4, { useRef as useRef2 } from "react";
|
|
962
|
+
import { flexRender } from "@tanstack/react-table";
|
|
963
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
964
|
+
import { ChevronDown as ChevronDown2, ChevronRight } from "lucide-react";
|
|
1055
965
|
|
|
1056
966
|
// src/components/DataTable/components/EmptyState.tsx
|
|
1057
967
|
init_Button();
|
|
1058
968
|
import { Database, Search as Search3, Plus as Plus2, User } from "lucide-react";
|
|
1059
|
-
import { jsx as
|
|
969
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1060
970
|
function EmptyState({
|
|
1061
971
|
title,
|
|
1062
972
|
description,
|
|
@@ -1067,8 +977,8 @@ function EmptyState({
|
|
|
1067
977
|
}) {
|
|
1068
978
|
const defaultTitle = isFiltered ? "No results found" : "No data available";
|
|
1069
979
|
const defaultDescription = isFiltered ? "Try adjusting your search or filter criteria" : "Get started by adding your first entry";
|
|
1070
|
-
return /* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center p-8 text-center", children: [
|
|
981
|
+
/* @__PURE__ */ jsx7(
|
|
1072
982
|
Icon,
|
|
1073
983
|
{
|
|
1074
984
|
role: "img",
|
|
@@ -1077,15 +987,15 @@ function EmptyState({
|
|
|
1077
987
|
"data-testid": Icon === Database ? "lucide-database" : Icon === User ? "lucide-user" : "custom-icon"
|
|
1078
988
|
}
|
|
1079
989
|
),
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1082
|
-
isFiltered && onClearFilters || action ? /* @__PURE__ */
|
|
1083
|
-
isFiltered && onClearFilters && /* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ jsx7("h3", { className: "text-lg font-semibold mb-2", children: title || defaultTitle }),
|
|
991
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground mb-4 max-w-sm", children: description || defaultDescription }),
|
|
992
|
+
isFiltered && onClearFilters || action ? /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
993
|
+
isFiltered && onClearFilters && /* @__PURE__ */ jsxs5(Button, { variant: "outline", onClick: onClearFilters, children: [
|
|
994
|
+
/* @__PURE__ */ jsx7(Search3, { className: "h-4 w-4 mr-2" }),
|
|
1085
995
|
"Clear filters"
|
|
1086
996
|
] }),
|
|
1087
|
-
action && /* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
997
|
+
action && /* @__PURE__ */ jsxs5(Button, { onClick: action.onClick, children: [
|
|
998
|
+
/* @__PURE__ */ jsx7(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
1089
999
|
action.label
|
|
1090
1000
|
] })
|
|
1091
1001
|
] }) : null
|
|
@@ -1095,7 +1005,7 @@ function EmptyState({
|
|
|
1095
1005
|
// src/components/DataTable/components/ColumnFilter.tsx
|
|
1096
1006
|
init_Button();
|
|
1097
1007
|
import { X as X2 } from "lucide-react";
|
|
1098
|
-
import { jsx as
|
|
1008
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1099
1009
|
function ColumnFilter({
|
|
1100
1010
|
column,
|
|
1101
1011
|
placeholder,
|
|
@@ -1121,22 +1031,22 @@ function ColumnFilter({
|
|
|
1121
1031
|
const renderFilterInput = () => {
|
|
1122
1032
|
switch (filterType) {
|
|
1123
1033
|
case "select":
|
|
1124
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsxs6(
|
|
1125
1035
|
Select,
|
|
1126
1036
|
{
|
|
1127
1037
|
value: columnFilterValue || "",
|
|
1128
1038
|
onValueChange: handleFilterChange,
|
|
1129
1039
|
children: [
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
/* @__PURE__ */
|
|
1133
|
-
options.map((option) => /* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ jsx8(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx8(SelectValue, { placeholder: placeholder || `Filter ${column.id}...` }) }),
|
|
1041
|
+
/* @__PURE__ */ jsxs6(SelectContent, { children: [
|
|
1042
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "", children: "All" }),
|
|
1043
|
+
options.map((option) => /* @__PURE__ */ jsx8(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
1134
1044
|
] })
|
|
1135
1045
|
]
|
|
1136
1046
|
}
|
|
1137
1047
|
);
|
|
1138
1048
|
case "number":
|
|
1139
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsx8(
|
|
1140
1050
|
Input,
|
|
1141
1051
|
{
|
|
1142
1052
|
type: "number",
|
|
@@ -1147,7 +1057,7 @@ function ColumnFilter({
|
|
|
1147
1057
|
}
|
|
1148
1058
|
);
|
|
1149
1059
|
case "date":
|
|
1150
|
-
return /* @__PURE__ */
|
|
1060
|
+
return /* @__PURE__ */ jsx8(
|
|
1151
1061
|
Input,
|
|
1152
1062
|
{
|
|
1153
1063
|
type: "date",
|
|
@@ -1158,7 +1068,7 @@ function ColumnFilter({
|
|
|
1158
1068
|
}
|
|
1159
1069
|
);
|
|
1160
1070
|
default:
|
|
1161
|
-
return /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ jsx8(
|
|
1162
1072
|
Input,
|
|
1163
1073
|
{
|
|
1164
1074
|
value: columnFilterValue || "",
|
|
@@ -1169,22 +1079,22 @@ function ColumnFilter({
|
|
|
1169
1079
|
);
|
|
1170
1080
|
}
|
|
1171
1081
|
};
|
|
1172
|
-
return /* @__PURE__ */
|
|
1082
|
+
return /* @__PURE__ */ jsxs6("div", { className: "relative flex items-center gap-1", children: [
|
|
1173
1083
|
renderFilterInput(),
|
|
1174
|
-
hasFilter && /* @__PURE__ */
|
|
1084
|
+
hasFilter && /* @__PURE__ */ jsx8(
|
|
1175
1085
|
Button,
|
|
1176
1086
|
{
|
|
1177
1087
|
variant: "ghost",
|
|
1178
1088
|
onClick: clearFilter,
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1089
|
+
children: /* @__PURE__ */ jsx8(X2, { className: "h-3 w-3" })
|
|
1180
1090
|
}
|
|
1181
1091
|
),
|
|
1182
|
-
hasFilter && /* @__PURE__ */
|
|
1092
|
+
hasFilter && /* @__PURE__ */ jsx8("div", { className: "absolute -top-1 -right-1 h-2 w-2 bg-main-500 rounded-full" })
|
|
1183
1093
|
] });
|
|
1184
1094
|
}
|
|
1185
1095
|
|
|
1186
1096
|
// src/components/DataTable/components/FilterRow.tsx
|
|
1187
|
-
import { jsx as
|
|
1097
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1188
1098
|
function FilterRow({ table, visibleColumns }) {
|
|
1189
1099
|
const { getState } = table;
|
|
1190
1100
|
const { columnFilters } = getState();
|
|
@@ -1224,17 +1134,16 @@ function FilterRow({ table, visibleColumns }) {
|
|
|
1224
1134
|
}
|
|
1225
1135
|
return "text";
|
|
1226
1136
|
};
|
|
1227
|
-
return /* @__PURE__ */
|
|
1137
|
+
return /* @__PURE__ */ jsx9("tr", { className: "border-b bg-sec-50/50", children: visibleColumns.map((header) => {
|
|
1228
1138
|
const column = header.column;
|
|
1229
1139
|
const canFilter = column.getCanFilter();
|
|
1230
1140
|
const filterType = getFilterType(column.id);
|
|
1231
1141
|
const options = filterType === "select" ? getColumnOptions(column.id) : [];
|
|
1232
|
-
return /* @__PURE__ */
|
|
1142
|
+
return /* @__PURE__ */ jsx9(
|
|
1233
1143
|
"td",
|
|
1234
1144
|
{
|
|
1235
1145
|
className: "px-4 py-2",
|
|
1236
|
-
|
|
1237
|
-
children: canFilter ? /* @__PURE__ */ jsx11(
|
|
1146
|
+
children: canFilter ? /* @__PURE__ */ jsx9(
|
|
1238
1147
|
ColumnFilter,
|
|
1239
1148
|
{
|
|
1240
1149
|
column,
|
|
@@ -1242,7 +1151,7 @@ function FilterRow({ table, visibleColumns }) {
|
|
|
1242
1151
|
options,
|
|
1243
1152
|
placeholder: `Filter ${column.id}...`
|
|
1244
1153
|
}
|
|
1245
|
-
) : /* @__PURE__ */
|
|
1154
|
+
) : /* @__PURE__ */ jsx9("div", { className: "h-8 flex items-center text-sec-400 text-sm", children: "No filter" })
|
|
1246
1155
|
},
|
|
1247
1156
|
header.id
|
|
1248
1157
|
);
|
|
@@ -1252,7 +1161,7 @@ function FilterRow({ table, visibleColumns }) {
|
|
|
1252
1161
|
// src/components/DataTable/components/ActionButtons.tsx
|
|
1253
1162
|
init_Button();
|
|
1254
1163
|
import { MoreHorizontal } from "lucide-react";
|
|
1255
|
-
import { Fragment, jsx as
|
|
1164
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1256
1165
|
function ActionButtons({
|
|
1257
1166
|
row,
|
|
1258
1167
|
actions = [],
|
|
@@ -1285,7 +1194,7 @@ function ActionButtons({
|
|
|
1285
1194
|
return null;
|
|
1286
1195
|
}
|
|
1287
1196
|
if (visibleActions.length <= 6) {
|
|
1288
|
-
return /* @__PURE__ */
|
|
1197
|
+
return /* @__PURE__ */ jsx10(Fragment, { children: visibleActions.map((action, actionIndex) => {
|
|
1289
1198
|
let Icon = action.icon;
|
|
1290
1199
|
let label = action.label;
|
|
1291
1200
|
if (hierarchical) {
|
|
@@ -1301,7 +1210,7 @@ function ActionButtons({
|
|
|
1301
1210
|
}
|
|
1302
1211
|
}
|
|
1303
1212
|
const isDisabled = typeof action.disabled === "function" ? action.disabled(row) : action.disabled;
|
|
1304
|
-
return /* @__PURE__ */
|
|
1213
|
+
return /* @__PURE__ */ jsx10(
|
|
1305
1214
|
Button,
|
|
1306
1215
|
{
|
|
1307
1216
|
variant: action.variant === "destructive" ? "destructive" : "ghost",
|
|
@@ -1312,18 +1221,18 @@ function ActionButtons({
|
|
|
1312
1221
|
"data-testid": action.testId,
|
|
1313
1222
|
"aria-label": label,
|
|
1314
1223
|
className: "h-8 w-8 p-0",
|
|
1315
|
-
children: Icon && /* @__PURE__ */
|
|
1224
|
+
children: Icon && /* @__PURE__ */ jsx10(Icon, { className: "h-4 w-4" })
|
|
1316
1225
|
},
|
|
1317
1226
|
actionIndex
|
|
1318
1227
|
);
|
|
1319
1228
|
}) });
|
|
1320
1229
|
}
|
|
1321
|
-
return /* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ jsxs7(Select, { children: [
|
|
1231
|
+
/* @__PURE__ */ jsx10(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(Button, { variant: "ghost", className: "h-8 w-8 p-0", children: [
|
|
1232
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Open menu" }),
|
|
1233
|
+
/* @__PURE__ */ jsx10(MoreHorizontal, { className: "h-4 w-4" })
|
|
1325
1234
|
] }) }),
|
|
1326
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ jsx10(SelectContent, { className: "!bg-main-50 border border-sec-200 shadow-lg z-[9999]", style: { backgroundColor: "white" }, children: visibleActions.map((action, actionIndex) => {
|
|
1327
1236
|
let Icon = action.icon;
|
|
1328
1237
|
let label = action.label;
|
|
1329
1238
|
if (hierarchical) {
|
|
@@ -1338,14 +1247,14 @@ function ActionButtons({
|
|
|
1338
1247
|
label = action.childLabel;
|
|
1339
1248
|
}
|
|
1340
1249
|
}
|
|
1341
|
-
return /* @__PURE__ */
|
|
1250
|
+
return /* @__PURE__ */ jsxs7(
|
|
1342
1251
|
SelectItem,
|
|
1343
1252
|
{
|
|
1344
1253
|
value: `action-${actionIndex}`,
|
|
1345
1254
|
onClick: () => action.onClick(row.original),
|
|
1346
1255
|
className: action.variant === "destructive" ? "text-acc-600" : "",
|
|
1347
1256
|
children: [
|
|
1348
|
-
Icon && /* @__PURE__ */
|
|
1257
|
+
Icon && /* @__PURE__ */ jsx10(Icon, { className: "mr-2 h-4 w-4" }),
|
|
1349
1258
|
label
|
|
1350
1259
|
]
|
|
1351
1260
|
},
|
|
@@ -1355,101 +1264,6 @@ function ActionButtons({
|
|
|
1355
1264
|
] });
|
|
1356
1265
|
}
|
|
1357
1266
|
|
|
1358
|
-
// src/components/DataTable/components/DraggableColumnHeader.tsx
|
|
1359
|
-
init_Button();
|
|
1360
|
-
import { useState as useState2 } from "react";
|
|
1361
|
-
init_cn();
|
|
1362
|
-
import { ChevronUp, ChevronDown as ChevronDown2, ChevronsUpDown } from "lucide-react";
|
|
1363
|
-
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1364
|
-
function DraggableColumnHeader({
|
|
1365
|
-
header,
|
|
1366
|
-
onMoveLeft,
|
|
1367
|
-
onMoveRight,
|
|
1368
|
-
canMoveLeft = false,
|
|
1369
|
-
canMoveRight = false,
|
|
1370
|
-
enableReordering = false,
|
|
1371
|
-
onColumnDrop
|
|
1372
|
-
}) {
|
|
1373
|
-
const [isDragging, setIsDragging] = useState2(false);
|
|
1374
|
-
const [dragOver, setDragOver] = useState2(false);
|
|
1375
|
-
const isSortable = header.column.getCanSort ? header.column.getCanSort() : false;
|
|
1376
|
-
const ariaSort = isSortable ? header.column.getIsSorted ? header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none" : "none" : void 0;
|
|
1377
|
-
const handleDragStart = (e) => {
|
|
1378
|
-
if (!enableReordering) return;
|
|
1379
|
-
setIsDragging(true);
|
|
1380
|
-
e.dataTransfer.setData("text/plain", header.id);
|
|
1381
|
-
e.dataTransfer.effectAllowed = "move";
|
|
1382
|
-
if (e.currentTarget instanceof HTMLElement) {
|
|
1383
|
-
e.currentTarget.style.opacity = "0.5";
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1386
|
-
const handleDragEnd = (e) => {
|
|
1387
|
-
setIsDragging(false);
|
|
1388
|
-
setDragOver(false);
|
|
1389
|
-
if (e.currentTarget instanceof HTMLElement) {
|
|
1390
|
-
e.currentTarget.style.opacity = "1";
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
const handleDragOver = (e) => {
|
|
1394
|
-
if (!enableReordering) return;
|
|
1395
|
-
e.preventDefault();
|
|
1396
|
-
e.dataTransfer.dropEffect = "move";
|
|
1397
|
-
setDragOver(true);
|
|
1398
|
-
};
|
|
1399
|
-
const handleDragLeave = (e) => {
|
|
1400
|
-
if (!enableReordering) return;
|
|
1401
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
1402
|
-
setDragOver(false);
|
|
1403
|
-
}
|
|
1404
|
-
};
|
|
1405
|
-
const handleDrop = (e) => {
|
|
1406
|
-
if (!enableReordering) return;
|
|
1407
|
-
e.preventDefault();
|
|
1408
|
-
setDragOver(false);
|
|
1409
|
-
const draggedHeaderId = e.dataTransfer.getData("text/plain");
|
|
1410
|
-
if (draggedHeaderId && draggedHeaderId !== header.id && onColumnDrop) {
|
|
1411
|
-
onColumnDrop(draggedHeaderId, header.id);
|
|
1412
|
-
}
|
|
1413
|
-
};
|
|
1414
|
-
return /* @__PURE__ */ jsx13(
|
|
1415
|
-
TableHead,
|
|
1416
|
-
{
|
|
1417
|
-
className: cn(
|
|
1418
|
-
"px-3 py-2 text-sm font-medium text-left relative group",
|
|
1419
|
-
isSortable && "cursor-pointer hover:bg-sec-50",
|
|
1420
|
-
isDragging && "opacity-50",
|
|
1421
|
-
dragOver && "bg-main-50 border-main-200",
|
|
1422
|
-
enableReordering && "cursor-move"
|
|
1423
|
-
),
|
|
1424
|
-
style: {
|
|
1425
|
-
width: header.getSize ? header.getSize() : 150,
|
|
1426
|
-
minWidth: header.getSize ? header.getSize() : 150
|
|
1427
|
-
},
|
|
1428
|
-
draggable: enableReordering,
|
|
1429
|
-
onDragStart: handleDragStart,
|
|
1430
|
-
onDragEnd: handleDragEnd,
|
|
1431
|
-
onDragOver: handleDragOver,
|
|
1432
|
-
onDragLeave: handleDragLeave,
|
|
1433
|
-
onDrop: handleDrop,
|
|
1434
|
-
...isSortable ? { "aria-sort": ariaSort } : {},
|
|
1435
|
-
children: /* @__PURE__ */ jsx13("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-1 flex-1", children: header.isPlaceholder ? null : isSortable ? /* @__PURE__ */ jsx13(
|
|
1436
|
-
Button,
|
|
1437
|
-
{
|
|
1438
|
-
variant: "ghost",
|
|
1439
|
-
className: "h-auto p-0 font-medium hover:bg-transparent flex-1 justify-start",
|
|
1440
|
-
onClick: header.column.getToggleSortingHandler(),
|
|
1441
|
-
"aria-label": `Sort by ${typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "column"}`,
|
|
1442
|
-
tabIndex: 0,
|
|
1443
|
-
children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
|
|
1444
|
-
typeof header.column.columnDef.header === "function" ? header.column.columnDef.header(header.getContext()) : header.column.columnDef.header,
|
|
1445
|
-
header.column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx13(ChevronUp, { className: "h-4 w-4" }) : header.column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx13(ChevronDown2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx13(ChevronsUpDown, { className: "h-4 w-4" })
|
|
1446
|
-
] })
|
|
1447
|
-
}
|
|
1448
|
-
) : /* @__PURE__ */ jsx13("div", { className: "flex-1", children: typeof header.column.columnDef.header === "function" ? header.column.columnDef.header(header.getContext()) : header.column.columnDef.header }) }) })
|
|
1449
|
-
}
|
|
1450
|
-
);
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
1267
|
// src/components/DataTable/utils/hierarchicalUtils.ts
|
|
1454
1268
|
function validateHierarchicalData(data) {
|
|
1455
1269
|
const errors = [];
|
|
@@ -1516,27 +1330,27 @@ function calculateIndentation(row, allData, baseIndent = 24) {
|
|
|
1516
1330
|
}
|
|
1517
1331
|
|
|
1518
1332
|
// src/components/DataTable/components/UnifiedTableBody.tsx
|
|
1519
|
-
import {
|
|
1333
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1520
1334
|
var VIRTUALIZATION_THRESHOLD = 1e3;
|
|
1521
1335
|
var renderEditField = (column, value, onChange, editingData = {}, placeholder) => {
|
|
1522
1336
|
const columnDef = column.columnDef;
|
|
1523
1337
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
1524
1338
|
const accessorKey = columnDef.editAccessorKey || column.id;
|
|
1525
1339
|
const currentValue = editingData[accessorKey] || value || "";
|
|
1526
|
-
return /* @__PURE__ */
|
|
1340
|
+
return /* @__PURE__ */ jsxs8(
|
|
1527
1341
|
Select,
|
|
1528
1342
|
{
|
|
1529
1343
|
value: currentValue,
|
|
1530
1344
|
onValueChange: (newValue) => onChange({ [accessorKey]: newValue }),
|
|
1531
1345
|
children: [
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ jsx11(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx11(SelectValue, { placeholder: placeholder || `Select ${columnDef.header || column.id}...` }) }),
|
|
1347
|
+
/* @__PURE__ */ jsx11(SelectContent, { children: columnDef.fieldOptions.map((option) => /* @__PURE__ */ jsx11(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1534
1348
|
]
|
|
1535
1349
|
}
|
|
1536
1350
|
);
|
|
1537
1351
|
}
|
|
1538
1352
|
if (columnDef.fieldType === "number") {
|
|
1539
|
-
return /* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ jsx11(
|
|
1540
1354
|
Input,
|
|
1541
1355
|
{
|
|
1542
1356
|
type: "number",
|
|
@@ -1548,7 +1362,7 @@ var renderEditField = (column, value, onChange, editingData = {}, placeholder) =
|
|
|
1548
1362
|
);
|
|
1549
1363
|
}
|
|
1550
1364
|
if (columnDef.fieldType === "date") {
|
|
1551
|
-
return /* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ jsx11(
|
|
1552
1366
|
Input,
|
|
1553
1367
|
{
|
|
1554
1368
|
type: "date",
|
|
@@ -1558,7 +1372,7 @@ var renderEditField = (column, value, onChange, editingData = {}, placeholder) =
|
|
|
1558
1372
|
}
|
|
1559
1373
|
);
|
|
1560
1374
|
}
|
|
1561
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ jsx11(
|
|
1562
1376
|
Input,
|
|
1563
1377
|
{
|
|
1564
1378
|
type: "text",
|
|
@@ -1572,7 +1386,6 @@ var renderEditField = (column, value, onChange, editingData = {}, placeholder) =
|
|
|
1572
1386
|
var MemoizedRow = ({
|
|
1573
1387
|
row,
|
|
1574
1388
|
style,
|
|
1575
|
-
columnSizes,
|
|
1576
1389
|
isEditing,
|
|
1577
1390
|
editingData,
|
|
1578
1391
|
onEditingDataChange,
|
|
@@ -1585,35 +1398,35 @@ var MemoizedRow = ({
|
|
|
1585
1398
|
actions
|
|
1586
1399
|
}) => {
|
|
1587
1400
|
const rowId = getRowId ? getRowId(row.original, row.index) : String(row.index);
|
|
1401
|
+
const hierarchicalRow = row.original;
|
|
1402
|
+
const isHierarchical = hierarchical?.enabled && hierarchicalRow?.isParent !== void 0;
|
|
1403
|
+
const isParent = isHierarchical && hierarchicalRow.isParent;
|
|
1404
|
+
const isChild = isHierarchical && !hierarchicalRow.isParent;
|
|
1588
1405
|
if (row.getIsGrouped && row.getIsGrouped()) {
|
|
1589
1406
|
const groupValue = row.getValue(grouping[0]);
|
|
1590
1407
|
const subRowsCount = row.subRows?.length || 0;
|
|
1591
1408
|
const isExpanded = row.getIsExpanded();
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
|
|
1409
|
+
return /* @__PURE__ */ jsxs8(React4.Fragment, { children: [
|
|
1410
|
+
/* @__PURE__ */ jsx11("tr", { className: "bg-sec-50 hover:bg-sec-100", style, children: /* @__PURE__ */ jsxs8(
|
|
1411
|
+
"td",
|
|
1595
1412
|
{
|
|
1596
1413
|
className: getTableCellClasses({
|
|
1597
1414
|
isCompact: true,
|
|
1598
1415
|
className: "px-3 py-2 flex items-center font-medium"
|
|
1599
1416
|
}),
|
|
1600
1417
|
colSpan: row.getAllCells().length,
|
|
1601
|
-
style: {
|
|
1602
|
-
width: "100%",
|
|
1603
|
-
minWidth: "100%"
|
|
1604
|
-
},
|
|
1605
1418
|
children: [
|
|
1606
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsx11(
|
|
1607
1420
|
Button,
|
|
1608
1421
|
{
|
|
1609
1422
|
variant: "ghost",
|
|
1610
1423
|
size: "sm",
|
|
1611
1424
|
onClick: () => row.toggleExpanded(),
|
|
1612
1425
|
className: "p-0 h-auto mr-2",
|
|
1613
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1426
|
+
children: isExpanded ? /* @__PURE__ */ jsx11(ChevronDown2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx11(ChevronRight, { className: "h-4 w-4" })
|
|
1614
1427
|
}
|
|
1615
1428
|
),
|
|
1616
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-sm", children: [
|
|
1617
1430
|
String(groupValue),
|
|
1618
1431
|
" (",
|
|
1619
1432
|
subRowsCount,
|
|
@@ -1625,23 +1438,20 @@ var MemoizedRow = ({
|
|
|
1625
1438
|
isExpanded && row.subRows?.map((subRow) => {
|
|
1626
1439
|
const subRowId = getRowId ? getRowId(subRow.original, subRow.index) : String(subRow.index);
|
|
1627
1440
|
const isSubRowEditing = editingRowId === subRowId;
|
|
1628
|
-
return /* @__PURE__ */
|
|
1629
|
-
|
|
1441
|
+
return /* @__PURE__ */ jsx11("tr", { className: "border-l-2 border-l-blue-200", style, children: subRow.getVisibleCells().map((cell) => /* @__PURE__ */ jsx11(
|
|
1442
|
+
"td",
|
|
1630
1443
|
{
|
|
1631
1444
|
className: getTableCellClasses({
|
|
1632
1445
|
isCompact: true,
|
|
1633
1446
|
className: "px-3 py-2 pl-8 whitespace-normal break-words"
|
|
1634
1447
|
}),
|
|
1635
|
-
style: {
|
|
1636
|
-
width: columnSizes[cell.column.id] || (cell.column?.getSize ? cell.column.getSize() : 120)
|
|
1637
|
-
},
|
|
1638
1448
|
children: isSubRowEditing && cell.column.id !== "actions" ? renderEditField(cell.column, editingData?.[cell.column.id], (value) => {
|
|
1639
1449
|
if (typeof value === "object" && value !== null) {
|
|
1640
1450
|
onEditingDataChange?.({ ...editingData, ...value });
|
|
1641
1451
|
} else {
|
|
1642
1452
|
onEditingDataChange?.({ ...editingData, [cell.column.id]: value });
|
|
1643
1453
|
}
|
|
1644
|
-
}, editingData) : cell.column.id === "actions" ? /* @__PURE__ */
|
|
1454
|
+
}, editingData) : cell.column.id === "actions" ? /* @__PURE__ */ jsx11(
|
|
1645
1455
|
ActionButtons,
|
|
1646
1456
|
{
|
|
1647
1457
|
row,
|
|
@@ -1671,15 +1481,11 @@ var MemoizedRow = ({
|
|
|
1671
1481
|
}
|
|
1672
1482
|
const visibleCells = row.getVisibleCells();
|
|
1673
1483
|
const allCells = row.getAllCells ? row.getAllCells() : [];
|
|
1674
|
-
const hierarchicalRow = row.original;
|
|
1675
|
-
const isHierarchical = hierarchical?.enabled && hierarchicalRow?.isParent !== void 0;
|
|
1676
|
-
const isParent = isHierarchical && hierarchicalRow.isParent;
|
|
1677
|
-
const isChild = isHierarchical && !hierarchicalRow.isParent;
|
|
1678
1484
|
const indentSize = hierarchical?.indentSize || 24;
|
|
1679
1485
|
const indentation = isChild && hierarchical?.state ? calculateIndentation(hierarchicalRow, [], indentSize) : 0;
|
|
1680
1486
|
const rowClassName = isHierarchical ? isParent ? hierarchical?.parentRowClassName || "bg-main-50 hover:bg-main-100 font-medium" : hierarchical?.childRowClassName || "bg-sec-25 hover:bg-sec-50" : "";
|
|
1681
|
-
return /* @__PURE__ */
|
|
1682
|
-
|
|
1487
|
+
return /* @__PURE__ */ jsx11(
|
|
1488
|
+
"tr",
|
|
1683
1489
|
{
|
|
1684
1490
|
style: {
|
|
1685
1491
|
...style,
|
|
@@ -1703,19 +1509,15 @@ var MemoizedRow = ({
|
|
|
1703
1509
|
isExpanded
|
|
1704
1510
|
});
|
|
1705
1511
|
}
|
|
1706
|
-
return /* @__PURE__ */
|
|
1707
|
-
|
|
1512
|
+
return /* @__PURE__ */ jsx11(
|
|
1513
|
+
"td",
|
|
1708
1514
|
{
|
|
1709
1515
|
className: getTableCellClasses({
|
|
1710
1516
|
isCompact: true,
|
|
1711
1517
|
className: "px-3 py-2 whitespace-normal break-words"
|
|
1712
1518
|
}),
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
minWidth: columnSizes[cell.column.id] ? void 0 : 120
|
|
1716
|
-
},
|
|
1717
|
-
children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
1718
|
-
shouldShowExpansionButton && hasChildren && /* @__PURE__ */ jsx14(
|
|
1519
|
+
children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
1520
|
+
shouldShowExpansionButton && hasChildren && /* @__PURE__ */ jsx11(
|
|
1719
1521
|
Button,
|
|
1720
1522
|
{
|
|
1721
1523
|
variant: "ghost",
|
|
@@ -1724,35 +1526,35 @@ var MemoizedRow = ({
|
|
|
1724
1526
|
className: "h-6 w-6 p-0 flex-shrink-0",
|
|
1725
1527
|
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
1726
1528
|
title: isExpanded ? "Collapse row" : "Expand row",
|
|
1727
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1529
|
+
children: isExpanded ? /* @__PURE__ */ jsx11(ChevronDown2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx11(ChevronRight, { className: "h-4 w-4" })
|
|
1728
1530
|
}
|
|
1729
1531
|
),
|
|
1730
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx11("div", { className: "flex-1", children: isEditing && cell.column.id !== "actions" ? renderEditField(cell.column, editingData?.[cell.column.id], (value) => {
|
|
1731
1533
|
if (typeof value === "object" && value !== null) {
|
|
1732
1534
|
onEditingDataChange?.({ ...editingData, ...value });
|
|
1733
1535
|
} else {
|
|
1734
1536
|
onEditingDataChange?.({ ...editingData, [cell.column.id]: value });
|
|
1735
1537
|
}
|
|
1736
|
-
}, editingData) : cell.column.id === "actions" ? isEditing ? /* @__PURE__ */
|
|
1737
|
-
/* @__PURE__ */
|
|
1538
|
+
}, editingData) : cell.column.id === "actions" ? isEditing ? /* @__PURE__ */ jsxs8("div", { className: "flex gap-1", children: [
|
|
1539
|
+
/* @__PURE__ */ jsx11(
|
|
1738
1540
|
"button",
|
|
1739
1541
|
{
|
|
1740
1542
|
onClick: onSaveEditing,
|
|
1741
1543
|
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
1742
1544
|
title: "Save changes",
|
|
1743
|
-
children: /* @__PURE__ */
|
|
1545
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
1744
1546
|
}
|
|
1745
1547
|
),
|
|
1746
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx11(
|
|
1747
1549
|
"button",
|
|
1748
1550
|
{
|
|
1749
1551
|
onClick: onCancelEditing,
|
|
1750
1552
|
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
1751
1553
|
title: "Cancel changes",
|
|
1752
|
-
children: /* @__PURE__ */
|
|
1554
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1753
1555
|
}
|
|
1754
1556
|
)
|
|
1755
|
-
] }) : /* @__PURE__ */
|
|
1557
|
+
] }) : /* @__PURE__ */ jsx11(
|
|
1756
1558
|
ActionButtons,
|
|
1757
1559
|
{
|
|
1758
1560
|
row,
|
|
@@ -1816,7 +1618,6 @@ function UnifiedTableBody({
|
|
|
1816
1618
|
const headerRef = useRef2(null);
|
|
1817
1619
|
const bodyRef = useRef2(null);
|
|
1818
1620
|
const parentRef = useRef2(null);
|
|
1819
|
-
const [columnSizes, setColumnSizes] = useState3({});
|
|
1820
1621
|
const shouldVirtualize = forceVirtualization || dataLength > VIRTUALIZATION_THRESHOLD;
|
|
1821
1622
|
const rows = table.getRowModel().rows;
|
|
1822
1623
|
const headerGroups = table.getHeaderGroups();
|
|
@@ -1828,47 +1629,15 @@ function UnifiedTableBody({
|
|
|
1828
1629
|
});
|
|
1829
1630
|
const virtualRows = virtualizer.getVirtualItems();
|
|
1830
1631
|
const totalSize = virtualizer.getTotalSize();
|
|
1831
|
-
useLayoutEffect(() => {
|
|
1832
|
-
if (headerRef.current && bodyRef.current) {
|
|
1833
|
-
const headerCells = headerRef.current.querySelectorAll("th");
|
|
1834
|
-
const newColumnSizes = {};
|
|
1835
|
-
const tableWidth = headerRef.current.closest("table")?.getBoundingClientRect().width || 0;
|
|
1836
|
-
const totalColumns = table.getHeaderGroups()[0]?.headers.length || 0;
|
|
1837
|
-
table.getHeaderGroups()[0]?.headers.forEach((header, index) => {
|
|
1838
|
-
const headerCell = headerCells[index];
|
|
1839
|
-
if (headerCell) {
|
|
1840
|
-
const columnSize = header.column?.getSize ? header.column.getSize() : 150;
|
|
1841
|
-
const computedWidth = headerCell.getBoundingClientRect().width;
|
|
1842
|
-
if (totalColumns > 0) {
|
|
1843
|
-
const availableWidth = tableWidth / totalColumns;
|
|
1844
|
-
const minWidth = Math.max(columnSize, 80);
|
|
1845
|
-
newColumnSizes[header.id] = Math.max(computedWidth, availableWidth, minWidth);
|
|
1846
|
-
} else {
|
|
1847
|
-
newColumnSizes[header.id] = Math.max(computedWidth, columnSize);
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
});
|
|
1851
|
-
const hasChanged = Object.keys(newColumnSizes).some(
|
|
1852
|
-
(key) => newColumnSizes[key] !== columnSizes[key]
|
|
1853
|
-
) || Object.keys(columnSizes).length !== Object.keys(newColumnSizes).length;
|
|
1854
|
-
if (hasChanged) {
|
|
1855
|
-
setColumnSizes(newColumnSizes);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
}, [table, columnSizes]);
|
|
1859
1632
|
const renderTableContent = () => {
|
|
1860
1633
|
if (rows.length === 0) {
|
|
1861
|
-
return /* @__PURE__ */
|
|
1862
|
-
|
|
1634
|
+
return /* @__PURE__ */ jsx11("tr", { children: /* @__PURE__ */ jsx11(
|
|
1635
|
+
"td",
|
|
1863
1636
|
{
|
|
1864
1637
|
colSpan: table.getVisibleFlatColumns().length,
|
|
1865
1638
|
className: "px-3 py-2",
|
|
1866
1639
|
role: "status",
|
|
1867
|
-
|
|
1868
|
-
width: "100%",
|
|
1869
|
-
minWidth: "100%"
|
|
1870
|
-
},
|
|
1871
|
-
children: /* @__PURE__ */ jsx14(
|
|
1640
|
+
children: /* @__PURE__ */ jsx11(
|
|
1872
1641
|
EmptyState,
|
|
1873
1642
|
{
|
|
1874
1643
|
title: emptyState?.title,
|
|
@@ -1888,11 +1657,10 @@ function UnifiedTableBody({
|
|
|
1888
1657
|
if (!row) return null;
|
|
1889
1658
|
const rowId = getRowId ? getRowId(row.original, row.index) : String(row.index);
|
|
1890
1659
|
const isEditing = editingRowId === rowId;
|
|
1891
|
-
return /* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ jsx11(
|
|
1892
1661
|
MemoizedRow,
|
|
1893
1662
|
{
|
|
1894
1663
|
row,
|
|
1895
|
-
columnSizes,
|
|
1896
1664
|
isEditing,
|
|
1897
1665
|
editingData,
|
|
1898
1666
|
onEditingDataChange,
|
|
@@ -1919,11 +1687,10 @@ function UnifiedTableBody({
|
|
|
1919
1687
|
return rows.map((row) => {
|
|
1920
1688
|
const rowId = getRowId ? getRowId(row.original, row.index) : String(row.index);
|
|
1921
1689
|
const isEditing = editingRowId === rowId;
|
|
1922
|
-
return /* @__PURE__ */
|
|
1690
|
+
return /* @__PURE__ */ jsx11(
|
|
1923
1691
|
MemoizedRow,
|
|
1924
1692
|
{
|
|
1925
1693
|
row,
|
|
1926
|
-
columnSizes,
|
|
1927
1694
|
isEditing,
|
|
1928
1695
|
editingData,
|
|
1929
1696
|
onEditingDataChange,
|
|
@@ -1940,183 +1707,72 @@ function UnifiedTableBody({
|
|
|
1940
1707
|
});
|
|
1941
1708
|
}
|
|
1942
1709
|
};
|
|
1943
|
-
return /* @__PURE__ */
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
Button,
|
|
1947
|
-
{
|
|
1948
|
-
variant: "ghost",
|
|
1949
|
-
size: "sm",
|
|
1950
|
-
onClick: hierarchical.isAllExpanded ? hierarchical.collapseAll : hierarchical.expandAll,
|
|
1951
|
-
className: "h-8 w-8 p-0",
|
|
1952
|
-
"aria-label": hierarchical.isAllExpanded ? "Collapse all" : "Expand all",
|
|
1953
|
-
title: hierarchical.isAllExpanded ? "Collapse all" : "Expand all",
|
|
1954
|
-
children: hierarchical.isAllExpanded ? /* @__PURE__ */ jsx14(ChevronDown3, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx14(ChevronRight, { className: "h-4 w-4" })
|
|
1955
|
-
}
|
|
1956
|
-
) }),
|
|
1957
|
-
headerGroup.headers.filter((header) => {
|
|
1710
|
+
return /* @__PURE__ */ jsxs8("tbody", { ref: bodyRef, children: [
|
|
1711
|
+
isCreating && /* @__PURE__ */ jsxs8("tr", { children: [
|
|
1712
|
+
headerGroups[0]?.headers?.filter((header) => {
|
|
1958
1713
|
return typeof header.column.getIsVisible === "function" ? header.column.getIsVisible() : true;
|
|
1959
|
-
}).map((header) => /* @__PURE__ */
|
|
1960
|
-
|
|
1714
|
+
})?.filter((header) => header.column.id !== "actions" && header.column.id !== "select")?.map((header) => /* @__PURE__ */ jsx11(
|
|
1715
|
+
"td",
|
|
1961
1716
|
{
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1717
|
+
className: getTableCellClasses({
|
|
1718
|
+
isCompact: true,
|
|
1719
|
+
className: "px-3 py-2"
|
|
1720
|
+
}),
|
|
1721
|
+
children: renderEditField(header.column, creationData[header.column.id], (value) => {
|
|
1722
|
+
if (typeof value === "object" && value !== null) {
|
|
1723
|
+
onCreationDataChange({ ...creationData, ...value });
|
|
1724
|
+
} else {
|
|
1725
|
+
onCreationDataChange({ ...creationData, [header.column.id]: value });
|
|
1726
|
+
}
|
|
1727
|
+
}, creationData)
|
|
1965
1728
|
},
|
|
1966
|
-
header.id
|
|
1967
|
-
))
|
|
1968
|
-
|
|
1969
|
-
|
|
1729
|
+
header.column.id
|
|
1730
|
+
)),
|
|
1731
|
+
/* @__PURE__ */ jsxs8(
|
|
1732
|
+
"td",
|
|
1733
|
+
{
|
|
1734
|
+
className: getTableCellClasses({
|
|
1735
|
+
isCompact: true,
|
|
1736
|
+
className: "px-3 py-2 flex gap-1"
|
|
1737
|
+
}),
|
|
1738
|
+
children: [
|
|
1739
|
+
/* @__PURE__ */ jsx11(
|
|
1740
|
+
"button",
|
|
1741
|
+
{
|
|
1742
|
+
onClick: onSaveCreation,
|
|
1743
|
+
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
1744
|
+
title: "Save new row",
|
|
1745
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
1746
|
+
}
|
|
1747
|
+
),
|
|
1748
|
+
/* @__PURE__ */ jsx11(
|
|
1749
|
+
"button",
|
|
1750
|
+
{
|
|
1751
|
+
onClick: onCancelCreation,
|
|
1752
|
+
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
1753
|
+
title: "Cancel new row",
|
|
1754
|
+
children: /* @__PURE__ */ jsx11("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx11("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
]
|
|
1758
|
+
}
|
|
1759
|
+
)
|
|
1760
|
+
] }),
|
|
1761
|
+
showFilterRow && enableFiltering && /* @__PURE__ */ jsx11(
|
|
1970
1762
|
FilterRow,
|
|
1971
1763
|
{
|
|
1972
1764
|
table,
|
|
1973
|
-
visibleColumns:
|
|
1974
|
-
return typeof header.column.getIsVisible === "function" ? header.column.getIsVisible() : true;
|
|
1975
|
-
}) || []
|
|
1765
|
+
visibleColumns: table.getHeaderGroups()[0]?.headers || []
|
|
1976
1766
|
}
|
|
1977
|
-
)
|
|
1978
|
-
|
|
1979
|
-
"div",
|
|
1980
|
-
{
|
|
1981
|
-
ref: parentRef,
|
|
1982
|
-
className: "overflow-auto",
|
|
1983
|
-
style: { height: `${virtualHeight}px` },
|
|
1984
|
-
children: /* @__PURE__ */ jsx14(
|
|
1985
|
-
"div",
|
|
1986
|
-
{
|
|
1987
|
-
style: {
|
|
1988
|
-
height: `${totalSize}px`,
|
|
1989
|
-
width: "100%",
|
|
1990
|
-
position: "relative"
|
|
1991
|
-
},
|
|
1992
|
-
children: /* @__PURE__ */ jsx14("table", { className: "w-full", style: { tableLayout: "fixed", width: "100%" }, children: /* @__PURE__ */ jsxs10(TableBody, { ref: bodyRef, children: [
|
|
1993
|
-
isCreating && /* @__PURE__ */ jsxs10(TableRow, { children: [
|
|
1994
|
-
headerGroups[0]?.headers?.filter((header) => {
|
|
1995
|
-
return typeof header.column.getIsVisible === "function" ? header.column.getIsVisible() : true;
|
|
1996
|
-
})?.filter((header) => header.column.id !== "actions" && header.column.id !== "select")?.map((header) => /* @__PURE__ */ jsx14(
|
|
1997
|
-
TableCell,
|
|
1998
|
-
{
|
|
1999
|
-
className: getTableCellClasses({
|
|
2000
|
-
isCompact: true,
|
|
2001
|
-
className: "px-3 py-2"
|
|
2002
|
-
}),
|
|
2003
|
-
style: {
|
|
2004
|
-
width: columnSizes[header.column.id] || (header.column?.getSize ? header.column.getSize() : 120)
|
|
2005
|
-
},
|
|
2006
|
-
children: renderEditField(header.column, creationData[header.column.id], (value) => {
|
|
2007
|
-
if (typeof value === "object" && value !== null) {
|
|
2008
|
-
onCreationDataChange({ ...creationData, ...value });
|
|
2009
|
-
} else {
|
|
2010
|
-
onCreationDataChange({ ...creationData, [header.column.id]: value });
|
|
2011
|
-
}
|
|
2012
|
-
}, creationData)
|
|
2013
|
-
},
|
|
2014
|
-
header.column.id
|
|
2015
|
-
)),
|
|
2016
|
-
/* @__PURE__ */ jsxs10(
|
|
2017
|
-
TableCell,
|
|
2018
|
-
{
|
|
2019
|
-
className: getTableCellClasses({
|
|
2020
|
-
isCompact: true,
|
|
2021
|
-
className: "px-3 py-2 flex gap-1"
|
|
2022
|
-
}),
|
|
2023
|
-
style: {
|
|
2024
|
-
width: columnSizes["actions"] || 100
|
|
2025
|
-
},
|
|
2026
|
-
children: [
|
|
2027
|
-
/* @__PURE__ */ jsx14(
|
|
2028
|
-
"button",
|
|
2029
|
-
{
|
|
2030
|
-
onClick: onSaveCreation,
|
|
2031
|
-
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
2032
|
-
title: "Save new row",
|
|
2033
|
-
children: /* @__PURE__ */ jsx14("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
2034
|
-
}
|
|
2035
|
-
),
|
|
2036
|
-
/* @__PURE__ */ jsx14(
|
|
2037
|
-
"button",
|
|
2038
|
-
{
|
|
2039
|
-
onClick: onCancelCreation,
|
|
2040
|
-
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
2041
|
-
title: "Cancel new row",
|
|
2042
|
-
children: /* @__PURE__ */ jsx14("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2043
|
-
}
|
|
2044
|
-
)
|
|
2045
|
-
]
|
|
2046
|
-
}
|
|
2047
|
-
)
|
|
2048
|
-
] }),
|
|
2049
|
-
renderTableContent()
|
|
2050
|
-
] }) })
|
|
2051
|
-
}
|
|
2052
|
-
)
|
|
2053
|
-
}
|
|
2054
|
-
) : /* @__PURE__ */ jsxs10(TableBody, { ref: bodyRef, children: [
|
|
2055
|
-
isCreating && /* @__PURE__ */ jsxs10(TableRow, { children: [
|
|
2056
|
-
headerGroups[0]?.headers?.filter((header) => {
|
|
2057
|
-
return typeof header.column.getIsVisible === "function" ? header.column.getIsVisible() : true;
|
|
2058
|
-
})?.filter((header) => header.column.id !== "actions" && header.column.id !== "select")?.map((header) => /* @__PURE__ */ jsx14(
|
|
2059
|
-
TableCell,
|
|
2060
|
-
{
|
|
2061
|
-
className: getTableCellClasses({
|
|
2062
|
-
isCompact: true,
|
|
2063
|
-
className: "px-3 py-2"
|
|
2064
|
-
}),
|
|
2065
|
-
style: {
|
|
2066
|
-
width: columnSizes[header.column.id] || (header.column?.getSize ? header.column.getSize() : 120)
|
|
2067
|
-
},
|
|
2068
|
-
children: renderEditField(header.column, creationData[header.column.id], (value) => {
|
|
2069
|
-
if (typeof value === "object" && value !== null) {
|
|
2070
|
-
onCreationDataChange({ ...creationData, ...value });
|
|
2071
|
-
} else {
|
|
2072
|
-
onCreationDataChange({ ...creationData, [header.column.id]: value });
|
|
2073
|
-
}
|
|
2074
|
-
}, creationData)
|
|
2075
|
-
},
|
|
2076
|
-
header.column.id
|
|
2077
|
-
)),
|
|
2078
|
-
/* @__PURE__ */ jsxs10(
|
|
2079
|
-
TableCell,
|
|
2080
|
-
{
|
|
2081
|
-
className: getTableCellClasses({
|
|
2082
|
-
isCompact: true,
|
|
2083
|
-
className: "px-3 py-2 flex gap-1"
|
|
2084
|
-
}),
|
|
2085
|
-
style: {
|
|
2086
|
-
width: columnSizes["actions"] || 100
|
|
2087
|
-
},
|
|
2088
|
-
children: [
|
|
2089
|
-
/* @__PURE__ */ jsx14(
|
|
2090
|
-
"button",
|
|
2091
|
-
{
|
|
2092
|
-
onClick: onSaveCreation,
|
|
2093
|
-
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
2094
|
-
title: "Save new row",
|
|
2095
|
-
children: /* @__PURE__ */ jsx14("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
2096
|
-
}
|
|
2097
|
-
),
|
|
2098
|
-
/* @__PURE__ */ jsx14(
|
|
2099
|
-
"button",
|
|
2100
|
-
{
|
|
2101
|
-
onClick: onCancelCreation,
|
|
2102
|
-
className: "h-8 w-8 p-0 hover:bg-muted/50 flex items-center justify-center",
|
|
2103
|
-
title: "Cancel new row",
|
|
2104
|
-
children: /* @__PURE__ */ jsx14("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx14("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
2105
|
-
}
|
|
2106
|
-
)
|
|
2107
|
-
]
|
|
2108
|
-
}
|
|
2109
|
-
)
|
|
2110
|
-
] }),
|
|
2111
|
-
renderTableContent()
|
|
2112
|
-
] })
|
|
1767
|
+
),
|
|
1768
|
+
renderTableContent()
|
|
2113
1769
|
] });
|
|
2114
1770
|
}
|
|
2115
1771
|
|
|
2116
1772
|
// src/components/DataTable/components/PaginationControls.tsx
|
|
2117
1773
|
init_Button();
|
|
2118
1774
|
init_cn();
|
|
2119
|
-
import
|
|
1775
|
+
import React5 from "react";
|
|
2120
1776
|
import {
|
|
2121
1777
|
ChevronLeft,
|
|
2122
1778
|
ChevronRight as ChevronRight2,
|
|
@@ -2126,7 +1782,7 @@ import {
|
|
|
2126
1782
|
Database as Database2,
|
|
2127
1783
|
Zap
|
|
2128
1784
|
} from "lucide-react";
|
|
2129
|
-
import { Fragment as
|
|
1785
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2130
1786
|
function PaginationControls({
|
|
2131
1787
|
table,
|
|
2132
1788
|
pageSizeOptions = [10, 20, 30, 40, 50],
|
|
@@ -2220,11 +1876,11 @@ function PaginationControls({
|
|
|
2220
1876
|
const getModeIcon = () => {
|
|
2221
1877
|
switch (paginationMode) {
|
|
2222
1878
|
case "server":
|
|
2223
|
-
return /* @__PURE__ */
|
|
1879
|
+
return /* @__PURE__ */ jsx12(Server, { className: "h-3 w-3" });
|
|
2224
1880
|
case "hybrid":
|
|
2225
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ jsx12(Database2, { className: "h-3 w-3" });
|
|
2226
1882
|
default:
|
|
2227
|
-
return /* @__PURE__ */
|
|
1883
|
+
return /* @__PURE__ */ jsx12(Zap, { className: "h-3 w-3" });
|
|
2228
1884
|
}
|
|
2229
1885
|
};
|
|
2230
1886
|
const getModeLabel = () => {
|
|
@@ -2237,14 +1893,14 @@ function PaginationControls({
|
|
|
2237
1893
|
return "Client-side";
|
|
2238
1894
|
}
|
|
2239
1895
|
};
|
|
2240
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ jsxs9(
|
|
2241
1897
|
"footer",
|
|
2242
1898
|
{
|
|
2243
1899
|
"aria-label": "pagination",
|
|
2244
1900
|
className: "mx-auto grid grid-cols-[auto_auto_1fr_auto_auto_auto_auto] gap-4",
|
|
2245
1901
|
children: [
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm text-sec-600", children: "Rows per page" }),
|
|
1903
|
+
/* @__PURE__ */ jsxs9(
|
|
2248
1904
|
Select,
|
|
2249
1905
|
{
|
|
2250
1906
|
value: currentPageSize?.toString() || "10",
|
|
@@ -2253,31 +1909,31 @@ function PaginationControls({
|
|
|
2253
1909
|
disabled: isLoading,
|
|
2254
1910
|
className: "w-36 h-8",
|
|
2255
1911
|
children: [
|
|
2256
|
-
/* @__PURE__ */
|
|
1912
|
+
/* @__PURE__ */ jsx12(
|
|
2257
1913
|
SelectTrigger,
|
|
2258
1914
|
{
|
|
2259
1915
|
className: cn(
|
|
2260
1916
|
isLoading && "opacity-50 cursor-not-allowed"
|
|
2261
1917
|
),
|
|
2262
1918
|
"aria-label": "Rows per page",
|
|
2263
|
-
children: /* @__PURE__ */
|
|
1919
|
+
children: /* @__PURE__ */ jsx12(SelectValue, {})
|
|
2264
1920
|
}
|
|
2265
1921
|
),
|
|
2266
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ jsx12(SelectContent, { children: pageSizeOptions.map((pageSize) => /* @__PURE__ */ jsx12(SelectItem, { value: pageSize?.toString() || "10", children: pageSize }, pageSize)) })
|
|
2267
1923
|
]
|
|
2268
1924
|
}
|
|
2269
1925
|
),
|
|
2270
|
-
showPerformanceInfo && /* @__PURE__ */
|
|
1926
|
+
showPerformanceInfo && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2271
1927
|
getModeIcon(),
|
|
2272
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsx12("span", { children: getModeLabel() })
|
|
2273
1929
|
] }),
|
|
2274
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsxs9("p", { className: "justify-self-center text-sm text-sec-600", children: [
|
|
2275
1931
|
"Page ",
|
|
2276
1932
|
currentPageIndex + 1,
|
|
2277
1933
|
" of ",
|
|
2278
1934
|
pageCount || 1
|
|
2279
1935
|
] }),
|
|
2280
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ jsx12(
|
|
2281
1937
|
Button,
|
|
2282
1938
|
{
|
|
2283
1939
|
variant: "outline",
|
|
@@ -2287,10 +1943,10 @@ function PaginationControls({
|
|
|
2287
1943
|
disabled: !canPreviousPage || isLoading,
|
|
2288
1944
|
"aria-label": "Go to first page",
|
|
2289
1945
|
tabIndex: 0,
|
|
2290
|
-
children: /* @__PURE__ */
|
|
1946
|
+
children: /* @__PURE__ */ jsx12(ChevronsLeft, { className: "h-4 w-4" })
|
|
2291
1947
|
}
|
|
2292
1948
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ jsx12(
|
|
2294
1950
|
Button,
|
|
2295
1951
|
{
|
|
2296
1952
|
variant: "outline",
|
|
@@ -2300,10 +1956,10 @@ function PaginationControls({
|
|
|
2300
1956
|
disabled: !canPreviousPage || isLoading,
|
|
2301
1957
|
"aria-label": "Go to previous page",
|
|
2302
1958
|
tabIndex: 0,
|
|
2303
|
-
children: /* @__PURE__ */
|
|
1959
|
+
children: /* @__PURE__ */ jsx12(ChevronLeft, { className: "h-4 w-4" })
|
|
2304
1960
|
}
|
|
2305
1961
|
),
|
|
2306
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx12(
|
|
2307
1963
|
Button,
|
|
2308
1964
|
{
|
|
2309
1965
|
variant: "outline",
|
|
@@ -2313,10 +1969,10 @@ function PaginationControls({
|
|
|
2313
1969
|
disabled: !canNextPage || isLoading,
|
|
2314
1970
|
"aria-label": "Go to next page",
|
|
2315
1971
|
tabIndex: 0,
|
|
2316
|
-
children: /* @__PURE__ */
|
|
1972
|
+
children: /* @__PURE__ */ jsx12(ChevronRight2, { className: "h-4 w-4" })
|
|
2317
1973
|
}
|
|
2318
1974
|
),
|
|
2319
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ jsx12(
|
|
2320
1976
|
Button,
|
|
2321
1977
|
{
|
|
2322
1978
|
variant: "outline",
|
|
@@ -2326,7 +1982,7 @@ function PaginationControls({
|
|
|
2326
1982
|
disabled: !canNextPage || isLoading,
|
|
2327
1983
|
"aria-label": "Go to last page",
|
|
2328
1984
|
tabIndex: 0,
|
|
2329
|
-
children: /* @__PURE__ */
|
|
1985
|
+
children: /* @__PURE__ */ jsx12(ChevronsRight, { className: "h-4 w-4" })
|
|
2330
1986
|
}
|
|
2331
1987
|
)
|
|
2332
1988
|
]
|
|
@@ -2337,7 +1993,7 @@ function EnhancedPaginationControls({
|
|
|
2337
1993
|
showJumpToPage = false,
|
|
2338
1994
|
...props
|
|
2339
1995
|
}) {
|
|
2340
|
-
const [jumpToPage, setJumpToPage] =
|
|
1996
|
+
const [jumpToPage, setJumpToPage] = React5.useState("");
|
|
2341
1997
|
const { table, paginationMode = "client", serverData, onPageChange } = props;
|
|
2342
1998
|
const { pageCount } = (() => {
|
|
2343
1999
|
if (paginationMode === "server" && serverData) {
|
|
@@ -2358,11 +2014,11 @@ function EnhancedPaginationControls({
|
|
|
2358
2014
|
setJumpToPage("");
|
|
2359
2015
|
}
|
|
2360
2016
|
};
|
|
2361
|
-
return /* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
showJumpToPage && /* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
2017
|
+
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2018
|
+
/* @__PURE__ */ jsx12(PaginationControls, { ...props }),
|
|
2019
|
+
showJumpToPage && /* @__PURE__ */ jsx12(Fragment2, { children: /* @__PURE__ */ jsxs9("form", { onSubmit: handleJumpToPage, className: "flex items-center space-x-2", children: [
|
|
2020
|
+
/* @__PURE__ */ jsx12("span", { children: "Jump to page:" }),
|
|
2021
|
+
/* @__PURE__ */ jsx12(
|
|
2366
2022
|
"input",
|
|
2367
2023
|
{
|
|
2368
2024
|
type: "number",
|
|
@@ -2374,31 +2030,31 @@ function EnhancedPaginationControls({
|
|
|
2374
2030
|
placeholder: "1"
|
|
2375
2031
|
}
|
|
2376
2032
|
),
|
|
2377
|
-
/* @__PURE__ */
|
|
2033
|
+
/* @__PURE__ */ jsx12(Button, { type: "submit", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", children: "Go" })
|
|
2378
2034
|
] }) })
|
|
2379
2035
|
] });
|
|
2380
2036
|
}
|
|
2381
2037
|
|
|
2382
2038
|
// src/components/DataTable/components/LoadingState.tsx
|
|
2383
|
-
import { jsx as
|
|
2039
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2384
2040
|
function LoadingState() {
|
|
2385
|
-
return /* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ jsx13("div", { className: "p-8 text-center", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
2042
|
+
/* @__PURE__ */ jsx13("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-primary" }),
|
|
2043
|
+
/* @__PURE__ */ jsx13("span", { "aria-live": "polite", className: "text-muted-foreground", children: "Loading..." })
|
|
2388
2044
|
] }) });
|
|
2389
2045
|
}
|
|
2390
2046
|
|
|
2391
2047
|
// src/components/DataTable/components/ImportModal.tsx
|
|
2392
|
-
import { useState as
|
|
2048
|
+
import { useState as useState3, useRef as useRef3, useEffect as useEffect2 } from "react";
|
|
2393
2049
|
init_Button();
|
|
2394
2050
|
import { Upload as Upload2, FileText, AlertCircle } from "lucide-react";
|
|
2395
|
-
import { jsx as
|
|
2051
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2396
2052
|
function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
2397
|
-
const [file, setFile] =
|
|
2398
|
-
const [isProcessing, setIsProcessing] =
|
|
2399
|
-
const [error, setError] =
|
|
2400
|
-
const [previewData, setPreviewData] =
|
|
2401
|
-
const [totalCount, setTotalCount] =
|
|
2053
|
+
const [file, setFile] = useState3(null);
|
|
2054
|
+
const [isProcessing, setIsProcessing] = useState3(false);
|
|
2055
|
+
const [error, setError] = useState3(null);
|
|
2056
|
+
const [previewData, setPreviewData] = useState3(null);
|
|
2057
|
+
const [totalCount, setTotalCount] = useState3(0);
|
|
2402
2058
|
const fileInputRef = useRef3(null);
|
|
2403
2059
|
const isMountedRef = useRef3(true);
|
|
2404
2060
|
useEffect2(() => {
|
|
@@ -2508,29 +2164,29 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
2508
2164
|
setTotalCount(0);
|
|
2509
2165
|
onClose();
|
|
2510
2166
|
};
|
|
2511
|
-
return /* @__PURE__ */
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2167
|
+
return /* @__PURE__ */ jsx14(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs11(DialogContent, { className: "sm:max-w-2xl bg-main-50", children: [
|
|
2168
|
+
/* @__PURE__ */ jsxs11(DialogHeader, { children: [
|
|
2169
|
+
/* @__PURE__ */ jsx14(DialogTitle, { children: title }),
|
|
2170
|
+
/* @__PURE__ */ jsx14(DialogDescription, { children: description })
|
|
2515
2171
|
] }),
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
file && /* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2172
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
|
|
2173
|
+
/* @__PURE__ */ jsxs11("div", { className: "border-2 border-dashed border-sec-200 rounded-lg p-6 text-center", children: [
|
|
2174
|
+
/* @__PURE__ */ jsx14(FileText, { className: "h-8 w-8 mx-auto text-sec-400 mb-2" }),
|
|
2175
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sec-600 mb-2", children: file ? `Selected: ${file.name}` : uploadText }),
|
|
2176
|
+
file && /* @__PURE__ */ jsx14("p", { className: "text-xs text-sec-500", children: "File selected, processing preview..." }),
|
|
2177
|
+
/* @__PURE__ */ jsxs11(
|
|
2522
2178
|
Button,
|
|
2523
2179
|
{
|
|
2524
2180
|
variant: "outline",
|
|
2525
2181
|
size: "sm",
|
|
2526
2182
|
onClick: () => fileInputRef.current?.click(),
|
|
2527
2183
|
children: [
|
|
2528
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ jsx14(Upload2, { className: "h-4 w-4 mr-2" }),
|
|
2529
2185
|
selectFileButtonText
|
|
2530
2186
|
]
|
|
2531
2187
|
}
|
|
2532
2188
|
),
|
|
2533
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ jsx14(
|
|
2534
2190
|
Input,
|
|
2535
2191
|
{
|
|
2536
2192
|
ref: fileInputRef,
|
|
@@ -2541,21 +2197,21 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
2541
2197
|
}
|
|
2542
2198
|
)
|
|
2543
2199
|
] }),
|
|
2544
|
-
error && /* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2200
|
+
error && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 p-3 bg-acc-50 border border-acc-200 rounded text-acc-700", children: [
|
|
2201
|
+
/* @__PURE__ */ jsx14(AlertCircle, { className: "h-4 w-4" }),
|
|
2202
|
+
/* @__PURE__ */ jsx14("span", { className: "text-sm", children: error })
|
|
2547
2203
|
] }),
|
|
2548
|
-
previewData && previewData.length > 0 && /* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2550
|
-
/* @__PURE__ */
|
|
2551
|
-
/* @__PURE__ */
|
|
2552
|
-
/* @__PURE__ */
|
|
2204
|
+
previewData && previewData.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-3", children: [
|
|
2205
|
+
/* @__PURE__ */ jsx14("h4", { className: "text-sec-900", children: previewHeaderText }),
|
|
2206
|
+
/* @__PURE__ */ jsx14("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ jsx14("div", { className: "overflow-x-auto max-h-48", children: /* @__PURE__ */ jsxs11("table", { className: "min-w-full text-xs", children: [
|
|
2207
|
+
/* @__PURE__ */ jsx14("thead", { className: "bg-sec-50", children: /* @__PURE__ */ jsx14("tr", { children: Object.keys(previewData[0]).map((header) => /* @__PURE__ */ jsx14("th", { className: "px-2 py-1 text-left font-medium text-sec-900 border-b", children: header }, header)) }) }),
|
|
2208
|
+
/* @__PURE__ */ jsx14("tbody", { children: previewData.map((row, index) => /* @__PURE__ */ jsx14("tr", { className: index % 2 === 0 ? "bg-app-main-50" : "bg-sec-50", children: Object.values(row).map((value, cellIndex) => /* @__PURE__ */ jsx14("td", { className: "px-2 py-1 text-sec-700 border-b", children: String(value) }, cellIndex)) }, index)) })
|
|
2553
2209
|
] }) }) }),
|
|
2554
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sec-500", children: totalRowsText.replace("{count}", totalCount.toString()) })
|
|
2555
2211
|
] }),
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-end gap-2", children: [
|
|
2213
|
+
/* @__PURE__ */ jsx14(Button, { variant: "outline", onClick: handleClose, children: cancelButtonText }),
|
|
2214
|
+
/* @__PURE__ */ jsx14(
|
|
2559
2215
|
Button,
|
|
2560
2216
|
{
|
|
2561
2217
|
onClick: handleImport,
|
|
@@ -2569,14 +2225,14 @@ function ImportModal({ isOpen, onClose, onImport, config = {} }) {
|
|
|
2569
2225
|
}
|
|
2570
2226
|
|
|
2571
2227
|
// src/components/DataTable/components/DataTableModals.tsx
|
|
2572
|
-
import { Fragment as
|
|
2228
|
+
import { Fragment as Fragment3, jsx as jsx15 } from "react/jsx-runtime";
|
|
2573
2229
|
function DataTableModals({
|
|
2574
2230
|
showImportModal,
|
|
2575
2231
|
onCloseImportModal,
|
|
2576
2232
|
onImport,
|
|
2577
2233
|
importModalConfig
|
|
2578
2234
|
}) {
|
|
2579
|
-
return /* @__PURE__ */
|
|
2235
|
+
return /* @__PURE__ */ jsx15(Fragment3, { children: /* @__PURE__ */ jsx15(
|
|
2580
2236
|
ImportModal,
|
|
2581
2237
|
{
|
|
2582
2238
|
isOpen: showImportModal,
|
|
@@ -2588,13 +2244,13 @@ function DataTableModals({
|
|
|
2588
2244
|
}
|
|
2589
2245
|
|
|
2590
2246
|
// src/components/DataTable/components/DataTableErrorBoundary.tsx
|
|
2591
|
-
import
|
|
2247
|
+
import React8, { Component } from "react";
|
|
2592
2248
|
|
|
2593
2249
|
// src/components/Alert/Alert.tsx
|
|
2594
2250
|
init_cn();
|
|
2595
|
-
import * as
|
|
2596
|
-
import { jsx as
|
|
2597
|
-
var AlertContext =
|
|
2251
|
+
import * as React7 from "react";
|
|
2252
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2253
|
+
var AlertContext = React7.createContext({ variant: "default" });
|
|
2598
2254
|
var getAlertClasses = (variant = "default") => {
|
|
2599
2255
|
const baseClasses = "relative w-full rounded-lg border p-4";
|
|
2600
2256
|
const variantClasses = {
|
|
@@ -2605,12 +2261,12 @@ var getAlertClasses = (variant = "default") => {
|
|
|
2605
2261
|
};
|
|
2606
2262
|
return `${baseClasses} ${variantClasses[variant]}`;
|
|
2607
2263
|
};
|
|
2608
|
-
var Alert =
|
|
2609
|
-
const contextValue =
|
|
2264
|
+
var Alert = React7.forwardRef(({ className, variant = "default", ...props }, ref) => {
|
|
2265
|
+
const contextValue = React7.useMemo(() => ({ variant }), [variant]);
|
|
2610
2266
|
if (variant === "inline") {
|
|
2611
|
-
return /* @__PURE__ */
|
|
2267
|
+
return /* @__PURE__ */ jsx16(AlertContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx16(React7.Fragment, { ...props }) });
|
|
2612
2268
|
}
|
|
2613
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ jsx16(AlertContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx16(
|
|
2614
2270
|
"div",
|
|
2615
2271
|
{
|
|
2616
2272
|
ref,
|
|
@@ -2621,12 +2277,12 @@ var Alert = React9.forwardRef(({ className, variant = "default", ...props }, ref
|
|
|
2621
2277
|
) });
|
|
2622
2278
|
});
|
|
2623
2279
|
Alert.displayName = "Alert";
|
|
2624
|
-
var AlertTitle =
|
|
2625
|
-
const { variant } =
|
|
2280
|
+
var AlertTitle = React7.forwardRef(({ className, ...props }, ref) => {
|
|
2281
|
+
const { variant } = React7.useContext(AlertContext);
|
|
2626
2282
|
if (variant === "inline") {
|
|
2627
|
-
return /* @__PURE__ */
|
|
2283
|
+
return /* @__PURE__ */ jsx16("strong", { ...props });
|
|
2628
2284
|
}
|
|
2629
|
-
return /* @__PURE__ */
|
|
2285
|
+
return /* @__PURE__ */ jsx16(
|
|
2630
2286
|
"h5",
|
|
2631
2287
|
{
|
|
2632
2288
|
ref,
|
|
@@ -2636,12 +2292,12 @@ var AlertTitle = React9.forwardRef(({ className, ...props }, ref) => {
|
|
|
2636
2292
|
);
|
|
2637
2293
|
});
|
|
2638
2294
|
AlertTitle.displayName = "AlertTitle";
|
|
2639
|
-
var AlertDescription =
|
|
2640
|
-
const { variant } =
|
|
2295
|
+
var AlertDescription = React7.forwardRef(({ className, ...props }, ref) => {
|
|
2296
|
+
const { variant } = React7.useContext(AlertContext);
|
|
2641
2297
|
if (variant === "inline") {
|
|
2642
|
-
return /* @__PURE__ */
|
|
2298
|
+
return /* @__PURE__ */ jsx16("span", { ...props });
|
|
2643
2299
|
}
|
|
2644
|
-
return /* @__PURE__ */
|
|
2300
|
+
return /* @__PURE__ */ jsx16(
|
|
2645
2301
|
"p",
|
|
2646
2302
|
{
|
|
2647
2303
|
ref,
|
|
@@ -2654,7 +2310,7 @@ AlertDescription.displayName = "AlertDescription";
|
|
|
2654
2310
|
|
|
2655
2311
|
// src/components/DataTable/components/DataTableErrorBoundary.tsx
|
|
2656
2312
|
init_Button();
|
|
2657
|
-
import { Fragment as
|
|
2313
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2658
2314
|
var DataTableErrorBoundary = class extends Component {
|
|
2659
2315
|
constructor(props) {
|
|
2660
2316
|
super(props);
|
|
@@ -2725,21 +2381,21 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
2725
2381
|
if (fallback) {
|
|
2726
2382
|
return fallback;
|
|
2727
2383
|
}
|
|
2728
|
-
return /* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
error && error.message ? /* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs12(Alert, { variant: "destructive", className: "max-w-md", children: [
|
|
2385
|
+
/* @__PURE__ */ jsx17(AlertTitle, { children: "DataTable Error" }),
|
|
2386
|
+
/* @__PURE__ */ jsx17(AlertDescription, { className: "mt-2", children: /* @__PURE__ */ jsx17("span", { children: "Something went wrong" }) }),
|
|
2387
|
+
error && error.message ? /* @__PURE__ */ jsxs12("details", { className: "mt-2", children: [
|
|
2388
|
+
/* @__PURE__ */ jsx17("summary", { className: "cursor-pointer text-sm font-medium", children: "Error Details" }),
|
|
2389
|
+
/* @__PURE__ */ jsxs12("pre", { className: "mt-2 text-xs overflow-auto max-h-32", children: [
|
|
2734
2390
|
error.message,
|
|
2735
|
-
showErrorDetails && error.stack && /* @__PURE__ */
|
|
2391
|
+
showErrorDetails && error.stack && /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2736
2392
|
"\n\nStack Trace:\n",
|
|
2737
2393
|
error.stack
|
|
2738
2394
|
] })
|
|
2739
2395
|
] })
|
|
2740
|
-
] }) : /* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
showRetryButton && retryCount < maxRetries && /* @__PURE__ */
|
|
2396
|
+
] }) : /* @__PURE__ */ jsx17("div", { className: "mt-2", children: /* @__PURE__ */ jsx17("span", { children: "An unexpected error occurred" }) }),
|
|
2397
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-4 flex gap-2", children: [
|
|
2398
|
+
showRetryButton && retryCount < maxRetries && /* @__PURE__ */ jsxs12(
|
|
2743
2399
|
Button,
|
|
2744
2400
|
{
|
|
2745
2401
|
variant: "outline",
|
|
@@ -2755,7 +2411,7 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
2755
2411
|
]
|
|
2756
2412
|
}
|
|
2757
2413
|
),
|
|
2758
|
-
/* @__PURE__ */
|
|
2414
|
+
/* @__PURE__ */ jsx17(
|
|
2759
2415
|
Button,
|
|
2760
2416
|
{
|
|
2761
2417
|
variant: "outline",
|
|
@@ -2772,14 +2428,14 @@ var DataTableErrorBoundary = class extends Component {
|
|
|
2772
2428
|
};
|
|
2773
2429
|
|
|
2774
2430
|
// src/components/DataTable/hooks/useColumnOrderPersistence.ts
|
|
2775
|
-
import { useState as
|
|
2431
|
+
import { useState as useState4, useEffect as useEffect3, useCallback as useCallback2 } from "react";
|
|
2776
2432
|
function useColumnOrderPersistence({
|
|
2777
2433
|
tableId,
|
|
2778
2434
|
defaultOrder = [],
|
|
2779
2435
|
enablePersistence = false
|
|
2780
2436
|
}) {
|
|
2781
|
-
const [columnOrder, setColumnOrder] =
|
|
2782
|
-
const [isLoaded, setIsLoaded] =
|
|
2437
|
+
const [columnOrder, setColumnOrder] = useState4(defaultOrder);
|
|
2438
|
+
const [isLoaded, setIsLoaded] = useState4(false);
|
|
2783
2439
|
const storageKey = tableId ? `datatable-column-order-${tableId}` : "datatable-column-order";
|
|
2784
2440
|
useEffect3(() => {
|
|
2785
2441
|
if (!enablePersistence || !tableId) {
|
|
@@ -2845,7 +2501,7 @@ function useColumnOrderPersistence({
|
|
|
2845
2501
|
}
|
|
2846
2502
|
|
|
2847
2503
|
// src/components/DataTable/hooks/useHierarchicalState.ts
|
|
2848
|
-
import { useState as
|
|
2504
|
+
import { useState as useState5, useCallback as useCallback3, useMemo as useMemo4, useEffect as useEffect4 } from "react";
|
|
2849
2505
|
function useHierarchicalState(data, config) {
|
|
2850
2506
|
const getInitialExpandedState = useCallback3(() => {
|
|
2851
2507
|
if (!config?.defaultExpanded) {
|
|
@@ -2859,7 +2515,7 @@ function useHierarchicalState(data, config) {
|
|
|
2859
2515
|
}
|
|
2860
2516
|
return /* @__PURE__ */ new Set();
|
|
2861
2517
|
}, [data, config?.defaultExpanded]);
|
|
2862
|
-
const [expandedRows, setExpandedRows] =
|
|
2518
|
+
const [expandedRows, setExpandedRows] = useState5(getInitialExpandedState);
|
|
2863
2519
|
useEffect4(() => {
|
|
2864
2520
|
setExpandedRows(getInitialExpandedState());
|
|
2865
2521
|
}, [getInitialExpandedState]);
|
|
@@ -3168,70 +2824,6 @@ function compareValues(a, b) {
|
|
|
3168
2824
|
return 0;
|
|
3169
2825
|
}
|
|
3170
2826
|
|
|
3171
|
-
// src/components/DataTable/utils/columnSizing.ts
|
|
3172
|
-
function calculateContentWidth(content, minWidth = 80, maxWidth = 400, padding = 32) {
|
|
3173
|
-
if (!content || typeof content !== "string") {
|
|
3174
|
-
return minWidth;
|
|
3175
|
-
}
|
|
3176
|
-
const estimatedWidth = content.length * 8 + padding;
|
|
3177
|
-
return Math.max(minWidth, Math.min(maxWidth, estimatedWidth));
|
|
3178
|
-
}
|
|
3179
|
-
function calculateColumnWidths(data, columns, options = {}) {
|
|
3180
|
-
const {
|
|
3181
|
-
minWidth = 80,
|
|
3182
|
-
maxWidth = 400,
|
|
3183
|
-
padding = 32,
|
|
3184
|
-
sampleSize = 100
|
|
3185
|
-
} = options;
|
|
3186
|
-
const columnWidths = {};
|
|
3187
|
-
const sampleData = data.slice(0, sampleSize);
|
|
3188
|
-
columns.forEach((column) => {
|
|
3189
|
-
const columnId = column.id || column.accessorKey;
|
|
3190
|
-
if (!columnId) return;
|
|
3191
|
-
let maxContentWidth = minWidth;
|
|
3192
|
-
const headerWidth = calculateContentWidth(
|
|
3193
|
-
column.header || column.accessorKey || "",
|
|
3194
|
-
minWidth,
|
|
3195
|
-
maxWidth,
|
|
3196
|
-
padding
|
|
3197
|
-
);
|
|
3198
|
-
maxContentWidth = Math.max(maxContentWidth, headerWidth);
|
|
3199
|
-
sampleData.forEach((row) => {
|
|
3200
|
-
const cellValue = column.accessorFn ? column.accessorFn(row, 0) : row[column.accessorKey];
|
|
3201
|
-
if (cellValue !== null && cellValue !== void 0) {
|
|
3202
|
-
const content = String(cellValue);
|
|
3203
|
-
const contentWidth = calculateContentWidth(
|
|
3204
|
-
content,
|
|
3205
|
-
minWidth,
|
|
3206
|
-
maxWidth,
|
|
3207
|
-
padding
|
|
3208
|
-
);
|
|
3209
|
-
maxContentWidth = Math.max(maxContentWidth, contentWidth);
|
|
3210
|
-
}
|
|
3211
|
-
});
|
|
3212
|
-
columnWidths[columnId] = Math.min(maxContentWidth, maxWidth);
|
|
3213
|
-
});
|
|
3214
|
-
return columnWidths;
|
|
3215
|
-
}
|
|
3216
|
-
function getColumnSizingConfig(autoSizing, columnWidths) {
|
|
3217
|
-
if (!autoSizing) {
|
|
3218
|
-
return {
|
|
3219
|
-
columnResizeMode: "onChange"
|
|
3220
|
-
};
|
|
3221
|
-
}
|
|
3222
|
-
return {
|
|
3223
|
-
columnResizeMode: "onChange",
|
|
3224
|
-
enableColumnResizing: true,
|
|
3225
|
-
columnResizeDirection: "ltr",
|
|
3226
|
-
// Set initial column sizes if provided
|
|
3227
|
-
...columnWidths && {
|
|
3228
|
-
initialState: {
|
|
3229
|
-
columnSizing: columnWidths
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
};
|
|
3233
|
-
}
|
|
3234
|
-
|
|
3235
2827
|
// src/components/DataTable/core/ColumnFactory.ts
|
|
3236
2828
|
var ColumnFactory = class {
|
|
3237
2829
|
/**
|
|
@@ -3400,7 +2992,7 @@ var ColumnFactory = class {
|
|
|
3400
2992
|
};
|
|
3401
2993
|
|
|
3402
2994
|
// src/components/DataTable/components/DataTableCore.tsx
|
|
3403
|
-
import { Fragment as
|
|
2995
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3404
2996
|
function DataTableInternal({
|
|
3405
2997
|
data,
|
|
3406
2998
|
columns,
|
|
@@ -3435,12 +3027,12 @@ function DataTableInternal({
|
|
|
3435
3027
|
actions = [],
|
|
3436
3028
|
columnOrder: externalColumnOrder
|
|
3437
3029
|
}) {
|
|
3438
|
-
const [sorting, setSorting] =
|
|
3439
|
-
const [columnFilters, setColumnFilters] =
|
|
3440
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3441
|
-
const [internalRowSelection, setInternalRowSelection] =
|
|
3030
|
+
const [sorting, setSorting] = useState6([]);
|
|
3031
|
+
const [columnFilters, setColumnFilters] = useState6([]);
|
|
3032
|
+
const [columnVisibility, setColumnVisibility] = useState6({});
|
|
3033
|
+
const [internalRowSelection, setInternalRowSelection] = useState6({});
|
|
3442
3034
|
const rowSelection = selection !== void 0 ? selection : internalRowSelection;
|
|
3443
|
-
const [columnOrder, setColumnOrder] =
|
|
3035
|
+
const [columnOrder, setColumnOrder] = useState6(() => {
|
|
3444
3036
|
if (externalColumnOrder && externalColumnOrder.length > 0) {
|
|
3445
3037
|
return externalColumnOrder;
|
|
3446
3038
|
}
|
|
@@ -3452,9 +3044,9 @@ function DataTableInternal({
|
|
|
3452
3044
|
}
|
|
3453
3045
|
return columnOrder;
|
|
3454
3046
|
}, [columnOrder, features.selection]);
|
|
3455
|
-
const [grouping, setGrouping] =
|
|
3456
|
-
const [expanded, setExpanded] =
|
|
3457
|
-
const [pagination, setPagination] =
|
|
3047
|
+
const [grouping, setGrouping] = useState6([]);
|
|
3048
|
+
const [expanded, setExpanded] = useState6({});
|
|
3049
|
+
const [pagination, setPagination] = useState6({
|
|
3458
3050
|
pageIndex: 0,
|
|
3459
3051
|
pageSize: initialPageSize
|
|
3460
3052
|
});
|
|
@@ -3468,8 +3060,8 @@ function DataTableInternal({
|
|
|
3468
3060
|
const creationData = tableState.creationData;
|
|
3469
3061
|
const editingRowId = tableState.editingRowId;
|
|
3470
3062
|
const editingData = tableState.editingData;
|
|
3471
|
-
const [showImportModal, setShowImportModal] =
|
|
3472
|
-
const [showFilterRow, setShowFilterRow] =
|
|
3063
|
+
const [showImportModal, setShowImportModal] = useState6(false);
|
|
3064
|
+
const [showFilterRow, setShowFilterRow] = useState6(false);
|
|
3473
3065
|
const performanceHook = useDataTablePerformance({
|
|
3474
3066
|
data,
|
|
3475
3067
|
performance,
|
|
@@ -3621,7 +3213,7 @@ function DataTableInternal({
|
|
|
3621
3213
|
header: ({ table: table2 }) => {
|
|
3622
3214
|
const isAllSelected = table2.getIsAllPageRowsSelected();
|
|
3623
3215
|
const isSomeSelected = table2.getIsSomePageRowsSelected();
|
|
3624
|
-
return /* @__PURE__ */
|
|
3216
|
+
return /* @__PURE__ */ jsx18(
|
|
3625
3217
|
Checkbox,
|
|
3626
3218
|
{
|
|
3627
3219
|
checked: isAllSelected ? true : isSomeSelected ? "indeterminate" : false,
|
|
@@ -3630,7 +3222,7 @@ function DataTableInternal({
|
|
|
3630
3222
|
}
|
|
3631
3223
|
);
|
|
3632
3224
|
},
|
|
3633
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3225
|
+
cell: ({ row }) => /* @__PURE__ */ jsx18(
|
|
3634
3226
|
Checkbox,
|
|
3635
3227
|
{
|
|
3636
3228
|
checked: row.getIsSelected(),
|
|
@@ -3689,17 +3281,6 @@ function DataTableInternal({
|
|
|
3689
3281
|
}
|
|
3690
3282
|
return finalColumns;
|
|
3691
3283
|
}, [columns, features, effectiveActions, columnOrder]);
|
|
3692
|
-
const columnWidths = useMemo6(() => {
|
|
3693
|
-
if (features.autoColumnSizing) {
|
|
3694
|
-
return calculateColumnWidths(data, enhancedColumns, {
|
|
3695
|
-
minWidth: 80,
|
|
3696
|
-
maxWidth: 400,
|
|
3697
|
-
padding: 32,
|
|
3698
|
-
sampleSize: Math.min(100, data.length)
|
|
3699
|
-
});
|
|
3700
|
-
}
|
|
3701
|
-
return void 0;
|
|
3702
|
-
}, [data, enhancedColumns, features.autoColumnSizing]);
|
|
3703
3284
|
const tableConfig = useMemo6(() => ({
|
|
3704
3285
|
data: finalTableData,
|
|
3705
3286
|
columns: enhancedColumns,
|
|
@@ -3741,8 +3322,7 @@ function DataTableInternal({
|
|
|
3741
3322
|
manualSorting: finalPaginationMode === "server",
|
|
3742
3323
|
manualFiltering: finalPaginationMode === "server",
|
|
3743
3324
|
manualPagination: finalPaginationMode === "server",
|
|
3744
|
-
pageCount: finalPaginationMode === "server" ? Math.ceil(dataCount / pagination.pageSize) : void 0
|
|
3745
|
-
...getColumnSizingConfig(features.autoColumnSizing || false, columnWidths)
|
|
3325
|
+
pageCount: finalPaginationMode === "server" ? Math.ceil(dataCount / pagination.pageSize) : void 0
|
|
3746
3326
|
}), [
|
|
3747
3327
|
finalTableData,
|
|
3748
3328
|
enhancedColumns,
|
|
@@ -3761,8 +3341,6 @@ function DataTableInternal({
|
|
|
3761
3341
|
onRowSelectionChange,
|
|
3762
3342
|
finalPaginationMode,
|
|
3763
3343
|
features.pagination,
|
|
3764
|
-
features.autoColumnSizing,
|
|
3765
|
-
columnWidths,
|
|
3766
3344
|
dataCount,
|
|
3767
3345
|
pagination.pageSize
|
|
3768
3346
|
]);
|
|
@@ -3807,132 +3385,171 @@ function DataTableInternal({
|
|
|
3807
3385
|
};
|
|
3808
3386
|
}, [cleanup]);
|
|
3809
3387
|
if (isLoading) {
|
|
3810
|
-
return /* @__PURE__ */
|
|
3388
|
+
return /* @__PURE__ */ jsx18(LoadingComponent, {});
|
|
3811
3389
|
}
|
|
3812
3390
|
const PaginationComponent = enhancedPagination || finalPaginationMode !== "client" ? EnhancedPaginationControls : PaginationControls;
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
DataTableToolbar,
|
|
3823
|
-
{
|
|
3824
|
-
features,
|
|
3825
|
-
globalFilter: searchQuery,
|
|
3826
|
-
onGlobalFilterChange: handleSearch,
|
|
3827
|
-
columns,
|
|
3828
|
-
grouping,
|
|
3829
|
-
onGroupByChange: (columnId) => {
|
|
3830
|
-
setGrouping(columnId ? [columnId] : []);
|
|
3831
|
-
},
|
|
3832
|
-
tableColumns: table?.getAllColumns() || [],
|
|
3833
|
-
onColumnVisibilityChange: (columnId, visible) => {
|
|
3834
|
-
setColumnVisibility((prev) => ({ ...prev, [columnId]: visible }));
|
|
3835
|
-
},
|
|
3836
|
-
onCreateRow: features.creation && onCreateRow ? () => tableActions.setCreating(true) : void 0,
|
|
3837
|
-
onImportClick: () => setShowImportModal(true),
|
|
3838
|
-
onExport: () => {
|
|
3839
|
-
},
|
|
3840
|
-
rowSelection,
|
|
3841
|
-
onDeleteSelected,
|
|
3842
|
-
onToggleFilterRow: () => setShowFilterRow(!showFilterRow),
|
|
3843
|
-
showFilterRow
|
|
3844
|
-
}
|
|
3845
|
-
),
|
|
3846
|
-
/* @__PURE__ */ jsx21("table", { className: getTableClasses({
|
|
3847
|
-
isFixed: !features.autoColumnSizing,
|
|
3391
|
+
const visibleColumns = table?.getVisibleFlatColumns() || [];
|
|
3392
|
+
const dataColumns = visibleColumns.filter(
|
|
3393
|
+
(col) => col.id !== "select" && col.id !== "actions"
|
|
3394
|
+
).length;
|
|
3395
|
+
const hasSelectColumn = visibleColumns.some((col) => col.id === "select");
|
|
3396
|
+
const hasActionsColumn = visibleColumns.some((col) => col.id === "actions");
|
|
3397
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
3398
|
+
/* @__PURE__ */ jsxs13("table", { className: getTableClasses({
|
|
3399
|
+
isFixed: true,
|
|
3848
3400
|
variant,
|
|
3849
3401
|
className: cn("border-collapse relative w-full", className)
|
|
3850
3402
|
}), style: {
|
|
3851
|
-
tableLayout:
|
|
3403
|
+
tableLayout: "fixed",
|
|
3852
3404
|
width: "100%"
|
|
3853
|
-
}, children:
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3405
|
+
}, children: [
|
|
3406
|
+
/* @__PURE__ */ jsxs13("caption", { className: "text-left pb-2", children: [
|
|
3407
|
+
(title || description) && /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
3408
|
+
title && /* @__PURE__ */ jsx18("h2", { children: title }),
|
|
3409
|
+
description && /* @__PURE__ */ jsx18("p", { children: description })
|
|
3410
|
+
] }),
|
|
3411
|
+
/* @__PURE__ */ jsx18(Fragment6, { children: /* @__PURE__ */ jsx18(
|
|
3412
|
+
DataTableToolbar,
|
|
3413
|
+
{
|
|
3414
|
+
features,
|
|
3415
|
+
globalFilter: searchQuery,
|
|
3416
|
+
onGlobalFilterChange: handleSearch,
|
|
3417
|
+
columns,
|
|
3418
|
+
grouping,
|
|
3419
|
+
onGroupByChange: (columnId) => {
|
|
3420
|
+
setGrouping(columnId ? [columnId] : []);
|
|
3421
|
+
},
|
|
3422
|
+
tableColumns: table?.getAllColumns() || [],
|
|
3423
|
+
onColumnVisibilityChange: (columnId, visible) => {
|
|
3424
|
+
setColumnVisibility((prev) => ({ ...prev, [columnId]: visible }));
|
|
3425
|
+
},
|
|
3426
|
+
onCreateRow: features.creation && onCreateRow ? () => tableActions.setCreating(true) : void 0,
|
|
3427
|
+
onImportClick: () => setShowImportModal(true),
|
|
3428
|
+
onExport: () => {
|
|
3429
|
+
},
|
|
3430
|
+
rowSelection,
|
|
3431
|
+
onDeleteSelected,
|
|
3432
|
+
onToggleFilterRow: () => setShowFilterRow(!showFilterRow),
|
|
3433
|
+
showFilterRow
|
|
3434
|
+
}
|
|
3435
|
+
) })
|
|
3436
|
+
] }),
|
|
3437
|
+
/* @__PURE__ */ jsxs13("colgroup", { children: [
|
|
3438
|
+
hasSelectColumn && /* @__PURE__ */ jsx18("col", { span: 1, "data-col-type": "select" }),
|
|
3439
|
+
/* @__PURE__ */ jsx18("col", { span: dataColumns, "data-col-type": "data" }),
|
|
3440
|
+
hasActionsColumn && /* @__PURE__ */ jsx18("col", { span: 1, "data-col-type": "actions" })
|
|
3441
|
+
] }),
|
|
3442
|
+
/* @__PURE__ */ jsx18("thead", { children: table?.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx18("tr", { children: headerGroup.headers.filter((header) => {
|
|
3443
|
+
return typeof header.column.getIsVisible === "function" ? header.column.getIsVisible() : true;
|
|
3444
|
+
}).map((header) => {
|
|
3445
|
+
const isSortable = header.column.getCanSort();
|
|
3446
|
+
const ariaSort = isSortable ? header.column.getIsSorted() === "asc" ? "ascending" : header.column.getIsSorted() === "desc" ? "descending" : "none" : void 0;
|
|
3447
|
+
return /* @__PURE__ */ jsx18(
|
|
3448
|
+
"th",
|
|
3449
|
+
{
|
|
3450
|
+
...isSortable ? { "aria-sort": ariaSort } : {},
|
|
3451
|
+
children: header.isPlaceholder ? null : isSortable ? /* @__PURE__ */ jsx18(
|
|
3452
|
+
Button,
|
|
3453
|
+
{
|
|
3454
|
+
variant: "ghost",
|
|
3455
|
+
className: "h-auto p-0 font-medium hover:bg-transparent",
|
|
3456
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
3457
|
+
"aria-label": `Sort by ${typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "column"}`,
|
|
3458
|
+
tabIndex: 0,
|
|
3459
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
3460
|
+
typeof header.column.columnDef.header === "function" ? header.column.columnDef.header(header.getContext()) : header.column.columnDef.header,
|
|
3461
|
+
header.column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx18(ChevronUp2, { className: "h-4 w-4" }) : header.column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx18(ChevronDown3, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx18(ChevronsUpDown, { className: "h-4 w-4" })
|
|
3462
|
+
] })
|
|
3463
|
+
}
|
|
3464
|
+
) : /* @__PURE__ */ jsx18("div", { children: typeof header.column.columnDef.header === "function" ? header.column.columnDef.header(header.getContext()) : header.column.columnDef.header })
|
|
3465
|
+
},
|
|
3466
|
+
header.id
|
|
3467
|
+
);
|
|
3468
|
+
}) }, headerGroup.id)) }),
|
|
3469
|
+
/* @__PURE__ */ jsx18(
|
|
3470
|
+
UnifiedTableBody,
|
|
3471
|
+
{
|
|
3472
|
+
table,
|
|
3473
|
+
isCreating,
|
|
3474
|
+
creationData,
|
|
3475
|
+
onCreationDataChange: tableActions.setCreationData,
|
|
3476
|
+
onSaveCreation: () => {
|
|
3477
|
+
if (onCreateRow) {
|
|
3478
|
+
onCreateRow(creationData);
|
|
3479
|
+
tableActions.clearCreationData();
|
|
3480
|
+
tableActions.setCreating(false);
|
|
3481
|
+
}
|
|
3482
|
+
},
|
|
3483
|
+
onCancelCreation: () => {
|
|
3863
3484
|
tableActions.clearCreationData();
|
|
3864
3485
|
tableActions.setCreating(false);
|
|
3865
|
-
}
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
editingRowId,
|
|
3872
|
-
editingData,
|
|
3873
|
-
onEditingDataChange: (data2) => {
|
|
3874
|
-
if (editingRowId) {
|
|
3875
|
-
tableActions.setEditingRow(editingRowId, data2);
|
|
3876
|
-
}
|
|
3877
|
-
},
|
|
3878
|
-
onSaveEditing: () => {
|
|
3879
|
-
if (onEditRow && editingRowId) {
|
|
3880
|
-
const originalRow = data.find((row) => {
|
|
3881
|
-
const rowId = getRowId ? getRowId(row, 0) : row.id || String(0);
|
|
3882
|
-
return rowId === editingRowId;
|
|
3883
|
-
});
|
|
3884
|
-
if (originalRow) {
|
|
3885
|
-
onEditRow(originalRow, editingData);
|
|
3486
|
+
},
|
|
3487
|
+
editingRowId,
|
|
3488
|
+
editingData,
|
|
3489
|
+
onEditingDataChange: (data2) => {
|
|
3490
|
+
if (editingRowId) {
|
|
3491
|
+
tableActions.setEditingRow(editingRowId, data2);
|
|
3886
3492
|
}
|
|
3887
|
-
}
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3493
|
+
},
|
|
3494
|
+
onSaveEditing: () => {
|
|
3495
|
+
if (onEditRow && editingRowId) {
|
|
3496
|
+
const originalRow = data.find((row) => {
|
|
3497
|
+
const rowId = getRowId ? getRowId(row, 0) : row.id || String(0);
|
|
3498
|
+
return rowId === editingRowId;
|
|
3499
|
+
});
|
|
3500
|
+
if (originalRow) {
|
|
3501
|
+
onEditRow(originalRow, editingData);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
tableActions.clearEditing();
|
|
3505
|
+
},
|
|
3506
|
+
onCancelEditing: () => {
|
|
3507
|
+
tableActions.clearEditing();
|
|
3508
|
+
},
|
|
3509
|
+
grouping,
|
|
3510
|
+
aggregates,
|
|
3511
|
+
getRowId,
|
|
3512
|
+
emptyState: React9.isValidElement(emptyState) ? void 0 : emptyState,
|
|
3513
|
+
isFiltered: searchQuery !== "" || columnFilters.length > 0,
|
|
3514
|
+
onClearFilters: () => {
|
|
3515
|
+
setSearchQuery("");
|
|
3516
|
+
setColumnFilters([]);
|
|
3517
|
+
},
|
|
3518
|
+
enableFiltering: features.filtering,
|
|
3519
|
+
showFilterRow,
|
|
3520
|
+
enableColumnReordering: features.columnReordering,
|
|
3521
|
+
onColumnOrderChange: setColumnOrder,
|
|
3522
|
+
onColumnDrop: (draggedColumnId, targetColumnId) => {
|
|
3523
|
+
},
|
|
3524
|
+
savedColumnOrder,
|
|
3525
|
+
enablePersistence: features.columnReordering,
|
|
3526
|
+
tableId: title ? `datatable-${title.toLowerCase().replace(/\s+/g, "-")}` : void 0,
|
|
3527
|
+
dataLength: finalTableData?.length || 0,
|
|
3528
|
+
virtualHeight,
|
|
3529
|
+
forceVirtualization: false,
|
|
3530
|
+
hierarchical: features.hierarchical && hierarchical?.enabled ? {
|
|
3531
|
+
...hierarchical,
|
|
3532
|
+
state: hierarchicalState,
|
|
3533
|
+
expandAll: hierarchicalState.expandAll,
|
|
3534
|
+
collapseAll: hierarchicalState.collapseAll,
|
|
3535
|
+
isAllExpanded: hierarchicalState.getExpandedIds().length > 0 && hierarchicalState.getExpandedIds().length === finalTableData.filter((row) => row.isParent).length,
|
|
3536
|
+
hasAnyChildren: finalTableData.some((row) => row.isParent)
|
|
3537
|
+
} : void 0,
|
|
3538
|
+
actions: effectiveActions
|
|
3539
|
+
}
|
|
3540
|
+
),
|
|
3541
|
+
features.pagination && /* @__PURE__ */ jsx18("tfoot", { children: /* @__PURE__ */ jsx18("tr", { children: /* @__PURE__ */ jsx18("td", { colSpan: visibleColumns.length, children: /* @__PURE__ */ jsx18(
|
|
3542
|
+
PaginationComponent,
|
|
3543
|
+
{
|
|
3544
|
+
table,
|
|
3545
|
+
pageSizeOptions: finalPageSizeOptions,
|
|
3546
|
+
paginationMode: finalPaginationMode,
|
|
3547
|
+
totalCount: finalDataCount,
|
|
3548
|
+
isLoading
|
|
3549
|
+
}
|
|
3550
|
+
) }) }) })
|
|
3551
|
+
] }),
|
|
3552
|
+
/* @__PURE__ */ jsx18(
|
|
3936
3553
|
DataTableModals,
|
|
3937
3554
|
{
|
|
3938
3555
|
showImportModal,
|
|
@@ -3952,11 +3569,11 @@ function DataTableInternal({
|
|
|
3952
3569
|
] });
|
|
3953
3570
|
}
|
|
3954
3571
|
function DataTableCore(props) {
|
|
3955
|
-
return /* @__PURE__ */
|
|
3572
|
+
return /* @__PURE__ */ jsx18(DataTableErrorBoundary, { children: /* @__PURE__ */ jsx18(DataTableInternal, { ...props }) });
|
|
3956
3573
|
}
|
|
3957
3574
|
|
|
3958
3575
|
// src/components/DataTable/DataTable.tsx
|
|
3959
|
-
import { jsx as
|
|
3576
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3960
3577
|
function DataTable(props) {
|
|
3961
3578
|
if (!props.features) {
|
|
3962
3579
|
throw new Error("DataTable: features configuration is required");
|
|
@@ -3964,9 +3581,9 @@ function DataTable(props) {
|
|
|
3964
3581
|
if (props.features.deleteSelected && !props.features.deletion) {
|
|
3965
3582
|
console.warn("DataTable: deleteSelected requires deletion to be enabled");
|
|
3966
3583
|
}
|
|
3967
|
-
return /* @__PURE__ */
|
|
3584
|
+
return /* @__PURE__ */ jsx19(DataTableCore, { ...props });
|
|
3968
3585
|
}
|
|
3969
|
-
var DataTableComponent =
|
|
3586
|
+
var DataTableComponent = React10.memo(DataTable);
|
|
3970
3587
|
|
|
3971
3588
|
// src/components/DataTable/core/DataManager.ts
|
|
3972
3589
|
var DataManager = class {
|
|
@@ -5139,7 +4756,7 @@ var LocalDataAdapter = class {
|
|
|
5139
4756
|
|
|
5140
4757
|
// src/components/DataTable/core/DataTableContext.tsx
|
|
5141
4758
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo7, useEffect as useEffect6 } from "react";
|
|
5142
|
-
import { jsx as
|
|
4759
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
5143
4760
|
var DataTableContext = createContext3(null);
|
|
5144
4761
|
function DataTableProvider({
|
|
5145
4762
|
children,
|
|
@@ -5223,7 +4840,7 @@ function DataTableProvider({
|
|
|
5223
4840
|
stateManager.updateActions(actions);
|
|
5224
4841
|
}
|
|
5225
4842
|
}, [actions, actionManager, stateManager]);
|
|
5226
|
-
return /* @__PURE__ */
|
|
4843
|
+
return /* @__PURE__ */ jsx20(DataTableContext.Provider, { value: contextValue, children });
|
|
5227
4844
|
}
|
|
5228
4845
|
function useDataTableContext() {
|
|
5229
4846
|
const context = useContext3(DataTableContext);
|
|
@@ -5260,7 +4877,7 @@ import {
|
|
|
5260
4877
|
Download as Download2,
|
|
5261
4878
|
Trash as Trash3
|
|
5262
4879
|
} from "lucide-react";
|
|
5263
|
-
import { jsx as
|
|
4880
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5264
4881
|
function BulkOperationsDropdown({
|
|
5265
4882
|
operations,
|
|
5266
4883
|
selectedRows = {},
|
|
@@ -5288,8 +4905,8 @@ function BulkOperationsDropdown({
|
|
|
5288
4905
|
onOperation(operation, selectedData);
|
|
5289
4906
|
}
|
|
5290
4907
|
};
|
|
5291
|
-
return /* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
4908
|
+
return /* @__PURE__ */ jsxs14(Select, { disabled: !hasSelection, children: [
|
|
4909
|
+
/* @__PURE__ */ jsx21(SelectTrigger, { asChild: true, children: /* @__PURE__ */ jsxs14(
|
|
5293
4910
|
Button,
|
|
5294
4911
|
{
|
|
5295
4912
|
variant: "outline",
|
|
@@ -5297,8 +4914,8 @@ function BulkOperationsDropdown({
|
|
|
5297
4914
|
disabled: !hasSelection,
|
|
5298
4915
|
className: `min-w-[140px] h-9 px-3 py-2 text-sm font-medium ${className || ""}`,
|
|
5299
4916
|
children: [
|
|
5300
|
-
/* @__PURE__ */
|
|
5301
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsx21(MoreHorizontal2, { className: "h-4 w-4 mr-2 flex-shrink-0" }),
|
|
4918
|
+
/* @__PURE__ */ jsxs14("span", { className: "truncate", children: [
|
|
5302
4919
|
"Bulk Actions (",
|
|
5303
4920
|
selectedCount,
|
|
5304
4921
|
")"
|
|
@@ -5306,11 +4923,11 @@ function BulkOperationsDropdown({
|
|
|
5306
4923
|
]
|
|
5307
4924
|
}
|
|
5308
4925
|
) }),
|
|
5309
|
-
/* @__PURE__ */
|
|
4926
|
+
/* @__PURE__ */ jsx21(SelectContent, { className: "w-48 !bg-main-50 border border-sec-200 shadow-lg z-[9999]", style: { backgroundColor: "white" }, children: operations.map((operation) => {
|
|
5310
4927
|
const Icon = operationIcons[operation];
|
|
5311
4928
|
const label = operationLabels[operation];
|
|
5312
4929
|
const variant = operationVariants[operation];
|
|
5313
|
-
return /* @__PURE__ */
|
|
4930
|
+
return /* @__PURE__ */ jsxs14(
|
|
5314
4931
|
SelectItem,
|
|
5315
4932
|
{
|
|
5316
4933
|
value: operation,
|
|
@@ -5318,8 +4935,8 @@ function BulkOperationsDropdown({
|
|
|
5318
4935
|
disabled: !hasSelection,
|
|
5319
4936
|
className: `flex items-center gap-2 ${variant === "destructive" ? "text-destructive focus:text-destructive" : ""}`,
|
|
5320
4937
|
children: [
|
|
5321
|
-
/* @__PURE__ */
|
|
5322
|
-
/* @__PURE__ */
|
|
4938
|
+
/* @__PURE__ */ jsx21(Icon, { className: "h-4 w-4" }),
|
|
4939
|
+
/* @__PURE__ */ jsx21("span", { children: label })
|
|
5323
4940
|
]
|
|
5324
4941
|
},
|
|
5325
4942
|
operation
|
|
@@ -5331,7 +4948,7 @@ function BulkOperationsDropdown({
|
|
|
5331
4948
|
// src/components/DataTable/components/GroupHeader.tsx
|
|
5332
4949
|
init_Button();
|
|
5333
4950
|
import { ChevronDown as ChevronDown4, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
5334
|
-
import { jsx as
|
|
4951
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5335
4952
|
function GroupHeader({
|
|
5336
4953
|
row,
|
|
5337
4954
|
groupByColumn,
|
|
@@ -5340,18 +4957,18 @@ function GroupHeader({
|
|
|
5340
4957
|
subRowsCount
|
|
5341
4958
|
}) {
|
|
5342
4959
|
const groupValue = row.getValue(groupByColumn);
|
|
5343
|
-
return /* @__PURE__ */
|
|
5344
|
-
/* @__PURE__ */
|
|
4960
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex items-center py-2 px-4 bg-muted/50 border-b font-medium", children: [
|
|
4961
|
+
/* @__PURE__ */ jsx22(
|
|
5345
4962
|
Button,
|
|
5346
4963
|
{
|
|
5347
4964
|
variant: "ghost",
|
|
5348
4965
|
size: "sm",
|
|
5349
4966
|
onClick: onToggle,
|
|
5350
4967
|
className: "p-0 h-auto mr-2",
|
|
5351
|
-
children: isExpanded ? /* @__PURE__ */
|
|
4968
|
+
children: isExpanded ? /* @__PURE__ */ jsx22(ChevronDown4, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx22(ChevronRight3, { className: "h-4 w-4" })
|
|
5352
4969
|
}
|
|
5353
4970
|
),
|
|
5354
|
-
/* @__PURE__ */
|
|
4971
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-sm", children: [
|
|
5355
4972
|
String(groupValue),
|
|
5356
4973
|
" (",
|
|
5357
4974
|
subRowsCount,
|
|
@@ -5362,13 +4979,13 @@ function GroupHeader({
|
|
|
5362
4979
|
|
|
5363
4980
|
// src/components/DataTable/components/EditableRow.tsx
|
|
5364
4981
|
init_Button();
|
|
5365
|
-
import { jsx as
|
|
4982
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5366
4983
|
var renderEditField2 = (column, value, onChange, editingData = {}, placeholder) => {
|
|
5367
4984
|
const columnDef = column.columnDef;
|
|
5368
4985
|
if (columnDef.fieldType === "select" && columnDef.fieldOptions) {
|
|
5369
4986
|
const editKey = columnDef.editAccessorKey || column.id;
|
|
5370
4987
|
const editValue = editingData[editKey] || value;
|
|
5371
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsxs16(
|
|
5372
4989
|
Select,
|
|
5373
4990
|
{
|
|
5374
4991
|
value: String(editValue || ""),
|
|
@@ -5380,14 +4997,14 @@ var renderEditField2 = (column, value, onChange, editingData = {}, placeholder)
|
|
|
5380
4997
|
}
|
|
5381
4998
|
},
|
|
5382
4999
|
children: [
|
|
5383
|
-
/* @__PURE__ */
|
|
5384
|
-
/* @__PURE__ */
|
|
5000
|
+
/* @__PURE__ */ jsx23(SelectTrigger, { className: "w-full h-7", children: /* @__PURE__ */ jsx23(SelectValue, { placeholder: placeholder || `Select ${column.id}` }) }),
|
|
5001
|
+
/* @__PURE__ */ jsx23(SelectContent, { children: columnDef.fieldOptions.map((option) => /* @__PURE__ */ jsx23(SelectItem, { value: String(option.value), children: option.label }, option.value)) })
|
|
5385
5002
|
]
|
|
5386
5003
|
}
|
|
5387
5004
|
);
|
|
5388
5005
|
}
|
|
5389
5006
|
if (columnDef.fieldType === "date") {
|
|
5390
|
-
return /* @__PURE__ */
|
|
5007
|
+
return /* @__PURE__ */ jsx23(
|
|
5391
5008
|
Input,
|
|
5392
5009
|
{
|
|
5393
5010
|
type: "date",
|
|
@@ -5397,7 +5014,7 @@ var renderEditField2 = (column, value, onChange, editingData = {}, placeholder)
|
|
|
5397
5014
|
}
|
|
5398
5015
|
);
|
|
5399
5016
|
}
|
|
5400
|
-
return /* @__PURE__ */
|
|
5017
|
+
return /* @__PURE__ */ jsx23(
|
|
5401
5018
|
Input,
|
|
5402
5019
|
{
|
|
5403
5020
|
type: "text",
|
|
@@ -5429,15 +5046,15 @@ function EditableRow({
|
|
|
5429
5046
|
testId: action.testId || `action-${action.label.toLowerCase().replace(/\s+/g, "-")}-${rowId}`,
|
|
5430
5047
|
visible: true
|
|
5431
5048
|
}));
|
|
5432
|
-
return /* @__PURE__ */
|
|
5433
|
-
row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
5049
|
+
return /* @__PURE__ */ jsxs16("tr", { children: [
|
|
5050
|
+
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx23("td", { children: cell.column.id !== "actions" ? renderEditField2(cell.column, editingData[cell.column.id], (value) => {
|
|
5434
5051
|
if (typeof value === "object" && value !== null) {
|
|
5435
5052
|
onEditingDataChange({ ...editingData, ...value });
|
|
5436
5053
|
} else {
|
|
5437
5054
|
onEditingDataChange({ ...editingData, [cell.column.id]: value });
|
|
5438
5055
|
}
|
|
5439
|
-
}, editingData) : /* @__PURE__ */
|
|
5440
|
-
/* @__PURE__ */
|
|
5056
|
+
}, editingData) : /* @__PURE__ */ jsxs16("div", { className: "flex gap-1", children: [
|
|
5057
|
+
/* @__PURE__ */ jsx23(
|
|
5441
5058
|
Button,
|
|
5442
5059
|
{
|
|
5443
5060
|
onClick: onSave,
|
|
@@ -5446,7 +5063,7 @@ function EditableRow({
|
|
|
5446
5063
|
children: "Save"
|
|
5447
5064
|
}
|
|
5448
5065
|
),
|
|
5449
|
-
/* @__PURE__ */
|
|
5066
|
+
/* @__PURE__ */ jsx23(
|
|
5450
5067
|
Button,
|
|
5451
5068
|
{
|
|
5452
5069
|
onClick: onCancel,
|
|
@@ -5456,7 +5073,7 @@ function EditableRow({
|
|
|
5456
5073
|
}
|
|
5457
5074
|
)
|
|
5458
5075
|
] }) }, cell.id)),
|
|
5459
|
-
actions.length > 0 && /* @__PURE__ */
|
|
5076
|
+
actions.length > 0 && /* @__PURE__ */ jsx23("td", { children: /* @__PURE__ */ jsx23(
|
|
5460
5077
|
ActionButtons,
|
|
5461
5078
|
{
|
|
5462
5079
|
row: row.original,
|
|
@@ -5485,18 +5102,9 @@ export {
|
|
|
5485
5102
|
SelectGroup,
|
|
5486
5103
|
SelectLabel,
|
|
5487
5104
|
SelectSeparator,
|
|
5488
|
-
DataTableHeader,
|
|
5489
5105
|
GroupingDropdown,
|
|
5490
5106
|
ColumnVisibilityDropdown,
|
|
5491
5107
|
DataTableToolbar,
|
|
5492
|
-
Table,
|
|
5493
|
-
TableHeader,
|
|
5494
|
-
TableBody,
|
|
5495
|
-
TableFooter,
|
|
5496
|
-
TableRow,
|
|
5497
|
-
TableHead,
|
|
5498
|
-
TableCell,
|
|
5499
|
-
TableCaption,
|
|
5500
5108
|
EmptyState,
|
|
5501
5109
|
ActionButtons,
|
|
5502
5110
|
UnifiedTableBody,
|
|
@@ -5506,8 +5114,6 @@ export {
|
|
|
5506
5114
|
ImportModal,
|
|
5507
5115
|
DataTableModals,
|
|
5508
5116
|
DataTableErrorBoundary,
|
|
5509
|
-
calculateColumnWidths,
|
|
5510
|
-
getColumnSizingConfig,
|
|
5511
5117
|
ColumnFactory,
|
|
5512
5118
|
DataTableCore,
|
|
5513
5119
|
DataTable,
|
|
@@ -5530,4 +5136,4 @@ export {
|
|
|
5530
5136
|
GroupHeader,
|
|
5531
5137
|
EditableRow
|
|
5532
5138
|
};
|
|
5533
|
-
//# sourceMappingURL=chunk-
|
|
5139
|
+
//# sourceMappingURL=chunk-EWKPTNPO.js.map
|