@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/es/index.js CHANGED
@@ -1112,6 +1112,24 @@ const reactI18n = i18n({
1112
1112
  }
1113
1113
  });
1114
1114
 
1115
+ function useDatatable() {
1116
+ const [scrolleable, setScrolleable] = useState(false);
1117
+ const bodyRef = useRef(null);
1118
+ useEffect(() => {
1119
+ let observer;
1120
+ if (bodyRef?.current) {
1121
+ observer = new ResizeObserver(() => {
1122
+ const scrollHeight = bodyRef?.current?.scrollHeight || 0;
1123
+ const clientHeight = bodyRef?.current?.clientHeight || 0;
1124
+ setScrolleable(scrollHeight > clientHeight);
1125
+ });
1126
+ observer.observe(bodyRef?.current);
1127
+ }
1128
+ return () => observer?.disconnect();
1129
+ }, []);
1130
+ return { bodyRef, scrolleable };
1131
+ }
1132
+
1115
1133
  class ListCollection {
1116
1134
  constructor(value) {
1117
1135
  this.value = value;
@@ -1526,19 +1544,24 @@ function RlsDatatableHeader({ children }) {
1526
1544
  return jsx("tr", { className: "rls-datatable__header", children: children });
1527
1545
  }
1528
1546
  function RlsDatatableTitle({ children, className, control }) {
1529
- return (jsx("th", { className: (renderClassStatus('rls-datatable__title', { control }) +
1530
- ` ${className || ''}`).trim(), children: children }));
1547
+ return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
1531
1548
  }
1532
1549
  function RlsDatatableData({ children, className, error }) {
1533
- return (jsx("tr", { className: (renderClassStatus('rls-datatable__data', { error }) +
1534
- ` ${className || ''}`).trim(), children: children }));
1550
+ return (jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
1535
1551
  }
1536
1552
  function RlsDatatableCell({ children, className, control, overflow }) {
1537
- return (jsx("th", { className: (renderClassStatus('rls-datatable__cell', { control, overflow }) +
1538
- ` ${className || ''}`).trim(), children: children }));
1553
+ return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1554
+ }
1555
+ function RlsDatatableTotals({ children, className, error }) {
1556
+ return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1557
+ }
1558
+ function RlsDatatableInfo({ children, className, control, overflow }) {
1559
+ return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1539
1560
  }
1540
- function RlsDatatable({ bodyRef, children, footer, header, rlsTheme }) {
1541
- return (jsxs("div", { className: "rls-datatable", "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: bodyRef, className: "rls-datatable__tbody", children: children })] }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1561
+ function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1562
+ return (jsxs("div", { className: renderClassStatus('rls-datatable', {
1563
+ scrolleable: datatable?.scrolleable
1564
+ }), "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1542
1565
  }
1543
1566
 
1544
1567
  const controlIsValid = (props) => {
@@ -2086,5 +2109,5 @@ function RlsApplication({ children }) {
2086
2109
  return (jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
2087
2110
  }
2088
2111
 
2089
- export { ConfirmationResult, ListCollection, RlsAmount, RlsApplication, RlsAutocompleteField, RlsAutocompleteFieldTemplate, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsCheckBoxLabel, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableTitle, RlsDateField, RlsDatePicker, RlsDateRangeField, RlsDateRangePicker, RlsDayPicker, RlsDayRangePicker, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsMessageIcon, RlsModal, RlsMoneyField, RlsMonthPicker, RlsMonthTitlePicker, RlsNumberField, RlsPagination, RlsPasswordField, RlsPoster, RlsProgressBar, RlsRadioButton, RlsRadioButtonLabel, RlsSearchInput, RlsSelectField, RlsSelectFieldTemplate, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsSwitchLabel, RlsTabularText, RlsTextField, RlsToolbar, RlsYearPicker, renderClassStatus, useConfirmationService, useListControl, useSnackbarService };
2112
+ export { ConfirmationResult, ListCollection, RlsAmount, RlsApplication, RlsAutocompleteField, RlsAutocompleteFieldTemplate, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsCheckBoxLabel, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableInfo, RlsDatatableTitle, RlsDatatableTotals, RlsDateField, RlsDatePicker, RlsDateRangeField, RlsDateRangePicker, RlsDayPicker, RlsDayRangePicker, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsMessageIcon, RlsModal, RlsMoneyField, RlsMonthPicker, RlsMonthTitlePicker, RlsNumberField, RlsPagination, RlsPasswordField, RlsPoster, RlsProgressBar, RlsRadioButton, RlsRadioButtonLabel, RlsSearchInput, RlsSelectField, RlsSelectFieldTemplate, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsSwitchLabel, RlsTabularText, RlsTextField, RlsToolbar, RlsYearPicker, renderClassStatus, useConfirmationService, useDatatable, useListControl, useSnackbarService };
2090
2113
  //# sourceMappingURL=index.js.map