@bsol-oss/react-datatable5 12.0.0-beta.7 → 12.0.0-beta.8
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 +3 -1
- package/dist/index.js +47 -0
- package/dist/index.mjs +47 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -441,6 +441,8 @@ interface GetColumnsConfigs<K extends RowData> {
|
|
|
441
441
|
declare const widthSanityCheck: <K extends unknown>(widthList: number[], ignoreList: K[], properties: { [key in K as string]?: object | undefined; }) => void;
|
|
442
442
|
declare const getColumns: <TData extends unknown>({ schema, include, ignore, width, meta, defaultWidth, translate, }: GetColumnsConfigs<TData>) => ColumnDef<TData>[];
|
|
443
443
|
|
|
444
|
+
declare const TableDataDisplay: () => react_jsx_runtime.JSX.Element;
|
|
445
|
+
|
|
444
446
|
interface FilterOptionsProps {
|
|
445
447
|
column: string;
|
|
446
448
|
}
|
|
@@ -612,4 +614,4 @@ declare module "@tanstack/react-table" {
|
|
|
612
614
|
}
|
|
613
615
|
}
|
|
614
616
|
|
|
615
|
-
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, FilterOptions, type FilterOptionsProps, 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, type ResetFilteringButtonProps, ResetSelectionButton, type ResetSelectionButtonProps, ResetSortingButton, type ResetSortingButtonProps, type Result, RowCountText, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableFilter, TableFilterTags, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, 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 };
|
|
617
|
+
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, FilterOptions, type FilterOptionsProps, 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, type ResetFilteringButtonProps, ResetSelectionButton, type ResetSelectionButtonProps, ResetSortingButton, type ResetSortingButtonProps, type Result, RowCountText, Table, TableBody, type TableBodyProps, TableCardContainer, type TableCardContainerProps, TableCards, type TableCardsProps, TableComponent, TableControls, type TableControlsProps, TableDataDisplay, TableFilter, TableFilterTags, TableFooter, type TableFooterProps, TableHeader, type TableHeaderProps, 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
|
@@ -3518,6 +3518,52 @@ const getColumns = ({ schema, include = [], ignore = [], width = [], meta = {},
|
|
|
3518
3518
|
return columns;
|
|
3519
3519
|
};
|
|
3520
3520
|
|
|
3521
|
+
const TableDataDisplay = () => {
|
|
3522
|
+
const { table, columns, translate } = useDataTableContext();
|
|
3523
|
+
const { query } = useDataTableServerContext();
|
|
3524
|
+
const { data } = query;
|
|
3525
|
+
const columnDef = table._getColumnDefs();
|
|
3526
|
+
console.log(columnDef, "glp");
|
|
3527
|
+
console.log(columnDef, columns, table.getState().columnOrder, data, "glp");
|
|
3528
|
+
const columnsMap = Object.fromEntries(columns.map((def) => {
|
|
3529
|
+
return [def.accessorKey, def];
|
|
3530
|
+
}));
|
|
3531
|
+
const columnHeaders = Object.keys(columnsMap);
|
|
3532
|
+
const columnWidths = columns
|
|
3533
|
+
.map(({ size }) => {
|
|
3534
|
+
if (!!size === false) {
|
|
3535
|
+
return "1fr";
|
|
3536
|
+
}
|
|
3537
|
+
return `${size}px`;
|
|
3538
|
+
})
|
|
3539
|
+
.join(" ");
|
|
3540
|
+
console.log({ columnWidths }, "hadfg");
|
|
3541
|
+
const cellProps = {
|
|
3542
|
+
flex: "1 0 0%",
|
|
3543
|
+
overflow: "auto",
|
|
3544
|
+
paddingX: "2",
|
|
3545
|
+
py: "1",
|
|
3546
|
+
borderBottomColor: { base: "colorPalette.200", _dark: "colorPalette.800" },
|
|
3547
|
+
borderBottomWidth: "1px",
|
|
3548
|
+
};
|
|
3549
|
+
return (jsxRuntime.jsxs(react.Grid, { templateColumns: `${columnWidths}`, overflow: "auto", borderWidth: "1px", borderColor: { base: "colorPalette.200", _dark: "colorPalette.800" }, children: [jsxRuntime.jsx(react.Grid, { templateColumns: `${columnWidths}`, column: `1/span ${columns.length}`, bg: { base: "colorPalette.200", _dark: "colorPalette.800" }, children: columnHeaders.map((header) => {
|
|
3550
|
+
return (jsxRuntime.jsx(react.Box, { flex: "1 0 0%", paddingX: "2", py: "1", children: translate.t(`column_header.${header}`) }));
|
|
3551
|
+
}) }), data?.data.map((record) => {
|
|
3552
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: columnHeaders.map((header) => {
|
|
3553
|
+
if (!!record === false) {
|
|
3554
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3555
|
+
}
|
|
3556
|
+
if (!!record[header] === false) {
|
|
3557
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3558
|
+
}
|
|
3559
|
+
if (typeof record[header] === "object") {
|
|
3560
|
+
return (jsxRuntime.jsx(react.Box, { ...cellProps, children: jsxRuntime.jsx(RecordDisplay, { object: record[header] }) }));
|
|
3561
|
+
}
|
|
3562
|
+
return jsxRuntime.jsx(react.Box, { ...cellProps, children: record[header] ?? "" });
|
|
3563
|
+
}) }));
|
|
3564
|
+
})] }));
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3521
3567
|
const AccordionItemTrigger = React__namespace.forwardRef(function AccordionItemTrigger(props, ref) {
|
|
3522
3568
|
const { children, indicatorPlacement = "end", ...rest } = props;
|
|
3523
3569
|
return (jsxRuntime.jsxs(react.Accordion.ItemTrigger, { ...rest, ref: ref, children: [indicatorPlacement === "start" && (jsxRuntime.jsx(react.Accordion.ItemIndicator, { rotate: { base: "-90deg", _open: "0deg" }, children: jsxRuntime.jsx(lu.LuChevronDown, {}) })), jsxRuntime.jsx(react.HStack, { gap: "4", flex: "1", textAlign: "start", width: "full", children: children }), indicatorPlacement === "end" && (jsxRuntime.jsx(react.Accordion.ItemIndicator, { children: jsxRuntime.jsx(lu.LuChevronDown, {}) }))] }));
|
|
@@ -5135,6 +5181,7 @@ exports.TableCardContainer = TableCardContainer;
|
|
|
5135
5181
|
exports.TableCards = TableCards;
|
|
5136
5182
|
exports.TableComponent = TableComponent;
|
|
5137
5183
|
exports.TableControls = TableControls;
|
|
5184
|
+
exports.TableDataDisplay = TableDataDisplay;
|
|
5138
5185
|
exports.TableFilter = TableFilter;
|
|
5139
5186
|
exports.TableFilterTags = TableFilterTags;
|
|
5140
5187
|
exports.TableFooter = TableFooter;
|
package/dist/index.mjs
CHANGED
|
@@ -3498,6 +3498,52 @@ const getColumns = ({ schema, include = [], ignore = [], width = [], meta = {},
|
|
|
3498
3498
|
return columns;
|
|
3499
3499
|
};
|
|
3500
3500
|
|
|
3501
|
+
const TableDataDisplay = () => {
|
|
3502
|
+
const { table, columns, translate } = useDataTableContext();
|
|
3503
|
+
const { query } = useDataTableServerContext();
|
|
3504
|
+
const { data } = query;
|
|
3505
|
+
const columnDef = table._getColumnDefs();
|
|
3506
|
+
console.log(columnDef, "glp");
|
|
3507
|
+
console.log(columnDef, columns, table.getState().columnOrder, data, "glp");
|
|
3508
|
+
const columnsMap = Object.fromEntries(columns.map((def) => {
|
|
3509
|
+
return [def.accessorKey, def];
|
|
3510
|
+
}));
|
|
3511
|
+
const columnHeaders = Object.keys(columnsMap);
|
|
3512
|
+
const columnWidths = columns
|
|
3513
|
+
.map(({ size }) => {
|
|
3514
|
+
if (!!size === false) {
|
|
3515
|
+
return "1fr";
|
|
3516
|
+
}
|
|
3517
|
+
return `${size}px`;
|
|
3518
|
+
})
|
|
3519
|
+
.join(" ");
|
|
3520
|
+
console.log({ columnWidths }, "hadfg");
|
|
3521
|
+
const cellProps = {
|
|
3522
|
+
flex: "1 0 0%",
|
|
3523
|
+
overflow: "auto",
|
|
3524
|
+
paddingX: "2",
|
|
3525
|
+
py: "1",
|
|
3526
|
+
borderBottomColor: { base: "colorPalette.200", _dark: "colorPalette.800" },
|
|
3527
|
+
borderBottomWidth: "1px",
|
|
3528
|
+
};
|
|
3529
|
+
return (jsxs(Grid, { templateColumns: `${columnWidths}`, overflow: "auto", borderWidth: "1px", borderColor: { base: "colorPalette.200", _dark: "colorPalette.800" }, children: [jsx(Grid, { templateColumns: `${columnWidths}`, column: `1/span ${columns.length}`, bg: { base: "colorPalette.200", _dark: "colorPalette.800" }, children: columnHeaders.map((header) => {
|
|
3530
|
+
return (jsx(Box, { flex: "1 0 0%", paddingX: "2", py: "1", children: translate.t(`column_header.${header}`) }));
|
|
3531
|
+
}) }), data?.data.map((record) => {
|
|
3532
|
+
return (jsx(Fragment, { children: columnHeaders.map((header) => {
|
|
3533
|
+
if (!!record === false) {
|
|
3534
|
+
return (jsx(Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3535
|
+
}
|
|
3536
|
+
if (!!record[header] === false) {
|
|
3537
|
+
return (jsx(Box, { ...cellProps, children: translate.t(`column_cell.placeholder`) }));
|
|
3538
|
+
}
|
|
3539
|
+
if (typeof record[header] === "object") {
|
|
3540
|
+
return (jsx(Box, { ...cellProps, children: jsx(RecordDisplay, { object: record[header] }) }));
|
|
3541
|
+
}
|
|
3542
|
+
return jsx(Box, { ...cellProps, children: record[header] ?? "" });
|
|
3543
|
+
}) }));
|
|
3544
|
+
})] }));
|
|
3545
|
+
};
|
|
3546
|
+
|
|
3501
3547
|
const AccordionItemTrigger = React.forwardRef(function AccordionItemTrigger(props, ref) {
|
|
3502
3548
|
const { children, indicatorPlacement = "end", ...rest } = props;
|
|
3503
3549
|
return (jsxs(Accordion.ItemTrigger, { ...rest, ref: ref, children: [indicatorPlacement === "start" && (jsx(Accordion.ItemIndicator, { rotate: { base: "-90deg", _open: "0deg" }, children: jsx(LuChevronDown, {}) })), jsx(HStack, { gap: "4", flex: "1", textAlign: "start", width: "full", children: children }), indicatorPlacement === "end" && (jsx(Accordion.ItemIndicator, { children: jsx(LuChevronDown, {}) }))] }));
|
|
@@ -5084,4 +5130,4 @@ const getMultiDates = ({ selected, selectedDate, selectedDates, selectable, }) =
|
|
|
5084
5130
|
}
|
|
5085
5131
|
};
|
|
5086
5132
|
|
|
5087
|
-
export { CardHeader, DataDisplay, DataTable, DataTableServer, DefaultCardTitle, DefaultForm, DefaultTable, DensityToggleButton, EditSortingButton, EmptyState$1 as EmptyState, ErrorAlert, FilterDialog, FilterOptions, FormBody, FormRoot, FormTitle, GlobalFilter, PageSizeControl, Pagination, RecordDisplay, ReloadButton, ResetFilteringButton, ResetSelectionButton, ResetSortingButton, RowCountText, Table, TableBody, TableCardContainer, TableCards, TableComponent, TableControls, TableFilter, TableFilterTags, TableFooter, TableHeader, TableLoadingComponent, TableSelector, TableSorter, TableViewer, TextCell, ViewDialog, getColumns, getMultiDates, getRangeDates, idPickerSanityCheck, useDataTable, useDataTableContext, useDataTableServer, useForm, widthSanityCheck };
|
|
5133
|
+
export { CardHeader, DataDisplay, DataTable, DataTableServer, DefaultCardTitle, DefaultForm, DefaultTable, DensityToggleButton, EditSortingButton, EmptyState$1 as EmptyState, ErrorAlert, FilterDialog, FilterOptions, 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 };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export * from "./components/DataTable/display/TextCell";
|
|
|
94
94
|
export * from "./components/DataTable/useDataTable";
|
|
95
95
|
export * from "./components/DataTable/useDataTableServer";
|
|
96
96
|
export * from "./components/DataTable/utils/getColumns";
|
|
97
|
+
export * from "./components/DataTable/display/TableDataDisplay";
|
|
97
98
|
export * from "./components/Filter/FilterOptions";
|
|
98
99
|
export * from "./components/Filter/GlobalFilter";
|
|
99
100
|
export * from "./components/Form/components/core/DefaultForm";
|