dp-widgets-framework 1.2.6 → 1.2.7
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.
- package/dist/index.esm.js +33 -8
- package/dist/index.js +33 -8
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -15391,7 +15391,28 @@ function DataGrid({ title, data, className }) {
|
|
|
15391
15391
|
return null;
|
|
15392
15392
|
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200", children: [jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50 w-8" }), columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index)))] }) }), jsxRuntimeExports.jsx("tbody", { children: grouping.sections.map((section, sectionIndex) => {
|
|
15393
15393
|
const isExpanded = expandedGroups.has(section.group_value);
|
|
15394
|
-
return (jsxRuntimeExports.jsxs(React__default.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), jsxRuntimeExports.jsx("td", {
|
|
15394
|
+
return (jsxRuntimeExports.jsxs(React__default.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), columns.map((column, columnIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm font-medium text-blue-700", children: columnIndex === 0 ? (jsxRuntimeExports.jsxs("span", { className: "font-semibold text-blue-900", children: [section.title, ": ", section.group_value] })) : (jsxRuntimeExports.jsx("div", { className: "text-left", children: (() => {
|
|
15395
|
+
var _a;
|
|
15396
|
+
// Find the statistic for this column
|
|
15397
|
+
const sectionStats = (_a = grouping.section_statistics) === null || _a === void 0 ? void 0 : _a[section.group_value];
|
|
15398
|
+
if (!sectionStats)
|
|
15399
|
+
return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
|
|
15400
|
+
// Look for exact column name match first
|
|
15401
|
+
if (sectionStats[column] &&
|
|
15402
|
+
typeof sectionStats[column].total === 'number' &&
|
|
15403
|
+
!isNaN(sectionStats[column].total)) {
|
|
15404
|
+
return (jsxRuntimeExports.jsx("span", { className: "whitespace-nowrap text-xs font-medium text-blue-800", children: sectionStats[column].total.toLocaleString() }));
|
|
15405
|
+
}
|
|
15406
|
+
// If exact match fails, try to find by partial match
|
|
15407
|
+
const matchingKey = Object.keys(sectionStats).find(key => key.toLowerCase().includes(column.toLowerCase()) ||
|
|
15408
|
+
column.toLowerCase().includes(key.toLowerCase()));
|
|
15409
|
+
if (matchingKey && sectionStats[matchingKey] &&
|
|
15410
|
+
typeof sectionStats[matchingKey].total === 'number' &&
|
|
15411
|
+
!isNaN(sectionStats[matchingKey].total)) {
|
|
15412
|
+
return (jsxRuntimeExports.jsx("span", { className: "whitespace-nowrap text-xs font-medium text-blue-800", children: sectionStats[matchingKey].total.toLocaleString() }));
|
|
15413
|
+
}
|
|
15414
|
+
return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
|
|
15415
|
+
})() })) }, columnIndex)))] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15395
15416
|
? "bg-white"
|
|
15396
15417
|
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3" }), row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
|
|
15397
15418
|
}) })] }));
|
|
@@ -15399,15 +15420,19 @@ function DataGrid({ title, data, className }) {
|
|
|
15399
15420
|
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200", children: columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15400
15421
|
? "bg-white"
|
|
15401
15422
|
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex))) }, rowIndex))) })] }));
|
|
15402
|
-
const getTotalRowCount = () => {
|
|
15403
|
-
if (grouped && (grouping === null || grouping === void 0 ? void 0 : grouping.sections)) {
|
|
15404
|
-
return grouping.sections.reduce((total, section) => total + section.row_count, 0);
|
|
15405
|
-
}
|
|
15406
|
-
return rows.length;
|
|
15407
|
-
};
|
|
15408
15423
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
15409
15424
|
color: "#0F172A"
|
|
15410
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping ? (jsxRuntimeExports.jsxs("
|
|
15425
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping && grouping.section_statistics ? (jsxRuntimeExports.jsxs("div", { className: "flex gap-6", children: [jsxRuntimeExports.jsxs("span", { children: [grouping.total_groups, " group", grouping.total_groups !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] }), jsxRuntimeExports.jsx("div", { className: "flex gap-4", children: (() => {
|
|
15426
|
+
const totals = {};
|
|
15427
|
+
Object.values(grouping.section_statistics).forEach(groupStats => {
|
|
15428
|
+
Object.entries(groupStats).forEach(([column, stats]) => {
|
|
15429
|
+
if (typeof stats.total === 'number' && !isNaN(stats.total)) {
|
|
15430
|
+
totals[column] = (totals[column] || 0) + stats.total;
|
|
15431
|
+
}
|
|
15432
|
+
});
|
|
15433
|
+
});
|
|
15434
|
+
return Object.entries(totals).map(([column, total], index) => (jsxRuntimeExports.jsxs("span", { className: "font-medium", children: ["Total ", column, ": ", total.toLocaleString()] }, index)));
|
|
15435
|
+
})() })] })) : (jsxRuntimeExports.jsxs("span", { children: ["Showing ", rows.length, " row", rows.length !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) })] }));
|
|
15411
15436
|
}
|
|
15412
15437
|
|
|
15413
15438
|
function ok$1() {}
|
package/dist/index.js
CHANGED
|
@@ -15418,7 +15418,28 @@ function DataGrid({ title, data, className }) {
|
|
|
15418
15418
|
return null;
|
|
15419
15419
|
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200", children: [jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50 w-8" }), columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index)))] }) }), jsxRuntimeExports.jsx("tbody", { children: grouping.sections.map((section, sectionIndex) => {
|
|
15420
15420
|
const isExpanded = expandedGroups.has(section.group_value);
|
|
15421
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(lucideReact.ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), jsxRuntimeExports.jsx("td", {
|
|
15421
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(lucideReact.ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), columns.map((column, columnIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm font-medium text-blue-700", children: columnIndex === 0 ? (jsxRuntimeExports.jsxs("span", { className: "font-semibold text-blue-900", children: [section.title, ": ", section.group_value] })) : (jsxRuntimeExports.jsx("div", { className: "text-left", children: (() => {
|
|
15422
|
+
var _a;
|
|
15423
|
+
// Find the statistic for this column
|
|
15424
|
+
const sectionStats = (_a = grouping.section_statistics) === null || _a === void 0 ? void 0 : _a[section.group_value];
|
|
15425
|
+
if (!sectionStats)
|
|
15426
|
+
return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
|
|
15427
|
+
// Look for exact column name match first
|
|
15428
|
+
if (sectionStats[column] &&
|
|
15429
|
+
typeof sectionStats[column].total === 'number' &&
|
|
15430
|
+
!isNaN(sectionStats[column].total)) {
|
|
15431
|
+
return (jsxRuntimeExports.jsx("span", { className: "whitespace-nowrap text-xs font-medium text-blue-800", children: sectionStats[column].total.toLocaleString() }));
|
|
15432
|
+
}
|
|
15433
|
+
// If exact match fails, try to find by partial match
|
|
15434
|
+
const matchingKey = Object.keys(sectionStats).find(key => key.toLowerCase().includes(column.toLowerCase()) ||
|
|
15435
|
+
column.toLowerCase().includes(key.toLowerCase()));
|
|
15436
|
+
if (matchingKey && sectionStats[matchingKey] &&
|
|
15437
|
+
typeof sectionStats[matchingKey].total === 'number' &&
|
|
15438
|
+
!isNaN(sectionStats[matchingKey].total)) {
|
|
15439
|
+
return (jsxRuntimeExports.jsx("span", { className: "whitespace-nowrap text-xs font-medium text-blue-800", children: sectionStats[matchingKey].total.toLocaleString() }));
|
|
15440
|
+
}
|
|
15441
|
+
return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
|
|
15442
|
+
})() })) }, columnIndex)))] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15422
15443
|
? "bg-white"
|
|
15423
15444
|
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3" }), row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
|
|
15424
15445
|
}) })] }));
|
|
@@ -15426,15 +15447,19 @@ function DataGrid({ title, data, className }) {
|
|
|
15426
15447
|
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200", children: columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15427
15448
|
? "bg-white"
|
|
15428
15449
|
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex))) }, rowIndex))) })] }));
|
|
15429
|
-
const getTotalRowCount = () => {
|
|
15430
|
-
if (grouped && (grouping === null || grouping === void 0 ? void 0 : grouping.sections)) {
|
|
15431
|
-
return grouping.sections.reduce((total, section) => total + section.row_count, 0);
|
|
15432
|
-
}
|
|
15433
|
-
return rows.length;
|
|
15434
|
-
};
|
|
15435
15450
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
15436
15451
|
color: "#0F172A"
|
|
15437
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping ? (jsxRuntimeExports.jsxs("
|
|
15452
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping && grouping.section_statistics ? (jsxRuntimeExports.jsxs("div", { className: "flex gap-6", children: [jsxRuntimeExports.jsxs("span", { children: [grouping.total_groups, " group", grouping.total_groups !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] }), jsxRuntimeExports.jsx("div", { className: "flex gap-4", children: (() => {
|
|
15453
|
+
const totals = {};
|
|
15454
|
+
Object.values(grouping.section_statistics).forEach(groupStats => {
|
|
15455
|
+
Object.entries(groupStats).forEach(([column, stats]) => {
|
|
15456
|
+
if (typeof stats.total === 'number' && !isNaN(stats.total)) {
|
|
15457
|
+
totals[column] = (totals[column] || 0) + stats.total;
|
|
15458
|
+
}
|
|
15459
|
+
});
|
|
15460
|
+
});
|
|
15461
|
+
return Object.entries(totals).map(([column, total], index) => (jsxRuntimeExports.jsxs("span", { className: "font-medium", children: ["Total ", column, ": ", total.toLocaleString()] }, index)));
|
|
15462
|
+
})() })] })) : (jsxRuntimeExports.jsxs("span", { children: ["Showing ", rows.length, " row", rows.length !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) })] }));
|
|
15438
15463
|
}
|
|
15439
15464
|
|
|
15440
15465
|
function ok$1() {}
|