@axzydev/axzy_ui_system 1.4.7 → 1.4.8
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.cjs +412 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +118 -6
- package/dist/index.d.ts +118 -6
- package/dist/index.js +412 -283
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +1 -1
- package/src/components/molecules/table/table.doc.mdx +18 -1
- package/src/components/molecules/table/table.props.ts +10 -2
- package/src/components/molecules/table/table.tsx +135 -88
- package/src/components/organisms/data-table/ITDataTable.doc.mdx +18 -1
- package/src/components/organisms/data-table/dataTable.props.ts +3 -2
- package/src/components/organisms/data-table/dataTable.tsx +120 -58
- package/src/index.ts +2 -2
- package/src/showcases/DataShowcases.tsx +107 -2
- package/src/types/table.types.ts +110 -0
package/dist/index.js
CHANGED
|
@@ -4490,13 +4490,44 @@ function ITDataTable({
|
|
|
4490
4490
|
virtualizedMaxHeight = 400,
|
|
4491
4491
|
rowHeight,
|
|
4492
4492
|
overscan = 5,
|
|
4493
|
-
stickyHeader = false
|
|
4493
|
+
stickyHeader = false,
|
|
4494
|
+
showViewToggle = true,
|
|
4495
|
+
design,
|
|
4496
|
+
colors,
|
|
4497
|
+
containerStyle,
|
|
4498
|
+
cardClassName,
|
|
4499
|
+
cardStyle,
|
|
4500
|
+
toolbarClassName,
|
|
4501
|
+
toolbarStyle,
|
|
4502
|
+
headerClassName,
|
|
4503
|
+
headerStyle,
|
|
4504
|
+
headerCellClassName,
|
|
4505
|
+
headerCellStyle,
|
|
4506
|
+
rowClassName,
|
|
4507
|
+
rowStyle,
|
|
4508
|
+
cellClassName,
|
|
4509
|
+
cellStyle,
|
|
4510
|
+
cardsClassName,
|
|
4511
|
+
cardsStyle,
|
|
4512
|
+
footerClassName,
|
|
4513
|
+
footerStyle
|
|
4494
4514
|
}) {
|
|
4495
4515
|
const [viewMode, setViewMode] = useState19(defaultView || "table");
|
|
4496
4516
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
4497
4517
|
const [data, setData] = useState19([]);
|
|
4498
4518
|
const [totalItems, setTotalItems] = useState19(0);
|
|
4499
4519
|
const [isLoading, setIsLoading] = useState19(fetchOnMount);
|
|
4520
|
+
const colorVars = {
|
|
4521
|
+
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
4522
|
+
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
4523
|
+
...colors?.rowBg ? { "--color-table-rowBg": colors.rowBg } : {},
|
|
4524
|
+
...colors?.rowText ? { "--color-table-rowText": colors.rowText } : {},
|
|
4525
|
+
...colors?.rowHover ? { "--color-table-rowHover": colors.rowHover } : {}
|
|
4526
|
+
};
|
|
4527
|
+
const mergeSlot = (slot, flatClassName, flatStyle) => ({
|
|
4528
|
+
className: clsx23(slot?.className, flatClassName),
|
|
4529
|
+
style: { ...slot?.style, ...flatStyle }
|
|
4530
|
+
});
|
|
4500
4531
|
const isFixed = layout === "fixed";
|
|
4501
4532
|
const forcedCards = autoCardBreakpoint > 0 && containerWidth > 0 && containerWidth < autoCardBreakpoint;
|
|
4502
4533
|
const effectiveView = forcedCards ? "cards" : viewMode;
|
|
@@ -4759,6 +4790,25 @@ function ITDataTable({
|
|
|
4759
4790
|
event.preventDefault();
|
|
4760
4791
|
onRowClick(row, event);
|
|
4761
4792
|
};
|
|
4793
|
+
const containerSlot = mergeSlot(design?.container, containerClassName, containerStyle);
|
|
4794
|
+
const cardSlot = mergeSlot(design?.card, cardClassName, cardStyle);
|
|
4795
|
+
const toolbarSlot = mergeSlot(design?.toolbar, toolbarClassName, toolbarStyle);
|
|
4796
|
+
const headerSlot = mergeSlot(design?.header, headerClassName, headerStyle);
|
|
4797
|
+
const headerCellSlot = mergeSlot(design?.headerCell, headerCellClassName, headerCellStyle);
|
|
4798
|
+
const rowSlot = mergeSlot(design?.row, rowClassName, rowStyle);
|
|
4799
|
+
const cellSlot = mergeSlot(design?.cell, cellClassName, cellStyle);
|
|
4800
|
+
const cardsSlot = mergeSlot(design?.cards, cardsClassName, cardsStyle);
|
|
4801
|
+
const footerSlot = mergeSlot(design?.footer, footerClassName, footerStyle);
|
|
4802
|
+
const viewToggle = /* @__PURE__ */ jsxs20("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
4803
|
+
/* @__PURE__ */ jsxs20("button", { onClick: () => setViewMode("table"), disabled: forcedCards, className: segCtrlClass("table"), children: [
|
|
4804
|
+
/* @__PURE__ */ jsx23(FaTable, { size: 11 }),
|
|
4805
|
+
"Table"
|
|
4806
|
+
] }),
|
|
4807
|
+
/* @__PURE__ */ jsxs20("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4808
|
+
/* @__PURE__ */ jsx23(FaThLarge, { size: 11 }),
|
|
4809
|
+
"Cards"
|
|
4810
|
+
] })
|
|
4811
|
+
] });
|
|
4762
4812
|
const tableEl = /* @__PURE__ */ jsxs20(
|
|
4763
4813
|
"table",
|
|
4764
4814
|
{
|
|
@@ -4784,7 +4834,8 @@ function ITDataTable({
|
|
|
4784
4834
|
/* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsx23(
|
|
4785
4835
|
"tr",
|
|
4786
4836
|
{
|
|
4787
|
-
className: clsx23(tableHeaderRow, "dark:text-slate-200"),
|
|
4837
|
+
className: clsx23(tableHeaderRow, "dark:text-slate-200", headerSlot.className),
|
|
4838
|
+
style: headerSlot.style,
|
|
4788
4839
|
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
4789
4840
|
children: columns.map((col) => {
|
|
4790
4841
|
const pin = pinnedMeta[col.key];
|
|
@@ -4799,13 +4850,17 @@ function ITDataTable({
|
|
|
4799
4850
|
isPinned && "sticky",
|
|
4800
4851
|
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
4801
4852
|
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
4802
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
4853
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
4854
|
+
headerCellSlot.className,
|
|
4855
|
+
col.headerClassName
|
|
4803
4856
|
),
|
|
4804
|
-
style:
|
|
4857
|
+
style: {
|
|
4805
4858
|
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4806
4859
|
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
4807
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4808
|
-
|
|
4860
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
4861
|
+
...headerCellSlot.style,
|
|
4862
|
+
...col.headerStyle
|
|
4863
|
+
},
|
|
4809
4864
|
children: /* @__PURE__ */ jsxs20("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
4810
4865
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4811
4866
|
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
@@ -4839,8 +4894,10 @@ function ITDataTable({
|
|
|
4839
4894
|
className: clsx23(
|
|
4840
4895
|
tableRow,
|
|
4841
4896
|
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
4842
|
-
onRowClick && !isLoading && tableRowClickable
|
|
4897
|
+
onRowClick && !isLoading && tableRowClickable,
|
|
4898
|
+
rowSlot.className
|
|
4843
4899
|
),
|
|
4900
|
+
style: rowSlot.style,
|
|
4844
4901
|
tabIndex: onRowClick && !isLoading ? 0 : void 0,
|
|
4845
4902
|
onClick: onRowClick && !isLoading ? handleRowClick(row) : void 0,
|
|
4846
4903
|
onKeyDown: onRowClick && !isLoading ? handleRowKeyDown(row) : void 0,
|
|
@@ -4857,12 +4914,16 @@ function ITDataTable({
|
|
|
4857
4914
|
col.align && tableAlignClasses[col.align],
|
|
4858
4915
|
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
4859
4916
|
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
4860
|
-
isPinned && "z-[1]"
|
|
4917
|
+
isPinned && "z-[1]",
|
|
4918
|
+
cellSlot.className,
|
|
4919
|
+
col.cellClassName
|
|
4861
4920
|
),
|
|
4862
|
-
style:
|
|
4921
|
+
style: {
|
|
4863
4922
|
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4864
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4865
|
-
|
|
4923
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
4924
|
+
...cellSlot.style,
|
|
4925
|
+
...col.cellStyle
|
|
4926
|
+
},
|
|
4866
4927
|
title: truncateTitle,
|
|
4867
4928
|
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) })
|
|
4868
4929
|
},
|
|
@@ -4881,78 +4942,89 @@ function ITDataTable({
|
|
|
4881
4942
|
]
|
|
4882
4943
|
}
|
|
4883
4944
|
);
|
|
4884
|
-
return /* @__PURE__ */ jsxs20(
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
/* @__PURE__ */ jsx23(FaTable, { size: 11 }),
|
|
4893
|
-
"Table"
|
|
4894
|
-
] }),
|
|
4895
|
-
/* @__PURE__ */ jsxs20("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4896
|
-
/* @__PURE__ */ jsx23(FaThLarge, { size: 11 }),
|
|
4897
|
-
"Cards"
|
|
4898
|
-
] })
|
|
4899
|
-
] })
|
|
4900
|
-
] })
|
|
4901
|
-
] }),
|
|
4902
|
-
!title && /* @__PURE__ */ jsx23("div", { className: "flex justify-end px-4 pt-3", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
4903
|
-
/* @__PURE__ */ jsxs20("button", { onClick: () => setViewMode("table"), disabled: forcedCards, className: segCtrlClass("table"), children: [
|
|
4904
|
-
/* @__PURE__ */ jsx23(FaTable, { size: 11 }),
|
|
4905
|
-
"Table"
|
|
4906
|
-
] }),
|
|
4907
|
-
/* @__PURE__ */ jsxs20("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4908
|
-
/* @__PURE__ */ jsx23(FaThLarge, { size: 11 }),
|
|
4909
|
-
"Cards"
|
|
4910
|
-
] })
|
|
4911
|
-
] }) }),
|
|
4912
|
-
/* @__PURE__ */ jsxs20("div", { className: scrollOuterClass, children: [
|
|
4913
|
-
isLoading && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-white/40 backdrop-blur-[2px] transition-all duration-300", children: /* @__PURE__ */ jsx23("div", { className: "flex flex-col items-center gap-3 p-6 rounded-2xl shadow-xl border border-secondary-100 animate-in fade-in zoom-in duration-300", style: { backgroundColor: "var(--color-table-rowBg, #ffffff)" }, children: loadingIndicator || /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
4914
|
-
/* @__PURE__ */ jsx23(FaSpinner, { className: "animate-spin text-primary-500 text-4xl" }),
|
|
4915
|
-
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-sm font-semibold text-secondary-600 animate-pulse", children: "Cargando datos..." })
|
|
4916
|
-
] }) }) }),
|
|
4917
|
-
effectiveView === "cards" ? /* @__PURE__ */ jsx23("div", { className: "p-4 space-y-3 max-h-[400px] overflow-y-auto", children: data.length > 0 ? data.map((row, i) => /* @__PURE__ */ jsx23(
|
|
4945
|
+
return /* @__PURE__ */ jsxs20(
|
|
4946
|
+
"div",
|
|
4947
|
+
{
|
|
4948
|
+
ref: rootRef,
|
|
4949
|
+
className: clsx23("space-y-4 w-full relative", containerSlot.className),
|
|
4950
|
+
style: { ...colorVars, ...containerSlot.style },
|
|
4951
|
+
children: [
|
|
4952
|
+
/* @__PURE__ */ jsxs20(
|
|
4918
4953
|
"div",
|
|
4919
4954
|
{
|
|
4920
|
-
className: clsx23(
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4955
|
+
className: clsx23(tableContainer, cardSlot.className),
|
|
4956
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...cardSlot.style },
|
|
4957
|
+
children: [
|
|
4958
|
+
title && /* @__PURE__ */ jsxs20(
|
|
4959
|
+
"div",
|
|
4960
|
+
{
|
|
4961
|
+
className: clsx23("px-6 py-5 flex items-center justify-between", toolbarSlot.className),
|
|
4962
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...toolbarSlot.style },
|
|
4963
|
+
children: [
|
|
4964
|
+
/* @__PURE__ */ jsx23(ITText, { as: "h2", className: "text-xl font-bold text-secondary-900 leading-tight", children: title }),
|
|
4965
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
4966
|
+
isLoading && /* @__PURE__ */ jsx23("div", { className: "text-secondary-400", children: loadingIndicator || /* @__PURE__ */ jsx23(FaSpinner, { className: "animate-spin text-primary-500 text-xl" }) }),
|
|
4967
|
+
showViewToggle && viewToggle
|
|
4968
|
+
] })
|
|
4969
|
+
]
|
|
4970
|
+
}
|
|
4971
|
+
),
|
|
4972
|
+
!title && showViewToggle && /* @__PURE__ */ jsx23("div", { className: clsx23("flex justify-end px-4 pt-3", toolbarSlot.className), style: toolbarSlot.style, children: viewToggle }),
|
|
4973
|
+
/* @__PURE__ */ jsxs20("div", { className: scrollOuterClass, children: [
|
|
4974
|
+
isLoading && /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-white/40 backdrop-blur-[2px] transition-all duration-300", children: /* @__PURE__ */ jsx23("div", { className: "flex flex-col items-center gap-3 p-6 rounded-2xl shadow-xl border border-secondary-100 animate-in fade-in zoom-in duration-300", style: { backgroundColor: "var(--color-table-rowBg, #ffffff)" }, children: loadingIndicator || /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
4975
|
+
/* @__PURE__ */ jsx23(FaSpinner, { className: "animate-spin text-primary-500 text-4xl" }),
|
|
4976
|
+
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-sm font-semibold text-secondary-600 animate-pulse", children: "Cargando datos..." })
|
|
4977
|
+
] }) }) }),
|
|
4978
|
+
effectiveView === "cards" ? /* @__PURE__ */ jsx23("div", { className: clsx23("p-4 space-y-3 max-h-[400px] overflow-y-auto", cardsSlot.className), style: cardsSlot.style, children: data.length > 0 ? data.map((row, i) => /* @__PURE__ */ jsx23(
|
|
4979
|
+
"div",
|
|
4980
|
+
{
|
|
4981
|
+
className: clsx23(tableCardHover, onRowClick && !isLoading && tableCardClickable),
|
|
4982
|
+
role: onRowClick && !isLoading ? "button" : void 0,
|
|
4983
|
+
tabIndex: onRowClick && !isLoading ? 0 : void 0,
|
|
4984
|
+
onClick: onRowClick && !isLoading ? handleRowClick(row) : void 0,
|
|
4985
|
+
onKeyDown: onRowClick && !isLoading ? handleRowKeyDown(row) : void 0,
|
|
4986
|
+
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
4987
|
+
},
|
|
4988
|
+
i
|
|
4989
|
+
)) : !isLoading && /* @__PURE__ */ jsxs20("div", { className: clsx23(tableEmptyContent, "py-12"), children: [
|
|
4990
|
+
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
4991
|
+
/* @__PURE__ */ jsx23(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
4992
|
+
] }) }) : isTableVirtual ? /* @__PURE__ */ jsx23(
|
|
4993
|
+
"div",
|
|
4994
|
+
{
|
|
4995
|
+
ref: scrollRef,
|
|
4996
|
+
className: "overflow-x-auto overflow-y-auto",
|
|
4997
|
+
style: { maxHeight: virtualizedMaxHeight },
|
|
4998
|
+
children: tableEl
|
|
4999
|
+
}
|
|
5000
|
+
) : tableEl
|
|
5001
|
+
] })
|
|
5002
|
+
]
|
|
5003
|
+
}
|
|
5004
|
+
),
|
|
5005
|
+
/* @__PURE__ */ jsx23(
|
|
4932
5006
|
"div",
|
|
4933
5007
|
{
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
5008
|
+
className: clsx23("rounded-b-xl px-6 py-4", footerSlot.className),
|
|
5009
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...footerSlot.style },
|
|
5010
|
+
children: /* @__PURE__ */ jsx23(
|
|
5011
|
+
ITPagination,
|
|
5012
|
+
{
|
|
5013
|
+
currentPage,
|
|
5014
|
+
totalPages: computedTotalPages,
|
|
5015
|
+
onPageChange: goToPage,
|
|
5016
|
+
color: "primary",
|
|
5017
|
+
itemsPerPageOptions,
|
|
5018
|
+
itemsPerPage,
|
|
5019
|
+
onItemsPerPageChange: handleItemsPerPageChange,
|
|
5020
|
+
totalItems
|
|
5021
|
+
}
|
|
5022
|
+
)
|
|
4938
5023
|
}
|
|
4939
|
-
)
|
|
4940
|
-
]
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
ITPagination,
|
|
4944
|
-
{
|
|
4945
|
-
currentPage,
|
|
4946
|
-
totalPages: computedTotalPages,
|
|
4947
|
-
onPageChange: goToPage,
|
|
4948
|
-
color: "primary",
|
|
4949
|
-
itemsPerPageOptions,
|
|
4950
|
-
itemsPerPage,
|
|
4951
|
-
onItemsPerPageChange: handleItemsPerPageChange,
|
|
4952
|
-
totalItems
|
|
4953
|
-
}
|
|
4954
|
-
) })
|
|
4955
|
-
] });
|
|
5024
|
+
)
|
|
5025
|
+
]
|
|
5026
|
+
}
|
|
5027
|
+
);
|
|
4956
5028
|
}
|
|
4957
5029
|
|
|
4958
5030
|
// src/components/organisms/dialog/dialog.tsx
|
|
@@ -8411,10 +8483,41 @@ function ITTable({
|
|
|
8411
8483
|
virtualizedMaxHeight = 400,
|
|
8412
8484
|
rowHeight,
|
|
8413
8485
|
overscan = 5,
|
|
8414
|
-
stickyHeader = false
|
|
8486
|
+
stickyHeader = false,
|
|
8487
|
+
showViewToggle = true,
|
|
8488
|
+
design,
|
|
8489
|
+
colors,
|
|
8490
|
+
containerStyle,
|
|
8491
|
+
cardClassName,
|
|
8492
|
+
cardStyle,
|
|
8493
|
+
toolbarClassName,
|
|
8494
|
+
toolbarStyle,
|
|
8495
|
+
headerClassName,
|
|
8496
|
+
headerStyle,
|
|
8497
|
+
headerCellClassName,
|
|
8498
|
+
headerCellStyle,
|
|
8499
|
+
rowClassName,
|
|
8500
|
+
rowStyle,
|
|
8501
|
+
cellClassName,
|
|
8502
|
+
cellStyle,
|
|
8503
|
+
cardsClassName,
|
|
8504
|
+
cardsStyle,
|
|
8505
|
+
footerClassName,
|
|
8506
|
+
footerStyle
|
|
8415
8507
|
}) {
|
|
8416
8508
|
const [viewMode, setViewMode] = useState30(defaultView);
|
|
8417
8509
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
8510
|
+
const colorVars = {
|
|
8511
|
+
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
8512
|
+
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
8513
|
+
...colors?.rowBg ? { "--color-table-rowBg": colors.rowBg } : {},
|
|
8514
|
+
...colors?.rowText ? { "--color-table-rowText": colors.rowText } : {},
|
|
8515
|
+
...colors?.rowHover ? { "--color-table-rowHover": colors.rowHover } : {}
|
|
8516
|
+
};
|
|
8517
|
+
const mergeSlot = (slot, flatClassName, flatStyle) => ({
|
|
8518
|
+
className: clsx44(slot?.className, flatClassName),
|
|
8519
|
+
style: { ...slot?.style, ...flatStyle }
|
|
8520
|
+
});
|
|
8418
8521
|
const isFixed = layout === "fixed";
|
|
8419
8522
|
const forcedCards = autoCardBreakpoint > 0 && containerWidth > 0 && containerWidth < autoCardBreakpoint;
|
|
8420
8523
|
const effectiveView = forcedCards ? "cards" : viewMode;
|
|
@@ -8746,215 +8849,241 @@ function ITTable({
|
|
|
8746
8849
|
event.preventDefault();
|
|
8747
8850
|
onRowClick(row, event);
|
|
8748
8851
|
};
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
"Table"
|
|
8762
|
-
]
|
|
8763
|
-
}
|
|
8764
|
-
),
|
|
8765
|
-
/* @__PURE__ */ jsxs47(
|
|
8766
|
-
"button",
|
|
8767
|
-
{
|
|
8768
|
-
onClick: () => setViewMode("cards"),
|
|
8769
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8770
|
-
children: [
|
|
8771
|
-
/* @__PURE__ */ jsx61(FaThLarge2, { size: 11 }),
|
|
8772
|
-
"Cards"
|
|
8773
|
-
]
|
|
8774
|
-
}
|
|
8775
|
-
)
|
|
8776
|
-
] })
|
|
8777
|
-
] }),
|
|
8778
|
-
!title && /* @__PURE__ */ jsx61("div", { className: "flex justify-end px-4 pt-3", children: /* @__PURE__ */ jsxs47("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
8779
|
-
/* @__PURE__ */ jsxs47(
|
|
8780
|
-
"button",
|
|
8781
|
-
{
|
|
8782
|
-
onClick: () => setViewMode("table"),
|
|
8783
|
-
disabled: forcedCards,
|
|
8784
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "table" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8785
|
-
children: [
|
|
8786
|
-
/* @__PURE__ */ jsx61(FaTable2, { size: 11 }),
|
|
8787
|
-
"Table"
|
|
8788
|
-
]
|
|
8789
|
-
}
|
|
8790
|
-
),
|
|
8791
|
-
/* @__PURE__ */ jsxs47(
|
|
8792
|
-
"button",
|
|
8793
|
-
{
|
|
8794
|
-
onClick: () => setViewMode("cards"),
|
|
8795
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8796
|
-
children: [
|
|
8797
|
-
/* @__PURE__ */ jsx61(FaThLarge2, { size: 11 }),
|
|
8798
|
-
"Cards"
|
|
8799
|
-
]
|
|
8800
|
-
}
|
|
8801
|
-
)
|
|
8802
|
-
] }) }),
|
|
8803
|
-
effectiveView === "cards" ? /* @__PURE__ */ jsx61("div", { className: "p-4 space-y-3 max-h-[400px] overflow-y-auto", children: currentData.length > 0 ? currentData.map((row, i) => /* @__PURE__ */ jsx61(
|
|
8804
|
-
"div",
|
|
8805
|
-
{
|
|
8806
|
-
className: clsx44(tableCardHover, onRowClick && tableCardClickable),
|
|
8807
|
-
role: onRowClick ? "button" : void 0,
|
|
8808
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8809
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8810
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8811
|
-
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
8812
|
-
},
|
|
8813
|
-
i
|
|
8814
|
-
)) : /* @__PURE__ */ jsxs47("div", { className: clsx44(tableEmptyContent, "py-12"), children: [
|
|
8815
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8816
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8817
|
-
] }) }) : /* @__PURE__ */ jsx61(
|
|
8818
|
-
"div",
|
|
8852
|
+
const containerSlot = mergeSlot(design?.container, containerClassName, containerStyle);
|
|
8853
|
+
const cardSlot = mergeSlot(design?.card, cardClassName, cardStyle);
|
|
8854
|
+
const toolbarSlot = mergeSlot(design?.toolbar, toolbarClassName, toolbarStyle);
|
|
8855
|
+
const headerSlot = mergeSlot(design?.header, headerClassName, headerStyle);
|
|
8856
|
+
const headerCellSlot = mergeSlot(design?.headerCell, headerCellClassName, headerCellStyle);
|
|
8857
|
+
const rowSlot = mergeSlot(design?.row, rowClassName, rowStyle);
|
|
8858
|
+
const cellSlot = mergeSlot(design?.cell, cellClassName, cellStyle);
|
|
8859
|
+
const cardsSlot = mergeSlot(design?.cards, cardsClassName, cardsStyle);
|
|
8860
|
+
const footerSlot = mergeSlot(design?.footer, footerClassName, footerStyle);
|
|
8861
|
+
const viewToggle = /* @__PURE__ */ jsxs47("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
8862
|
+
/* @__PURE__ */ jsxs47(
|
|
8863
|
+
"button",
|
|
8819
8864
|
{
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
children:
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
tableLayoutClass,
|
|
8828
|
-
showVerticalBorder && "[&_th]:border-r [&_th:last-child]:border-r-0 [&_td]:border-r [&_td:last-child]:border-r-0",
|
|
8829
|
-
showVerticalBorder && (verticalBorderClassname || "[&_th]:border-slate-100 dark:[&_th]:border-slate-700/30 [&_td]:border-slate-100 dark:[&_td]:border-slate-700/30"),
|
|
8830
|
-
variantStyles[variant],
|
|
8831
|
-
sizeStyles[size]
|
|
8832
|
-
),
|
|
8833
|
-
style: isFixed ? { tableLayout: "fixed" } : void 0,
|
|
8834
|
-
"aria-rowcount": isTableVirtual ? currentData.length + 1 : void 0,
|
|
8835
|
-
children: [
|
|
8836
|
-
hasColumnWidths && /* @__PURE__ */ jsx61("colgroup", { children: columns.map((col) => /* @__PURE__ */ jsx61(
|
|
8837
|
-
"col",
|
|
8838
|
-
{
|
|
8839
|
-
style: col.width != null ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0
|
|
8840
|
-
},
|
|
8841
|
-
col.key
|
|
8842
|
-
)) }),
|
|
8843
|
-
/* @__PURE__ */ jsx61("thead", { children: /* @__PURE__ */ jsx61(
|
|
8844
|
-
"tr",
|
|
8845
|
-
{
|
|
8846
|
-
className: clsx44(tableHeaderRow, "dark:text-slate-200"),
|
|
8847
|
-
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
8848
|
-
children: columns.map((col) => {
|
|
8849
|
-
const pin = pinnedMeta[col.key];
|
|
8850
|
-
const isPinned = pin != null;
|
|
8851
|
-
return /* @__PURE__ */ jsx61(
|
|
8852
|
-
"th",
|
|
8853
|
-
{
|
|
8854
|
-
scope: "col",
|
|
8855
|
-
className: clsx44(
|
|
8856
|
-
tableHeaderCell(col.className, density),
|
|
8857
|
-
col.align && tableAlignClasses[col.align],
|
|
8858
|
-
isPinned && "sticky",
|
|
8859
|
-
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
8860
|
-
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
8861
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
8862
|
-
),
|
|
8863
|
-
style: col.minWidth != null || isStickyHeader || isPinned ? {
|
|
8864
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8865
|
-
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
8866
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8867
|
-
} : void 0,
|
|
8868
|
-
children: /* @__PURE__ */ jsxs47("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
8869
|
-
/* @__PURE__ */ jsxs47("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8870
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
8871
|
-
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx61(
|
|
8872
|
-
"button",
|
|
8873
|
-
{
|
|
8874
|
-
onClick: () => handleSort(col.key),
|
|
8875
|
-
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"}`,
|
|
8876
|
-
title: `Ordenar por ${col.label}`,
|
|
8877
|
-
children: /* @__PURE__ */ jsx61(MdOutlineSwapVert2, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
8878
|
-
}
|
|
8879
|
-
)
|
|
8880
|
-
] }),
|
|
8881
|
-
/* @__PURE__ */ jsx61("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
8882
|
-
] })
|
|
8883
|
-
},
|
|
8884
|
-
col.key
|
|
8885
|
-
);
|
|
8886
|
-
})
|
|
8887
|
-
}
|
|
8888
|
-
) }),
|
|
8889
|
-
/* @__PURE__ */ jsx61("tbody", { className: clsx44(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
|
|
8890
|
-
isTableVirtual && topSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: topSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) }),
|
|
8891
|
-
windowData.map((row, windowIndex) => {
|
|
8892
|
-
const absoluteIndex = isTableVirtual ? startIndex + windowIndex : windowIndex;
|
|
8893
|
-
return /* @__PURE__ */ jsx61(
|
|
8894
|
-
"tr",
|
|
8895
|
-
{
|
|
8896
|
-
"aria-rowindex": isTableVirtual ? absoluteIndex + 2 : void 0,
|
|
8897
|
-
className: clsx44(
|
|
8898
|
-
tableRow,
|
|
8899
|
-
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
8900
|
-
onRowClick && tableRowClickable
|
|
8901
|
-
),
|
|
8902
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8903
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8904
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8905
|
-
children: columns.map((col) => {
|
|
8906
|
-
const rawValue = getNestedValue(row, col.key);
|
|
8907
|
-
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
8908
|
-
const pin = pinnedMeta[col.key];
|
|
8909
|
-
const isPinned = pin != null;
|
|
8910
|
-
return /* @__PURE__ */ jsx61(
|
|
8911
|
-
"td",
|
|
8912
|
-
{
|
|
8913
|
-
className: clsx44(
|
|
8914
|
-
tableCell(col.className, density),
|
|
8915
|
-
col.align && tableAlignClasses[col.align],
|
|
8916
|
-
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
8917
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
8918
|
-
isPinned && "z-[1]"
|
|
8919
|
-
),
|
|
8920
|
-
style: col.minWidth != null || isPinned ? {
|
|
8921
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8922
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8923
|
-
} : void 0,
|
|
8924
|
-
title: truncateTitle,
|
|
8925
|
-
children: col.type === "actions" ? /* @__PURE__ */ jsx61("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ jsx61("div", { className: clsx44(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
8926
|
-
},
|
|
8927
|
-
`${absoluteIndex}-${col.key}`
|
|
8928
|
-
);
|
|
8929
|
-
})
|
|
8930
|
-
},
|
|
8931
|
-
absoluteIndex
|
|
8932
|
-
);
|
|
8933
|
-
}),
|
|
8934
|
-
isTableVirtual && bottomSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: bottomSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) })
|
|
8935
|
-
] }) : /* @__PURE__ */ jsx61("tr", { children: /* @__PURE__ */ jsx61("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ jsxs47("div", { className: tableEmptyContent, children: [
|
|
8936
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8937
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8938
|
-
] }) }) }) })
|
|
8939
|
-
]
|
|
8940
|
-
}
|
|
8941
|
-
)
|
|
8865
|
+
onClick: () => setViewMode("table"),
|
|
8866
|
+
disabled: forcedCards,
|
|
8867
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "table" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8868
|
+
children: [
|
|
8869
|
+
/* @__PURE__ */ jsx61(FaTable2, { size: 11 }),
|
|
8870
|
+
"Table"
|
|
8871
|
+
]
|
|
8942
8872
|
}
|
|
8943
8873
|
),
|
|
8944
|
-
/* @__PURE__ */
|
|
8945
|
-
|
|
8874
|
+
/* @__PURE__ */ jsxs47(
|
|
8875
|
+
"button",
|
|
8946
8876
|
{
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
onItemsPerPageChange: handleItemsPerPageChange,
|
|
8954
|
-
totalItems: filteredData.length
|
|
8877
|
+
onClick: () => setViewMode("cards"),
|
|
8878
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8879
|
+
children: [
|
|
8880
|
+
/* @__PURE__ */ jsx61(FaThLarge2, { size: 11 }),
|
|
8881
|
+
"Cards"
|
|
8882
|
+
]
|
|
8955
8883
|
}
|
|
8956
|
-
)
|
|
8957
|
-
] })
|
|
8884
|
+
)
|
|
8885
|
+
] });
|
|
8886
|
+
return /* @__PURE__ */ jsx61(
|
|
8887
|
+
"div",
|
|
8888
|
+
{
|
|
8889
|
+
ref: rootRef,
|
|
8890
|
+
className: clsx44("space-y-4 w-full", containerSlot.className),
|
|
8891
|
+
style: { ...colorVars, ...containerSlot.style },
|
|
8892
|
+
children: /* @__PURE__ */ jsxs47(
|
|
8893
|
+
"div",
|
|
8894
|
+
{
|
|
8895
|
+
className: clsx44(tableContainer, cardSlot.className),
|
|
8896
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...cardSlot.style },
|
|
8897
|
+
children: [
|
|
8898
|
+
title && /* @__PURE__ */ jsxs47(
|
|
8899
|
+
"div",
|
|
8900
|
+
{
|
|
8901
|
+
className: clsx44("px-6 py-5 flex items-center justify-between", toolbarSlot.className),
|
|
8902
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...toolbarSlot.style },
|
|
8903
|
+
children: [
|
|
8904
|
+
/* @__PURE__ */ jsx61(ITText, { as: "h2", className: "text-xl font-bold text-secondary-900 leading-tight", children: title }),
|
|
8905
|
+
showViewToggle && viewToggle
|
|
8906
|
+
]
|
|
8907
|
+
}
|
|
8908
|
+
),
|
|
8909
|
+
!title && showViewToggle && /* @__PURE__ */ jsx61("div", { className: clsx44("flex justify-end px-4 pt-3", toolbarSlot.className), style: toolbarSlot.style, children: viewToggle }),
|
|
8910
|
+
effectiveView === "cards" ? /* @__PURE__ */ jsx61("div", { className: clsx44("p-4 space-y-3 max-h-[400px] overflow-y-auto", cardsSlot.className), style: cardsSlot.style, children: currentData.length > 0 ? currentData.map((row, i) => /* @__PURE__ */ jsx61(
|
|
8911
|
+
"div",
|
|
8912
|
+
{
|
|
8913
|
+
className: clsx44(tableCardHover, onRowClick && tableCardClickable),
|
|
8914
|
+
role: onRowClick ? "button" : void 0,
|
|
8915
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
8916
|
+
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8917
|
+
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8918
|
+
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
8919
|
+
},
|
|
8920
|
+
i
|
|
8921
|
+
)) : /* @__PURE__ */ jsxs47("div", { className: clsx44(tableEmptyContent, "py-12"), children: [
|
|
8922
|
+
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8923
|
+
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8924
|
+
] }) }) : /* @__PURE__ */ jsx61(
|
|
8925
|
+
"div",
|
|
8926
|
+
{
|
|
8927
|
+
ref: isTableVirtual ? scrollRef : void 0,
|
|
8928
|
+
className: isTableVirtual ? "overflow-x-auto overflow-y-auto" : "overflow-x-auto",
|
|
8929
|
+
style: isTableVirtual ? { maxHeight: virtualizedMaxHeight } : void 0,
|
|
8930
|
+
children: /* @__PURE__ */ jsxs47(
|
|
8931
|
+
"table",
|
|
8932
|
+
{
|
|
8933
|
+
className: clsx44(
|
|
8934
|
+
tableLayoutClass,
|
|
8935
|
+
showVerticalBorder && "[&_th]:border-r [&_th:last-child]:border-r-0 [&_td]:border-r [&_td:last-child]:border-r-0",
|
|
8936
|
+
showVerticalBorder && (verticalBorderClassname || "[&_th]:border-slate-100 dark:[&_th]:border-slate-700/30 [&_td]:border-slate-100 dark:[&_td]:border-slate-700/30"),
|
|
8937
|
+
variantStyles[variant],
|
|
8938
|
+
sizeStyles[size]
|
|
8939
|
+
),
|
|
8940
|
+
style: isFixed ? { tableLayout: "fixed" } : void 0,
|
|
8941
|
+
"aria-rowcount": isTableVirtual ? currentData.length + 1 : void 0,
|
|
8942
|
+
children: [
|
|
8943
|
+
hasColumnWidths && /* @__PURE__ */ jsx61("colgroup", { children: columns.map((col) => /* @__PURE__ */ jsx61(
|
|
8944
|
+
"col",
|
|
8945
|
+
{
|
|
8946
|
+
style: col.width != null ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0
|
|
8947
|
+
},
|
|
8948
|
+
col.key
|
|
8949
|
+
)) }),
|
|
8950
|
+
/* @__PURE__ */ jsx61("thead", { children: /* @__PURE__ */ jsx61(
|
|
8951
|
+
"tr",
|
|
8952
|
+
{
|
|
8953
|
+
className: clsx44(tableHeaderRow, "dark:text-slate-200", headerSlot.className),
|
|
8954
|
+
style: headerSlot.style,
|
|
8955
|
+
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
8956
|
+
children: columns.map((col) => {
|
|
8957
|
+
const pin = pinnedMeta[col.key];
|
|
8958
|
+
const isPinned = pin != null;
|
|
8959
|
+
return /* @__PURE__ */ jsx61(
|
|
8960
|
+
"th",
|
|
8961
|
+
{
|
|
8962
|
+
scope: "col",
|
|
8963
|
+
className: clsx44(
|
|
8964
|
+
tableHeaderCell(col.className, density),
|
|
8965
|
+
col.align && tableAlignClasses[col.align],
|
|
8966
|
+
isPinned && "sticky",
|
|
8967
|
+
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
8968
|
+
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
8969
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
8970
|
+
headerCellSlot.className,
|
|
8971
|
+
col.headerClassName
|
|
8972
|
+
),
|
|
8973
|
+
style: {
|
|
8974
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8975
|
+
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
8976
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
8977
|
+
...headerCellSlot.style,
|
|
8978
|
+
...col.headerStyle
|
|
8979
|
+
},
|
|
8980
|
+
children: /* @__PURE__ */ jsxs47("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
8981
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8982
|
+
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
8983
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx61(
|
|
8984
|
+
"button",
|
|
8985
|
+
{
|
|
8986
|
+
onClick: () => handleSort(col.key),
|
|
8987
|
+
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"}`,
|
|
8988
|
+
title: `Ordenar por ${col.label}`,
|
|
8989
|
+
children: /* @__PURE__ */ jsx61(MdOutlineSwapVert2, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
8990
|
+
}
|
|
8991
|
+
)
|
|
8992
|
+
] }),
|
|
8993
|
+
/* @__PURE__ */ jsx61("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
8994
|
+
] })
|
|
8995
|
+
},
|
|
8996
|
+
col.key
|
|
8997
|
+
);
|
|
8998
|
+
})
|
|
8999
|
+
}
|
|
9000
|
+
) }),
|
|
9001
|
+
/* @__PURE__ */ jsx61("tbody", { className: clsx44(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
|
|
9002
|
+
isTableVirtual && topSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: topSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) }),
|
|
9003
|
+
windowData.map((row, windowIndex) => {
|
|
9004
|
+
const absoluteIndex = isTableVirtual ? startIndex + windowIndex : windowIndex;
|
|
9005
|
+
return /* @__PURE__ */ jsx61(
|
|
9006
|
+
"tr",
|
|
9007
|
+
{
|
|
9008
|
+
"aria-rowindex": isTableVirtual ? absoluteIndex + 2 : void 0,
|
|
9009
|
+
className: clsx44(
|
|
9010
|
+
tableRow,
|
|
9011
|
+
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
9012
|
+
onRowClick && tableRowClickable,
|
|
9013
|
+
rowSlot.className
|
|
9014
|
+
),
|
|
9015
|
+
style: rowSlot.style,
|
|
9016
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
9017
|
+
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
9018
|
+
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
9019
|
+
children: columns.map((col) => {
|
|
9020
|
+
const rawValue = getNestedValue(row, col.key);
|
|
9021
|
+
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
9022
|
+
const pin = pinnedMeta[col.key];
|
|
9023
|
+
const isPinned = pin != null;
|
|
9024
|
+
return /* @__PURE__ */ jsx61(
|
|
9025
|
+
"td",
|
|
9026
|
+
{
|
|
9027
|
+
className: clsx44(
|
|
9028
|
+
tableCell(col.className, density),
|
|
9029
|
+
col.align && tableAlignClasses[col.align],
|
|
9030
|
+
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
9031
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
9032
|
+
isPinned && "z-[1]",
|
|
9033
|
+
cellSlot.className,
|
|
9034
|
+
col.cellClassName
|
|
9035
|
+
),
|
|
9036
|
+
style: {
|
|
9037
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
9038
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
9039
|
+
...cellSlot.style,
|
|
9040
|
+
...col.cellStyle
|
|
9041
|
+
},
|
|
9042
|
+
title: truncateTitle,
|
|
9043
|
+
children: col.type === "actions" ? /* @__PURE__ */ jsx61("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ jsx61("div", { className: clsx44(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
9044
|
+
},
|
|
9045
|
+
`${absoluteIndex}-${col.key}`
|
|
9046
|
+
);
|
|
9047
|
+
})
|
|
9048
|
+
},
|
|
9049
|
+
absoluteIndex
|
|
9050
|
+
);
|
|
9051
|
+
}),
|
|
9052
|
+
isTableVirtual && bottomSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: bottomSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) })
|
|
9053
|
+
] }) : /* @__PURE__ */ jsx61("tr", { children: /* @__PURE__ */ jsx61("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ jsxs47("div", { className: tableEmptyContent, children: [
|
|
9054
|
+
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
9055
|
+
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
9056
|
+
] }) }) }) })
|
|
9057
|
+
]
|
|
9058
|
+
}
|
|
9059
|
+
)
|
|
9060
|
+
}
|
|
9061
|
+
),
|
|
9062
|
+
/* @__PURE__ */ jsx61(
|
|
9063
|
+
"div",
|
|
9064
|
+
{
|
|
9065
|
+
className: clsx44("rounded-b-xl px-6 py-4", footerSlot.className),
|
|
9066
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...footerSlot.style },
|
|
9067
|
+
children: /* @__PURE__ */ jsx61(
|
|
9068
|
+
ITPagination,
|
|
9069
|
+
{
|
|
9070
|
+
currentPage,
|
|
9071
|
+
totalPages: computedTotalPages,
|
|
9072
|
+
onPageChange: goToPage,
|
|
9073
|
+
color: "primary",
|
|
9074
|
+
itemsPerPageOptions,
|
|
9075
|
+
itemsPerPage,
|
|
9076
|
+
onItemsPerPageChange: handleItemsPerPageChange,
|
|
9077
|
+
totalItems: filteredData.length
|
|
9078
|
+
}
|
|
9079
|
+
)
|
|
9080
|
+
}
|
|
9081
|
+
)
|
|
9082
|
+
]
|
|
9083
|
+
}
|
|
9084
|
+
)
|
|
9085
|
+
}
|
|
9086
|
+
);
|
|
8958
9087
|
}
|
|
8959
9088
|
|
|
8960
9089
|
// src/components/atoms/textarea/textarea.tsx
|