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.
package/dist/index.js CHANGED
@@ -9687,41 +9687,44 @@ var TableRow = function TableRow(_ref) {
9687
9687
  };
9688
9688
 
9689
9689
  var _templateObject$q, _templateObject2$l, _templateObject3$e, _templateObject4$b, _templateObject5$9;
9690
- var TableContainer = styled__default.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) {
9690
+ var TableContainer = styled__default.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) {
9691
9691
  var theme = _ref.theme;
9692
9692
  return theme.vms.brand.light;
9693
9693
  });
9694
- var TableHeader = styled__default.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) {
9695
- var $hbcolor = _ref2.$hbcolor,
9696
- theme = _ref2.theme;
9697
- return $hbcolor || theme.vms["default"].tertiary;
9698
- }, function (_ref3) {
9699
- var $tcolor = _ref3.$tcolor,
9700
- theme = _ref3.theme;
9701
- return $tcolor || theme.vms.text.white;
9702
- });
9703
- var TableData = styled__default.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) {
9704
- var $isLegends = _ref4.$isLegends;
9694
+ var TableData = styled__default.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) {
9695
+ var $isLegends = _ref2.$isLegends;
9705
9696
  return $isLegends ? 'calc(100% - 56px)' : 'calc(100% - 36px)';
9706
9697
  });
