dp-widgets-framework 1.3.8 → 1.3.9

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 CHANGED
@@ -17652,7 +17652,6 @@ function DataGrid({ title, data, className }) {
17652
17652
  var _a;
17653
17653
  const { columns, rows, units, grouped = false, grouping } = data;
17654
17654
  const [expandedGroups, setExpandedGroups] = useState(new Set(((_a = grouping === null || grouping === void 0 ? void 0 : grouping.sections) === null || _a === void 0 ? void 0 : _a.filter(s => s.expanded).map(s => s.group_value)) || []));
17655
- console.log('units==>', units);
17656
17655
  const toggleGroup = (groupValue) => {
17657
17656
  const newExpanded = new Set(expandedGroups);
17658
17657
  if (newExpanded.has(groupValue)) {
@@ -17667,14 +17666,14 @@ function DataGrid({ title, data, className }) {
17667
17666
  if (value === null || value === undefined)
17668
17667
  return "—";
17669
17668
  const unit = units === null || units === void 0 ? void 0 : units[columnIndex];
17669
+ console.log('value==>', value, unit);
17670
17670
  // Format the value with commas if it's a number or numeric string
17671
17671
  let valueStr;
17672
17672
  if (typeof value === 'number') {
17673
17673
  valueStr = value.toLocaleString();
17674
17674
  }
17675
17675
  else {
17676
- const numValue = parseFloat(String(value));
17677
- valueStr = !isNaN(numValue) ? numValue.toLocaleString() : String(value);
17676
+ valueStr = String(value);
17678
17677
  }
17679
17678
  // If no unit or unit length > 3, return value only
17680
17679
  if (!unit || unit.length > 3) {
@@ -17723,12 +17722,12 @@ function DataGrid({ title, data, className }) {
17723
17722
  return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
17724
17723
  })() })) }, columnIndex)))] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
17725
17724
  ? "bg-white"
17726
- : "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: formatValueWithUnit(cell, cellIndex) }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
17725
+ : "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 whitespace-nowrap", children: formatValueWithUnit(cell, cellIndex) }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
17727
17726
  }) })] }));
17728
17727
  };
17729
17728
  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.jsxs("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: [column, (units === null || units === void 0 ? void 0 : units[index]) ? ` (${units[index]})` : ''] }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
17730
17729
  ? "bg-white"
17731
- : "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: formatValueWithUnit(cell, cellIndex) }, cellIndex))) }, rowIndex))) })] }));
17730
+ : "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 whitespace-nowrap", children: formatValueWithUnit(cell, cellIndex) }, cellIndex))) }, rowIndex))) })] }));
17732
17731
  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: {
17733
17732
  color: "#0F172A"
17734
17733
  }, 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: (() => {
@@ -39999,22 +39998,17 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
39999
39998
  return true;
40000
39999
  })
40001
40000
  .map((widget) => {
40002
- const isText = widget.type === "text";
40001
+ widget.type === "text";
40003
40002
  return {
40004
40003
  i: widget.id,
40005
40004
  x: widget.position_x,
40006
40005
  y: widget.position_y,
40007
40006
  w: widget.width,
40008
- h: isText
40009
- ? (isEditing ? widget.height : Math.max(widget.height - 1, 1))
40010
- : widget.height,
40007
+ h: widget.height,
40011
40008
  minW: 0,
40012
- minH: isText ? widget.height : 1,
40013
- maxH: isText ? widget.height : undefined,
40009
+ minH: 1,
40014
40010
  isResizable: isEditing,
40015
- resizeHandles: isText
40016
- ? ["w", "e"] // only horizontal
40017
- : ["sw", "nw", "se", "ne"],
40011
+ resizeHandles: ["sw", "nw", "se", "ne"],
40018
40012
  };
40019
40013
  });
40020
40014
  };
