@axzydev/axzy_ui_system 1.4.6 → 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 +439 -298
- 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 +439 -298
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +1 -1
- package/src/components/molecules/line-bar-chart/line-bar-chart.tsx +24 -15
- 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
|
|
@@ -8264,7 +8336,12 @@ function ITLineBarChart({
|
|
|
8264
8336
|
const linePoints = data.map((d, i) => `${x(i)},${y(d.line)}`).join(" ");
|
|
8265
8337
|
const areaPath = data.length > 0 ? `M ${x(0)} ${y(data[0].line)} ` + data.slice(1).map((d, i) => `L ${x(i + 1)} ${y(d.line)}`).join(" ") + ` L ${x(data.length - 1)} ${padding.top + plotHeight} L ${x(0)} ${padding.top + plotHeight} Z` : "";
|
|
8266
8338
|
const active = hover !== null ? data[hover] : null;
|
|
8267
|
-
|
|
8339
|
+
const tooltipLeft = (() => {
|
|
8340
|
+
if (hover === null) return 0;
|
|
8341
|
+
const center = x(hover) / width * 100;
|
|
8342
|
+
return Math.min(Math.max(center, 12), 88);
|
|
8343
|
+
})();
|
|
8344
|
+
return /* @__PURE__ */ jsxs46("div", { className: `relative flex flex-col gap-3 ${className}`.trim(), children: [
|
|
8268
8345
|
/* @__PURE__ */ jsxs46(
|
|
8269
8346
|
"svg",
|
|
8270
8347
|
{
|
|
@@ -8333,20 +8410,27 @@ function ITLineBarChart({
|
|
|
8333
8410
|
data.map((d, i) => /* @__PURE__ */ jsxs46("g", { onMouseEnter: () => setHover(i), children: [
|
|
8334
8411
|
/* @__PURE__ */ jsx60("rect", { x: padding.left + step * i, y: padding.top, width: step, height: plotHeight, fill: "transparent" }),
|
|
8335
8412
|
/* @__PURE__ */ jsx60("text", { x: x(i), y: height - 8, textAnchor: "middle", fontSize: 10, fill: "#64748b", children: d.label })
|
|
8336
|
-
] }, `hit-${d.label}`))
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8413
|
+
] }, `hit-${d.label}`))
|
|
8414
|
+
]
|
|
8415
|
+
}
|
|
8416
|
+
),
|
|
8417
|
+
active && /* @__PURE__ */ jsxs46(
|
|
8418
|
+
"div",
|
|
8419
|
+
{
|
|
8420
|
+
className: "pointer-events-none absolute z-10 -translate-x-1/2 rounded-lg px-2.5 py-1.5 shadow-lg",
|
|
8421
|
+
style: { left: `${tooltipLeft}%`, top: 4, background: "#0f172a", opacity: 0.94, minWidth: 132 },
|
|
8422
|
+
role: "status",
|
|
8423
|
+
children: [
|
|
8424
|
+
/* @__PURE__ */ jsx60("p", { className: "text-[10px] font-semibold", style: { color: "#e2e8f0" }, children: active.label }),
|
|
8425
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
8426
|
+
lineLabel,
|
|
8427
|
+
": ",
|
|
8428
|
+
formatValue(active.line)
|
|
8429
|
+
] }),
|
|
8430
|
+
/* @__PURE__ */ jsxs46("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
8431
|
+
barLabel,
|
|
8432
|
+
": ",
|
|
8433
|
+
formatValue(active.bar)
|
|
8350
8434
|
] })
|
|
8351
8435
|
]
|
|
8352
8436
|
}
|
|
@@ -8399,10 +8483,41 @@ function ITTable({
|
|
|
8399
8483
|
virtualizedMaxHeight = 400,
|
|
8400
8484
|
rowHeight,
|
|
8401
8485
|
overscan = 5,
|
|
8402
|
-
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
|
|
8403
8507
|
}) {
|
|
8404
8508
|
const [viewMode, setViewMode] = useState30(defaultView);
|
|
8405
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
|
+
});
|
|
8406
8521
|
const isFixed = layout === "fixed";
|
|
8407
8522
|
const forcedCards = autoCardBreakpoint > 0 && containerWidth > 0 && containerWidth < autoCardBreakpoint;
|
|
8408
8523
|
const effectiveView = forcedCards ? "cards" : viewMode;
|
|
@@ -8734,215 +8849,241 @@ function ITTable({
|
|
|
8734
8849
|
event.preventDefault();
|
|
8735
8850
|
onRowClick(row, event);
|
|
8736
8851
|
};
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
"Table"
|
|
8750
|
-
]
|
|
8751
|
-
}
|
|
8752
|
-
),
|
|
8753
|
-
/* @__PURE__ */ jsxs47(
|
|
8754
|
-
"button",
|
|
8755
|
-
{
|
|
8756
|
-
onClick: () => setViewMode("cards"),
|
|
8757
|
-
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"}`,
|
|
8758
|
-
children: [
|
|
8759
|
-
/* @__PURE__ */ jsx61(FaThLarge2, { size: 11 }),
|
|
8760
|
-
"Cards"
|
|
8761
|
-
]
|
|
8762
|
-
}
|
|
8763
|
-
)
|
|
8764
|
-
] })
|
|
8765
|
-
] }),
|
|
8766
|
-
!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: [
|
|
8767
|
-
/* @__PURE__ */ jsxs47(
|
|
8768
|
-
"button",
|
|
8769
|
-
{
|
|
8770
|
-
onClick: () => setViewMode("table"),
|
|
8771
|
-
disabled: forcedCards,
|
|
8772
|
-
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"}`,
|
|
8773
|
-
children: [
|
|
8774
|
-
/* @__PURE__ */ jsx61(FaTable2, { size: 11 }),
|
|
8775
|
-
"Table"
|
|
8776
|
-
]
|
|
8777
|
-
}
|
|
8778
|
-
),
|
|
8779
|
-
/* @__PURE__ */ jsxs47(
|
|
8780
|
-
"button",
|
|
8781
|
-
{
|
|
8782
|
-
onClick: () => setViewMode("cards"),
|
|
8783
|
-
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"}`,
|
|
8784
|
-
children: [
|
|
8785
|
-
/* @__PURE__ */ jsx61(FaThLarge2, { size: 11 }),
|
|
8786
|
-
"Cards"
|
|
8787
|
-
]
|
|
8788
|
-
}
|
|
8789
|
-
)
|
|
8790
|
-
] }) }),
|
|
8791
|
-
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(
|
|
8792
|
-
"div",
|
|
8793
|
-
{
|
|
8794
|
-
className: clsx44(tableCardHover, onRowClick && tableCardClickable),
|
|
8795
|
-
role: onRowClick ? "button" : void 0,
|
|
8796
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8797
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8798
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8799
|
-
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
8800
|
-
},
|
|
8801
|
-
i
|
|
8802
|
-
)) : /* @__PURE__ */ jsxs47("div", { className: clsx44(tableEmptyContent, "py-12"), children: [
|
|
8803
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8804
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8805
|
-
] }) }) : /* @__PURE__ */ jsx61(
|
|
8806
|
-
"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",
|
|
8807
8864
|
{
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
children:
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
tableLayoutClass,
|
|
8816
|
-
showVerticalBorder && "[&_th]:border-r [&_th:last-child]:border-r-0 [&_td]:border-r [&_td:last-child]:border-r-0",
|
|
8817
|
-
showVerticalBorder && (verticalBorderClassname || "[&_th]:border-slate-100 dark:[&_th]:border-slate-700/30 [&_td]:border-slate-100 dark:[&_td]:border-slate-700/30"),
|
|
8818
|
-
variantStyles[variant],
|
|
8819
|
-
sizeStyles[size]
|
|
8820
|
-
),
|
|
8821
|
-
style: isFixed ? { tableLayout: "fixed" } : void 0,
|
|
8822
|
-
"aria-rowcount": isTableVirtual ? currentData.length + 1 : void 0,
|
|
8823
|
-
children: [
|
|
8824
|
-
hasColumnWidths && /* @__PURE__ */ jsx61("colgroup", { children: columns.map((col) => /* @__PURE__ */ jsx61(
|
|
8825
|
-
"col",
|
|
8826
|
-
{
|
|
8827
|
-
style: col.width != null ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0
|
|
8828
|
-
},
|
|
8829
|
-
col.key
|
|
8830
|
-
)) }),
|
|
8831
|
-
/* @__PURE__ */ jsx61("thead", { children: /* @__PURE__ */ jsx61(
|
|
8832
|
-
"tr",
|
|
8833
|
-
{
|
|
8834
|
-
className: clsx44(tableHeaderRow, "dark:text-slate-200"),
|
|
8835
|
-
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
8836
|
-
children: columns.map((col) => {
|
|
8837
|
-
const pin = pinnedMeta[col.key];
|
|
8838
|
-
const isPinned = pin != null;
|
|
8839
|
-
return /* @__PURE__ */ jsx61(
|
|
8840
|
-
"th",
|
|
8841
|
-
{
|
|
8842
|
-
scope: "col",
|
|
8843
|
-
className: clsx44(
|
|
8844
|
-
tableHeaderCell(col.className, density),
|
|
8845
|
-
col.align && tableAlignClasses[col.align],
|
|
8846
|
-
isPinned && "sticky",
|
|
8847
|
-
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
8848
|
-
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
8849
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
8850
|
-
),
|
|
8851
|
-
style: col.minWidth != null || isStickyHeader || isPinned ? {
|
|
8852
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8853
|
-
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
8854
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8855
|
-
} : void 0,
|
|
8856
|
-
children: /* @__PURE__ */ jsxs47("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
8857
|
-
/* @__PURE__ */ jsxs47("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8858
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
8859
|
-
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx61(
|
|
8860
|
-
"button",
|
|
8861
|
-
{
|
|
8862
|
-
onClick: () => handleSort(col.key),
|
|
8863
|
-
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"}`,
|
|
8864
|
-
title: `Ordenar por ${col.label}`,
|
|
8865
|
-
children: /* @__PURE__ */ jsx61(MdOutlineSwapVert2, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
8866
|
-
}
|
|
8867
|
-
)
|
|
8868
|
-
] }),
|
|
8869
|
-
/* @__PURE__ */ jsx61("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
8870
|
-
] })
|
|
8871
|
-
},
|
|
8872
|
-
col.key
|
|
8873
|
-
);
|
|
8874
|
-
})
|
|
8875
|
-
}
|
|
8876
|
-
) }),
|
|
8877
|
-
/* @__PURE__ */ jsx61("tbody", { className: clsx44(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
|
|
8878
|
-
isTableVirtual && topSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: topSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) }),
|
|
8879
|
-
windowData.map((row, windowIndex) => {
|
|
8880
|
-
const absoluteIndex = isTableVirtual ? startIndex + windowIndex : windowIndex;
|
|
8881
|
-
return /* @__PURE__ */ jsx61(
|
|
8882
|
-
"tr",
|
|
8883
|
-
{
|
|
8884
|
-
"aria-rowindex": isTableVirtual ? absoluteIndex + 2 : void 0,
|
|
8885
|
-
className: clsx44(
|
|
8886
|
-
tableRow,
|
|
8887
|
-
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
8888
|
-
onRowClick && tableRowClickable
|
|
8889
|
-
),
|
|
8890
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8891
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8892
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8893
|
-
children: columns.map((col) => {
|
|
8894
|
-
const rawValue = getNestedValue(row, col.key);
|
|
8895
|
-
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
8896
|
-
const pin = pinnedMeta[col.key];
|
|
8897
|
-
const isPinned = pin != null;
|
|
8898
|
-
return /* @__PURE__ */ jsx61(
|
|
8899
|
-
"td",
|
|
8900
|
-
{
|
|
8901
|
-
className: clsx44(
|
|
8902
|
-
tableCell(col.className, density),
|
|
8903
|
-
col.align && tableAlignClasses[col.align],
|
|
8904
|
-
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
8905
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
8906
|
-
isPinned && "z-[1]"
|
|
8907
|
-
),
|
|
8908
|
-
style: col.minWidth != null || isPinned ? {
|
|
8909
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8910
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8911
|
-
} : void 0,
|
|
8912
|
-
title: truncateTitle,
|
|
8913
|
-
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) })
|
|
8914
|
-
},
|
|
8915
|
-
`${absoluteIndex}-${col.key}`
|
|
8916
|
-
);
|
|
8917
|
-
})
|
|
8918
|
-
},
|
|
8919
|
-
absoluteIndex
|
|
8920
|
-
);
|
|
8921
|
-
}),
|
|
8922
|
-
isTableVirtual && bottomSpacerHeight > 0 && /* @__PURE__ */ jsx61("tr", { "aria-hidden": "true", style: { height: bottomSpacerHeight }, children: /* @__PURE__ */ jsx61("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) })
|
|
8923
|
-
] }) : /* @__PURE__ */ jsx61("tr", { children: /* @__PURE__ */ jsx61("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ jsxs47("div", { className: tableEmptyContent, children: [
|
|
8924
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8925
|
-
/* @__PURE__ */ jsx61(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8926
|
-
] }) }) }) })
|
|
8927
|
-
]
|
|
8928
|
-
}
|
|
8929
|
-
)
|
|
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
|
+
]
|
|
8930
8872
|
}
|
|
8931
8873
|
),
|
|
8932
|
-
/* @__PURE__ */
|
|
8933
|
-
|
|
8874
|
+
/* @__PURE__ */ jsxs47(
|
|
8875
|
+
"button",
|
|
8934
8876
|
{
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
onItemsPerPageChange: handleItemsPerPageChange,
|
|
8942
|
-
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
|
+
]
|
|
8943
8883
|
}
|
|
8944
|
-
)
|
|
8945
|
-
] })
|
|
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
|
+
);
|
|
8946
9087
|
}
|
|
8947
9088
|
|
|
8948
9089
|
// src/components/atoms/textarea/textarea.tsx
|