@dolusoft/query-table 3.11.0 → 3.11.1
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/query-table.js
CHANGED
|
@@ -2496,6 +2496,7 @@ var isDevelopment$1 = () => {
|
|
|
2496
2496
|
return true;
|
|
2497
2497
|
}
|
|
2498
2498
|
};
|
|
2499
|
+
var automaticLayout = "[QueryTable] `scrollBody`: the body table has the automatic layout, so its columns follow its rows, not the header. Give the body and footer tables `table-layout: fixed` and a width that is a length or a percentage, such as `width: 100%`: with `width: auto` or `max-content` the browser uses the automatic layout whatever `table-layout` says (C-101).";
|
|
2499
2500
|
/**
|
|
2500
2501
|
* Header, body and footer of `scrollBody` scroll sideways together (C-101):
|
|
2501
2502
|
* one passive `scroll` listener on each wrapper sets the `scrollLeft` of the
|
|
@@ -2544,12 +2545,43 @@ var useScrollBody = (options) => {
|
|
|
2544
2545
|
const table = options.bodyTable();
|
|
2545
2546
|
if (table && !warned && isDevelopment$1() && getComputedStyle(table).tableLayout !== "fixed") {
|
|
2546
2547
|
warned = true;
|
|
2547
|
-
console.warn(
|
|
2548
|
+
console.warn(automaticLayout);
|
|
2548
2549
|
}
|
|
2549
2550
|
}, {
|
|
2550
2551
|
flush: "post",
|
|
2551
2552
|
immediate: true
|
|
2552
2553
|
});
|
|
2554
|
+
/**
|
|
2555
|
+
* `table-layout: fixed` applies only to a table with a definite width:
|
|
2556
|
+
* under `width: auto` or `max-content` the browser lays the body out
|
|
2557
|
+
* automatically while `tableLayout` still reads `fixed`, and a cell wider
|
|
2558
|
+
* than its `col` widens its column and the table. That shows once the
|
|
2559
|
+
* rows hold such a cell, so it is checked whenever the rows or the `col`
|
|
2560
|
+
* widths change, against `col` widths that match the header cells (not
|
|
2561
|
+
* ones a change of the drawn columns has made stale until measured).
|
|
2562
|
+
*/
|
|
2563
|
+
const checkLayout = () => {
|
|
2564
|
+
const head = options.headTable();
|
|
2565
|
+
const body = options.bodyTable();
|
|
2566
|
+
if (warned || !head || !body) return;
|
|
2567
|
+
const cells = head.querySelectorAll(":scope > thead > tr > *");
|
|
2568
|
+
const widths = options.colWidths();
|
|
2569
|
+
if (cells.length === 0 || cells.length !== widths.length || [...cells].some((cell, i) => {
|
|
2570
|
+
const width = widths[i];
|
|
2571
|
+
return width === void 0 || Math.abs(cell.getBoundingClientRect().width - width) >= .5;
|
|
2572
|
+
})) return;
|
|
2573
|
+
if (body.getBoundingClientRect().width - head.getBoundingClientRect().width >= 1) {
|
|
2574
|
+
warned = true;
|
|
2575
|
+
console.warn(automaticLayout);
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
if (isDevelopment$1()) watch(() => options.enabled() ? [
|
|
2579
|
+
options.colWidths(),
|
|
2580
|
+
options.rows(),
|
|
2581
|
+
options.bodyTable()
|
|
2582
|
+
] : null, (sources) => {
|
|
2583
|
+
if (sources) checkLayout();
|
|
2584
|
+
}, { flush: "post" });
|
|
2553
2585
|
onBeforeUnmount(detach);
|
|
2554
2586
|
};
|
|
2555
2587
|
//#endregion
|
|
@@ -4051,7 +4083,10 @@ var query_table_default = /* @__PURE__ */ defineComponent({
|
|
|
4051
4083
|
body: bodyWrap.value,
|
|
4052
4084
|
foot: footWrap.value
|
|
4053
4085
|
}),
|
|
4054
|
-
|
|
4086
|
+
headTable: () => tableEl.value,
|
|
4087
|
+
bodyTable: () => bodyTableEl.value,
|
|
4088
|
+
colWidths: () => colWidths.value,
|
|
4089
|
+
rows: () => props.rows
|
|
4055
4090
|
});
|
|
4056
4091
|
const resize = useColumnResize({
|
|
4057
4092
|
resizable: () => props.resizable,
|