@appcorp/shadcn 1.0.21 → 1.0.22
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.
|
@@ -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, 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;
|
|
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, textFormatter = _a.textFormatter, 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,10 +136,13 @@ 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" }, String(value)))));
|
|
139
|
+
react_1.default.createElement("span", { className: "text-xs text-muted-foreground font-mono" }, textFormatter ? textFormatter(value) : String(value)))));
|
|
140
140
|
}
|
|
141
141
|
if (normalizedType === COMPONENT_TYPE.BOLD_TEXT) {
|
|
142
|
-
|
|
142
|
+
var formatted = textFormatter
|
|
143
|
+
? textFormatter(value)
|
|
144
|
+
: String(value || "");
|
|
145
|
+
return react_1.default.createElement("span", { className: "font-semibold" }, formatted);
|
|
143
146
|
}
|
|
144
147
|
if (normalizedType === COMPONENT_TYPE.BOOLEAN) {
|
|
145
148
|
var isTrue = Boolean(value);
|
|
@@ -161,9 +164,10 @@ var EnhancedTable = function (_a) {
|
|
|
161
164
|
return ["string", "number", "boolean"].includes(typeof v);
|
|
162
165
|
})
|
|
163
166
|
: nested;
|
|
164
|
-
|
|
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)));
|
|
165
169
|
}
|
|
166
|
-
return react_1.default.createElement("span", null, String(nested));
|
|
170
|
+
return (react_1.default.createElement("span", null, textFormatter ? textFormatter(nested) : String(nested)));
|
|
167
171
|
}
|
|
168
172
|
// MULTIPLE_TEXT_LINES => col.key is an array of keys, render up to 3 lines
|
|
169
173
|
if (normalizedType === COMPONENT_TYPE.MULTIPLE_TEXT_LINES) {
|
|
@@ -172,7 +176,7 @@ var EnhancedTable = function (_a) {
|
|
|
172
176
|
var v = resolveValue(row, k);
|
|
173
177
|
return v == null ? "" : String(v);
|
|
174
178
|
});
|
|
175
|
-
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" }, 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" }, textFormatter ? textFormatter(line) : line)); })));
|
|
176
180
|
}
|
|
177
181
|
// CREATED_UPDATED_AT => show createdAt and updatedAt from the object (or nested object)
|
|
178
182
|
if (normalizedType === COMPONENT_TYPE.CREATED_UPDATED_AT) {
|
|
@@ -191,7 +195,7 @@ var EnhancedTable = function (_a) {
|
|
|
191
195
|
react_1.default.createElement("span", null, fmt(created)),
|
|
192
196
|
react_1.default.createElement("span", null, fmt(updated))));
|
|
193
197
|
}
|
|
194
|
-
return react_1.default.createElement("span", null, String(value || ""));
|
|
198
|
+
return (react_1.default.createElement("span", null, textFormatter ? textFormatter(value) : String(value || "")));
|
|
195
199
|
};
|
|
196
200
|
// Create loading skeleton rows
|
|
197
201
|
var renderLoadingRows = function () {
|