package/dist/index.js CHANGED
@@ -17679,7 +17679,6 @@ function DataGrid({ title, data, className }) {
17679
17679
  var _a;
17680
17680
  const { columns, rows, units, grouped = false, grouping } = data;
17681
17681
  const [expandedGroups, setExpandedGroups] = React.useState(new Set(((_a = grouping === null || grouping === void 0 ? void 0 : grouping.sections) === null || _a === void 0 ? void 0 : _a.filter(s => s.expanded).map(s => s.group_value)) || []));
17682
- console.log('units==>', units);
17683
17682
  const toggleGroup = (groupValue) => {
17684
17683
  const newExpanded = new Set(expandedGroups);
17685
17684
  if (newExpanded.has(groupValue)) {
@@ -17694,14 +17693,14 @@ function DataGrid({ title, data, className }) {
17694
17693
  if (value === null || value === undefined)
17695
17694
  return "—";
17696
17695
  const unit = units === null || units === void 0 ? void 0 : units[columnIndex];
17696
+ console.log('value==>', value, unit);
17697
17697
  // Format the value with commas if it's a number or numeric string
17698
17698
  let valueStr;
17699
17699
  if (typeof value === 'number') {
17700
17700
  valueStr = value.toLocaleString();
17701
17701
  }
17702
17702
  else {
17703
- const numValue = parseFloat(String(value));
17704
- valueStr = !isNaN(numValue) ? numValue.toLocaleString() : String(value);
17703
+ valueStr = String(value);
17705
17704
  }
17706
17705
  // If no unit or unit length > 3, return value only
17707
17706
  if (!unit || unit.length > 3) {
@@ -17750,12 +17749,12 @@ function DataGrid({ title, data, className }) {
17750
17749
  return jsxRuntimeExports.jsx("span", { className: "text-gray-400", children: "\u2014" });
17751
17750
  })() })) }, columnIndex)))] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
17752
17751
  ? "bg-white"
17753
- : "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: formatValueWithUnit(cell, cellIndex) }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
17752
+ : "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 whitespace-nowrap", children: formatValueWithUnit(cell, cellIndex) }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
17754
17753
  }) })] }));
17755
17754
  };
17756
17755
  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.jsxs("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: [column, (units === null || units === void 0 ? void 0 : units[index]) ? ` (${units[index]})` : ''] }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
17757
17756
  ? "bg-white"
17758
- : "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: formatValueWithUnit(cell, cellIndex) }, cellIndex))) }, rowIndex))) })] }));
17757
+ : "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 whitespace-nowrap", children: formatValueWithUnit(cell, cellIndex) }, cellIndex))) }, rowIndex))) })] }));
17759
17758
  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: {
17760
17759
  color: "#0F172A"
17761
17760
  }, 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: (() => {
@@ -40026,22 +40025,17 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
40026
40025
  return true;
40027
40026
  })
40028
40027
  .map((widget) => {
40029
- const isText = widget.type === "text";
40028
+ widget.type === "text";
40030
40029
  return {
40031
40030
  i: widget.id,
40032
40031
  x: widget.position_x,
40033
40032
  y: widget.position_y,
40034
40033
  w: widget.width,
40035
- h: isText
40036
- ? (isEditing ? widget.height : Math.max(widget.height - 1, 1))
40037
- : widget.height,
40034
+ h: widget.height,
40038
40035
  minW: 0,
40039
- minH: isText ? widget.height : 1,
40040
- maxH: isText ? widget.height : undefined,
40036
+ minH: 1,
40041
40037
  isResizable: isEditing,
40042
- resizeHandles: isText
40043
- ? ["w", "e"] // only horizontal
40044
- : ["sw", "nw", "se", "ne"],
40038
+ resizeHandles: ["sw", "nw", "se", "ne"],
40045
40039
  };
40046
40040
  });
40047
40041
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dp-widgets-framework",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -136,4 +136,4 @@
136
136
  "tailwindcss": "^3.3.0",
137
137
  "typescript": "^5"
138
138
  }
139
- }
139
+ }