@axzydev/axzy_ui_system 1.3.4 → 1.3.5
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/README.md +1 -1
- package/dist/index.cjs +216 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +216 -124
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/components/molecules/table/table.doc.mdx +12 -1
- package/src/components/molecules/table/table.props.ts +17 -0
- package/src/components/molecules/table/table.stories.tsx +45 -0
- package/src/components/molecules/table/table.tsx +37 -8
- package/src/components/organisms/data-table/ITDataTable.doc.mdx +14 -1
- package/src/components/organisms/data-table/ITDataTable.stories.tsx +25 -0
- package/src/components/organisms/data-table/dataTable.tsx +37 -8
- package/src/components/organisms/sidebar/sidebar.doc.mdx +39 -1
- package/src/components/organisms/sidebar/sidebar.props.ts +28 -2
- package/src/components/organisms/sidebar/sidebar.stories.tsx +61 -1
- package/src/components/organisms/sidebar/sidebar.tsx +111 -57
- package/src/index.css +10 -0
- package/src/index.ts +2 -1
- package/src/showcases/DataShowcases.tsx +61 -0
- package/src/showcases/StructureShowcases.tsx +33 -5
- package/src/utils/table.utils.ts +83 -0
package/dist/index.js
CHANGED
|
@@ -3601,7 +3601,7 @@ function useVirtualRows({
|
|
|
3601
3601
|
|
|
3602
3602
|
// src/components/organisms/data-table/dataTable.tsx
|
|
3603
3603
|
import clsx23 from "clsx";
|
|
3604
|
-
import { useState as useState19, useEffect as useEffect9, useCallback as useCallback7, useRef as useRef13 } from "react";
|
|
3604
|
+
import React6, { useState as useState19, useEffect as useEffect9, useCallback as useCallback7, useRef as useRef13 } from "react";
|
|
3605
3605
|
import { FaCheck as FaCheck2, FaSpinner, FaTimes as FaTimes5, FaTable, FaThLarge } from "react-icons/fa";
|
|
3606
3606
|
import { MdOutlineSwapVert } from "react-icons/md";
|
|
3607
3607
|
|
|
@@ -4396,6 +4396,32 @@ function isInteractiveTarget(target, boundary = null) {
|
|
|
4396
4396
|
if (boundary instanceof Node && interactive === boundary) return false;
|
|
4397
4397
|
return true;
|
|
4398
4398
|
}
|
|
4399
|
+
function pinnedColumnWidth(col) {
|
|
4400
|
+
if (typeof col.width === "number") return col.width;
|
|
4401
|
+
if (typeof col.width === "string" && /^\d+(\.\d+)?px$/.test(col.width.trim())) {
|
|
4402
|
+
return parseFloat(col.width);
|
|
4403
|
+
}
|
|
4404
|
+
return col.minWidth ?? 0;
|
|
4405
|
+
}
|
|
4406
|
+
function getPinnedColumnMeta(columns) {
|
|
4407
|
+
const meta = {};
|
|
4408
|
+
let leftOffset = 0;
|
|
4409
|
+
for (const col of columns) {
|
|
4410
|
+
if (col.pinned === "left") {
|
|
4411
|
+
meta[col.key] = { side: "left", offset: leftOffset };
|
|
4412
|
+
leftOffset += pinnedColumnWidth(col);
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
let rightOffset = 0;
|
|
4416
|
+
for (let i = columns.length - 1; i >= 0; i--) {
|
|
4417
|
+
const col = columns[i];
|
|
4418
|
+
if (col.pinned === "right") {
|
|
4419
|
+
meta[col.key] = { side: "right", offset: rightOffset };
|
|
4420
|
+
rightOffset += pinnedColumnWidth(col);
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
return meta;
|
|
4424
|
+
}
|
|
4399
4425
|
|
|
4400
4426
|
// src/components/organisms/data-table/dataTable.tsx
|
|
4401
4427
|
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
@@ -4446,6 +4472,7 @@ function ITDataTable({
|
|
|
4446
4472
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
4447
4473
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
4448
4474
|
const columnCount = columns.length;
|
|
4475
|
+
const pinnedMeta = React6.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
4449
4476
|
const scrollOuterClass = isTableVirtual ? "relative min-h-[200px]" : "overflow-x-auto relative min-h-[200px]";
|
|
4450
4477
|
const {
|
|
4451
4478
|
currentPage,
|
|
@@ -4725,38 +4752,46 @@ function ITDataTable({
|
|
|
4725
4752
|
{
|
|
4726
4753
|
className: clsx23(tableHeaderRow, "dark:text-slate-200"),
|
|
4727
4754
|
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
4728
|
-
children: columns.map((col) =>
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
col.
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4755
|
+
children: columns.map((col) => {
|
|
4756
|
+
const pin = pinnedMeta[col.key];
|
|
4757
|
+
const isPinned = pin != null;
|
|
4758
|
+
return /* @__PURE__ */ jsx23(
|
|
4759
|
+
"th",
|
|
4760
|
+
{
|
|
4761
|
+
scope: "col",
|
|
4762
|
+
className: clsx23(
|
|
4763
|
+
tableHeaderCell(col.className, density),
|
|
4764
|
+
col.align && tableAlignClasses[col.align],
|
|
4765
|
+
isPinned && "sticky",
|
|
4766
|
+
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
4767
|
+
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
4768
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
4769
|
+
),
|
|
4770
|
+
style: col.minWidth != null || isStickyHeader || isPinned ? {
|
|
4771
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4772
|
+
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
4773
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4774
|
+
} : void 0,
|
|
4775
|
+
children: /* @__PURE__ */ jsxs20("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
4776
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4777
|
+
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
4778
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx23(
|
|
4779
|
+
"button",
|
|
4780
|
+
{
|
|
4781
|
+
onClick: () => handleSort(col.key),
|
|
4782
|
+
disabled: isLoading,
|
|
4783
|
+
className: `p-1 rounded-md transition-colors ${sortConfig?.key === col.key ? "bg-secondary-200 text-secondary-900" : "hover:bg-secondary-200 text-secondary-400 hover:text-secondary-700"} disabled:opacity-50`,
|
|
4784
|
+
title: `Ordenar por ${col.label}`,
|
|
4785
|
+
children: /* @__PURE__ */ jsx23(MdOutlineSwapVert, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
4786
|
+
}
|
|
4787
|
+
)
|
|
4788
|
+
] }),
|
|
4789
|
+
/* @__PURE__ */ jsx23("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
4790
|
+
] })
|
|
4791
|
+
},
|
|
4792
|
+
col.key
|
|
4793
|
+
);
|
|
4794
|
+
})
|
|
4760
4795
|
}
|
|
4761
4796
|
) }),
|
|
4762
4797
|
/* @__PURE__ */ jsx23("tbody", { className: clsx23(tableBody, "dark:divide-slate-700/30"), children: data.length > 0 ? /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
@@ -4778,14 +4813,22 @@ function ITDataTable({
|
|
|
4778
4813
|
children: columns.map((col) => {
|
|
4779
4814
|
const rawValue = getNestedValue2(row, col.key);
|
|
4780
4815
|
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
4816
|
+
const pin = pinnedMeta[col.key];
|
|
4817
|
+
const isPinned = pin != null;
|
|
4781
4818
|
return /* @__PURE__ */ jsx23(
|
|
4782
4819
|
"td",
|
|
4783
4820
|
{
|
|
4784
4821
|
className: clsx23(
|
|
4785
4822
|
tableCell(col.className, density),
|
|
4786
|
-
col.align && tableAlignClasses[col.align]
|
|
4823
|
+
col.align && tableAlignClasses[col.align],
|
|
4824
|
+
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
4825
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
4826
|
+
isPinned && "z-[1]"
|
|
4787
4827
|
),
|
|
4788
|
-
style: col.minWidth != null
|
|
4828
|
+
style: col.minWidth != null || isPinned ? {
|
|
4829
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4830
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4831
|
+
} : void 0,
|
|
4789
4832
|
title: truncateTitle,
|
|
4790
4833
|
children: col.type === "actions" ? /* @__PURE__ */ jsx23("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ jsx23("div", { className: clsx23(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
4791
4834
|
},
|
|
@@ -7480,6 +7523,14 @@ function ITSegmentedControl({
|
|
|
7480
7523
|
import { useEffect as useEffect13, useRef as useRef20, useState as useState27 } from "react";
|
|
7481
7524
|
import { FaChevronDown as FaChevronDown4 } from "react-icons/fa";
|
|
7482
7525
|
import { jsx as jsx55, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
7526
|
+
function isSubItemGroup(entry) {
|
|
7527
|
+
return "items" in entry;
|
|
7528
|
+
}
|
|
7529
|
+
function flattenSubItems(entries) {
|
|
7530
|
+
return entries.flatMap(
|
|
7531
|
+
(entry) => isSubItemGroup(entry) ? entry.items : [entry]
|
|
7532
|
+
);
|
|
7533
|
+
}
|
|
7483
7534
|
function ITSidebar({
|
|
7484
7535
|
navigationItems = [],
|
|
7485
7536
|
isCollapsed = false,
|
|
@@ -7525,7 +7576,7 @@ function ITSidebar({
|
|
|
7525
7576
|
useEffect13(() => {
|
|
7526
7577
|
const activeParents = /* @__PURE__ */ new Set();
|
|
7527
7578
|
navigationItems.forEach((item) => {
|
|
7528
|
-
if (item.subitems && item.subitems.some((sub) => sub.isActive)) {
|
|
7579
|
+
if (item.subitems && flattenSubItems(item.subitems).some((sub) => sub.isActive)) {
|
|
7529
7580
|
activeParents.add(item.id);
|
|
7530
7581
|
}
|
|
7531
7582
|
});
|
|
@@ -7559,6 +7610,80 @@ function ITSidebar({
|
|
|
7559
7610
|
};
|
|
7560
7611
|
const isSidebarCollapsed = visibleOnMobile ? false : !isHovering && isCollapsed;
|
|
7561
7612
|
const sidebarWidth = isSidebarCollapsed ? "w-[88px]" : "w-[280px]";
|
|
7613
|
+
const renderSubItem = (subitem) => /* @__PURE__ */ jsx55("li", { className: "relative", children: /* @__PURE__ */ jsxs43(
|
|
7614
|
+
"button",
|
|
7615
|
+
{
|
|
7616
|
+
"aria-current": subitem.isActive ? "page" : void 0,
|
|
7617
|
+
onClick: () => {
|
|
7618
|
+
if (subitem.action) subitem.action();
|
|
7619
|
+
if (onSubItemClick) onSubItemClick(subitem);
|
|
7620
|
+
},
|
|
7621
|
+
className: `flex items-center gap-2 w-full text-left px-3 py-1.5 rounded-xl transition-all duration-300`,
|
|
7622
|
+
style: {
|
|
7623
|
+
color: subitem.isActive ? "var(--it-sidebar-active-color, var(--color-secondary-900))" : "var(--it-sidebar-label-color, var(--color-secondary-600))",
|
|
7624
|
+
backgroundColor: subitem.isActive ? "var(--it-sidebar-active-bg, var(--color-secondary-50))" : "transparent",
|
|
7625
|
+
fontSize: "0.78rem",
|
|
7626
|
+
fontWeight: subitem.isActive ? 600 : 500,
|
|
7627
|
+
letterSpacing: "0.01em",
|
|
7628
|
+
marginLeft: subitemConnector === "|" ? "-1px" : "0"
|
|
7629
|
+
},
|
|
7630
|
+
onMouseEnter: (e) => {
|
|
7631
|
+
if (!subitem.isActive) {
|
|
7632
|
+
e.currentTarget.style.backgroundColor = "var(--it-sidebar-hover-bg, var(--color-secondary-100))";
|
|
7633
|
+
e.currentTarget.style.transform = "translateX(3px)";
|
|
7634
|
+
}
|
|
7635
|
+
},
|
|
7636
|
+
onMouseLeave: (e) => {
|
|
7637
|
+
if (!subitem.isActive) {
|
|
7638
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
7639
|
+
e.currentTarget.style.transform = "translateX(0)";
|
|
7640
|
+
}
|
|
7641
|
+
},
|
|
7642
|
+
children: [
|
|
7643
|
+
subitem.isActive && subitemConnector === "|" && /* @__PURE__ */ jsx55(
|
|
7644
|
+
"div",
|
|
7645
|
+
{
|
|
7646
|
+
className: "absolute left-0 top-1/3 bottom-1/3 w-[2.5px] rounded-r-full transition-all",
|
|
7647
|
+
style: {
|
|
7648
|
+
backgroundColor: "var(--it-sidebar-active-icon, var(--color-primary-500))",
|
|
7649
|
+
boxShadow: "0 0 6px color-mix(in srgb, var(--it-sidebar-active-icon, var(--color-primary-500)) 25%, transparent)"
|
|
7650
|
+
}
|
|
7651
|
+
}
|
|
7652
|
+
),
|
|
7653
|
+
subitemConnector === "dot" && /* @__PURE__ */ jsx55(
|
|
7654
|
+
"span",
|
|
7655
|
+
{
|
|
7656
|
+
className: `w-1.5 h-1.5 rounded-full flex-shrink-0 transition-all duration-300 ${subitem.isActive ? "scale-125" : ""}`,
|
|
7657
|
+
style: {
|
|
7658
|
+
backgroundColor: subitem.isActive ? "var(--it-sidebar-active-icon, var(--color-primary-500))" : "var(--it-sidebar-icon-color, var(--color-secondary-400))"
|
|
7659
|
+
}
|
|
7660
|
+
}
|
|
7661
|
+
),
|
|
7662
|
+
/* @__PURE__ */ jsx55(ITText, { as: "span", className: "truncate", children: subitem.label })
|
|
7663
|
+
]
|
|
7664
|
+
}
|
|
7665
|
+
) }, subitem.id);
|
|
7666
|
+
const renderSubItemGroup = (group, itemId) => {
|
|
7667
|
+
const headingId = `it-sidebar-subgroup-${itemId}-${group.id}`;
|
|
7668
|
+
return /* @__PURE__ */ jsxs43("li", { className: "relative", children: [
|
|
7669
|
+
/* @__PURE__ */ jsx55("div", { id: headingId, className: "px-3 pt-2.5 pb-1 mt-1", children: /* @__PURE__ */ jsx55(
|
|
7670
|
+
ITText,
|
|
7671
|
+
{
|
|
7672
|
+
as: "span",
|
|
7673
|
+
className: "block",
|
|
7674
|
+
style: {
|
|
7675
|
+
color: "var(--it-sidebar-icon-color, var(--color-secondary-400))",
|
|
7676
|
+
fontSize: "0.68rem",
|
|
7677
|
+
fontWeight: 700,
|
|
7678
|
+
letterSpacing: "0.08em",
|
|
7679
|
+
textTransform: "uppercase"
|
|
7680
|
+
},
|
|
7681
|
+
children: group.label
|
|
7682
|
+
}
|
|
7683
|
+
) }),
|
|
7684
|
+
/* @__PURE__ */ jsx55("ul", { "aria-labelledby": headingId, className: "flex flex-col gap-0", children: group.items.map(renderSubItem) })
|
|
7685
|
+
] }, group.id);
|
|
7686
|
+
};
|
|
7562
7687
|
return /* @__PURE__ */ jsxs43(
|
|
7563
7688
|
"aside",
|
|
7564
7689
|
{
|
|
@@ -7692,7 +7817,7 @@ function ITSidebar({
|
|
|
7692
7817
|
item.icon && /* @__PURE__ */ jsx55("span", { style: { color: "var(--it-sidebar-active-icon, var(--color-primary-500))" }, className: "text-xl drop-shadow-sm", children: item.icon }),
|
|
7693
7818
|
/* @__PURE__ */ jsx55(ITText, { as: "span", className: "tracking-wide text-[15px]", children: item.label })
|
|
7694
7819
|
] }),
|
|
7695
|
-
item.subitems && item.subitems.length > 0 ? /* @__PURE__ */ jsx55("div", { className: "py-2", children: item.subitems.map((subitem) => /* @__PURE__ */ jsxs43(
|
|
7820
|
+
item.subitems && item.subitems.length > 0 ? /* @__PURE__ */ jsx55("div", { className: "py-2", children: flattenSubItems(item.subitems).map((subitem) => /* @__PURE__ */ jsxs43(
|
|
7696
7821
|
"div",
|
|
7697
7822
|
{
|
|
7698
7823
|
className: `px-5 py-2.5 text-sm flex items-center gap-3 transition-colors relative`,
|
|
@@ -7716,66 +7841,16 @@ function ITSidebar({
|
|
|
7716
7841
|
]
|
|
7717
7842
|
}
|
|
7718
7843
|
),
|
|
7719
|
-
!isSidebarCollapsed && item.subitems && item.subitems.length > 0 && /* @__PURE__ */ jsx55("div", { id: submenuId, role: "group", "aria-label": item.label, className: `overflow-hidden transition-all duration-400 ease-[cubic-bezier(0.2,0,0,1)] ${expandedItems.has(item.id) ? "max-h-[
|
|
7844
|
+
!isSidebarCollapsed && item.subitems && item.subitems.length > 0 && /* @__PURE__ */ jsx55("div", { id: submenuId, role: "group", "aria-label": item.label, className: `overflow-hidden transition-all duration-400 ease-[cubic-bezier(0.2,0,0,1)] ${expandedItems.has(item.id) ? "max-h-[1000px] opacity-100 mt-1" : "max-h-0 opacity-0"}`, children: /* @__PURE__ */ jsx55(
|
|
7720
7845
|
"ul",
|
|
7721
7846
|
{
|
|
7722
7847
|
className: "ml-4 flex flex-col gap-0 py-0.5",
|
|
7723
7848
|
style: {
|
|
7724
7849
|
borderLeft: subitemConnector === "|" ? "1px solid var(--it-sidebar-border, var(--color-secondary-200))" : "none"
|
|
7725
7850
|
},
|
|
7726
|
-
children: item.subitems.map(
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
"aria-current": subitem.isActive ? "page" : void 0,
|
|
7730
|
-
onClick: () => {
|
|
7731
|
-
if (subitem.action) subitem.action();
|
|
7732
|
-
if (onSubItemClick) onSubItemClick(subitem);
|
|
7733
|
-
},
|
|
7734
|
-
className: `flex items-center gap-2 w-full text-left px-3 py-1.5 rounded-xl transition-all duration-300`,
|
|
7735
|
-
style: {
|
|
7736
|
-
color: subitem.isActive ? "var(--it-sidebar-active-color, var(--color-secondary-900))" : "var(--it-sidebar-label-color, var(--color-secondary-600))",
|
|
7737
|
-
backgroundColor: subitem.isActive ? "var(--it-sidebar-active-bg, var(--color-secondary-50))" : "transparent",
|
|
7738
|
-
fontSize: "0.78rem",
|
|
7739
|
-
fontWeight: subitem.isActive ? 600 : 500,
|
|
7740
|
-
letterSpacing: "0.01em",
|
|
7741
|
-
marginLeft: subitemConnector === "|" ? "-1px" : "0"
|
|
7742
|
-
},
|
|
7743
|
-
onMouseEnter: (e) => {
|
|
7744
|
-
if (!subitem.isActive) {
|
|
7745
|
-
e.currentTarget.style.backgroundColor = "var(--it-sidebar-hover-bg, var(--color-secondary-100))";
|
|
7746
|
-
e.currentTarget.style.transform = "translateX(3px)";
|
|
7747
|
-
}
|
|
7748
|
-
},
|
|
7749
|
-
onMouseLeave: (e) => {
|
|
7750
|
-
if (!subitem.isActive) {
|
|
7751
|
-
e.currentTarget.style.backgroundColor = "transparent";
|
|
7752
|
-
e.currentTarget.style.transform = "translateX(0)";
|
|
7753
|
-
}
|
|
7754
|
-
},
|
|
7755
|
-
children: [
|
|
7756
|
-
subitem.isActive && subitemConnector === "|" && /* @__PURE__ */ jsx55(
|
|
7757
|
-
"div",
|
|
7758
|
-
{
|
|
7759
|
-
className: "absolute left-0 top-1/3 bottom-1/3 w-[2.5px] rounded-r-full transition-all",
|
|
7760
|
-
style: {
|
|
7761
|
-
backgroundColor: "var(--it-sidebar-active-icon, var(--color-primary-500))",
|
|
7762
|
-
boxShadow: "0 0 6px color-mix(in srgb, var(--it-sidebar-active-icon, var(--color-primary-500)) 25%, transparent)"
|
|
7763
|
-
}
|
|
7764
|
-
}
|
|
7765
|
-
),
|
|
7766
|
-
subitemConnector === "dot" && /* @__PURE__ */ jsx55(
|
|
7767
|
-
"span",
|
|
7768
|
-
{
|
|
7769
|
-
className: `w-1.5 h-1.5 rounded-full flex-shrink-0 transition-all duration-300 ${subitem.isActive ? "scale-125" : ""}`,
|
|
7770
|
-
style: {
|
|
7771
|
-
backgroundColor: subitem.isActive ? "var(--it-sidebar-active-icon, var(--color-primary-500))" : "var(--it-sidebar-icon-color, var(--color-secondary-400))"
|
|
7772
|
-
}
|
|
7773
|
-
}
|
|
7774
|
-
),
|
|
7775
|
-
/* @__PURE__ */ jsx55(ITText, { as: "span", className: "truncate", children: subitem.label })
|
|
7776
|
-
]
|
|
7777
|
-
}
|
|
7778
|
-
) }, subitem.id))
|
|
7851
|
+
children: item.subitems.map(
|
|
7852
|
+
(entry) => isSubItemGroup(entry) ? renderSubItemGroup(entry, item.id) : renderSubItem(entry)
|
|
7853
|
+
)
|
|
7779
7854
|
}
|
|
7780
7855
|
) })
|
|
7781
7856
|
] }, item.id);
|
|
@@ -8107,6 +8182,7 @@ function ITTable({
|
|
|
8107
8182
|
const isStickyHeader = stickyHeader && isTableVirtual;
|
|
8108
8183
|
const resolvedRowHeight = rowHeight ?? getRowHeight(size, density);
|
|
8109
8184
|
const columnCount = columns.length;
|
|
8185
|
+
const pinnedMeta = React11.useMemo(() => getPinnedColumnMeta(columns), [columns]);
|
|
8110
8186
|
const {
|
|
8111
8187
|
scrollRef,
|
|
8112
8188
|
startIndex,
|
|
@@ -8431,37 +8507,45 @@ function ITTable({
|
|
|
8431
8507
|
{
|
|
8432
8508
|
className: clsx43(tableHeaderRow, "dark:text-slate-200"),
|
|
8433
8509
|
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
8434
|
-
children: columns.map((col) =>
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
col.
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8510
|
+
children: columns.map((col) => {
|
|
8511
|
+
const pin = pinnedMeta[col.key];
|
|
8512
|
+
const isPinned = pin != null;
|
|
8513
|
+
return /* @__PURE__ */ jsx59(
|
|
8514
|
+
"th",
|
|
8515
|
+
{
|
|
8516
|
+
scope: "col",
|
|
8517
|
+
className: clsx43(
|
|
8518
|
+
tableHeaderCell(col.className, density),
|
|
8519
|
+
col.align && tableAlignClasses[col.align],
|
|
8520
|
+
isPinned && "sticky",
|
|
8521
|
+
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
8522
|
+
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
8523
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
8524
|
+
),
|
|
8525
|
+
style: col.minWidth != null || isStickyHeader || isPinned ? {
|
|
8526
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8527
|
+
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
8528
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8529
|
+
} : void 0,
|
|
8530
|
+
children: /* @__PURE__ */ jsxs46("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
8531
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8532
|
+
/* @__PURE__ */ jsx59(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
8533
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx59(
|
|
8534
|
+
"button",
|
|
8535
|
+
{
|
|
8536
|
+
onClick: () => handleSort(col.key),
|
|
8537
|
+
className: `p-1 rounded-md transition-colors ${sortConfig?.key === col.key ? "bg-secondary-200 text-secondary-900" : "hover:bg-secondary-200 text-secondary-400 hover:text-secondary-700"}`,
|
|
8538
|
+
title: `Ordenar por ${col.label}`,
|
|
8539
|
+
children: /* @__PURE__ */ jsx59(MdOutlineSwapVert2, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
8540
|
+
}
|
|
8541
|
+
)
|
|
8542
|
+
] }),
|
|
8543
|
+
/* @__PURE__ */ jsx59("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
8544
|
+
] })
|
|
8545
|
+
},
|
|
8546
|
+
col.key
|
|
8547
|
+
);
|
|
8548
|
+
})
|
|
8465
8549
|
}
|
|
8466
8550
|
) }),
|
|
8467
8551
|
/* @__PURE__ */ jsx59("tbody", { className: clsx43(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ jsxs46(Fragment9, { children: [
|
|
@@ -8483,14 +8567,22 @@ function ITTable({
|
|
|
8483
8567
|
children: columns.map((col) => {
|
|
8484
8568
|
const rawValue = getNestedValue(row, col.key);
|
|
8485
8569
|
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
8570
|
+
const pin = pinnedMeta[col.key];
|
|
8571
|
+
const isPinned = pin != null;
|
|
8486
8572
|
return /* @__PURE__ */ jsx59(
|
|
8487
8573
|
"td",
|
|
8488
8574
|
{
|
|
8489
8575
|
className: clsx43(
|
|
8490
8576
|
tableCell(col.className, density),
|
|
8491
|
-
col.align && tableAlignClasses[col.align]
|
|
8577
|
+
col.align && tableAlignClasses[col.align],
|
|
8578
|
+
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
8579
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
8580
|
+
isPinned && "z-[1]"
|
|
8492
8581
|
),
|
|
8493
|
-
style: col.minWidth != null
|
|
8582
|
+
style: col.minWidth != null || isPinned ? {
|
|
8583
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8584
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8585
|
+
} : void 0,
|
|
8494
8586
|
title: truncateTitle,
|
|
8495
8587
|
children: col.type === "actions" ? /* @__PURE__ */ jsx59("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ jsx59("div", { className: clsx43(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
8496
8588
|
},
|