@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.cjs
CHANGED
|
@@ -2911,7 +2911,7 @@ var formatCurrencyMX = (value) => {
|
|
|
2911
2911
|
};
|
|
2912
2912
|
function ITTable({
|
|
2913
2913
|
columns,
|
|
2914
|
-
data,
|
|
2914
|
+
data = [],
|
|
2915
2915
|
containerClassName,
|
|
2916
2916
|
className,
|
|
2917
2917
|
variant = "default",
|
|
@@ -2925,8 +2925,9 @@ function ITTable({
|
|
|
2925
2925
|
const [filters, setFilters] = (0, import_react16.useState)({});
|
|
2926
2926
|
const [sortConfig, setSortConfig] = (0, import_react16.useState)(null);
|
|
2927
2927
|
const sortedData = import_react16.default.useMemo(() => {
|
|
2928
|
-
|
|
2929
|
-
|
|
2928
|
+
const safeData = Array.isArray(data) ? data : [];
|
|
2929
|
+
if (!sortConfig) return safeData;
|
|
2930
|
+
return [...safeData].sort((a, b) => {
|
|
2930
2931
|
const aValue = getNestedValue(a, sortConfig.key);
|
|
2931
2932
|
const bValue = getNestedValue(b, sortConfig.key);
|
|
2932
2933
|
if (aValue == null || bValue == null) return 0;
|
|
@@ -3141,63 +3142,61 @@ function ITTable({
|
|
|
3141
3142
|
return value;
|
|
3142
3143
|
}
|
|
3143
3144
|
};
|
|
3144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.
|
|
3145
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
children:
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
) })
|
|
3200
|
-
] }),
|
|
3145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_clsx12.default)("space-y-4 w-full", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "bg-white rounded-xl shadow-sm border border-secondary-200 overflow-hidden", children: [
|
|
3146
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg-white px-6 py-5 border-b border-secondary-100", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { className: "text-xl font-bold text-secondary-900 leading-tight", children: title }) }),
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3148
|
+
"table",
|
|
3149
|
+
{
|
|
3150
|
+
className: (0, import_clsx12.default)(
|
|
3151
|
+
"min-w-max w-full text-sm text-left text-secondary-600",
|
|
3152
|
+
variantStyles[variant],
|
|
3153
|
+
sizeStyles[size]
|
|
3154
|
+
),
|
|
3155
|
+
children: [
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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__ */ (0, import_jsx_runtime15.jsx)(
|
|
3157
|
+
"th",
|
|
3158
|
+
{
|
|
3159
|
+
scope: "col",
|
|
3160
|
+
className: (0, import_clsx12.default)("px-4 py-4 align-top", col.className),
|
|
3161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-3 min-w-[150px]", children: [
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3163
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-secondary-700 font-bold", children: col.label }),
|
|
3164
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3165
|
+
"button",
|
|
3166
|
+
{
|
|
3167
|
+
onClick: () => handleSort(col.key),
|
|
3168
|
+
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"}`,
|
|
3169
|
+
title: `Ordenar por ${col.label}`,
|
|
3170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_md.MdOutlineSwapVert, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
3171
|
+
}
|
|
3172
|
+
)
|
|
3173
|
+
] }),
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
3175
|
+
] })
|
|
3176
|
+
},
|
|
3177
|
+
col.key
|
|
3178
|
+
)) }) }),
|
|
3179
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: "divide-y divide-secondary-100", children: currentData.length > 0 ? currentData.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3180
|
+
"tr",
|
|
3181
|
+
{
|
|
3182
|
+
className: "hover:bg-secondary-50/50 transition-colors duration-150 group",
|
|
3183
|
+
children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3184
|
+
"td",
|
|
3185
|
+
{
|
|
3186
|
+
className: (0, import_clsx12.default)("px-4 py-3 align-middle", col.className),
|
|
3187
|
+
children: col.type === "actions" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center gap-2", children: renderCellContent(col, row) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-secondary-700 font-medium", children: renderCellContent(col, row) })
|
|
3188
|
+
},
|
|
3189
|
+
`${rowIndex}-${col.key}`
|
|
3190
|
+
))
|
|
3191
|
+
},
|
|
3192
|
+
rowIndex
|
|
3193
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col items-center justify-center text-secondary-400", children: [
|
|
3194
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-lg", children: "No se encontraron resultados" }),
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
3196
|
+
] }) }) }) })
|
|
3197
|
+
]
|
|
3198
|
+
}
|
|
3199
|
+
) }),
|
|
3201
3200
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg-white rounded-b-xl border-t border-secondary-200 px-6 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3202
3201
|
ITPagination,
|
|
3203
3202
|
{
|
|
@@ -3211,7 +3210,7 @@ function ITTable({
|
|
|
3211
3210
|
totalItems: filteredData.length
|
|
3212
3211
|
}
|
|
3213
3212
|
) })
|
|
3214
|
-
] });
|
|
3213
|
+
] }) });
|
|
3215
3214
|
}
|
|
3216
3215
|
|
|
3217
3216
|
// src/types/toast.types.ts
|