@apia/table 3.0.25 → 3.0.27
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.d.ts +1 -0
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ type TResponsiveTableRowState = {
|
|
|
151
151
|
type TResponsiveTableColumn = TResponsiveTableWithRendererElement & {
|
|
152
152
|
/** Con esta propiedad se puede pasar parámetros opcionales */
|
|
153
153
|
additionalData?: Record<string, unknown>;
|
|
154
|
+
autoAdjustWidth?: boolean;
|
|
154
155
|
/**
|
|
155
156
|
* Determina si la columna admite ordenamiento.
|
|
156
157
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1266,6 +1266,32 @@ const NoMemoHeaderCell = ({
|
|
|
1266
1266
|
...domProps,
|
|
1267
1267
|
role: "rowheader",
|
|
1268
1268
|
className: `${isFilterRequired && window.SHOW_REQUIRED_POSITION ? "requiredFilterColumn" : ""}`,
|
|
1269
|
+
ref: (el) => {
|
|
1270
|
+
if (!column?.autoAdjustWidth)
|
|
1271
|
+
return;
|
|
1272
|
+
if (el instanceof HTMLElement && !el.dataset.resized && storedWidth === void 0) {
|
|
1273
|
+
const clone = el.cloneNode(true);
|
|
1274
|
+
const child = clone.querySelector(
|
|
1275
|
+
".headButton__label"
|
|
1276
|
+
);
|
|
1277
|
+
child.style.opacity = "0";
|
|
1278
|
+
document.body.append(child);
|
|
1279
|
+
child.style.position = "fixed";
|
|
1280
|
+
child.style.maxWidth = "0";
|
|
1281
|
+
child.style.minWidth = "0";
|
|
1282
|
+
child.style.width = "0";
|
|
1283
|
+
child.style.overflow = "auto";
|
|
1284
|
+
child.style.textWrap = "nowrap";
|
|
1285
|
+
window.requestAnimationFrame(() => {
|
|
1286
|
+
const idealWidth = child.scrollWidth;
|
|
1287
|
+
const currentWidth = el.querySelector(".headButton__label").getBoundingClientRect().width;
|
|
1288
|
+
const elWidth = el.getBoundingClientRect().width;
|
|
1289
|
+
const diff = idealWidth - currentWidth;
|
|
1290
|
+
setWidth(elWidth + diff + 5);
|
|
1291
|
+
el.dataset.resized = "true";
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1269
1295
|
children: /* @__PURE__ */ jsxs(Box, { as: "span", className: "headButton__container", children: [
|
|
1270
1296
|
/* @__PURE__ */ jsx(
|
|
1271
1297
|
Box,
|
|
@@ -3541,10 +3567,11 @@ const NoMemoAccordionHTMLCellRenderer = React.forwardRef(
|
|
|
3541
3567
|
column,
|
|
3542
3568
|
row,
|
|
3543
3569
|
...props
|
|
3544
|
-
}, currentRef) => (
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3570
|
+
}, currentRef) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
3571
|
+
(column.label || column.name) && /* @__PURE__ */ jsxs(Box, { as: "strong", children: [
|
|
3572
|
+
column.label ?? column.name,
|
|
3573
|
+
": "
|
|
3574
|
+
] }),
|
|
3548
3575
|
/* @__PURE__ */ jsx(
|
|
3549
3576
|
Box,
|
|
3550
3577
|
{
|
|
@@ -3561,7 +3588,7 @@ const NoMemoAccordionHTMLCellRenderer = React.forwardRef(
|
|
|
3561
3588
|
as: "span"
|
|
3562
3589
|
}
|
|
3563
3590
|
)
|
|
3564
|
-
)
|
|
3591
|
+
] })
|
|
3565
3592
|
);
|
|
3566
3593
|
NoMemoAccordionHTMLCellRenderer.displayName = "AccordionHTMLCellRenderer";
|
|
3567
3594
|
const AccordionHTMLCellRenderer = NoMemoAccordionHTMLCellRenderer;
|