labsense-ui-kit 1.2.94 → 1.2.95

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.
@@ -9683,41 +9683,44 @@ var TableRow = function TableRow(_ref) {
9683
9683
  };
9684
9684
 
9685
9685
  var _templateObject$q, _templateObject2$l, _templateObject3$e, _templateObject4$b, _templateObject5$9;
9686
- var TableContainer = styled.div(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n background: ", ";\n display: flex;\n flex-direction: column;\n border-radius: 8px;\n scrollbar-width: thin;\n flex: 1;\n"])), function (_ref) {
9686
+ var TableContainer = styled.div(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n background: ", ";\n display: flex;\n flex-direction: column;\n border-radius: 8px;\n scrollbar-width: thin;\n flex: 1;\n height: 100%;\n overflow: hidden;\n box-sizing: border-box;\n"])), function (_ref) {
9687
9687
  var theme = _ref.theme;
9688
9688
  return theme.vms.brand.light;
9689
9689
  });
9690
- var TableHeader = styled.div(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n display: flex;\n background: ", ";\n color: ", ";\n min-height: 36px;\n align-items: center;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n padding: 9px 12px;\n width: 100%;\n"])), function (_ref2) {
9691
- var $hbcolor = _ref2.$hbcolor,
9692
- theme = _ref2.theme;
9693
- return $hbcolor || theme.vms["default"].tertiary;
9694
- }, function (_ref3) {
9695
- var $tcolor = _ref3.$tcolor,
9696
- theme = _ref3.theme;
9697
- return $tcolor || theme.vms.text.white;
9698
- });
9699
- var TableData = styled.div(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n width: 100%;\n overflow-y: auto;\n scrollbar-width: thin;\n height: 100%;\n max-height: ", ";\n"])), function (_ref4) {
9700
- var $isLegends = _ref4.$isLegends;
9690
+ var TableData = styled.div(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n width: 100%;\n overflow-y: auto;\n scrollbar-width: thin;\n height: 100%;\n max-height: ", ";\n /* Customize scrollbar */\n &::-webkit-scrollbar {\n width: 16px;\n }\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.2);\n border-radius: 8px;\n border: 4px solid transparent;\n background-clip: content-box;\n }\n"])), function (_ref2) {
9691
+ var $isLegends = _ref2.$isLegends;
9701
9692
  return $isLegends ? 'calc(100% - 56px)' : 'calc(100% - 36px)';
9702
9693
  });
