@rolster/react-components 18.12.7 → 18.12.9

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/cjs/index.js CHANGED
@@ -1114,6 +1114,24 @@ const reactI18n = i18n.i18n({
1114
1114
  }
1115
1115
  });
1116
1116
 
1117
+ function useDatatable() {
1118
+ const [scrolleable, setScrolleable] = react.useState(false);
1119
+ const bodyRef = react.useRef(null);
1120
+ react.useEffect(() => {
1121
+ let observer;
1122
+ if (bodyRef?.current) {
1123
+ observer = new ResizeObserver(() => {
1124
+ const scrollHeight = bodyRef?.current?.scrollHeight || 0;
1125
+ const clientHeight = bodyRef?.current?.clientHeight || 0;
1126
+ setScrolleable(scrollHeight > clientHeight);
1127
+ });
1128
+ observer.observe(bodyRef?.current);
1129
+ }
1130
+ return () => observer?.disconnect();
1131
+ }, []);
1132
+ return { bodyRef, scrolleable };
1133
+ }
1134
+
1117
1135
  class ListCollection {
1118
1136
  constructor(value) {
1119
1137
  this.value = value;
@@ -1528,19 +1546,24 @@ function RlsDatatableHeader({ children }) {
1528
1546
  return jsxRuntime.jsx("tr", { className: "rls-datatable__header", children: children });
1529
1547
  }
1530
1548
  function RlsDatatableTitle({ children, className, control }) {
1531
- return (jsxRuntime.jsx("th", { className: (renderClassStatus('rls-datatable__title', { control }) +
1532
- ` ${className || ''}`).trim(), children: children }));
1549
+ return (jsxRuntime.jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
1533
1550
  }
1534
1551
  function RlsDatatableData({ children, className, error }) {
1535
- return (jsxRuntime.jsx("tr", { className: (renderClassStatus('rls-datatable__data', { error }) +
1536
- ` ${className || ''}`).trim(), children: children }));
1552
+ return (jsxRuntime.jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
1537
1553
  }
1538
1554
  function RlsDatatableCell({ children, className, control, overflow }) {
1539
- return (jsxRuntime.jsx("th", { className: (renderClassStatus('rls-datatable__cell', { control, overflow }) +
1540
- ` ${className || ''}`).trim(), children: children }));
1555
+ return (jsxRuntime.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1556
+ }
1557
+ function RlsDatatableTotals({ children, className, error }) {
1558
+ return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1559
+ }
1560
+ function RlsDatatableInfo({ children, className, control, overflow }) {
1561
+ return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1541
1562
  }
1542
- function RlsDatatable({ bodyRef, children, footer, header, rlsTheme }) {
1543
- return (jsxRuntime.jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1563
+ function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1564
+ return (jsxRuntime.jsxs("div", { className: renderClassStatus('rls-datatable', {
1565
+ scrolleable: datatable?.scrolleable
1566
+ }), "rls-theme": rlsTheme, children: [jsxRuntime.jsxs("table", { children: [header && jsxRuntime.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntime.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntime.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntime.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1544
1567
  }
1545
1568
 
1546
1569
  const controlIsValid = (props) => {
@@ -2111,7 +2134,9 @@ exports.RlsDatatable = RlsDatatable;
2111
2134
  exports.RlsDatatableCell = RlsDatatableCell;
2112
2135
  exports.RlsDatatableData = RlsDatatableData;
2113
2136
  exports.RlsDatatableHeader = RlsDatatableHeader;
2137
+ exports.RlsDatatableInfo = RlsDatatableInfo;
2114
2138
  exports.RlsDatatableTitle = RlsDatatableTitle;
2139
+ exports.RlsDatatableTotals = RlsDatatableTotals;
2115
2140
  exports.RlsDateField = RlsDateField;
2116
2141
  exports.RlsDatePicker = RlsDatePicker;
2117
2142
  exports.RlsDateRangeField = RlsDateRangeField;
@@ -2153,6 +2178,7 @@ exports.RlsToolbar = RlsToolbar;
2153
2178
  exports.RlsYearPicker = RlsYearPicker;
2154
2179
  exports.renderClassStatus = renderClassStatus;
2155
2180
  exports.useConfirmationService = useConfirmationService;
2181
+ exports.useDatatable = useDatatable;
2156
2182
  exports.useListControl = useListControl;
2157
2183
  exports.useSnackbarService = useSnackbarService;
2158
2184
  //# sourceMappingURL=index.js.map