@appcorp/shadcn 1.0.22 → 1.0.23
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.
|
@@ -49,6 +49,7 @@ export interface EnhancedTableProps {
|
|
|
49
49
|
tableBodyCols: Array<{
|
|
50
50
|
key?: string | string[];
|
|
51
51
|
componentType: COMPONENT_TYPE | string;
|
|
52
|
+
textFormatter?: (value: unknown) => React.ReactNode;
|
|
52
53
|
}>;
|
|
53
54
|
tableHeading: string;
|
|
54
55
|
tableDescription?: string;
|
|
@@ -84,7 +85,6 @@ export interface EnhancedTableProps {
|
|
|
84
85
|
loading?: string;
|
|
85
86
|
rowsPerPage?: string;
|
|
86
87
|
};
|
|
87
|
-
textFormatter?: (value: unknown) => React.ReactNode;
|
|
88
88
|
nodeSelectKey?: string;
|
|
89
89
|
}
|
|
90
90
|
export declare const EnhancedTable: React.FC<EnhancedTableProps>;
|
|
@@ -42,7 +42,7 @@ var COMPONENT_TYPE;
|
|
|
42
42
|
COMPONENT_TYPE["BOOLEAN"] = "BOOLEAN";
|
|
43
43
|
})(COMPONENT_TYPE || (exports.COMPONENT_TYPE = COMPONENT_TYPE = {}));
|
|
44
44
|
var EnhancedTable = function (_a) {
|
|
45
|
-
var currentPage = _a.currentPage, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, listOptions = _a.listOptions, loading = _a.loading, _c = _a.nodeSelectKey, nodeSelectKey = _c === void 0 ? "pageLimit" : _c, numberOfFilters = _a.numberOfFilters, onClearFilters = _a.onClearFilters,
|
|
45
|
+
var currentPage = _a.currentPage, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, listOptions = _a.listOptions, loading = _a.loading, _c = _a.nodeSelectKey, nodeSelectKey = _c === void 0 ? "pageLimit" : _c, numberOfFilters = _a.numberOfFilters, onClearFilters = _a.onClearFilters, pageLimit = _a.pageLimit, rowActions = _a.rowActions, _d = _a.searchDisabled, searchDisabled = _d === void 0 ? false : _d, _e = _a.searchEnabled, searchEnabled = _e === void 0 ? true : _e, _f = _a.searchId, searchId = _f === void 0 ? "table-search" : _f, _g = _a.searchPlaceholder, searchPlaceholder = _g === void 0 ? "Search..." : _g, searchValue = _a.searchValue, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, tableDescription = _a.tableDescription, tableHeading = _a.tableHeading, tableHeadItems = _a.tableHeadItems, totalPages = _a.totalPages, _h = _a.translationLabels, translationLabels = _h === void 0 ? {} : _h;
|
|
46
46
|
// Default translation values
|
|
47
47
|
var defaultLabels = {
|
|
48
48
|
booleanYes: "Yes",
|
|
@@ -136,11 +136,11 @@ var EnhancedTable = function (_a) {
|
|
|
136
136
|
? "".concat(value.substring(0, 8), "...")
|
|
137
137
|
: String(value || ""))),
|
|
138
138
|
react_1.default.createElement(popover_1.PopoverContent, null,
|
|
139
|
-
react_1.default.createElement("span", { className: "text-xs text-muted-foreground font-mono" }, textFormatter ? textFormatter(value) : String(value)))));
|
|
139
|
+
react_1.default.createElement("span", { className: "text-xs text-muted-foreground font-mono" }, col.textFormatter ? col.textFormatter(value) : String(value)))));
|
|
140
140
|
}
|
|
141
141
|
if (normalizedType === COMPONENT_TYPE.BOLD_TEXT) {
|
|
142
|
-
var formatted = textFormatter
|
|
143
|
-
? textFormatter(value)
|
|
142
|
+
var formatted = col.textFormatter
|
|
143
|
+
? col.textFormatter(value)
|
|
144
144
|
: String(value || "");
|
|
145
145
|
return react_1.default.createElement("span", { className: "font-semibold" }, formatted);
|
|
146
146
|
}
|
|
@@ -165,9 +165,9 @@ var EnhancedTable = function (_a) {
|
|
|
165
165
|
})
|
|
166
166
|
: nested;
|
|
167
167
|
var toRender = primitive !== null && primitive !== void 0 ? primitive : JSON.stringify(nested);
|
|
168
|
-
return (react_1.default.createElement("span", null, textFormatter ? textFormatter(toRender) : String(toRender)));
|
|
168
|
+
return (react_1.default.createElement("span", null, col.textFormatter ? col.textFormatter(toRender) : String(toRender)));
|
|
169
169
|
}
|
|
170
|
-
return (react_1.default.createElement("span", null, textFormatter ? textFormatter(nested) : String(nested)));
|
|
170
|
+
return (react_1.default.createElement("span", null, col.textFormatter ? col.textFormatter(nested) : String(nested)));
|
|
171
171
|
}
|
|
172
172
|
// MULTIPLE_TEXT_LINES => col.key is an array of keys, render up to 3 lines
|
|
173
173
|
if (normalizedType === COMPONENT_TYPE.MULTIPLE_TEXT_LINES) {
|
|
@@ -176,7 +176,7 @@ var EnhancedTable = function (_a) {
|
|
|
176
176
|
var v = resolveValue(row, k);
|
|
177
177
|
return v == null ? "" : String(v);
|
|
178
178
|
});
|
|
179
|
-
return (react_1.default.createElement("div", { className: "flex flex-col" }, lines.map(function (line, idx) { return (react_1.default.createElement("span", { key: idx, className: "text-sm" }, textFormatter ? textFormatter(line) : line)); })));
|
|
179
|
+
return (react_1.default.createElement("div", { className: "flex flex-col" }, lines.map(function (line, idx) { return (react_1.default.createElement("span", { key: idx, className: "text-sm" }, col.textFormatter ? col.textFormatter(line) : line)); })));
|
|
180
180
|
}
|
|
181
181
|
// CREATED_UPDATED_AT => show createdAt and updatedAt from the object (or nested object)
|
|
182
182
|
if (normalizedType === COMPONENT_TYPE.CREATED_UPDATED_AT) {
|
|
@@ -195,7 +195,7 @@ var EnhancedTable = function (_a) {
|
|
|
195
195
|
react_1.default.createElement("span", null, fmt(created)),
|
|
196
196
|
react_1.default.createElement("span", null, fmt(updated))));
|
|
197
197
|
}
|
|
198
|
-
return (react_1.default.createElement("span", null, textFormatter ? textFormatter(value) : String(value || "")));
|
|
198
|
+
return (react_1.default.createElement("span", null, col.textFormatter ? col.textFormatter(value) : String(value || "")));
|
|
199
199
|
};
|
|
200
200
|
// Create loading skeleton rows
|
|
201
201
|
var renderLoadingRows = function () {
|