@appcorp/shadcn 1.0.23 → 1.0.25
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,7 +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
|
+
textFormatter?: (value: unknown, row: unknown) => React.ReactNode;
|
|
53
53
|
}>;
|
|
54
54
|
tableHeading: string;
|
|
55
55
|
tableDescription?: string;
|
|
@@ -136,11 +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" }, col.textFormatter
|
|
139
|
+
react_1.default.createElement("span", { className: "text-xs text-muted-foreground font-mono" }, col.textFormatter
|
|
140
|
+
? col.textFormatter(value, row)
|
|
141
|
+
: String(value)))));
|
|
140
142
|
}
|
|
141
143
|
if (normalizedType === COMPONENT_TYPE.BOLD_TEXT) {
|
|
142
144
|
var formatted = col.textFormatter
|
|
143
|
-
? col.textFormatter(value)
|
|
145
|
+
? col.textFormatter(value, row)
|
|
144
146
|
: String(value || "");
|
|
145
147
|
return react_1.default.createElement("span", { className: "font-semibold" }, formatted);
|
|
146
148
|
}
|
|
@@ -165,9 +167,11 @@ var EnhancedTable = function (_a) {
|
|
|
165
167
|
})
|
|
166
168
|
: nested;
|
|
167
169
|
var toRender = primitive !== null && primitive !== void 0 ? primitive : JSON.stringify(nested);
|
|
168
|
-
return (react_1.default.createElement("span", null, col.textFormatter
|
|
170
|
+
return (react_1.default.createElement("span", null, col.textFormatter
|
|
171
|
+
? col.textFormatter(toRender, row)
|
|
172
|
+
: String(toRender)));
|
|
169
173
|
}
|
|
170
|
-
return (react_1.default.createElement("span", null, col.textFormatter ? col.textFormatter(nested) : String(nested)));
|
|
174
|
+
return (react_1.default.createElement("span", null, col.textFormatter ? col.textFormatter(nested, row) : String(nested)));
|
|
171
175
|
}
|
|
172
176
|
// MULTIPLE_TEXT_LINES => col.key is an array of keys, render up to 3 lines
|
|
173
177
|
if (normalizedType === COMPONENT_TYPE.MULTIPLE_TEXT_LINES) {
|
|
@@ -176,7 +180,7 @@ var EnhancedTable = function (_a) {
|
|
|
176
180
|
var v = resolveValue(row, k);
|
|
177
181
|
return v == null ? "" : String(v);
|
|
178
182
|
});
|
|
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)); })));
|
|
183
|
+
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, row) : line)); })));
|
|
180
184
|
}
|
|
181
185
|
// CREATED_UPDATED_AT => show createdAt and updatedAt from the object (or nested object)
|
|
182
186
|
if (normalizedType === COMPONENT_TYPE.CREATED_UPDATED_AT) {
|
|
@@ -195,7 +199,9 @@ var EnhancedTable = function (_a) {
|
|
|
195
199
|
react_1.default.createElement("span", null, fmt(created)),
|
|
196
200
|
react_1.default.createElement("span", null, fmt(updated))));
|
|
197
201
|
}
|
|
198
|
-
return (react_1.default.createElement("span", null, col.textFormatter
|
|
202
|
+
return (react_1.default.createElement("span", null, col.textFormatter
|
|
203
|
+
? col.textFormatter(value, row)
|
|
204
|
+
: String(value || "")));
|
|
199
205
|
};
|
|
200
206
|
// Create loading skeleton rows
|
|
201
207
|
var renderLoadingRows = function () {
|