@appcorp/shadcn 1.1.27 → 1.1.28
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.
|
@@ -24,12 +24,7 @@ var EnhancedTableHeaderAction = function (_a) {
|
|
|
24
24
|
return (react_1.default.createElement("div", { key: action.id || action.key || index, className: "relative" },
|
|
25
25
|
react_1.default.createElement(button_1.Button, { variant: action.variant || "default", "data-testid": testIdActionPrefix
|
|
26
26
|
? "".concat(testIdActionPrefix, "-").concat(index)
|
|
27
|
-
: undefined, onClick: function () {
|
|
28
|
-
if (action.onClick)
|
|
29
|
-
action.onClick();
|
|
30
|
-
if (action.handleOnClick)
|
|
31
|
-
action.handleOnClick();
|
|
32
|
-
} }, action.label),
|
|
27
|
+
: undefined, onClick: function () { var _a; return (_a = action.handleOnClick) === null || _a === void 0 ? void 0 : _a.call(action, undefined); } }, action.label),
|
|
33
28
|
showFilterIndicators && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
34
29
|
react_1.default.createElement("div", { className: "absolute -top-2 -left-2 group" },
|
|
35
30
|
react_1.default.createElement(badge_1.Badge, { variant: "secondary", className: (0, utils_1.cn)("h-5 w-5 flex items-center justify-center p-0 text-xs rounded-full transition-all relative", onClearFilters && "cursor-pointer"), "data-testid": testIdFilterBadge, onClick: onClearFilters
|
|
@@ -26,9 +26,8 @@ export interface RowAction {
|
|
|
26
26
|
enabled?: boolean;
|
|
27
27
|
order?: number;
|
|
28
28
|
variant?: "default" | "destructive";
|
|
29
|
-
|
|
30
|
-
handleOnClick?: (row
|
|
31
|
-
handleAction?: (id: string) => void;
|
|
29
|
+
/** Preferred handler for row and header actions. Receives the full `row` when invoked from a row. */
|
|
30
|
+
handleOnClick?: (row?: TableRow) => void;
|
|
32
31
|
}
|
|
33
32
|
export interface HeaderAction {
|
|
34
33
|
id?: string;
|
|
@@ -37,8 +36,8 @@ export interface HeaderAction {
|
|
|
37
36
|
enabled?: boolean;
|
|
38
37
|
order?: number;
|
|
39
38
|
variant?: "default" | "outline" | "secondary";
|
|
40
|
-
|
|
41
|
-
handleOnClick?: () => void;
|
|
39
|
+
/** Preferred handler — will receive a `row` when invoked from row actions. */
|
|
40
|
+
handleOnClick?: (row?: TableRow) => void;
|
|
42
41
|
}
|
|
43
42
|
export interface PageLimitOption {
|
|
44
43
|
option: string;
|
|
@@ -185,14 +185,7 @@ var EnhancedTable = function (_a) {
|
|
|
185
185
|
.map(function (action, index) { return (react_1.default.createElement(dropdown_menu_1.DropdownMenuItem, { key: action.id || action.key || index, "data-testid": _testIdRowActionPrefix
|
|
186
186
|
? "".concat(_testIdRowActionPrefix, "-").concat(rowIndex, "-").concat(index)
|
|
187
187
|
: undefined, className: (0, utils_1.cn)(action.variant === "destructive" &&
|
|
188
|
-
"text-destructive focus:text-destructive"), onClick: function () {
|
|
189
|
-
if (action.onClick)
|
|
190
|
-
action.onClick(row);
|
|
191
|
-
if (action.handleOnClick)
|
|
192
|
-
action.handleOnClick(row);
|
|
193
|
-
if (action.handleAction && row.id)
|
|
194
|
-
action.handleAction(row.id);
|
|
195
|
-
} }, action.label)); }))));
|
|
188
|
+
"text-destructive focus:text-destructive"), onClick: function () { var _a; return (_a = action.handleOnClick) === null || _a === void 0 ? void 0 : _a.call(action, row); } }, action.label)); }))));
|
|
196
189
|
}
|
|
197
190
|
if (normalizedType === COMPONENT_TYPE.ID) {
|
|
198
191
|
return (react_1.default.createElement(popover_1.Popover, null,
|