@geneui/components 3.0.0-next-26b248e-20042026 → 3.0.0-next-e10ab23-21042026
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/{DataTable-259ce886.js → DataTable-86d964f8.js} +2 -2
- package/DataTable.js +14 -7
- package/SegmentedControl.js +1 -1
- package/components/organisms/DataTable/DataTable.d.ts +11 -2
- package/components/organisms/DataTable/TableBody/Row/TableRow.d.ts +7 -3
- package/components/organisms/DataTable/TableBody/TableBody.d.ts +6 -2
- package/components/organisms/DataTable/types.d.ts +8 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -3083,7 +3083,7 @@ function useReactTable(options) {
|
|
|
3083
3083
|
return tableRef.current;
|
|
3084
3084
|
}
|
|
3085
3085
|
|
|
3086
|
-
var css_248z$6 = ".tableBodyCell{border-bottom:var(--guit-ref-border-width-thin) solid var(--guit-sem-color-border-neutral-1);height:4.4rem;padding-block:var(--guit-ref-spacing-medium);padding-inline:var(--guit-ref-spacing-large);vertical-align:middle}.tableBodyCell:not(:last-child){-webkit-border-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2)}.tableBodyCell__content{align-items:center;display:flex;gap:var(--guit-ref-spacing-3xsmall)}.tableBodyCell__text{-webkit-line-clamp:4;-webkit-box-orient:vertical;color:var(--guit-sem-color-foreground-neutral-2);display:-webkit-box;overflow:hidden}";
|
|
3086
|
+
var css_248z$6 = ".tableBodyCell{border-bottom:var(--guit-ref-border-width-thin) solid var(--guit-sem-color-border-neutral-1);height:4.4rem;padding-block:var(--guit-ref-spacing-medium);padding-inline:var(--guit-ref-spacing-large);vertical-align:middle}.tableBodyCell:not(:last-child){-webkit-border-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);border-inline-end:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2)}.tableBodyCell__content{align-items:center;display:flex;gap:var(--guit-ref-spacing-3xsmall)}.tableBodyCell__text{-webkit-line-clamp:4;-webkit-box-orient:vertical;color:var(--guit-sem-color-foreground-neutral-2);display:-webkit-box;overflow:hidden}.tableBodyCell:hover .tableRow__actionsWrapper,.tableBodyCell_active .tableRow__actionsWrapper{opacity:1}";
|
|
3087
3087
|
styleInject(css_248z$6);
|
|
3088
3088
|
|
|
3089
3089
|
/**
|
|
@@ -3117,7 +3117,7 @@ const MemoizedTableBodyCell = memo$1(TableBodyCell, areCellsEqual);
|
|
|
3117
3117
|
var css_248z$5 = ".tableExpandedRow{background-color:var(--guit-sem-color-background-neutral-2);display:table-row;position:relative;width:100%}.tableExpandedRow .tableExpandedCell{padding:var(--guit-ref-spacing-large)}";
|
|
3118
3118
|
styleInject(css_248z$5);
|
|
3119
3119
|
|
|
3120
|
-
var css_248z$4 = ".tableRow{display:table-row;position:relative;width:100%}.tableRow:active{background-color:var(--guit-sem-color-background-neutral-3-pressed)}.tableRow:nth-child(2n){background-color:var(--guit-sem-color-background-neutral-3)}.tableRow:nth-child(odd){background-color:var(--guit-sem-color-background-neutral-1)}@media screen and (hover:hover){.tableRow:hover{background-color:var(--guit-sem-color-background-neutral-3-hover)}}";
|
|
3120
|
+
var css_248z$4 = ".tableRow{display:table-row;position:relative;width:100%}.tableRow:active{background-color:var(--guit-sem-color-background-neutral-3-pressed)}.tableRow:nth-child(2n){background-color:var(--guit-sem-color-background-neutral-3)}.tableRow:nth-child(odd){background-color:var(--guit-sem-color-background-neutral-1)}@media screen and (hover:hover){.tableRow:hover{background-color:var(--guit-sem-color-background-neutral-3-hover)}.tableRow:hover .tableRow__actionsWrapper{opacity:1;pointer-events:auto;visibility:visible}}.tableRow__actionsWrapper{border-bottom:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-1);inset-inline-end:0;opacity:0;pointer-events:none;position:-webkit-sticky;position:sticky;top:0;visibility:hidden;white-space:nowrap;width:1%;z-index:2}.tableRow__actions{align-items:center;background-color:var(--guit-sem-color-background-neutral-3-hover);column-gap:var(--guit-ref-spacing-3xsmall);display:flex;inset-block:0;inset-inline-end:0;padding:var(--guit-ref-spacing-small) var(--guit-ref-spacing-large);position:absolute}.tableRow__actions:after{content:\"\";inset-block:0;pointer-events:none;position:absolute;width:.4rem}[dir=ltr] .tableRow__actions:after{background:linear-gradient(to left,var(--guit-sem-color-raised-top-rgba),#0000);right:100%}[dir=rtl] .tableRow__actions:after{background:linear-gradient(to right,var(--guit-sem-color-raised-top-rgba),#0000);left:100%}";
|
|
3121
3121
|
styleInject(css_248z$4);
|
|
3122
3122
|
|
|
3123
3123
|
var css_248z$3 = ".tableBody{display:table-row-group;width:100%}.tableBody__emptyBody{align-items:center;display:flex;inset:0;justify-content:center;position:fixed}";
|
package/DataTable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React__default, { useRef, useEffect, useMemo, useState, useCallback } from 'react';
|
|
2
|
-
import { M as MemoizedTableBodyCell, f as flexRender, u as useReactTable, g as getCoreRowModel, a as getPaginationRowModel, b as getExpandedRowModel } from './DataTable-
|
|
2
|
+
import { M as MemoizedTableBodyCell, f as flexRender, u as useReactTable, g as getCoreRowModel, a as getPaginationRowModel, b as getExpandedRowModel } from './DataTable-86d964f8.js';
|
|
3
3
|
import { c as classNames } from './index-ce02421b.js';
|
|
4
4
|
import Scrollbar from './Scrollbar.js';
|
|
5
5
|
import Pagination from './Pagination.js';
|
|
@@ -166,6 +166,9 @@ const TableExpandedRow = ({ colspan, children }) => {
|
|
|
166
166
|
React__default.createElement("td", { colSpan: colspan, className: "tableExpandedCell" }, children)));
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
const RowActionsWrapper = ({ title, children }) => {
|
|
170
|
+
return title ? React__default.createElement(Tooltip, { text: title }, children) : children;
|
|
171
|
+
};
|
|
169
172
|
/**
|
|
170
173
|
* Renders an individual table row (`<tr>`).
|
|
171
174
|
* * This component iterates through all visible cells for the provided row instance
|
|
@@ -175,11 +178,15 @@ const TableExpandedRow = ({ colspan, children }) => {
|
|
|
175
178
|
* @param props - The properties for the component.
|
|
176
179
|
* @returns A table row element containing its respective rendered cells.
|
|
177
180
|
*/
|
|
178
|
-
const TableRow = ({ row }) => {
|
|
181
|
+
const TableRow = ({ row, rowActions }) => {
|
|
179
182
|
const { expandedRow } = row.original;
|
|
180
183
|
const isRowExpanded = row.getIsExpanded() && expandedRow;
|
|
181
184
|
return (React__default.createElement(React__default.Fragment, null,
|
|
182
|
-
React__default.createElement("tr", { className: "tableRow" },
|
|
185
|
+
React__default.createElement("tr", { className: "tableRow" },
|
|
186
|
+
row.getVisibleCells().map((cell) => (React__default.createElement(MemoizedTableBodyCell, { key: cell.id, cell: cell }))),
|
|
187
|
+
(rowActions === null || rowActions === void 0 ? void 0 : rowActions.length) ? (React__default.createElement("td", { className: "tableRow__actionsWrapper" },
|
|
188
|
+
React__default.createElement("div", { className: "tableRow__actions" }, rowActions.map(({ Icon, title, onClick, disabled }, index) => (React__default.createElement(RowActionsWrapper, { key: `action-${title !== null && title !== void 0 ? title : index}`, title: title },
|
|
189
|
+
React__default.createElement(Button, { appearance: "secondary", layout: "text", size: "small", Icon: Icon, disabled: disabled, onClick: onClick }))))))) : null),
|
|
183
190
|
isRowExpanded && React__default.createElement(TableExpandedRow, { colspan: row.getVisibleCells().length }, expandedRow)));
|
|
184
191
|
};
|
|
185
192
|
|
|
@@ -201,7 +208,7 @@ const TableEmptyDataWrapper = ({ children }) => (React__default.createElement("t
|
|
|
201
208
|
* @param props - The properties for the component.
|
|
202
209
|
* @returns The table body element, or a fallback UI (loader/empty state) depending on the data.
|
|
203
210
|
*/
|
|
204
|
-
const TableBody = ({ rows, loading, loadingText, noDataTexts, noDataAvailableActions }) => {
|
|
211
|
+
const TableBody = ({ rows, loading, loadingText, noDataTexts, noDataAvailableActions, rowActions }) => {
|
|
205
212
|
if (loading) {
|
|
206
213
|
return (React__default.createElement(TableEmptyDataWrapper, null,
|
|
207
214
|
React__default.createElement(Loader, { size: "large", text: loadingText, textPosition: "below" })));
|
|
@@ -210,7 +217,7 @@ const TableBody = ({ rows, loading, loadingText, noDataTexts, noDataAvailableAct
|
|
|
210
217
|
return (React__default.createElement(TableEmptyDataWrapper, null,
|
|
211
218
|
React__default.createElement(Empty, { appearance: "noData", title: noDataTexts === null || noDataTexts === void 0 ? void 0 : noDataTexts.noDataAvailableTitle, description: noDataTexts === null || noDataTexts === void 0 ? void 0 : noDataTexts.noDataAvailableText, actions: noDataAvailableActions })));
|
|
212
219
|
}
|
|
213
|
-
return (React__default.createElement("tbody", { className: "tableBody" }, rows.map((row) => (React__default.createElement(TableRow, { key: row.id, row: row })))));
|
|
220
|
+
return (React__default.createElement("tbody", { className: "tableBody" }, rows.map((row) => (React__default.createElement(TableRow, { key: row.id, row: row, rowActions: rowActions })))));
|
|
214
221
|
};
|
|
215
222
|
|
|
216
223
|
/**
|
|
@@ -260,7 +267,7 @@ const defaultColumn = {
|
|
|
260
267
|
* @param props - The properties for the component.
|
|
261
268
|
* @returns The fully assembled DataTable component including headers, body, and optional pagination.
|
|
262
269
|
*/
|
|
263
|
-
const DataTable = ({ className, data = [], columns = [], pagination = false, loading: externalLoading = false, sticky = true, loadingText, noDataTexts, noDataAvailableActions, manualPagination = false, expandable = false, onRowExpandChange }) => {
|
|
270
|
+
const DataTable = ({ className, data = [], columns = [], pagination = false, loading: externalLoading = false, sticky = true, loadingText, noDataTexts, noDataAvailableActions, manualPagination = false, expandable = false, onRowExpandChange, rowActions }) => {
|
|
264
271
|
var _a, _b;
|
|
265
272
|
const [internalLoading] = useState(false);
|
|
266
273
|
const [expanded, setExpanded] = useState({});
|
|
@@ -299,7 +306,7 @@ const DataTable = ({ className, data = [], columns = [], pagination = false, loa
|
|
|
299
306
|
dataTable__noDataToDisplay: isTableDataEmpty
|
|
300
307
|
}) },
|
|
301
308
|
React__default.createElement(TableHeader, { sticky: sticky, headerGroups: table.getHeaderGroups() }),
|
|
302
|
-
React__default.createElement(TableBody, { loading: isTableLoading, loadingText: loadingText, rows: table.getRowModel().rows, noDataTexts: noDataTexts, noDataAvailableActions: noDataAvailableActions }))),
|
|
309
|
+
React__default.createElement(TableBody, { loading: isTableLoading, loadingText: loadingText, rows: table.getRowModel().rows, noDataTexts: noDataTexts, noDataAvailableActions: noDataAvailableActions, rowActions: rowActions }))),
|
|
303
310
|
shouldShowPagination && (React__default.createElement(Pagination, Object.assign({ className: "dataTable__pagination" }, paginationProps, { disabled: isTableDataEmpty })))));
|
|
304
311
|
};
|
|
305
312
|
|
package/SegmentedControl.js
CHANGED
|
@@ -60,7 +60,7 @@ import './OTPField-af15abb1.js';
|
|
|
60
60
|
import './index-ed1441a5.js';
|
|
61
61
|
import './PageHeader-cfa2c255.js';
|
|
62
62
|
import './PopoverConfirm-d6880a4f.js';
|
|
63
|
-
import './DataTable-
|
|
63
|
+
import './DataTable-86d964f8.js';
|
|
64
64
|
import './GlobalHeader-e3be2af9.js';
|
|
65
65
|
import './DataCardList-eb674418.js';
|
|
66
66
|
import './useEllipsisDetection-c5f9b175.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { IButtonProps } from "@components/atoms/Button";
|
|
3
3
|
import { IPaginationProps } from "@components/molecules/Pagination";
|
|
4
|
-
import { DataTableColumn, DataTableRowExpandChangeHandler, ITableData, ITableNoDataTexts } from "@components/organisms/DataTable/types";
|
|
4
|
+
import { DataTableColumn, DataTableRowAction, DataTableRowExpandChangeHandler, ITableData, ITableNoDataTexts } from "@components/organisms/DataTable/types";
|
|
5
5
|
import "./DataTable.scss";
|
|
6
6
|
/**
|
|
7
7
|
* Props for the {@link DataTable} component.
|
|
@@ -120,6 +120,15 @@ interface IDataTableProps<TData extends ITableData> {
|
|
|
120
120
|
* ```
|
|
121
121
|
*/
|
|
122
122
|
onRowExpandChange?: DataTableRowExpandChangeHandler<TData>;
|
|
123
|
+
/**
|
|
124
|
+
* An array of action button objects to display in the row's action menu.
|
|
125
|
+
* @example
|
|
126
|
+
* rowActions={[
|
|
127
|
+
* { Icon: Edit, title: 'Edit', disabled: false, onClick: handleEdit },
|
|
128
|
+
* { Icon: Delete, title: 'Delete', disabled: true, onClick: handleDelete }
|
|
129
|
+
* ]}
|
|
130
|
+
*/
|
|
131
|
+
rowActions?: DataTableRowAction[];
|
|
123
132
|
}
|
|
124
133
|
/**
|
|
125
134
|
* Data Table used to display structured information in a grid format, making it easy to organize, view, and interact with large datasets.
|
|
@@ -130,5 +139,5 @@ interface IDataTableProps<TData extends ITableData> {
|
|
|
130
139
|
* @param props - The properties for the component.
|
|
131
140
|
* @returns The fully assembled DataTable component including headers, body, and optional pagination.
|
|
132
141
|
*/
|
|
133
|
-
declare const DataTable: <TData extends ITableData>({ className, data, columns, pagination, loading: externalLoading, sticky, loadingText, noDataTexts, noDataAvailableActions, manualPagination, expandable, onRowExpandChange }: IDataTableProps<TData>) => ReactElement;
|
|
142
|
+
declare const DataTable: <TData extends ITableData>({ className, data, columns, pagination, loading: externalLoading, sticky, loadingText, noDataTexts, noDataAvailableActions, manualPagination, expandable, onRowExpandChange, rowActions }: IDataTableProps<TData>) => ReactElement;
|
|
134
143
|
export { IDataTableProps, DataTable as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { JSX } from "react";
|
|
2
2
|
import { Row } from "@tanstack/table-core";
|
|
3
|
-
import { ITableData } from "@components/organisms/DataTable/types";
|
|
3
|
+
import { DataTableRowAction, ITableData } from "@components/organisms/DataTable/types";
|
|
4
4
|
import "./TableRow.scss";
|
|
5
5
|
/**
|
|
6
6
|
* Props for the {@link TableRow} component.
|
|
@@ -13,6 +13,10 @@ interface ITableRowProps<TData extends ITableData> {
|
|
|
13
13
|
* the visible cells to be rendered within this specific row.
|
|
14
14
|
*/
|
|
15
15
|
row: Row<TData>;
|
|
16
|
+
/**
|
|
17
|
+
* An array of action button objects to display in the row's actions section.
|
|
18
|
+
*/
|
|
19
|
+
rowActions?: DataTableRowAction[];
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* Renders an individual table row (`<tr>`).
|
|
@@ -23,5 +27,5 @@ interface ITableRowProps<TData extends ITableData> {
|
|
|
23
27
|
* @param props - The properties for the component.
|
|
24
28
|
* @returns A table row element containing its respective rendered cells.
|
|
25
29
|
*/
|
|
26
|
-
declare const TableRow: <TData extends ITableData>({ row }: ITableRowProps<TData>) =>
|
|
30
|
+
declare const TableRow: <TData extends ITableData>({ row, rowActions }: ITableRowProps<TData>) => JSX.Element;
|
|
27
31
|
export default TableRow;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Row } from "@tanstack/table-core";
|
|
3
3
|
import { IButtonProps } from "@components/atoms/Button";
|
|
4
|
-
import { ITableData, ITableNoDataTexts } from "@components/organisms/DataTable/types";
|
|
4
|
+
import { DataTableRowAction, ITableData, ITableNoDataTexts } from "@components/organisms/DataTable/types";
|
|
5
5
|
import "./TableBody.scss";
|
|
6
6
|
/**
|
|
7
7
|
* Props for the {@link TableBody} component.
|
|
@@ -36,6 +36,10 @@ interface ITableBody<TData> {
|
|
|
36
36
|
* ]}
|
|
37
37
|
*/
|
|
38
38
|
noDataAvailableActions?: IButtonProps[];
|
|
39
|
+
/**
|
|
40
|
+
* An array of action button objects to display in the row's action menu.
|
|
41
|
+
*/
|
|
42
|
+
rowActions?: DataTableRowAction[];
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* Renders the `<tbody>` section of the table, including empty and loading states.
|
|
@@ -49,5 +53,5 @@ interface ITableBody<TData> {
|
|
|
49
53
|
* @param props - The properties for the component.
|
|
50
54
|
* @returns The table body element, or a fallback UI (loader/empty state) depending on the data.
|
|
51
55
|
*/
|
|
52
|
-
declare const TableBody: <TData extends ITableData>({ rows, loading, loadingText, noDataTexts, noDataAvailableActions }: ITableBody<TData>) => React.JSX.Element;
|
|
56
|
+
declare const TableBody: <TData extends ITableData>({ rows, loading, loadingText, noDataTexts, noDataAvailableActions, rowActions }: ITableBody<TData>) => React.JSX.Element;
|
|
53
57
|
export default TableBody;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from "react";
|
|
2
|
+
import { IconProps } from "@geneui/icons";
|
|
2
3
|
export interface ITableNoDataTexts {
|
|
3
4
|
noDataAvailableTitle?: string;
|
|
4
5
|
noDataAvailableText?: string;
|
|
@@ -12,6 +13,12 @@ export type DataTableRenderCellArgs<TData, TValue> = {
|
|
|
12
13
|
row: TData & ITableData;
|
|
13
14
|
rowId: string;
|
|
14
15
|
};
|
|
16
|
+
export type DataTableRowAction = {
|
|
17
|
+
Icon: FC<IconProps>;
|
|
18
|
+
title?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
onClick: (e: MouseEvent) => void;
|
|
21
|
+
};
|
|
15
22
|
/**
|
|
16
23
|
* Public DataTable column type (Gene UI).
|
|
17
24
|
* Kept intentionally small: only the props used by the current DataTable implementation.
|
package/index.js
CHANGED
|
@@ -132,6 +132,6 @@ import './ColorPicker-76533087.js';
|
|
|
132
132
|
import './OTPField-af15abb1.js';
|
|
133
133
|
import './PageHeader-cfa2c255.js';
|
|
134
134
|
import './PopoverConfirm-d6880a4f.js';
|
|
135
|
-
import './DataTable-
|
|
135
|
+
import './DataTable-86d964f8.js';
|
|
136
136
|
import './GlobalHeader-e3be2af9.js';
|
|
137
137
|
import './DataCardList-eb674418.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geneui/components",
|
|
3
3
|
"description": "The Gene UI components library designed for BI tools",
|
|
4
|
-
"version": "3.0.0-next-
|
|
4
|
+
"version": "3.0.0-next-e10ab23-21042026",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|