@appcorp/shadcn 1.1.43 → 1.1.45
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.
|
@@ -23,7 +23,7 @@ export interface RowAction {
|
|
|
23
23
|
id?: string;
|
|
24
24
|
key?: string;
|
|
25
25
|
label: string;
|
|
26
|
-
enabled?: boolean;
|
|
26
|
+
enabled?: boolean | ((row?: TableRow) => boolean);
|
|
27
27
|
order?: number;
|
|
28
28
|
variant?: "default" | "destructive";
|
|
29
29
|
/** Preferred handler for row and header actions. Receives the full `row` when invoked from a row. */
|
|
@@ -33,7 +33,7 @@ export interface HeaderAction {
|
|
|
33
33
|
id?: string;
|
|
34
34
|
key?: string;
|
|
35
35
|
label: string;
|
|
36
|
-
enabled?: boolean;
|
|
36
|
+
enabled?: boolean | ((row?: TableRow) => boolean);
|
|
37
37
|
order?: number;
|
|
38
38
|
variant?: "default" | "outline" | "secondary";
|
|
39
39
|
/** Preferred handler — will receive a `row` when invoked from row actions. */
|
|
@@ -180,7 +180,10 @@ var EnhancedTable = function (_a) {
|
|
|
180
180
|
react_1.default.createElement(dropdown_menu_1.DropdownMenuTrigger, { asChild: true },
|
|
181
181
|
react_1.default.createElement(lucide_react_1.MoreHorizontal, { className: "h-4 w-4" })),
|
|
182
182
|
react_1.default.createElement(dropdown_menu_1.DropdownMenuContent, { align: "end" }, rowActions
|
|
183
|
-
.filter(function (
|
|
183
|
+
.filter(function (_a) {
|
|
184
|
+
var enabled = _a.enabled;
|
|
185
|
+
return typeof enabled === "function" ? enabled(row) : enabled;
|
|
186
|
+
})
|
|
184
187
|
.sort(function (a, b) { return (a.order || 0) - (b.order || 0); })
|
|
185
188
|
.map(function (action, index) { return (react_1.default.createElement(dropdown_menu_1.DropdownMenuItem, { key: action.id || action.key || index, "data-testid": _testIdRowActionPrefix
|
|
186
189
|
? "".concat(_testIdRowActionPrefix, "-").concat(rowIndex, "-").concat(index)
|
|
@@ -308,9 +311,12 @@ var EnhancedTable = function (_a) {
|
|
|
308
311
|
react_1.default.createElement(table_1.TableBody, null, loading ? (renderLoadingRows()) : tableBodyRows.length === 0 ? (react_1.default.createElement(table_1.TableRow, null,
|
|
309
312
|
react_1.default.createElement(table_1.TableCell, { colSpan: tableHeadItems.length, className: "h-24 text-center text-muted-foreground", "data-testid": _testIdNoResults }, labels.noResultsFound))) : (tableBodyRows.map(function (row, rowIndex) { return (react_1.default.createElement(table_1.TableRow, { key: rowIndex, className: "hover:bg-muted/50", "data-testid": _testIdRowPrefix
|
|
310
313
|
? "".concat(_testIdRowPrefix, "-").concat(rowIndex)
|
|
311
|
-
: undefined }, tableBodyCols.map(function (col, colIndex) { return (react_1.default.createElement(table_1.TableCell, { key: colIndex, className: "py-4", "data-testid": _testIdCellPrefix
|
|
314
|
+
: undefined }, tableBodyCols.map(function (col, colIndex) { return (react_1.default.createElement(table_1.TableCell, { key: colIndex, className: (0, utils_1.cn)("py-4 cursor-pointer"), "data-testid": _testIdCellPrefix
|
|
312
315
|
? "".concat(_testIdCellPrefix, "-").concat(rowIndex, "-").concat(colIndex)
|
|
313
|
-
: undefined
|
|
316
|
+
: undefined, onClick: function (e) {
|
|
317
|
+
var _a;
|
|
318
|
+
return (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(e.currentTarget.textContent || "");
|
|
319
|
+
} }, renderCellContent(row, col, rowIndex))); }))); }))))),
|
|
314
320
|
react_1.default.createElement("div", { className: "flex items-center justify-between", "data-testid": _testIdPaginationWrapper },
|
|
315
321
|
react_1.default.createElement("div", { "data-testid": _testIdFooterPagination },
|
|
316
322
|
react_1.default.createElement(enhanced_table_footer_pagination_1.EnhancedTableFooterPagination, { handleOnSelect: handleOnSelect, isRTL: isRTL, listOptions: listOptions, loading: loading, nodeSelectKey: nodeSelectKey, pageLimit: pageLimit, rowsPerPageLabel: labels.rowsPerPage, totalPages: totalPages })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/shadcn",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build:next": "next build",
|
|
6
6
|
"build:storybook": "mv ../.pnp.cjs ../.pnp.cjs.bak 2>/dev/null || true && storybook build -c .storybook -o .out && mv ../.pnp.cjs.bak ../.pnp.cjs 2>/dev/null || true",
|