@farmzone/fz-react-ui 1.0.12 → 1.0.13
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 +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tw.css +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ var buttonVariants = cva(
|
|
|
48
48
|
carousel: "bg-white border border-gray-300 hover:bg-gray-100 hover:text-black rounded-full",
|
|
49
49
|
accent: "btn-grad text-white rounded-full",
|
|
50
50
|
metal: "btn-metal text-white min-w-22",
|
|
51
|
-
ghost: "p-1 h-auto rounded-sm bg-transparent
|
|
51
|
+
ghost: "p-1 h-auto rounded-sm bg-transparent text-sub-darkgray transition-colors hover:bg-gray-100",
|
|
52
52
|
link: "bg-transparent border-none text-main-blue underline-offset-4 hover:underline h-auto p-0"
|
|
53
53
|
},
|
|
54
54
|
size: {
|
|
@@ -4707,15 +4707,26 @@ function Table(props) {
|
|
|
4707
4707
|
if (!isDynamicHeight) return;
|
|
4708
4708
|
const el = scrollRef.current;
|
|
4709
4709
|
if (!el) return;
|
|
4710
|
+
const pageContainer = el.parentElement?.parentElement;
|
|
4711
|
+
const isContainerConstrained = (container2) => {
|
|
4712
|
+
if (!container2) return false;
|
|
4713
|
+
const style = window.getComputedStyle(container2);
|
|
4714
|
+
return style.overflow === "hidden" || style.overflowY === "hidden";
|
|
4715
|
+
};
|
|
4716
|
+
const getContainerBottom = () => {
|
|
4717
|
+
if (isContainerConstrained(pageContainer)) {
|
|
4718
|
+
return Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight);
|
|
4719
|
+
}
|
|
4720
|
+
return window.innerHeight;
|
|
4721
|
+
};
|
|
4710
4722
|
const update = () => {
|
|
4711
4723
|
const top = el.getBoundingClientRect().top;
|
|
4712
4724
|
const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
|
|
4713
|
-
setTableHeight(
|
|
4725
|
+
setTableHeight(getContainerBottom() - top - footerH - 24);
|
|
4714
4726
|
};
|
|
4715
4727
|
update();
|
|
4716
4728
|
window.addEventListener("resize", update);
|
|
4717
4729
|
const observer = new ResizeObserver(update);
|
|
4718
|
-
const pageContainer = el.parentElement?.parentElement;
|
|
4719
4730
|
if (pageContainer) observer.observe(pageContainer);
|
|
4720
4731
|
const footer = footerRef.current;
|
|
4721
4732
|
if (footer) observer.observe(footer);
|
|
@@ -4728,9 +4739,15 @@ function Table(props) {
|
|
|
4728
4739
|
if (!isDynamicHeight) return;
|
|
4729
4740
|
const el = scrollRef.current;
|
|
4730
4741
|
if (!el) return;
|
|
4742
|
+
const pageContainer = el.parentElement?.parentElement;
|
|
4731
4743
|
const top = el.getBoundingClientRect().top;
|
|
4732
4744
|
const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
|
|
4733
|
-
|
|
4745
|
+
const isContainerConstrained = !!pageContainer && (() => {
|
|
4746
|
+
const style = window.getComputedStyle(pageContainer);
|
|
4747
|
+
return style.overflow === "hidden" || style.overflowY === "hidden";
|
|
4748
|
+
})();
|
|
4749
|
+
const containerBottom = isContainerConstrained ? Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight) : window.innerHeight;
|
|
4750
|
+
setTableHeight(containerBottom - top - footerH - 24);
|
|
4734
4751
|
}, [showSkeleton, showEmpty]);
|
|
4735
4752
|
const selectedKeysRef = useRef(selectedKeys);
|
|
4736
4753
|
selectedKeysRef.current = selectedKeys;
|