9703
- var LegendDivider = styled.div(_templateObject4$b || (_templateObject4$b = _taggedTemplateLiteralLoose(["\n flex: 1;\n height: 2px;\n background: ", ";\n margin-right: ", ";\n"])), function (_ref5) {
9704
- var theme = _ref5.theme;
9694
+ var LegendDivider = styled.div(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n flex: 1;\n height: 2px;\n background: ", ";\n margin-right: ", ";\n"])), function (_ref3) {
9695
+ var theme = _ref3.theme;
9705
9696
  return theme.vms.border.extraLight;
9706
- }, function (_ref6) {
9707
- var $marginRight = _ref6.$marginRight;
9697
+ }, function (_ref4) {
9698
+ var $marginRight = _ref4.$marginRight;
9708
9699
  return $marginRight != null ? $marginRight : '0px';
9709
9700
  });
9710
- var Divider = styled.div(_templateObject5$9 || (_templateObject5$9 = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref7) {
9711
- var theme = _ref7.theme;
9701
+ var Divider = styled.div(_templateObject4$b || (_templateObject4$b = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref5) {
9702
+ var theme = _ref5.theme;
9712
9703
  return theme.vms.border.extraLight;
9713
9704
  });
9714
- var Table = function Table(_ref8) {
9715
- var tableObject = _ref8.tableObject,
9716
- _ref8$filter = _ref8.filter,
9717
- filter = _ref8$filter === void 0 ? false : _ref8$filter,
9718
- loading = _ref8.loading,
9719
- _ref8$noDataText = _ref8.noDataText,
9720
- noDataText = _ref8$noDataText === void 0 ? 'No Data Found!' : _ref8$noDataText;
9705
+ var TableHeaderWithScrollbarAdjustment = styled.div(_templateObject5$9 || (_templateObject5$9 = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n display: flex;\n background: ", ";\n color: ", ";\n min-height: 36px;\n align-items: center;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n padding: 9px 12px;\n padding-right: ", ";\n width: 100%;\n box-sizing: border-box;\n"])), function (_ref6) {
9706
+ var $hbcolor = _ref6.$hbcolor,
9707
+ theme = _ref6.theme;
9708
+ return $hbcolor || theme.vms["default"].tertiary;
9709
+ }, function (_ref7) {
9710
+ var $tcolor = _ref7.$tcolor,
9711
+ theme = _ref7.theme;
9712
+ return $tcolor || theme.vms.text.white;
9713
+ }, function (_ref8) {
9714
+ var $hasScrollbar = _ref8.$hasScrollbar;
9715
+ return $hasScrollbar ? '23px' : '12px';
9716
+ });
9717
+ var Table = function Table(_ref9) {
9718
+ var tableObject = _ref9.tableObject,
9719
+ _ref9$filter = _ref9.filter,
9720
+ filter = _ref9$filter === void 0 ? false : _ref9$filter,
9721
+ loading = _ref9.loading,
9722
+ _ref9$noDataText = _ref9.noDataText,
9723
+ noDataText = _ref9$noDataText === void 0 ? 'No Data Found!' : _ref9$noDataText;
9721
9724
  var themeColors = useTheme();
9722
9725
  var rowconfig = tableObject.rowconfig,
9723
9726
  tableheaderconfig = tableObject.tableheaderconfig;
@@ -9727,6 +9730,10 @@ var Table = function Table(_ref8) {
9727
9730
  var _useState2 = useState(false),
9728
9731
  isAllSelected = _useState2[0],
9729
9732
  setIsAllSelected = _useState2[1];
9733
+ var _useState3 = useState(false),
9734
+ hasScrollbar = _useState3[0],
9735
+ setHasScrollbar = _useState3[1];
9736
+ var tableDataRef = React.useRef(null);
9730
9737
  var getRole = function getRole(row) {
9731
9738
  var _row$rowData, _row$rowData$, _row$rowData$$CustomF, _row$rowData$$CustomF2, _row$rowData2, _row$rowData2$, _row$rowData2$$Custom, _row$rowData2$$Custom2;
9732
9739
  return ((_row$rowData = row.rowData) === null || _row$rowData === void 0 ? void 0 : (_row$rowData$ = _row$rowData[1]) === null || _row$rowData$ === void 0 ? void 0 : (_row$rowData$$CustomF = _row$rowData$.CustomFunction) === null || _row$rowData$$CustomF === void 0 ? void 0 : (_row$rowData$$CustomF2 = _row$rowData$$CustomF.props) === null || _row$rowData$$CustomF2 === void 0 ? void 0 : _row$rowData$$CustomF2.text) || ((_row$rowData2 = row.rowData) === null || _row$rowData2 === void 0 ? void 0 : (_row$rowData2$ = _row$rowData2[1]) === null || _row$rowData2$ === void 0 ? void 0 : (_row$rowData2$$Custom = _row$rowData2$.CustomFunction) === null || _row$rowData2$$Custom === void 0 ? void 0 : (_row$rowData2$$Custom2 = _row$rowData2$$Custom.props) === null || _row$rowData2$$Custom2 === void 0 ? void 0 : _row$rowData2$$Custom2.$text) || 'Unassigned';
@@ -9766,7 +9773,42 @@ var Table = function Table(_ref8) {
9766
9773
  });
9767
9774
  setIsAllSelected(allChecked);
9768
9775
  }, [rowconfig]);
9769
- return React.createElement(TableContainer, null, React.createElement(TableHeader, {
9776
+ useEffect(function () {
9777
+ var checkForScrollbar = function checkForScrollbar() {
9778
+ if (tableDataRef.current) {
9779
+ var hasVerticalScrollbar = tableDataRef.current.scrollHeight > tableDataRef.current.clientHeight;
9780
+ setHasScrollbar(hasVerticalScrollbar);
9781
+ }
9782
+ };
9783
+ checkForScrollbar();
9784
+ window.addEventListener('resize', checkForScrollbar);
9785
+ var timeoutId = setTimeout(checkForScrollbar, 100);
9786
+ return function () {
9787
+ window.removeEventListener('resize', checkForScrollbar);
9788
+ clearTimeout(timeoutId);
9789
+ };
9790
+ }, [rowconfig, filter, loading]);
9791
+ useEffect(function () {
9792
+ if (!tableDataRef.current) return;
9793
+ var checkForScrollbar = function checkForScrollbar() {
9794
+ if (tableDataRef.current) {
9795
+ var hasVerticalScrollbar = tableDataRef.current.scrollHeight > tableDataRef.current.clientHeight;
9796
+ setHasScrollbar(hasVerticalScrollbar);
9797
+ }
9798
+ };
9799
+ var handleScroll = function handleScroll() {
9800
+ checkForScrollbar();
9801
+ };
9802
+ tableDataRef.current.addEventListener('scroll', handleScroll);
9803
+ var intervalId = setInterval(checkForScrollbar, 1000);
9804
+ return function () {
9805
+ var _tableDataRef$current;
9806
+ clearInterval(intervalId);
9807
+ (_tableDataRef$current = tableDataRef.current) === null || _tableDataRef$current === void 0 ? void 0 : _tableDataRef$current.removeEventListener('scroll', handleScroll);
9808
+ };
9809
+ }, []);
9810
+ return React.createElement(TableContainer, null, React.createElement(TableHeaderWithScrollbarAdjustment, {
9811
+ "$hasScrollbar": hasScrollbar,
9770
9812
  "$hbcolor": tableheaderconfig.headercolor,
9771
9813
  "$tcolor": tableheaderconfig.textcolor
9772
9814
  }, tableheaderconfig.isAllSelectable && React.createElement(Container, {
@@ -9829,12 +9871,13 @@ var Table = function Table(_ref8) {
9829
9871
  "$padding": '24px 24px',
9830
9872
  "$justifyContent": 'center'
9831
9873
  }, React.createElement(Span, null, noDataText)) : filter ? React.createElement(TableData, {
9874
+ ref: tableDataRef,
9832
9875
  "$isLegends": tableheaderconfig.headerdata.some(function (col) {
9833
9876
  return !!col.groupTitle;
9834
9877
  })
9835
- }, Object.entries(roleGroups).map(function (_ref9) {
9836
- var role = _ref9[0],
9837
- rows = _ref9[1];
9878
+ }, Object.entries(roleGroups).map(function (_ref10) {
9879
+ var role = _ref10[0],
9880
+ rows = _ref10[1];
9838
9881
  return React.createElement(React.Fragment, {
9839
9882
  key: role
9840
9883
  }, React.createElement(Container, {
@@ -9866,6 +9909,7 @@ var Table = function Table(_ref8) {
9866
9909
  }), rows.length > 1 && index < rows.length - 1 && React.createElement(Divider, null));
9867
9910
  }));
9868
9911
  })) : React.createElement(TableData, {
9912
+ ref: tableDataRef,
9869
9913
  "$isLegends": tableheaderconfig.headerdata.some(function (col) {
9870
9914
  return !!col.groupTitle;
9871
9915
  })