@bsol-oss/react-datatable5 12.0.0-beta.51 → 12.0.0-beta.52
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/index.d.ts +9 -11
- package/dist/index.js +28 -35
- package/dist/index.mjs +31 -37
- package/dist/types/components/DataTable/DataTable.d.ts +1 -1
- package/dist/types/components/DataTable/controls/TableControls.d.ts +7 -4
- package/dist/types/components/Filter/TagFilter.d.ts +1 -0
- package/dist/types/index.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ interface DataTableProps<TData = unknown> {
|
|
|
144
144
|
setDensity: OnChangeFn<DensityState>;
|
|
145
145
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
146
146
|
translate: UseTranslationResponse<any, any>;
|
|
147
|
-
tableLabel
|
|
147
|
+
tableLabel?: DataTableLabel;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* DataTable will create a context to hold all values to
|
|
@@ -311,16 +311,19 @@ interface TableControlsProps {
|
|
|
311
311
|
showPageSizeControl?: boolean;
|
|
312
312
|
showPageCountText?: boolean;
|
|
313
313
|
showView?: boolean;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
filterTagsOptions?: {
|
|
315
|
+
column: string;
|
|
316
|
+
options: {
|
|
317
|
+
label: string;
|
|
318
|
+
value: string;
|
|
319
|
+
}[];
|
|
317
320
|
}[];
|
|
318
321
|
extraItems?: ReactNode;
|
|
319
322
|
loading?: boolean;
|
|
320
323
|
hasError?: boolean;
|
|
321
324
|
gridProps?: GridProps;
|
|
322
325
|
}
|
|
323
|
-
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView,
|
|
326
|
+
declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => react_jsx_runtime.JSX.Element;
|
|
324
327
|
|
|
325
328
|
interface TableProps extends TableRootProps {
|
|
326
329
|
showLoading?: boolean;
|
|
@@ -491,11 +494,6 @@ interface TableDataDisplayProps {
|
|
|
491
494
|
}
|
|
492
495
|
declare const TableDataDisplay: ({ colorPalette, emptyComponent, }: TableDataDisplayProps) => react_jsx_runtime.JSX.Element;
|
|
493
496
|
|
|
494
|
-
interface FilterOptionsProps {
|
|
495
|
-
column: string;
|
|
496
|
-
}
|
|
497
|
-
declare const FilterOptions: ({ column }: FilterOptionsProps) => react_jsx_runtime.JSX.Element;
|
|
498
|
-
|
|
499
497
|
declare const GlobalFilter: () => react_jsx_runtime.JSX.Element;
|
|
500
498
|
|
|
501
499
|
interface ForeignKeyProps {
|
|
@@ -708,4 +706,4 @@ declare module "@tanstack/react-table" {
|
|
|
708
706
|
}
|
|
709
707
|
}
|
|
710
708
|
|
|
711
|
-
export { type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, type DatePickerProps, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, ErrorAlert, type ErrorAlertProps, FilterDialog,
|
|
709
|
+
export { type CalendarProps, CardHeader, type CardHeaderProps, type CustomJSONSchema7Definition, DataDisplay, type DataDisplayProps, type DataResponse, DataTable, type DataTableDefaultState, type DataTableProps, DataTableServer, type DataTableServerProps, type DatePickerProps, DefaultCardTitle, DefaultForm, type DefaultFormProps, DefaultTable, type DefaultTableProps, DensityToggleButton, type DensityToggleButtonProps, type EditFilterButtonProps, EditSortingButton, type EditSortingButtonProps, type EditViewButtonProps, EmptyState, type EmptyStateProps, ErrorAlert, type ErrorAlertProps, FilterDialog, FormBody, FormRoot, type FormRootProps, FormTitle, type GetColumnsConfigs, type GetDateColorProps, type GetMultiDatesProps, type GetRangeDatesProps, type GetStyleProps, type GetVariantProps, GlobalFilter, PageSizeControl, type PageSizeControlProps, Pagination, type RangeCalendarProps, type RangeDatePickerProps, RecordDisplay, type RecordDisplayProps, ReloadButton, type ReloadButtonProps, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, type Result, RowCountText, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, type TableDataDisplayProps, TableFilter, TableFilterTags, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, type TableHeaderTexts, TableLoadingComponent, type TableLoadingComponentProps, type TableProps, type TableRendererProps, type TableRowSelectorProps, TableSelector, TableSorter, TableViewer, TextCell, type TextCellProps, type UseDataTableProps, type UseDataTableReturn, type UseDataTableServerProps, type UseDataTableServerReturn, type UseFormProps, ViewDialog, getColumns, getMultiDates, getRangeDates, idPickerSanityCheck, useDataTable, useDataTableContext, useDataTableServer, useForm, widthSanityCheck };
|
package/dist/index.js
CHANGED
|
@@ -350,8 +350,17 @@ const Tag = React__namespace.forwardRef(function Tag(props, ref) {
|
|
|
350
350
|
return (jsxRuntime.jsxs(react.Tag.Root, { ref: ref, ...rest, children: [startElement && (jsxRuntime.jsx(react.Tag.StartElement, { children: startElement })), jsxRuntime.jsx(react.Tag.Label, { children: children }), endElement && (jsxRuntime.jsx(react.Tag.EndElement, { children: endElement })), closable && (jsxRuntime.jsx(react.Tag.EndElement, { children: jsxRuntime.jsx(react.Tag.CloseTrigger, { onClick: onClose }) }))] }));
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
-
const TagFilter = ({ availableTags, selectedTags, onTagChange, }) => {
|
|
353
|
+
const TagFilter = ({ availableTags, selectedTags, onTagChange, selectOne = false, }) => {
|
|
354
354
|
const toggleTag = (tag) => {
|
|
355
|
+
if (selectOne) {
|
|
356
|
+
if (selectedTags.includes(tag)) {
|
|
357
|
+
onTagChange([]);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
onTagChange([tag]);
|
|
361
|
+
}
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
355
364
|
if (selectedTags.includes(tag)) {
|
|
356
365
|
onTagChange(selectedTags.filter((t) => t !== tag));
|
|
357
366
|
}
|
|
@@ -3002,13 +3011,6 @@ function DataTableServer({ columns, enableRowSelection = true, enableMultiRowSel
|
|
|
3002
3011
|
}, children: jsxRuntime.jsx(DataTableServerContext.Provider, { value: { url, query }, children: children }) }));
|
|
3003
3012
|
}
|
|
3004
3013
|
|
|
3005
|
-
const Tooltip = React__namespace.forwardRef(function Tooltip(props, ref) {
|
|
3006
|
-
const { showArrow, children, disabled, portalled, content, contentProps, portalRef, ...rest } = props;
|
|
3007
|
-
if (disabled)
|
|
3008
|
-
return children;
|
|
3009
|
-
return (jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: jsxRuntime.jsx(react.Tooltip.Positioner, { children: jsxRuntime.jsxs(react.Tooltip.Content, { ref: ref, ...contentProps, children: [showArrow && (jsxRuntime.jsx(react.Tooltip.Arrow, { children: jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) })), content] }) }) })] }));
|
|
3010
|
-
});
|
|
3011
|
-
|
|
3012
3014
|
const InputGroup = React__namespace.forwardRef(function InputGroup(props, ref) {
|
|
3013
3015
|
const { startElement, startElementProps, endElement, endElementProps, children, startOffset = "6px", endOffset = "6px", ...rest } = props;
|
|
3014
3016
|
return (jsxRuntime.jsxs(react.Group, { ref: ref, ...rest, children: [startElement && (jsxRuntime.jsx(react.InputElement, { pointerEvents: "none", ...startElementProps, children: startElement })), React__namespace.cloneElement(children, {
|
|
@@ -3036,6 +3038,13 @@ const GlobalFilter = () => {
|
|
|
3036
3038
|
} }) }) }));
|
|
3037
3039
|
};
|
|
3038
3040
|
|
|
3041
|
+
const Tooltip = React__namespace.forwardRef(function Tooltip(props, ref) {
|
|
3042
|
+
const { showArrow, children, disabled, portalled, content, contentProps, portalRef, ...rest } = props;
|
|
3043
|
+
if (disabled)
|
|
3044
|
+
return children;
|
|
3045
|
+
return (jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: jsxRuntime.jsx(react.Tooltip.Positioner, { children: jsxRuntime.jsxs(react.Tooltip.Content, { ref: ref, ...contentProps, children: [showArrow && (jsxRuntime.jsx(react.Tooltip.Arrow, { children: jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) })), content] }) }) })] }));
|
|
3046
|
+
});
|
|
3047
|
+
|
|
3039
3048
|
const ReloadButton = ({ variant = "icon", }) => {
|
|
3040
3049
|
const { url } = useDataTableServerContext();
|
|
3041
3050
|
const queryClient = reactQuery.useQueryClient();
|
|
@@ -3051,27 +3060,6 @@ const ReloadButton = ({ variant = "icon", }) => {
|
|
|
3051
3060
|
}, children: [jsxRuntime.jsx(io5.IoReload, {}), " ", reloadButtonText] }));
|
|
3052
3061
|
};
|
|
3053
3062
|
|
|
3054
|
-
const FilterOptions = ({ column }) => {
|
|
3055
|
-
const { table } = useDataTableContext();
|
|
3056
|
-
const tableColumn = table.getColumn(column);
|
|
3057
|
-
const options = tableColumn?.columnDef.meta?.filterOptions ?? [];
|
|
3058
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: options.map((option) => {
|
|
3059
|
-
const selected = table.getColumn(column)?.getFilterValue() === option;
|
|
3060
|
-
const { label, value } = option;
|
|
3061
|
-
return (jsxRuntime.jsxs(react.Button, { size: "sm", onClick: () => {
|
|
3062
|
-
if (selected) {
|
|
3063
|
-
table.setColumnFilters((state) => {
|
|
3064
|
-
return state.filter((filter) => {
|
|
3065
|
-
return filter.id !== column;
|
|
3066
|
-
});
|
|
3067
|
-
});
|
|
3068
|
-
return;
|
|
3069
|
-
}
|
|
3070
|
-
table.getColumn(column)?.setFilterValue(value);
|
|
3071
|
-
}, variant: selected ? "solid" : "outline", display: "flex", gap: "0.25rem", children: [label, selected && jsxRuntime.jsx(md.MdClose, {})] }, option.value));
|
|
3072
|
-
}) }));
|
|
3073
|
-
};
|
|
3074
|
-
|
|
3075
3063
|
const TableFilterTags = () => {
|
|
3076
3064
|
const { table } = useDataTableContext();
|
|
3077
3065
|
return (jsxRuntime.jsx(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: table.getState().columnFilters.map(({ id, value }) => {
|
|
@@ -3083,12 +3071,18 @@ const TableFilterTags = () => {
|
|
|
3083
3071
|
}) }));
|
|
3084
3072
|
};
|
|
3085
3073
|
|
|
3086
|
-
const TableControls = ({ fitTableWidth = false, fitTableHeight = false, children = jsxRuntime.jsx(jsxRuntime.Fragment, {}), showGlobalFilter = false, showFilter = false, showFilterName = false, showFilterTags = false, showReload = false, showPagination = true, showPageSizeControl = true, showPageCountText = true, showView = true,
|
|
3087
|
-
const { tableLabel } = useDataTableContext();
|
|
3074
|
+
const TableControls = ({ fitTableWidth = false, fitTableHeight = false, children = jsxRuntime.jsx(jsxRuntime.Fragment, {}), showGlobalFilter = false, showFilter = false, showFilterName = false, showFilterTags = false, showReload = false, showPagination = true, showPageSizeControl = true, showPageCountText = true, showView = true, filterTagsOptions = [], extraItems = jsxRuntime.jsx(jsxRuntime.Fragment, {}), loading = false, hasError = false, gridProps = {}, }) => {
|
|
3075
|
+
const { tableLabel, table } = useDataTableContext();
|
|
3088
3076
|
const { rowCountText, hasErrorText } = tableLabel;
|
|
3089
|
-
return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", gap: "0.5rem", ...gridProps, children: [jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: 2, children: [jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", children: [jsxRuntime.jsx(react.Box, { children: showView && jsxRuntime.jsx(ViewDialog, { icon: jsxRuntime.jsx(md.MdOutlineViewColumn, {}) }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsxRuntime.jsx(react.Spinner, { size: "sm" }), hasError && (jsxRuntime.jsx(Tooltip, { content: hasErrorText, children: jsxRuntime.jsx(react.Icon, { as: bs.BsExclamationCircleFill, color: "red.400" }) })), showGlobalFilter && jsxRuntime.jsx(GlobalFilter, {}), showFilter && jsxRuntime.jsx(FilterDialog, {}), showReload && jsxRuntime.jsx(ReloadButton, {}), extraItems] })] }),
|
|
3090
|
-
const {
|
|
3091
|
-
|
|
3077
|
+
return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", gap: "0.5rem", ...gridProps, children: [jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: 2, children: [jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", children: [jsxRuntime.jsx(react.Box, { children: showView && jsxRuntime.jsx(ViewDialog, { icon: jsxRuntime.jsx(md.MdOutlineViewColumn, {}) }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsxRuntime.jsx(react.Spinner, { size: "sm" }), hasError && (jsxRuntime.jsx(Tooltip, { content: hasErrorText, children: jsxRuntime.jsx(react.Icon, { as: bs.BsExclamationCircleFill, color: "red.400" }) })), showGlobalFilter && jsxRuntime.jsx(GlobalFilter, {}), showFilter && jsxRuntime.jsx(FilterDialog, {}), showReload && jsxRuntime.jsx(ReloadButton, {}), extraItems] })] }), filterTagsOptions.length > 0 && (jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: "0.5rem", children: filterTagsOptions.map((option) => {
|
|
3078
|
+
const { column, options } = option;
|
|
3079
|
+
const tableColumn = table.getColumn(column);
|
|
3080
|
+
return (jsxRuntime.jsxs(react.Flex, { alignItems: "center", flexFlow: "wrap", gap: "0.5rem", children: [showFilterName && jsxRuntime.jsxs(react.Text, { children: [column, ":"] }), jsxRuntime.jsx(TagFilter, { availableTags: options.map((item) => item.value), selectedTags: tableColumn?.getFilterValue() ?? [], selectOne: true, onTagChange: (tags) => {
|
|
3081
|
+
if (tags.length === 0) {
|
|
3082
|
+
return tableColumn?.setFilterValue(undefined);
|
|
3083
|
+
}
|
|
3084
|
+
tableColumn?.setFilterValue(tags);
|
|
3085
|
+
} })] }, column));
|
|
3092
3086
|
}) })), showFilterTags && (jsxRuntime.jsx(react.Flex, { children: jsxRuntime.jsx(TableFilterTags, {}) }))] }), jsxRuntime.jsx(react.Grid, { overflow: "auto", bg: { base: "colorPalette.50", _dark: "colorPalette.950" }, children: children }), (showPageSizeControl || showPageCountText || showPagination) && (jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", children: [jsxRuntime.jsxs(react.Flex, { gap: "1rem", alignItems: "center", children: [showPageSizeControl && jsxRuntime.jsx(PageSizeControl, {}), showPageCountText && (jsxRuntime.jsxs(react.Flex, { children: [jsxRuntime.jsx(react.Text, { paddingRight: "0.5rem", children: rowCountText }), jsxRuntime.jsx(RowCountText, {})] }))] }), jsxRuntime.jsx(react.Box, { justifySelf: "end", children: showPagination && jsxRuntime.jsx(Pagination, {}) })] }))] }));
|
|
3093
3087
|
};
|
|
3094
3088
|
|
|
@@ -5613,7 +5607,6 @@ exports.EditSortingButton = EditSortingButton;
|
|
|
5613
5607
|
exports.EmptyState = EmptyState$1;
|
|
5614
5608
|
exports.ErrorAlert = ErrorAlert;
|
|
5615
5609
|
exports.FilterDialog = FilterDialog;
|
|
5616
|
-
exports.FilterOptions = FilterOptions;
|
|
5617
5610
|
exports.FormBody = FormBody;
|
|
5618
5611
|
exports.FormRoot = FormRoot;
|
|
5619
5612
|
exports.FormTitle = FormTitle;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Button as Button$1, AbsoluteCenter, Spinner, Span, IconButton, Portal, Dialog, Flex, Text, useDisclosure, DialogBackdrop, RadioGroup as RadioGroup$1, Grid, Box, Slider as Slider$1, HStack, For, Tag as Tag$1, Input, Menu, createRecipeContext, createContext as createContext$1, Pagination as Pagination$1, usePaginationContext, CheckboxCard as CheckboxCard$1, Image, EmptyState as EmptyState$2, VStack, Alert, Card, Tooltip as Tooltip$1,
|
|
2
|
+
import { Button as Button$1, AbsoluteCenter, Spinner, Span, IconButton, Portal, Dialog, Flex, Text, useDisclosure, DialogBackdrop, RadioGroup as RadioGroup$1, Grid, Box, Slider as Slider$1, HStack, For, Tag as Tag$1, Input, Menu, createRecipeContext, createContext as createContext$1, Pagination as Pagination$1, usePaginationContext, CheckboxCard as CheckboxCard$1, Image, EmptyState as EmptyState$2, VStack, Alert, Card, Group, InputElement, Tooltip as Tooltip$1, Icon, List, Table as Table$1, Checkbox as Checkbox$1, MenuRoot as MenuRoot$1, MenuTrigger as MenuTrigger$1, Accordion, Field as Field$1, Popover, NumberInput, Show, RadioCard, CheckboxGroup, Textarea, Center, Heading } from '@chakra-ui/react';
|
|
3
3
|
import { AiOutlineColumnWidth } from 'react-icons/ai';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { createContext, useContext, useState, useEffect, useRef } from 'react';
|
|
6
6
|
import { LuX, LuCheck, LuChevronRight, LuChevronDown } from 'react-icons/lu';
|
|
7
|
-
import { MdOutlineSort, MdFilterAlt, MdSearch,
|
|
7
|
+
import { MdOutlineSort, MdFilterAlt, MdSearch, MdOutlineViewColumn, MdFilterListAlt, MdPushPin, MdCancel, MdClear, MdOutlineChecklist, MdDateRange } from 'react-icons/md';
|
|
8
8
|
import { FaUpDown, FaGripLinesVertical } from 'react-icons/fa6';
|
|
9
9
|
import { BiDownArrow, BiUpArrow, BiError } from 'react-icons/bi';
|
|
10
10
|
import { CgClose, CgTrash } from 'react-icons/cg';
|
|
@@ -330,8 +330,17 @@ const Tag = React.forwardRef(function Tag(props, ref) {
|
|
|
330
330
|
return (jsxs(Tag$1.Root, { ref: ref, ...rest, children: [startElement && (jsx(Tag$1.StartElement, { children: startElement })), jsx(Tag$1.Label, { children: children }), endElement && (jsx(Tag$1.EndElement, { children: endElement })), closable && (jsx(Tag$1.EndElement, { children: jsx(Tag$1.CloseTrigger, { onClick: onClose }) }))] }));
|
|
331
331
|
});
|
|
332
332
|
|
|
333
|
-
const TagFilter = ({ availableTags, selectedTags, onTagChange, }) => {
|
|
333
|
+
const TagFilter = ({ availableTags, selectedTags, onTagChange, selectOne = false, }) => {
|
|
334
334
|
const toggleTag = (tag) => {
|
|
335
|
+
if (selectOne) {
|
|
336
|
+
if (selectedTags.includes(tag)) {
|
|
337
|
+
onTagChange([]);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
onTagChange([tag]);
|
|
341
|
+
}
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
335
344
|
if (selectedTags.includes(tag)) {
|
|
336
345
|
onTagChange(selectedTags.filter((t) => t !== tag));
|
|
337
346
|
}
|
|
@@ -2982,13 +2991,6 @@ function DataTableServer({ columns, enableRowSelection = true, enableMultiRowSel
|
|
|
2982
2991
|
}, children: jsx(DataTableServerContext.Provider, { value: { url, query }, children: children }) }));
|
|
2983
2992
|
}
|
|
2984
2993
|
|
|
2985
|
-
const Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
2986
|
-
const { showArrow, children, disabled, portalled, content, contentProps, portalRef, ...rest } = props;
|
|
2987
|
-
if (disabled)
|
|
2988
|
-
return children;
|
|
2989
|
-
return (jsxs(Tooltip$1.Root, { ...rest, children: [jsx(Tooltip$1.Trigger, { asChild: true, children: children }), jsx(Portal, { disabled: !portalled, container: portalRef, children: jsx(Tooltip$1.Positioner, { children: jsxs(Tooltip$1.Content, { ref: ref, ...contentProps, children: [showArrow && (jsx(Tooltip$1.Arrow, { children: jsx(Tooltip$1.ArrowTip, {}) })), content] }) }) })] }));
|
|
2990
|
-
});
|
|
2991
|
-
|
|
2992
2994
|
const InputGroup = React.forwardRef(function InputGroup(props, ref) {
|
|
2993
2995
|
const { startElement, startElementProps, endElement, endElementProps, children, startOffset = "6px", endOffset = "6px", ...rest } = props;
|
|
2994
2996
|
return (jsxs(Group, { ref: ref, ...rest, children: [startElement && (jsx(InputElement, { pointerEvents: "none", ...startElementProps, children: startElement })), React.cloneElement(children, {
|
|
@@ -3016,6 +3018,13 @@ const GlobalFilter = () => {
|
|
|
3016
3018
|
} }) }) }));
|
|
3017
3019
|
};
|
|
3018
3020
|
|
|
3021
|
+
const Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
3022
|
+
const { showArrow, children, disabled, portalled, content, contentProps, portalRef, ...rest } = props;
|
|
3023
|
+
if (disabled)
|
|
3024
|
+
return children;
|
|
3025
|
+
return (jsxs(Tooltip$1.Root, { ...rest, children: [jsx(Tooltip$1.Trigger, { asChild: true, children: children }), jsx(Portal, { disabled: !portalled, container: portalRef, children: jsx(Tooltip$1.Positioner, { children: jsxs(Tooltip$1.Content, { ref: ref, ...contentProps, children: [showArrow && (jsx(Tooltip$1.Arrow, { children: jsx(Tooltip$1.ArrowTip, {}) })), content] }) }) })] }));
|
|
3026
|
+
});
|
|
3027
|
+
|
|
3019
3028
|
const ReloadButton = ({ variant = "icon", }) => {
|
|
3020
3029
|
const { url } = useDataTableServerContext();
|
|
3021
3030
|
const queryClient = useQueryClient();
|
|
@@ -3031,27 +3040,6 @@ const ReloadButton = ({ variant = "icon", }) => {
|
|
|
3031
3040
|
}, children: [jsx(IoReload, {}), " ", reloadButtonText] }));
|
|
3032
3041
|
};
|
|
3033
3042
|
|
|
3034
|
-
const FilterOptions = ({ column }) => {
|
|
3035
|
-
const { table } = useDataTableContext();
|
|
3036
|
-
const tableColumn = table.getColumn(column);
|
|
3037
|
-
const options = tableColumn?.columnDef.meta?.filterOptions ?? [];
|
|
3038
|
-
return (jsx(Fragment, { children: options.map((option) => {
|
|
3039
|
-
const selected = table.getColumn(column)?.getFilterValue() === option;
|
|
3040
|
-
const { label, value } = option;
|
|
3041
|
-
return (jsxs(Button$1, { size: "sm", onClick: () => {
|
|
3042
|
-
if (selected) {
|
|
3043
|
-
table.setColumnFilters((state) => {
|
|
3044
|
-
return state.filter((filter) => {
|
|
3045
|
-
return filter.id !== column;
|
|
3046
|
-
});
|
|
3047
|
-
});
|
|
3048
|
-
return;
|
|
3049
|
-
}
|
|
3050
|
-
table.getColumn(column)?.setFilterValue(value);
|
|
3051
|
-
}, variant: selected ? "solid" : "outline", display: "flex", gap: "0.25rem", children: [label, selected && jsx(MdClose, {})] }, option.value));
|
|
3052
|
-
}) }));
|
|
3053
|
-
};
|
|
3054
|
-
|
|
3055
3043
|
const TableFilterTags = () => {
|
|
3056
3044
|
const { table } = useDataTableContext();
|
|
3057
3045
|
return (jsx(Flex, { gap: "0.5rem", flexFlow: "wrap", children: table.getState().columnFilters.map(({ id, value }) => {
|
|
@@ -3063,12 +3051,18 @@ const TableFilterTags = () => {
|
|
|
3063
3051
|
}) }));
|
|
3064
3052
|
};
|
|
3065
3053
|
|
|
3066
|
-
const TableControls = ({ fitTableWidth = false, fitTableHeight = false, children = jsx(Fragment, {}), showGlobalFilter = false, showFilter = false, showFilterName = false, showFilterTags = false, showReload = false, showPagination = true, showPageSizeControl = true, showPageCountText = true, showView = true,
|
|
3067
|
-
const { tableLabel } = useDataTableContext();
|
|
3054
|
+
const TableControls = ({ fitTableWidth = false, fitTableHeight = false, children = jsx(Fragment, {}), showGlobalFilter = false, showFilter = false, showFilterName = false, showFilterTags = false, showReload = false, showPagination = true, showPageSizeControl = true, showPageCountText = true, showView = true, filterTagsOptions = [], extraItems = jsx(Fragment, {}), loading = false, hasError = false, gridProps = {}, }) => {
|
|
3055
|
+
const { tableLabel, table } = useDataTableContext();
|
|
3068
3056
|
const { rowCountText, hasErrorText } = tableLabel;
|
|
3069
|
-
return (jsxs(Grid, { templateRows: "auto 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", gap: "0.5rem", ...gridProps, children: [jsxs(Flex, { flexFlow: "column", gap: 2, children: [jsxs(Flex, { justifyContent: "space-between", children: [jsx(Box, { children: showView && jsx(ViewDialog, { icon: jsx(MdOutlineViewColumn, {}) }) }), jsxs(Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsx(Spinner, { size: "sm" }), hasError && (jsx(Tooltip, { content: hasErrorText, children: jsx(Icon, { as: BsExclamationCircleFill, color: "red.400" }) })), showGlobalFilter && jsx(GlobalFilter, {}), showFilter && jsx(FilterDialog, {}), showReload && jsx(ReloadButton, {}), extraItems] })] }),
|
|
3070
|
-
const {
|
|
3071
|
-
|
|
3057
|
+
return (jsxs(Grid, { templateRows: "auto 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", gap: "0.5rem", ...gridProps, children: [jsxs(Flex, { flexFlow: "column", gap: 2, children: [jsxs(Flex, { justifyContent: "space-between", children: [jsx(Box, { children: showView && jsx(ViewDialog, { icon: jsx(MdOutlineViewColumn, {}) }) }), jsxs(Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsx(Spinner, { size: "sm" }), hasError && (jsx(Tooltip, { content: hasErrorText, children: jsx(Icon, { as: BsExclamationCircleFill, color: "red.400" }) })), showGlobalFilter && jsx(GlobalFilter, {}), showFilter && jsx(FilterDialog, {}), showReload && jsx(ReloadButton, {}), extraItems] })] }), filterTagsOptions.length > 0 && (jsx(Flex, { flexFlow: "column", gap: "0.5rem", children: filterTagsOptions.map((option) => {
|
|
3058
|
+
const { column, options } = option;
|
|
3059
|
+
const tableColumn = table.getColumn(column);
|
|
3060
|
+
return (jsxs(Flex, { alignItems: "center", flexFlow: "wrap", gap: "0.5rem", children: [showFilterName && jsxs(Text, { children: [column, ":"] }), jsx(TagFilter, { availableTags: options.map((item) => item.value), selectedTags: tableColumn?.getFilterValue() ?? [], selectOne: true, onTagChange: (tags) => {
|
|
3061
|
+
if (tags.length === 0) {
|
|
3062
|
+
return tableColumn?.setFilterValue(undefined);
|
|
3063
|
+
}
|
|
3064
|
+
tableColumn?.setFilterValue(tags);
|
|
3065
|
+
} })] }, column));
|
|
3072
3066
|
}) })), showFilterTags && (jsx(Flex, { children: jsx(TableFilterTags, {}) }))] }), jsx(Grid, { overflow: "auto", bg: { base: "colorPalette.50", _dark: "colorPalette.950" }, children: children }), (showPageSizeControl || showPageCountText || showPagination) && (jsxs(Flex, { justifyContent: "space-between", children: [jsxs(Flex, { gap: "1rem", alignItems: "center", children: [showPageSizeControl && jsx(PageSizeControl, {}), showPageCountText && (jsxs(Flex, { children: [jsx(Text, { paddingRight: "0.5rem", children: rowCountText }), jsx(RowCountText, {})] }))] }), jsx(Box, { justifySelf: "end", children: showPagination && jsx(Pagination, {}) })] }))] }));
|
|
3073
3067
|
};
|
|
3074
3068
|
|
|
@@ -5581,4 +5575,4 @@ const getMultiDates = ({ selected, selectedDate, selectedDates, selectable, }) =
|
|
|
5581
5575
|
}
|
|
5582
5576
|
};
|
|
5583
5577
|
|
|
5584
|
-
export { CardHeader, DataDisplay, DataTable, DataTableServer, DefaultCardTitle, DefaultForm, DefaultTable, DensityToggleButton, EditSortingButton, EmptyState$1 as EmptyState, ErrorAlert, FilterDialog,
|
|
5578
|
+
export { CardHeader, DataDisplay, DataTable, DataTableServer, DefaultCardTitle, DefaultForm, DefaultTable, DensityToggleButton, EditSortingButton, EmptyState$1 as EmptyState, ErrorAlert, FilterDialog, FormBody, FormRoot, FormTitle, GlobalFilter, PageSizeControl, Pagination, RecordDisplay, ReloadButton, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, RowCountText, Table, TableBody, TableCardContainer, TableCards, TableComponent, TableControls, TableDataDisplay, TableFilter, TableFilterTags, TableFooter, TableHeader, TableLoadingComponent, TableSelector, TableSorter, TableViewer, TextCell, ViewDialog, getColumns, getMultiDates, getRangeDates, idPickerSanityCheck, useDataTable, useDataTableContext, useDataTableServer, useForm, widthSanityCheck };
|
|
@@ -50,7 +50,7 @@ export interface DataTableProps<TData = unknown> {
|
|
|
50
50
|
setDensity: OnChangeFn<DensityState>;
|
|
51
51
|
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
52
52
|
translate: UseTranslationResponse<any, any>;
|
|
53
|
-
tableLabel
|
|
53
|
+
tableLabel?: DataTableLabel;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* DataTable will create a context to hold all values to
|
|
@@ -14,13 +14,16 @@ export interface TableControlsProps {
|
|
|
14
14
|
showPageSizeControl?: boolean;
|
|
15
15
|
showPageCountText?: boolean;
|
|
16
16
|
showView?: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
filterTagsOptions?: {
|
|
18
|
+
column: string;
|
|
19
|
+
options: {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}[];
|
|
20
23
|
}[];
|
|
21
24
|
extraItems?: ReactNode;
|
|
22
25
|
loading?: boolean;
|
|
23
26
|
hasError?: boolean;
|
|
24
27
|
gridProps?: GridProps;
|
|
25
28
|
}
|
|
26
|
-
export declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView,
|
|
29
|
+
export declare const TableControls: ({ fitTableWidth, fitTableHeight, children, showGlobalFilter, showFilter, showFilterName, showFilterTags, showReload, showPagination, showPageSizeControl, showPageCountText, showView, filterTagsOptions, extraItems, loading, hasError, gridProps, }: TableControlsProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -110,7 +110,6 @@ export * from "./components/DataTable/useDataTable";
|
|
|
110
110
|
export * from "./components/DataTable/useDataTableServer";
|
|
111
111
|
export * from "./components/DataTable/utils/getColumns";
|
|
112
112
|
export * from "./components/DataTable/display/TableDataDisplay";
|
|
113
|
-
export * from "./components/Filter/FilterOptions";
|
|
114
113
|
export * from "./components/Filter/GlobalFilter";
|
|
115
114
|
export * from "./components/Form/components/core/DefaultForm";
|
|
116
115
|
export * from "./components/Form/components/core/FormRoot";
|