@dbcdk/react-components 0.0.4 → 0.0.5
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/assets/logo.cjs +10 -10
- package/dist/assets/logo.js +10 -10
- package/dist/components/__stories__/story-components/Colors.cjs +159 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +10 -0
- package/dist/components/__stories__/story-components/Colors.js +151 -0
- package/dist/components/__stories__/story-components/Colors.module.css +27 -0
- package/dist/components/__stories__/story-components/Spacing.cjs +190 -0
- package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
- package/dist/components/__stories__/story-components/Spacing.js +184 -0
- package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
- package/dist/components/app-header/AppHeader.module.css +10 -15
- package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
- package/dist/components/attribute-chip/AttributeChip.d.ts +8 -0
- package/dist/components/attribute-chip/AttributeChip.js +16 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.cjs +38 -4
- package/dist/components/avatar/Avatar.d.ts +4 -2
- package/dist/components/avatar/Avatar.js +39 -5
- package/dist/components/avatar/Avatar.module.css +27 -0
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
- package/dist/components/button/Button.cjs +20 -12
- package/dist/components/button/Button.d.ts +4 -1
- package/dist/components/button/Button.js +20 -12
- package/dist/components/button/Button.module.css +118 -55
- package/dist/components/card/Card.cjs +53 -13
- package/dist/components/card/Card.d.ts +21 -6
- package/dist/components/card/Card.js +54 -14
- package/dist/components/card/Card.module.css +148 -44
- package/dist/components/card-container/CardContainer.cjs +6 -5
- package/dist/components/card-container/CardContainer.d.ts +5 -2
- package/dist/components/card-container/CardContainer.js +6 -5
- package/dist/components/card-container/CardContainer.module.css +40 -0
- package/dist/components/checkbox/Checkbox.cjs +3 -4
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.js +3 -4
- package/dist/components/checkbox/Checkbox.module.css +10 -10
- package/dist/components/chip/Chip.cjs +2 -1
- package/dist/components/chip/Chip.d.ts +2 -1
- package/dist/components/chip/Chip.js +2 -1
- package/dist/components/chip/Chip.module.css +42 -27
- package/dist/components/circle/Circle.module.css +11 -11
- package/dist/components/clear-button/ClearButton.cjs +3 -3
- package/dist/components/clear-button/ClearButton.js +3 -3
- package/dist/components/clear-button/ClearButton.module.css +8 -7
- package/dist/components/code-block/CodeBlock.cjs +18 -0
- package/dist/components/code-block/CodeBlock.d.ts +6 -0
- package/dist/components/code-block/CodeBlock.js +12 -0
- package/dist/components/code-block/CodeBlock.module.css +60 -0
- package/dist/components/copy-button/CopyButton.cjs +35 -0
- package/dist/components/copy-button/CopyButton.d.ts +9 -0
- package/dist/components/copy-button/CopyButton.js +29 -0
- package/dist/components/copy-button/CopyButton.module.css +6 -0
- package/dist/components/datetime-picker/DateTimePicker.cjs +504 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts +39 -0
- package/dist/components/datetime-picker/DateTimePicker.js +498 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
- package/dist/components/filter-field/FilterField.cjs +34 -19
- package/dist/components/filter-field/FilterField.d.ts +2 -2
- package/dist/components/filter-field/FilterField.js +35 -20
- package/dist/components/filter-field/FilterField.module.css +14 -20
- package/dist/components/headline/Headline.cjs +10 -4
- package/dist/components/headline/Headline.d.ts +9 -1
- package/dist/components/headline/Headline.js +10 -4
- package/dist/components/headline/Headline.module.css +32 -7
- package/dist/components/icon/Icon.module.css +10 -9
- package/dist/components/input/Input.cjs +60 -19
- package/dist/components/input/Input.d.ts +7 -2
- package/dist/components/input/Input.js +60 -19
- package/dist/components/input/Input.module.css +90 -43
- package/dist/components/link/Link.cjs +46 -0
- package/dist/components/link/Link.d.ts +9 -0
- package/dist/components/link/Link.js +21 -0
- package/dist/components/link/Link.module.css +32 -0
- package/dist/components/menu/Menu.module.css +10 -32
- package/dist/components/meta-bar/MetaBar.cjs +29 -0
- package/dist/components/meta-bar/MetaBar.d.ts +11 -0
- package/dist/components/meta-bar/MetaBar.js +22 -0
- package/dist/components/meta-bar/MetaBar.module.css +12 -0
- package/dist/components/modal/Modal.cjs +134 -0
- package/dist/components/modal/Modal.d.ts +21 -0
- package/dist/components/modal/Modal.js +128 -0
- package/dist/components/modal/Modal.module.css +66 -0
- package/dist/components/modal/provider/ModalProvider.cjs +80 -0
- package/dist/components/modal/provider/ModalProvider.d.ts +21 -0
- package/dist/components/modal/provider/ModalProvider.js +77 -0
- package/dist/components/multi-select/MultiSelect.cjs +12 -1
- package/dist/components/multi-select/MultiSelect.js +12 -1
- package/dist/components/nav-bar/NavBar.module.css +11 -16
- package/dist/components/page/Page.module.css +2 -2
- package/dist/components/page-layout/PageLayout.cjs +5 -22
- package/dist/components/page-layout/PageLayout.d.ts +1 -8
- package/dist/components/page-layout/PageLayout.js +5 -22
- package/dist/components/page-layout/PageLayout.module.css +4 -80
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +32 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +25 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
- package/dist/components/pagination/Pagination.cjs +83 -67
- package/dist/components/pagination/Pagination.d.ts +3 -1
- package/dist/components/pagination/Pagination.js +84 -68
- package/dist/components/pagination/Pagination.module.css +11 -3
- package/dist/components/panel/Panel.module.css +5 -7
- package/dist/components/popover/Popover.cjs +25 -8
- package/dist/components/popover/Popover.d.ts +2 -1
- package/dist/components/popover/Popover.js +25 -8
- package/dist/components/popover/Popover.module.css +4 -6
- package/dist/components/search-box/SearchBox.cjs +50 -37
- package/dist/components/search-box/SearchBox.d.ts +10 -7
- package/dist/components/search-box/SearchBox.js +50 -37
- package/dist/components/search-box/SearchBox.module.css +0 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
- package/dist/components/select/Select.cjs +82 -13
- package/dist/components/select/Select.d.ts +2 -1
- package/dist/components/select/Select.js +83 -14
- package/dist/components/sidebar/Sidebar.cjs +3 -30
- package/dist/components/sidebar/Sidebar.d.ts +2 -1
- package/dist/components/sidebar/Sidebar.js +4 -26
- package/dist/components/sidebar/components/SidebarItem.cjs +3 -1
- package/dist/components/sidebar/components/SidebarItem.js +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +50 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +8 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +43 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +2 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +2 -1
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +29 -2
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +25 -2
- package/dist/components/sidebar/providers/SidebarProvider.cjs +108 -10
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +7 -3
- package/dist/components/sidebar/providers/SidebarProvider.js +109 -11
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
- package/dist/components/split-pane/SplitPane.cjs +123 -0
- package/dist/components/split-pane/SplitPane.d.ts +34 -0
- package/dist/components/split-pane/SplitPane.js +114 -0
- package/dist/components/split-pane/SplitPane.module.css +106 -0
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +87 -0
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +79 -0
- package/dist/components/table/Table.cjs +180 -112
- package/dist/components/table/Table.d.ts +22 -6
- package/dist/components/table/Table.js +181 -113
- package/dist/components/table/Table.module.css +74 -47
- package/dist/components/table/components/empty-state/EmptyState.cjs +52 -0
- package/dist/components/table/components/empty-state/EmptyState.d.ts +40 -0
- package/dist/components/table/components/empty-state/EmptyState.js +46 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +32 -0
- package/dist/components/table/components/table-settings/TableSettings.d.ts +7 -0
- package/dist/components/table/components/table-settings/TableSettings.js +30 -0
- package/dist/{tanstack.cjs → components/table/tanstack.cjs} +61 -99
- package/dist/components/table/tanstack.d.ts +14 -0
- package/dist/{tanstack.js → components/table/tanstack.js} +61 -99
- package/dist/components/tabs/Tabs.cjs +33 -17
- package/dist/components/tabs/Tabs.d.ts +6 -3
- package/dist/components/tabs/Tabs.js +33 -17
- package/dist/components/tabs/Tabs.module.css +9 -9
- package/dist/components/toast/Toast.cjs +47 -0
- package/dist/components/toast/Toast.d.ts +14 -0
- package/dist/components/toast/Toast.js +41 -0
- package/dist/components/toast/Toast.module.css +101 -0
- package/dist/components/toast/provider/ToastProvider.cjs +98 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
- package/dist/components/toast/provider/ToastProvider.js +91 -0
- package/dist/components/tooltip/Tooltip.cjs +134 -29
- package/dist/components/tooltip/Tooltip.js +135 -30
- package/dist/components/tooltip/Tooltip.module.css +25 -43
- package/dist/components/user-display/UserDisplay.module.css +2 -2
- package/dist/constants/severity.cjs +12 -12
- package/dist/constants/severity.js +12 -12
- package/dist/constants/sizes.cjs +1 -0
- package/dist/constants/sizes.d.ts +1 -1
- package/dist/constants/sizes.js +1 -0
- package/dist/hooks/usePagination.cjs +88 -0
- package/dist/hooks/usePagination.d.ts +33 -0
- package/dist/hooks/usePagination.js +86 -0
- package/dist/hooks/useSorting.cjs +118 -0
- package/dist/hooks/useSorting.d.ts +49 -0
- package/dist/hooks/useSorting.js +116 -0
- package/dist/hooks/useTableData.cjs +52 -0
- package/dist/hooks/useTableData.d.ts +40 -0
- package/dist/hooks/useTableData.js +50 -0
- package/dist/hooks/useTableSelection.cjs +130 -0
- package/dist/hooks/useTableSelection.d.ts +25 -0
- package/dist/hooks/useTableSelection.js +128 -0
- package/dist/hooks/useTableSettings.cjs +28 -0
- package/dist/hooks/useTableSettings.d.ts +7 -0
- package/dist/hooks/useTableSettings.js +26 -0
- package/dist/hooks/useTimeDuration.cjs +39 -0
- package/dist/hooks/useTimeDuration.d.ts +22 -0
- package/dist/hooks/useTimeDuration.js +37 -0
- package/dist/hooks/useViewportFill.js +1 -1
- package/dist/index.cjs +119 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/src/styles/styles.css +101 -8
- package/dist/styles/css-helper-classes/flex.css +97 -0
- package/dist/styles/css-helper-classes/typography.css +7 -0
- package/dist/styles/styles.css +101 -8
- package/dist/styles/themes/dbc/dark.css +206 -99
- package/dist/styles/themes/dbc/light.css +183 -89
- package/dist/types/sizes.types.d.ts +2 -2
- package/package.json +17 -11
- package/dist/components/data-summary/DataSummary.cjs +0 -49
- package/dist/components/data-summary/DataSummary.d.ts +0 -19
- package/dist/components/data-summary/DataSummary.js +0 -43
- package/dist/components/data-summary/DataSummary.module.css +0 -51
- package/dist/components/sidebar/Sidebar.module.css +0 -66
- package/dist/tanstack.d.ts +0 -25
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '../../../button/Button';
|
|
3
|
+
import { Headline } from '../../../headline/Headline';
|
|
4
|
+
import { SearchX, RefreshCw, ArrowLeft } from 'lucide-react';
|
|
5
|
+
import styles from './EmptyState.module.css';
|
|
6
|
+
|
|
7
|
+
const defaultEmptyConfig = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
title: /* @__PURE__ */ jsx(Headline, { disableMargin: true, size: 3, children: "Hov, der er ingen data" }),
|
|
10
|
+
description: /* @__PURE__ */ jsx("span", { children: "Pr\xF8v at \xE6ndre dine filtre eller tilf\xF8je data." }),
|
|
11
|
+
showBack: true,
|
|
12
|
+
showRefresh: true,
|
|
13
|
+
backLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(ArrowLeft, {}),
|
|
15
|
+
"Tilbage"
|
|
16
|
+
] }),
|
|
17
|
+
refreshLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(RefreshCw, {}),
|
|
19
|
+
"Indl\xE6s igen"
|
|
20
|
+
] }),
|
|
21
|
+
className: "dbc-flex dbc-flex-column dbc-justify-center dbc-items-center dbc-flex-grow "
|
|
22
|
+
};
|
|
23
|
+
function TableEmptyState({ config }) {
|
|
24
|
+
const merged = {
|
|
25
|
+
...defaultEmptyConfig,
|
|
26
|
+
...config != null ? config : {}
|
|
27
|
+
};
|
|
28
|
+
if (!merged.enabled) return null;
|
|
29
|
+
const showBack = merged.showBack && typeof merged.onBack === "function";
|
|
30
|
+
const showRefresh = merged.showRefresh && typeof merged.onRefresh === "function";
|
|
31
|
+
const hasAnyActions = Boolean(merged.actions) || showBack || showRefresh;
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", { className: `${merged.className} ${styles.container}`, children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("span", { className: "dbc-flex dbc-flex-column dbc-gap-sm dbc-items-center", children: [
|
|
34
|
+
/* @__PURE__ */ jsx(SearchX, { className: styles.icon }),
|
|
35
|
+
merged.title,
|
|
36
|
+
merged.description
|
|
37
|
+
] }),
|
|
38
|
+
hasAnyActions && /* @__PURE__ */ jsxs("div", { className: "dbc-flex dbc-gap-sm", children: [
|
|
39
|
+
merged.actions,
|
|
40
|
+
showBack && /* @__PURE__ */ jsx(Button, { onClick: merged.onBack, className: "dbc-mr-xxs", children: merged.backLabel }),
|
|
41
|
+
showRefresh && /* @__PURE__ */ jsx(Button, { onClick: merged.onRefresh, children: merged.refreshLabel })
|
|
42
|
+
] })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { TableEmptyState };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
inset: 0;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
transform: translateY(clamp(-32px, -6vh, -12px));
|
|
8
|
+
padding-top: 56px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.icon {
|
|
13
|
+
inline-size: var(--component-size-lg);
|
|
14
|
+
block-size: var(--component-size-lg);
|
|
15
|
+
color: var(--color-fg-muted);
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Button = require('../../../button/Button');
|
|
5
|
+
var Popover = require('../../../popover/Popover');
|
|
6
|
+
var Menu = require('../../../menu/Menu');
|
|
7
|
+
var lucideReact = require('lucide-react');
|
|
8
|
+
|
|
9
|
+
function TableSettings({
|
|
10
|
+
viewMode,
|
|
11
|
+
handleChangeViewMode
|
|
12
|
+
}) {
|
|
13
|
+
const handleViewModeChange = (mode, close) => {
|
|
14
|
+
handleChangeViewMode("compact" );
|
|
15
|
+
close == null ? void 0 : close();
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
|
+
Popover.Popover,
|
|
19
|
+
{
|
|
20
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { onClick, children: [
|
|
21
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, {}),
|
|
22
|
+
icon
|
|
23
|
+
] }),
|
|
24
|
+
children: (close) => /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: viewMode === "compact", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: () => handleViewModeChange("compact", close), children: [
|
|
25
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListChevronsDownUp, {}),
|
|
26
|
+
"Kompakt"
|
|
27
|
+
] }) }) })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.TableSettings = TableSettings;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ViewMode } from '../../../../hooks/useTableSettings';
|
|
2
|
+
interface TableSettingsProps {
|
|
3
|
+
handleChangeViewMode: (mode: ViewMode) => void;
|
|
4
|
+
viewMode: ViewMode;
|
|
5
|
+
}
|
|
6
|
+
export declare function TableSettings({ viewMode, handleChangeViewMode, }: TableSettingsProps): React.ReactNode | JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '../../../button/Button';
|
|
3
|
+
import { Popover } from '../../../popover/Popover';
|
|
4
|
+
import { Menu } from '../../../menu/Menu';
|
|
5
|
+
import { ListChevronsDownUp, Settings } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
function TableSettings({
|
|
8
|
+
viewMode,
|
|
9
|
+
handleChangeViewMode
|
|
10
|
+
}) {
|
|
11
|
+
const handleViewModeChange = (mode, close) => {
|
|
12
|
+
handleChangeViewMode("compact" );
|
|
13
|
+
close == null ? void 0 : close();
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Popover,
|
|
17
|
+
{
|
|
18
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsxs(Button, { onClick, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Settings, {}),
|
|
20
|
+
icon
|
|
21
|
+
] }),
|
|
22
|
+
children: (close) => /* @__PURE__ */ jsx(Menu, { children: /* @__PURE__ */ jsx(Menu.Item, { active: viewMode === "compact", children: /* @__PURE__ */ jsxs("button", { onClick: () => handleViewModeChange("compact", close), children: [
|
|
23
|
+
/* @__PURE__ */ jsx(ListChevronsDownUp, {}),
|
|
24
|
+
"Kompakt"
|
|
25
|
+
] }) }) })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { TableSettings };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactTable = require('@tanstack/react-table');
|
|
6
|
-
var Table = require('./
|
|
7
|
-
var ColumnResizer = require('./components/
|
|
6
|
+
var Table = require('./Table');
|
|
7
|
+
var ColumnResizer = require('./components/column-resizer/ColumnResizer');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
@@ -29,57 +29,52 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
30
30
|
var ColumnResizer__default = /*#__PURE__*/_interopDefault(ColumnResizer);
|
|
31
31
|
|
|
32
|
+
function getColumnId(def, index) {
|
|
33
|
+
const d = def;
|
|
34
|
+
if (d.id != null && String(d.id).length) return String(d.id);
|
|
35
|
+
if (d.accessorKey != null && String(d.accessorKey).length) return String(d.accessorKey);
|
|
36
|
+
return `col_${index}`;
|
|
37
|
+
}
|
|
32
38
|
function mapDefsToColumnItems(defs) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const accessor = def.accessorKey;
|
|
39
|
+
return defs.map((def, index) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
41
|
+
const id = getColumnId(def, index);
|
|
42
|
+
const accessorKey = def.accessorKey;
|
|
38
43
|
const accessorFn = def.accessorFn;
|
|
39
44
|
const cell = def.cell;
|
|
40
45
|
let render;
|
|
41
46
|
if (typeof cell === "function") {
|
|
42
47
|
render = (row) => cell({
|
|
43
48
|
row: { original: row },
|
|
44
|
-
getValue: () =>
|
|
49
|
+
getValue: () => accessorKey != null ? row[accessorKey] : accessorFn ? accessorFn(row) : void 0
|
|
45
50
|
});
|
|
46
51
|
} else if (accessorFn) {
|
|
47
52
|
render = (row) => accessorFn(row);
|
|
48
|
-
} else if (
|
|
49
|
-
render = (row) => row[
|
|
53
|
+
} else if (accessorKey != null) {
|
|
54
|
+
render = (row) => row[accessorKey];
|
|
55
|
+
} else {
|
|
56
|
+
render = () => null;
|
|
50
57
|
}
|
|
51
58
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
id,
|
|
60
|
+
header: def.header,
|
|
61
|
+
accessor: accessorKey,
|
|
62
|
+
sortable: (_a = def.enableSorting) != null ? _a : !!accessorKey,
|
|
55
63
|
render,
|
|
56
|
-
hidden: (
|
|
57
|
-
align: (
|
|
64
|
+
hidden: (_c = (_b = def.meta) == null ? void 0 : _b.hidden) != null ? _c : false,
|
|
65
|
+
align: (_e = (_d = def.meta) == null ? void 0 : _d.align) != null ? _e : void 0,
|
|
66
|
+
verticalAlign: (_g = (_f = def.meta) == null ? void 0 : _f.verticalAlign) != null ? _g : void 0,
|
|
58
67
|
fitContent: (_i = (_h = def.meta) == null ? void 0 : _h.fitContent) != null ? _i : false,
|
|
59
|
-
|
|
68
|
+
emptyPlaceholder: (_k = (_j = def.meta) == null ? void 0 : _j.emptyPlaceholder) != null ? _k : "-",
|
|
69
|
+
allowWrap: (_m = (_l = def.meta) == null ? void 0 : _l.allowWrap) != null ? _m : false,
|
|
70
|
+
fillWidth: (_o = (_n = def.meta) == null ? void 0 : _n.fillWidth) != null ? _o : false,
|
|
71
|
+
severity: (_q = (_p = def.meta) == null ? void 0 : _p.severity) != null ? _q : void 0
|
|
60
72
|
};
|
|
61
73
|
});
|
|
62
74
|
}
|
|
63
|
-
function TanstackTable({
|
|
64
|
-
data,
|
|
65
|
-
dataKey,
|
|
66
|
-
columns,
|
|
67
|
-
filterable = [],
|
|
68
|
-
loading,
|
|
69
|
-
onRowClick,
|
|
70
|
-
striped,
|
|
71
|
-
fillViewport = false,
|
|
72
|
-
viewportBottomOffset = 0,
|
|
73
|
-
viewportMin = 120,
|
|
74
|
-
viewportIncludeMarginTop = false,
|
|
75
|
-
pageSize,
|
|
76
|
-
skip,
|
|
77
|
-
totalItemsCount,
|
|
78
|
-
onPageChange,
|
|
79
|
-
variant,
|
|
80
|
-
size
|
|
81
|
-
}) {
|
|
75
|
+
function TanstackTable(props) {
|
|
82
76
|
var _a, _b;
|
|
77
|
+
const { data, dataKey, columns, filterable = [], onSortingChange, ...tableProps } = props;
|
|
83
78
|
const [sorting, setSorting] = React__namespace.useState([]);
|
|
84
79
|
const [columnFilters, setColumnFilters] = React__namespace.useState([]);
|
|
85
80
|
const [columnSizing, setColumnSizing] = React__namespace.useState({});
|
|
@@ -108,42 +103,30 @@ function TanstackTable({
|
|
|
108
103
|
[table, data]
|
|
109
104
|
);
|
|
110
105
|
const s = (_a = table.getState().sorting) == null ? void 0 : _a[0];
|
|
111
|
-
const
|
|
106
|
+
const sortById = (_b = s == null ? void 0 : s.id) != null ? _b : void 0;
|
|
112
107
|
const sortDirection = s ? s.desc ? "desc" : "asc" : null;
|
|
113
108
|
const gridTemplateColumns = React__namespace.useMemo(() => {
|
|
114
109
|
return columnItems.filter((ci) => !ci.hidden).map((ci) => {
|
|
115
|
-
var _a2
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const w = (_b2 = col == null ? void 0 : col.getSize) == null ? void 0 : _b2.call(col);
|
|
110
|
+
var _a2;
|
|
111
|
+
const col = table.getColumn(ci.id);
|
|
112
|
+
const w = (_a2 = col == null ? void 0 : col.getSize) == null ? void 0 : _a2.call(col);
|
|
119
113
|
if (ci.fillWidth) return "1fr";
|
|
120
114
|
if (ci.fitContent) return "1%";
|
|
121
115
|
return `${w != null ? w : 180}px`;
|
|
122
116
|
}).join(" ");
|
|
123
117
|
}, [columnItems, table, table.getState().columnSizing]);
|
|
124
118
|
const columnStyles = React__namespace.useMemo(() => {
|
|
125
|
-
var _a2;
|
|
126
119
|
const styles = {};
|
|
127
120
|
for (const c of table.getAllLeafColumns()) {
|
|
128
121
|
const id = c.id;
|
|
129
|
-
const
|
|
130
|
-
const ci = columnItems.find((x) => {
|
|
131
|
-
var _a3;
|
|
132
|
-
return String((_a3 = x.accessor) != null ? _a3 : "") === String(key);
|
|
133
|
-
});
|
|
122
|
+
const ci = columnItems.find((x) => x.id === id);
|
|
134
123
|
if (ci == null ? void 0 : ci.fillWidth) {
|
|
135
|
-
styles[
|
|
136
|
-
width: "auto",
|
|
137
|
-
minWidth: 0
|
|
138
|
-
};
|
|
124
|
+
styles[id] = { width: "auto", minWidth: 0 };
|
|
139
125
|
} else if (ci == null ? void 0 : ci.fitContent) {
|
|
140
|
-
styles[
|
|
141
|
-
width: "1%",
|
|
142
|
-
whiteSpace: "nowrap"
|
|
143
|
-
};
|
|
126
|
+
styles[id] = { width: "1%", whiteSpace: "nowrap" };
|
|
144
127
|
} else {
|
|
145
128
|
const w = c.getSize();
|
|
146
|
-
styles[
|
|
129
|
+
styles[id] = { width: w, minWidth: w, maxWidth: w };
|
|
147
130
|
}
|
|
148
131
|
}
|
|
149
132
|
return styles;
|
|
@@ -164,66 +147,45 @@ function TanstackTable({
|
|
|
164
147
|
);
|
|
165
148
|
const headerBelowRow = React__namespace.useMemo(() => {
|
|
166
149
|
if (!(filterable == null ? void 0 : filterable.length)) return null;
|
|
167
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "grid", gridTemplateColumns, gap: 8 }, children: columnItems.filter((ci) => !ci.hidden).map((ci) => {
|
|
151
|
+
var _a2;
|
|
152
|
+
const id = ci.id;
|
|
153
|
+
const isFilterable = filterable.includes(id);
|
|
154
|
+
if (!isFilterable) return /* @__PURE__ */ jsxRuntime.jsx("div", {}, id);
|
|
155
|
+
const col = table.getColumn(id);
|
|
156
|
+
const value = (_a2 = col == null ? void 0 : col.getFilterValue()) != null ? _a2 : "";
|
|
157
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
"input",
|
|
159
|
+
{
|
|
160
|
+
value,
|
|
161
|
+
placeholder: `Filter ${String(ci.header)}`,
|
|
162
|
+
onChange: (e) => col == null ? void 0 : col.setFilterValue(e.target.value),
|
|
163
|
+
style: { width: "100%", padding: "4px 6px" }
|
|
174
164
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const isFilterable = id && filterable.includes(id);
|
|
179
|
-
if (!isFilterable) return /* @__PURE__ */ jsxRuntime.jsx("div", {}, id);
|
|
180
|
-
const col = table.getColumn(id);
|
|
181
|
-
const value = (_b2 = col == null ? void 0 : col.getFilterValue()) != null ? _b2 : "";
|
|
182
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
-
"input",
|
|
184
|
-
{
|
|
185
|
-
value,
|
|
186
|
-
placeholder: `Filter ${ci.header}`,
|
|
187
|
-
onChange: (e) => col == null ? void 0 : col.setFilterValue(e.target.value),
|
|
188
|
-
style: { width: "100%", padding: "4px 6px" }
|
|
189
|
-
},
|
|
190
|
-
id
|
|
191
|
-
);
|
|
192
|
-
})
|
|
193
|
-
}
|
|
194
|
-
);
|
|
165
|
+
id
|
|
166
|
+
);
|
|
167
|
+
}) });
|
|
195
168
|
}, [columnItems, filterable, table, table.getState().columnFilters, gridTemplateColumns]);
|
|
196
169
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
197
170
|
Table.Table,
|
|
198
171
|
{
|
|
172
|
+
...tableProps,
|
|
199
173
|
dataKey,
|
|
200
|
-
variant,
|
|
201
174
|
data: visibleData,
|
|
202
175
|
columns: columnItems,
|
|
203
|
-
|
|
176
|
+
sortById,
|
|
204
177
|
sortDirection,
|
|
205
178
|
onSortChange: (col, dir) => {
|
|
206
|
-
var _a2;
|
|
207
|
-
const id = String(
|
|
179
|
+
var _a2, _b2, _c;
|
|
180
|
+
const id = String(col.id);
|
|
208
181
|
if (!id) return;
|
|
209
182
|
if (!dir) table.setSorting([]);
|
|
210
183
|
else table.setSorting([{ id, desc: dir === "desc" }]);
|
|
184
|
+
onSortingChange == null ? void 0 : onSortingChange((_c = (_b2 = (_a2 = table.getState().sorting) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.id) != null ? _c : null, dir);
|
|
211
185
|
},
|
|
212
186
|
headerExtras,
|
|
213
187
|
columnStyles,
|
|
214
|
-
headerBelowRow
|
|
215
|
-
loading,
|
|
216
|
-
onRowClick,
|
|
217
|
-
striped,
|
|
218
|
-
fillViewport,
|
|
219
|
-
viewportBottomOffset,
|
|
220
|
-
viewportMin,
|
|
221
|
-
viewportIncludeMarginTop,
|
|
222
|
-
take: pageSize,
|
|
223
|
-
skip,
|
|
224
|
-
totalItemsCount,
|
|
225
|
-
onPageChange,
|
|
226
|
-
size
|
|
188
|
+
headerBelowRow
|
|
227
189
|
}
|
|
228
190
|
);
|
|
229
191
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ColumnDef } from '@tanstack/react-table';
|
|
3
|
+
import { type TableProps, type TableVariant } from './Table';
|
|
4
|
+
import { ViewMode } from '../../hooks/useTableSettings';
|
|
5
|
+
type Filterable<T> = Array<keyof T>;
|
|
6
|
+
export type TanstackTableProps<T extends Record<string, any>> = Omit<TableProps<T>, 'columns' | 'onSortChange' | 'sortById' | 'sortDirection' | 'headerBelowRow' | 'headerExtras' | 'columnStyles'> & {
|
|
7
|
+
columns: ReadonlyArray<ColumnDef<T, any>>;
|
|
8
|
+
filterable?: Filterable<T>;
|
|
9
|
+
onSortingChange?: (sortBy: string | number | symbol | null, direction: 'asc' | 'desc' | null) => void;
|
|
10
|
+
variant?: TableVariant;
|
|
11
|
+
viewMode?: ViewMode;
|
|
12
|
+
};
|
|
13
|
+
export declare function TanstackTable<T extends Record<string, any>>(props: TanstackTableProps<T>): React.ReactNode;
|
|
14
|
+
export {};
|
|
@@ -1,60 +1,55 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useReactTable, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
4
|
-
import { Table } from './
|
|
5
|
-
import ColumnResizer from './components/
|
|
4
|
+
import { Table } from './Table';
|
|
5
|
+
import ColumnResizer from './components/column-resizer/ColumnResizer';
|
|
6
6
|
|
|
7
|
+
function getColumnId(def, index) {
|
|
8
|
+
const d = def;
|
|
9
|
+
if (d.id != null && String(d.id).length) return String(d.id);
|
|
10
|
+
if (d.accessorKey != null && String(d.accessorKey).length) return String(d.accessorKey);
|
|
11
|
+
return `col_${index}`;
|
|
12
|
+
}
|
|
7
13
|
function mapDefsToColumnItems(defs) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const accessor = def.accessorKey;
|
|
14
|
+
return defs.map((def, index) => {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
16
|
+
const id = getColumnId(def, index);
|
|
17
|
+
const accessorKey = def.accessorKey;
|
|
13
18
|
const accessorFn = def.accessorFn;
|
|
14
19
|
const cell = def.cell;
|
|
15
20
|
let render;
|
|
16
21
|
if (typeof cell === "function") {
|
|
17
22
|
render = (row) => cell({
|
|
18
23
|
row: { original: row },
|
|
19
|
-
getValue: () =>
|
|
24
|
+
getValue: () => accessorKey != null ? row[accessorKey] : accessorFn ? accessorFn(row) : void 0
|
|
20
25
|
});
|
|
21
26
|
} else if (accessorFn) {
|
|
22
27
|
render = (row) => accessorFn(row);
|
|
23
|
-
} else if (
|
|
24
|
-
render = (row) => row[
|
|
28
|
+
} else if (accessorKey != null) {
|
|
29
|
+
render = (row) => row[accessorKey];
|
|
30
|
+
} else {
|
|
31
|
+
render = () => null;
|
|
25
32
|
}
|
|
26
33
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
id,
|
|
35
|
+
header: def.header,
|
|
36
|
+
accessor: accessorKey,
|
|
37
|
+
sortable: (_a = def.enableSorting) != null ? _a : !!accessorKey,
|
|
30
38
|
render,
|
|
31
|
-
hidden: (
|
|
32
|
-
align: (
|
|
39
|
+
hidden: (_c = (_b = def.meta) == null ? void 0 : _b.hidden) != null ? _c : false,
|
|
40
|
+
align: (_e = (_d = def.meta) == null ? void 0 : _d.align) != null ? _e : void 0,
|
|
41
|
+
verticalAlign: (_g = (_f = def.meta) == null ? void 0 : _f.verticalAlign) != null ? _g : void 0,
|
|
33
42
|
fitContent: (_i = (_h = def.meta) == null ? void 0 : _h.fitContent) != null ? _i : false,
|
|
34
|
-
|
|
43
|
+
emptyPlaceholder: (_k = (_j = def.meta) == null ? void 0 : _j.emptyPlaceholder) != null ? _k : "-",
|
|
44
|
+
allowWrap: (_m = (_l = def.meta) == null ? void 0 : _l.allowWrap) != null ? _m : false,
|
|
45
|
+
fillWidth: (_o = (_n = def.meta) == null ? void 0 : _n.fillWidth) != null ? _o : false,
|
|
46
|
+
severity: (_q = (_p = def.meta) == null ? void 0 : _p.severity) != null ? _q : void 0
|
|
35
47
|
};
|
|
36
48
|
});
|
|
37
49
|
}
|
|
38
|
-
function TanstackTable({
|
|
39
|
-
data,
|
|
40
|
-
dataKey,
|
|
41
|
-
columns,
|
|
42
|
-
filterable = [],
|
|
43
|
-
loading,
|
|
44
|
-
onRowClick,
|
|
45
|
-
striped,
|
|
46
|
-
fillViewport = false,
|
|
47
|
-
viewportBottomOffset = 0,
|
|
48
|
-
viewportMin = 120,
|
|
49
|
-
viewportIncludeMarginTop = false,
|
|
50
|
-
pageSize,
|
|
51
|
-
skip,
|
|
52
|
-
totalItemsCount,
|
|
53
|
-
onPageChange,
|
|
54
|
-
variant,
|
|
55
|
-
size
|
|
56
|
-
}) {
|
|
50
|
+
function TanstackTable(props) {
|
|
57
51
|
var _a, _b;
|
|
52
|
+
const { data, dataKey, columns, filterable = [], onSortingChange, ...tableProps } = props;
|
|
58
53
|
const [sorting, setSorting] = React.useState([]);
|
|
59
54
|
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
60
55
|
const [columnSizing, setColumnSizing] = React.useState({});
|
|
@@ -83,42 +78,30 @@ function TanstackTable({
|
|
|
83
78
|
[table, data]
|
|
84
79
|
);
|
|
85
80
|
const s = (_a = table.getState().sorting) == null ? void 0 : _a[0];
|
|
86
|
-
const
|
|
81
|
+
const sortById = (_b = s == null ? void 0 : s.id) != null ? _b : void 0;
|
|
87
82
|
const sortDirection = s ? s.desc ? "desc" : "asc" : null;
|
|
88
83
|
const gridTemplateColumns = React.useMemo(() => {
|
|
89
84
|
return columnItems.filter((ci) => !ci.hidden).map((ci) => {
|
|
90
|
-
var _a2
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const w = (_b2 = col == null ? void 0 : col.getSize) == null ? void 0 : _b2.call(col);
|
|
85
|
+
var _a2;
|
|
86
|
+
const col = table.getColumn(ci.id);
|
|
87
|
+
const w = (_a2 = col == null ? void 0 : col.getSize) == null ? void 0 : _a2.call(col);
|
|
94
88
|
if (ci.fillWidth) return "1fr";
|
|
95
89
|
if (ci.fitContent) return "1%";
|
|
96
90
|
return `${w != null ? w : 180}px`;
|
|
97
91
|
}).join(" ");
|
|
98
92
|
}, [columnItems, table, table.getState().columnSizing]);
|
|
99
93
|
const columnStyles = React.useMemo(() => {
|
|
100
|
-
var _a2;
|
|
101
94
|
const styles = {};
|
|
102
95
|
for (const c of table.getAllLeafColumns()) {
|
|
103
96
|
const id = c.id;
|
|
104
|
-
const
|
|
105
|
-
const ci = columnItems.find((x) => {
|
|
106
|
-
var _a3;
|
|
107
|
-
return String((_a3 = x.accessor) != null ? _a3 : "") === String(key);
|
|
108
|
-
});
|
|
97
|
+
const ci = columnItems.find((x) => x.id === id);
|
|
109
98
|
if (ci == null ? void 0 : ci.fillWidth) {
|
|
110
|
-
styles[
|
|
111
|
-
width: "auto",
|
|
112
|
-
minWidth: 0
|
|
113
|
-
};
|
|
99
|
+
styles[id] = { width: "auto", minWidth: 0 };
|
|
114
100
|
} else if (ci == null ? void 0 : ci.fitContent) {
|
|
115
|
-
styles[
|
|
116
|
-
width: "1%",
|
|
117
|
-
whiteSpace: "nowrap"
|
|
118
|
-
};
|
|
101
|
+
styles[id] = { width: "1%", whiteSpace: "nowrap" };
|
|
119
102
|
} else {
|
|
120
103
|
const w = c.getSize();
|
|
121
|
-
styles[
|
|
104
|
+
styles[id] = { width: w, minWidth: w, maxWidth: w };
|
|
122
105
|
}
|
|
123
106
|
}
|
|
124
107
|
return styles;
|
|
@@ -139,66 +122,45 @@ function TanstackTable({
|
|
|
139
122
|
);
|
|
140
123
|
const headerBelowRow = React.useMemo(() => {
|
|
141
124
|
if (!(filterable == null ? void 0 : filterable.length)) return null;
|
|
142
|
-
return /* @__PURE__ */ jsx(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
125
|
+
return /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns, gap: 8 }, children: columnItems.filter((ci) => !ci.hidden).map((ci) => {
|
|
126
|
+
var _a2;
|
|
127
|
+
const id = ci.id;
|
|
128
|
+
const isFilterable = filterable.includes(id);
|
|
129
|
+
if (!isFilterable) return /* @__PURE__ */ jsx("div", {}, id);
|
|
130
|
+
const col = table.getColumn(id);
|
|
131
|
+
const value = (_a2 = col == null ? void 0 : col.getFilterValue()) != null ? _a2 : "";
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"input",
|
|
134
|
+
{
|
|
135
|
+
value,
|
|
136
|
+
placeholder: `Filter ${String(ci.header)}`,
|
|
137
|
+
onChange: (e) => col == null ? void 0 : col.setFilterValue(e.target.value),
|
|
138
|
+
style: { width: "100%", padding: "4px 6px" }
|
|
149
139
|
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const isFilterable = id && filterable.includes(id);
|
|
154
|
-
if (!isFilterable) return /* @__PURE__ */ jsx("div", {}, id);
|
|
155
|
-
const col = table.getColumn(id);
|
|
156
|
-
const value = (_b2 = col == null ? void 0 : col.getFilterValue()) != null ? _b2 : "";
|
|
157
|
-
return /* @__PURE__ */ jsx(
|
|
158
|
-
"input",
|
|
159
|
-
{
|
|
160
|
-
value,
|
|
161
|
-
placeholder: `Filter ${ci.header}`,
|
|
162
|
-
onChange: (e) => col == null ? void 0 : col.setFilterValue(e.target.value),
|
|
163
|
-
style: { width: "100%", padding: "4px 6px" }
|
|
164
|
-
},
|
|
165
|
-
id
|
|
166
|
-
);
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
);
|
|
140
|
+
id
|
|
141
|
+
);
|
|
142
|
+
}) });
|
|
170
143
|
}, [columnItems, filterable, table, table.getState().columnFilters, gridTemplateColumns]);
|
|
171
144
|
return /* @__PURE__ */ jsx(
|
|
172
145
|
Table,
|
|
173
146
|
{
|
|
147
|
+
...tableProps,
|
|
174
148
|
dataKey,
|
|
175
|
-
variant,
|
|
176
149
|
data: visibleData,
|
|
177
150
|
columns: columnItems,
|
|
178
|
-
|
|
151
|
+
sortById,
|
|
179
152
|
sortDirection,
|
|
180
153
|
onSortChange: (col, dir) => {
|
|
181
|
-
var _a2;
|
|
182
|
-
const id = String(
|
|
154
|
+
var _a2, _b2, _c;
|
|
155
|
+
const id = String(col.id);
|
|
183
156
|
if (!id) return;
|
|
184
157
|
if (!dir) table.setSorting([]);
|
|
185
158
|
else table.setSorting([{ id, desc: dir === "desc" }]);
|
|
159
|
+
onSortingChange == null ? void 0 : onSortingChange((_c = (_b2 = (_a2 = table.getState().sorting) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.id) != null ? _c : null, dir);
|
|
186
160
|
},
|
|
187
161
|
headerExtras,
|
|
188
162
|
columnStyles,
|
|
189
|
-
headerBelowRow
|
|
190
|
-
loading,
|
|
191
|
-
onRowClick,
|
|
192
|
-
striped,
|
|
193
|
-
fillViewport,
|
|
194
|
-
viewportBottomOffset,
|
|
195
|
-
viewportMin,
|
|
196
|
-
viewportIncludeMarginTop,
|
|
197
|
-
take: pageSize,
|
|
198
|
-
skip,
|
|
199
|
-
totalItemsCount,
|
|
200
|
-
onPageChange,
|
|
201
|
-
size
|
|
163
|
+
headerBelowRow
|
|
202
164
|
}
|
|
203
165
|
);
|
|
204
166
|
}
|