9707
- var LegendDivider = styled__default.div(_templateObject4$b || (_templateObject4$b = _taggedTemplateLiteralLoose(["\n flex: 1;\n height: 2px;\n background: ", ";\n margin-right: ", ";\n"])), function (_ref5) {
9708
- var theme = _ref5.theme;
9698
+ var LegendDivider = styled__default.div(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n flex: 1;\n height: 2px;\n background: ", ";\n margin-right: ", ";\n"])), function (_ref3) {
9699
+ var theme = _ref3.theme;
9709
9700
  return theme.vms.border.extraLight;
9710
- }, function (_ref6) {
9711
- var $marginRight = _ref6.$marginRight;
9701
+ }, function (_ref4) {
9702
+ var $marginRight = _ref4.$marginRight;
9712
9703
  return $marginRight != null ? $marginRight : '0px';
9713
9704
  });
9714
- var Divider = styled__default.div(_templateObject5$9 || (_templateObject5$9 = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref7) {
9715
- var theme = _ref7.theme;
9705
+ var Divider = styled__default.div(_templateObject4$b || (_templateObject4$b = _taggedTemplateLiteralLoose(["\n height: 2px;\n background: ", ";\n"])), function (_ref5) {
9706
+ var theme = _ref5.theme;
9716
9707
  return theme.vms.border.extraLight;
9717
9708
  });
9718
- var Table = function Table(_ref8) {
9719
- var tableObject = _ref8.tableObject,
9720
- _ref8$filter = _ref8.filter,
9721
- filter = _ref8$filter === void 0 ? false : _ref8$filter,
9722
- loading = _ref8.loading,
9723
- _ref8$noDataText = _ref8.noDataText,
9724
- noDataText = _ref8$noDataText === void 0 ? 'No Data Found!' : _ref8$noDataText;
9709
+ var TableHeaderWithScrollbarAdjustment = styled__default.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) {
9710
+ var $hbcolor = _ref6.$hbcolor,
9711
+ theme = _ref6.theme;
9712
+ return $hbcolor || theme.vms["default"].tertiary;
9713
+ }, function (_ref7) {
9714
+ var $tcolor = _ref7.$tcolor,
9715
+ theme = _ref7.theme;
9716
+ return $tcolor || theme.vms.text.white;
9717
+ }, function (_ref8) {
9718
+ var $hasScrollbar = _ref8.$hasScrollbar;
9719
+ return $hasScrollbar ? '23px' : '12px';
9720
+ });
9721
+ var Table = function Table(_ref9) {
9722
+ var tableObject = _ref9.tableObject,
9723
+ _ref9$filter = _ref9.filter,
9724
+ filter = _ref9$filter === void 0 ? false : _ref9$filter,
9725
+ loading = _ref9.loading,
9726
+ _ref9$noDataText = _ref9.noDataText,
9727
+ noDataText = _ref9$noDataText === void 0 ? 'No Data Found!' : _ref9$noDataText;
9725
9728
  var themeColors = useTheme();
9726
9729
  var rowconfig = tableObject.rowconfig,
9727
9730
  tableheaderconfig = tableObject.tableheaderconfig;
@@ -9731,6 +9734,10 @@ var Table = function Table(_ref8) {
9731
9734
  var _useState2 = React.useState(false),
9732
9735
  isAllSelected = _useState2[0],
9733
9736
  setIsAllSelected = _useState2[1];
9737
+ var _useState3 = React.useState(false),
9738
+ hasScrollbar = _useState3[0],
9739
+ setHasScrollbar = _useState3[1];
9740
+ var tableDataRef = React__default.useRef(null);
9734
9741
  var getRole = function getRole(row) {
9735
9742
  var _row$rowData, _row$rowData$, _row$rowData$$CustomF, _row$rowData$$CustomF2, _row$rowData2, _row$rowData2$, _row$rowData2$$Custom, _row$rowData2$$Custom2;
9736
9743
  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';
@@ -9770,7 +9777,42 @@ var Table = function Table(_ref8) {
9770
9777
  });
9771
9778
  setIsAllSelected(allChecked);
9772
9779
  }, [rowconfig]);
9773
- return React__default.createElement(TableContainer, null, React__default.createElement(TableHeader, {
9780
+ React.useEffect(function () {
9781
+ var checkForScrollbar = function checkForScrollbar() {
9782
+ if (tableDataRef.current) {
9783
+ var hasVerticalScrollbar = tableDataRef.current.scrollHeight > tableDataRef.current.clientHeight;
9784
+ setHasScrollbar(hasVerticalScrollbar);
9785
+ }
9786
+ };
9787
+ checkForScrollbar();
9788
+ window.addEventListener('resize', checkForScrollbar);
9789
+ var timeoutId = setTimeout(checkForScrollbar, 100);
9790
+ return function () {
9791
+ window.removeEventListener('resize', checkForScrollbar);
9792
+ clearTimeout(timeoutId);
9793
+ };
9794
+ }, [rowconfig, filter, loading]);
9795
+ React.useEffect(function () {
9796
+ if (!tableDataRef.current) return;
9797
+ var checkForScrollbar = function checkForScrollbar() {
9798
+ if (tableDataRef.current) {
9799
+ var hasVerticalScrollbar = tableDataRef.current.scrollHeight > tableDataRef.current.clientHeight;
9800
+ setHasScrollbar(hasVerticalScrollbar);
9801
+ }
9802
+ };
9803
+ var handleScroll = function handleScroll() {
9804
+ checkForScrollbar();
9805
+ };
9806
+ tableDataRef.current.addEventListener('scroll', handleScroll);
9807
+ var intervalId = setInterval(checkForScrollbar, 1000);
9808
+ return function () {
9809
+ var _tableDataRef$current;
9810
+ clearInterval(intervalId);
9811
+ (_tableDataRef$current = tableDataRef.current) === null || _tableDataRef$current === void 0 ? void 0 : _tableDataRef$current.removeEventListener('scroll', handleScroll);
9812
+ };
9813
+ }, []);
9814
+ return React__default.createElement(TableContainer, null, React__default.createElement(TableHeaderWithScrollbarAdjustment, {
9815
+ "$hasScrollbar": hasScrollbar,
9774
9816
  "$hbcolor": tableheaderconfig.headercolor,
9775
9817
  "$tcolor": tableheaderconfig.textcolor
9776
9818
  }, tableheaderconfig.isAllSelectable && React__default.createElement(Container, {
@@ -9833,12 +9875,13 @@ var Table = function Table(_ref8) {
9833
9875
  "$padding": '24px 24px',
9834
9876
  "$justifyContent": 'center'
9835
9877
  }, React__default.createElement(Span, null, noDataText)) : filter ? React__default.createElement(TableData, {
9878
+ ref: tableDataRef,
9836
9879
  "$isLegends": tableheaderconfig.headerdata.some(function (col) {
9837
9880
  return !!col.groupTitle;
9838
9881
  })
9839
- }, Object.entries(roleGroups).map(function (_ref9) {
9840
- var role = _ref9[0],
9841
- rows = _ref9[1];
9882
+ }, Object.entries(roleGroups).map(function (_ref10) {
9883
+ var role = _ref10[0],
9884
+ rows = _ref10[1];
9842
9885
  return React__default.createElement(React__default.Fragment, {
9843
9886
  key: role
9844
9887
  }, React__default.createElement(Container, {
@@ -9870,6 +9913,7 @@ var Table = function Table(_ref8) {
9870
9913
  }), rows.length > 1 && index < rows.length - 1 && React__default.createElement(Divider, null));
9871
9914
  }));
9872
9915
  })) : React__default.createElement(TableData, {
9916
+ ref: tableDataRef,
9873
9917
  "$isLegends": tableheaderconfig.headerdata.some(function (col) {
9874
9918
  return !!col.groupTitle;
9875
9919
  })