@axzydev/axzy_ui_system 1.0.160 → 1.0.162
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 +60 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2876,7 +2876,7 @@ var formatCurrencyMX = (value) => {
|
|
|
2876
2876
|
};
|
|
2877
2877
|
function ITTable({
|
|
2878
2878
|
columns,
|
|
2879
|
-
data,
|
|
2879
|
+
data = [],
|
|
2880
2880
|
containerClassName,
|
|
2881
2881
|
className,
|
|
2882
2882
|
variant = "default",
|
|
@@ -2890,8 +2890,9 @@ function ITTable({
|
|
|
2890
2890
|
const [filters, setFilters] = useState12({});
|
|
2891
2891
|
const [sortConfig, setSortConfig] = useState12(null);
|
|
2892
2892
|
const sortedData = React7.useMemo(() => {
|
|
2893
|
-
|
|
2894
|
-
|
|
2893
|
+
const safeData = Array.isArray(data) ? data : [];
|
|
2894
|
+
if (!sortConfig) return safeData;
|
|
2895
|
+
return [...safeData].sort((a, b) => {
|
|
2895
2896
|
const aValue = getNestedValue(a, sortConfig.key);
|
|
2896
2897
|
const bValue = getNestedValue(b, sortConfig.key);
|
|
2897
2898
|
if (aValue == null || bValue == null) return 0;
|
|
@@ -3106,63 +3107,61 @@ function ITTable({
|
|
|
3106
3107
|
return value;
|
|
3107
3108
|
}
|
|
3108
3109
|
};
|
|
3109
|
-
return /* @__PURE__ */
|
|
3110
|
-
/* @__PURE__ */
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
children:
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
) })
|
|
3165
|
-
] }),
|
|
3110
|
+
return /* @__PURE__ */ jsx15("div", { className: clsx12("space-y-4 w-full", containerClassName), children: /* @__PURE__ */ jsxs11("div", { className: "bg-white rounded-xl shadow-sm border border-secondary-200 overflow-hidden", children: [
|
|
3111
|
+
title && /* @__PURE__ */ jsx15("div", { className: "bg-white px-6 py-5 border-b border-secondary-100", children: /* @__PURE__ */ jsx15("h2", { className: "text-xl font-bold text-secondary-900 leading-tight", children: title }) }),
|
|
3112
|
+
/* @__PURE__ */ jsx15("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs11(
|
|
3113
|
+
"table",
|
|
3114
|
+
{
|
|
3115
|
+
className: clsx12(
|
|
3116
|
+
"min-w-max w-full text-sm text-left text-secondary-600",
|
|
3117
|
+
variantStyles[variant],
|
|
3118
|
+
sizeStyles[size]
|
|
3119
|
+
),
|
|
3120
|
+
children: [
|
|
3121
|
+
/* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { className: "bg-secondary-50 border-b border-secondary-200 text-xs uppercase tracking-wider font-semibold text-secondary-500", children: columns.map((col) => /* @__PURE__ */ jsx15(
|
|
3122
|
+
"th",
|
|
3123
|
+
{
|
|
3124
|
+
scope: "col",
|
|
3125
|
+
className: clsx12("px-4 py-4 align-top", col.className),
|
|
3126
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 min-w-[150px]", children: [
|
|
3127
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3128
|
+
/* @__PURE__ */ jsx15("span", { className: "text-secondary-700 font-bold", children: col.label }),
|
|
3129
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ jsx15(
|
|
3130
|
+
"button",
|
|
3131
|
+
{
|
|
3132
|
+
onClick: () => handleSort(col.key),
|
|
3133
|
+
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"}`,
|
|
3134
|
+
title: `Ordenar por ${col.label}`,
|
|
3135
|
+
children: /* @__PURE__ */ jsx15(MdOutlineSwapVert, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
3136
|
+
}
|
|
3137
|
+
)
|
|
3138
|
+
] }),
|
|
3139
|
+
/* @__PURE__ */ jsx15("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
3140
|
+
] })
|
|
3141
|
+
},
|
|
3142
|
+
col.key
|
|
3143
|
+
)) }) }),
|
|
3144
|
+
/* @__PURE__ */ jsx15("tbody", { className: "divide-y divide-secondary-100", children: currentData.length > 0 ? currentData.map((row, rowIndex) => /* @__PURE__ */ jsx15(
|
|
3145
|
+
"tr",
|
|
3146
|
+
{
|
|
3147
|
+
className: "hover:bg-secondary-50/50 transition-colors duration-150 group",
|
|
3148
|
+
children: columns.map((col) => /* @__PURE__ */ jsx15(
|
|
3149
|
+
"td",
|
|
3150
|
+
{
|
|
3151
|
+
className: clsx12("px-4 py-3 align-middle", col.className),
|
|
3152
|
+
children: col.type === "actions" ? /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center gap-2", children: renderCellContent(col, row) }) : /* @__PURE__ */ jsx15("div", { className: "text-secondary-700 font-medium", children: renderCellContent(col, row) })
|
|
3153
|
+
},
|
|
3154
|
+
`${rowIndex}-${col.key}`
|
|
3155
|
+
))
|
|
3156
|
+
},
|
|
3157
|
+
rowIndex
|
|
3158
|
+
)) : /* @__PURE__ */ jsx15("tr", { children: /* @__PURE__ */ jsx15("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center justify-center text-secondary-400", children: [
|
|
3159
|
+
/* @__PURE__ */ jsx15("span", { className: "text-lg", children: "No se encontraron resultados" }),
|
|
3160
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
3161
|
+
] }) }) }) })
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
) }),
|
|
3166
3165
|
/* @__PURE__ */ jsx15("div", { className: "bg-white rounded-b-xl border-t border-secondary-200 px-6 py-4", children: /* @__PURE__ */ jsx15(
|
|
3167
3166
|
ITPagination,
|
|
3168
3167
|
{
|
|
@@ -3176,7 +3175,7 @@ function ITTable({
|
|
|
3176
3175
|
totalItems: filteredData.length
|
|
3177
3176
|
}
|
|
3178
3177
|
) })
|
|
3179
|
-
] });
|
|
3178
|
+
] }) });
|
|
3180
3179
|
}
|
|
3181
3180
|
|
|
3182
3181
|
// src/types/toast.types.ts
|