@coreui/react-pro 4.11.0-next.0 → 4.11.0

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
@@ -2636,15 +2636,6 @@ CAccordionButton.propTypes = {
2636
2636
  };
2637
2637
  CAccordionButton.displayName = 'CAccordionButton';
2638
2638
 
2639
- var CAccordionCollapse = React$1.forwardRef(function (_a, ref) {
2640
- var children = _a.children, props = __rest$1(_a, ["children"]);
2641
- return (React$1.createElement(CCollapse, __assign$1({ className: "accordion-collapse" }, props, { ref: ref }), children));
2642
- });
2643
- CAccordionCollapse.propTypes = {
2644
- children: propTypesExports.node,
2645
- };
2646
- CAccordionCollapse.displayName = 'CAccordionCollapse';
2647
-
2648
2639
  var CAccordionHeader = React$1.forwardRef(function (_a, ref) {
2649
2640
  var children = _a.children, className = _a.className, rest = __rest$1(_a, ["children", "className"]);
2650
2641
  return (React$1.createElement("div", __assign$1({ className: classNames$1('accordion-header', className) }, rest, { ref: ref }),
@@ -6941,7 +6932,7 @@ var isToday = function (date) {
6941
6932
  };
6942
6933
 
6943
6934
  var Calendar = function (props) {
6944
- var addMonths = props.addMonths, calendarDate = props.calendarDate, dayFormat = props.dayFormat, disabledDates = props.disabledDates, endDate = props.endDate, firstDayOfWeek = props.firstDayOfWeek, hoverDate = props.hoverDate, locale = props.locale, maxDate = props.maxDate, minDate = props.minDate, onCellClick = props.onCellClick, onCellKeyDown = props.onCellKeyDown, onCellMouseEnter = props.onCellMouseEnter, onCellMouseLeave = props.onCellMouseLeave, onMonthClick = props.onMonthClick, onYearClick = props.onYearClick, selectAdjacementDays = props.selectAdjacementDays, selectEndDate = props.selectEndDate, showAdjacementDays = props.showAdjacementDays, startDate = props.startDate, view = props.view, weekdayFormat = props.weekdayFormat;
6935
+ var addMonths = props.addMonths, calendarDate = props.calendarDate, dayFormat = props.dayFormat, disabledDates = props.disabledDates, endDate = props.endDate, firstDayOfWeek = props.firstDayOfWeek, hoverDate = props.hoverDate, locale = props.locale, maxDate = props.maxDate, minDate = props.minDate, onCellClick = props.onCellClick, onCellKeyDown = props.onCellKeyDown, onCellMouseEnter = props.onCellMouseEnter, onCellMouseLeave = props.onCellMouseLeave, onMonthClick = props.onMonthClick, onMonthKeyDown = props.onMonthKeyDown, onYearClick = props.onYearClick, onYearKeyDown = props.onYearKeyDown, selectAdjacementDays = props.selectAdjacementDays, selectEndDate = props.selectEndDate, showAdjacementDays = props.showAdjacementDays, startDate = props.startDate, view = props.view, weekdayFormat = props.weekdayFormat;
6945
6936
  var _a = React$1.useState(calendarDate), date = _a[0], setDate = _a[1];
6946
6937
  var _b = React$1.useState([]), listOfMonths = _b[0], setListOfMonths = _b[1];
6947
6938
  React$1.useEffect(function () {
@@ -6979,6 +6970,7 @@ var Calendar = function (props) {
6979
6970
  disabled: isDateDisabled(date, minDate, maxDate, disabledDates)
6980
6971
  },
6981
6972
  _b[month] = true,
6973
+ _b.clickable = month !== 'current' && selectAdjacementDays,
6982
6974
  _b.last = isLastDayOfMonth(date),
6983
6975
  _b['range-hover'] = month === 'current' &&
6984
6976
  (hoverDate && selectEndDate
@@ -6988,7 +6980,10 @@ var Calendar = function (props) {
6988
6980
  _b.selected = isDateSelected(date, startDate, endDate),
6989
6981
  _b.start = isStartDate(date, startDate, endDate),
6990
6982
  _b.end = isEndDate(date, startDate, endDate),
6991
- _b)), key: idx, tabIndex: 0, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6983
+ _b)), key: idx, tabIndex: (month === 'current' || selectAdjacementDays) &&
6984
+ !isDateDisabled(date, minDate, maxDate, disabledDates)
6985
+ ? 0
6986
+ : -1, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6992
6987
  onBlur: function () { return onCellMouseLeave(); },
6993
6988
  onClick: function () { return onCellClick(date); },
6994
6989
  onFocus: function () { return onCellMouseEnter(date); },
@@ -7007,16 +7002,18 @@ var Calendar = function (props) {
7007
7002
  view === 'months' &&
7008
7003
  listOfMonths.map(function (row, index) {
7009
7004
  return (React$1.createElement("tr", { key: index }, row.map(function (month, idx) {
7010
- return (React$1.createElement("td", { key: idx, className: "calendar-cell month", onClick: function () { return onMonthClick(index * 3 + idx - addMonths, 'days'); } },
7005
+ return (React$1.createElement("td", { className: "calendar-cell month", key: idx, onClick: function () { return onMonthClick(index * 3 + idx - addMonths); }, onKeyDown: function (event) { return onMonthKeyDown(event, index * 3 + idx - addMonths); }, tabIndex: 0 },
7011
7006
  React$1.createElement("div", { className: "calendar-cell-inner" }, month)));
7012
7007
  })));
7013
7008
  }),
7014
7009
  view === 'years' &&
7015
7010
  listOfYears.map(function (row, index) {
7016
7011
  return (React$1.createElement("tr", { key: index }, row.map(function (year, idx) {
7017
- return (React$1.createElement("td", { key: idx, className: "calendar-cell year", onClick: function () {
7018
- return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()), 'months');
7019
- } },
7012
+ return (React$1.createElement("td", { className: "calendar-cell year", key: idx, onClick: function () {
7013
+ return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()));
7014
+ }, onKeyDown: function (event) {
7015
+ return onYearKeyDown(event, new Date(year, date.getMonth() - addMonths, date.getDate()));
7016
+ }, tabIndex: 0 },
7020
7017
  React$1.createElement("div", { className: "calendar-cell-inner" }, new Date(year, 0, 1).toLocaleDateString(locale, { year: 'numeric' }))));
7021
7018
  })));
7022
7019
  }))));
@@ -7163,6 +7160,16 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
7163
7160
  return;
7164
7161
  }
7165
7162
  };
7163
+ var handleMonthClick = function (month) {
7164
+ setCalendarPage(0, 0, month);
7165
+ setView('days');
7166
+ };
7167
+ var handleMonthKeyDown = function (event, month) {
7168
+ if (event.code === 'Space' || event.key === 'Enter') {
7169
+ setCalendarPage(0, 0, month);
7170
+ setView('days');
7171
+ }
7172
+ };
7166
7173
  var handleNavigationOnClick = function (direction, double) {
7167
7174
  if (double === void 0) { double = false; }
7168
7175
  if (direction === 'prev') {
@@ -7190,16 +7197,20 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
7190
7197
  return;
7191
7198
  }
7192
7199
  };
7200
+ var handleYearClick = function (date) {
7201
+ setCalendarDate(date);
7202
+ setView('months');
7203
+ };
7204
+ var handleYearKeyDown = function (event, date) {
7205
+ if (event.code === 'Space' || event.key === 'Enter') {
7206
+ setCalendarDate(date);
7207
+ setView('months');
7208
+ }
7209
+ };
7193
7210
  return (React$1.createElement("div", { className: classNames$1('calendars', className) }, _calendarDate &&
7194
7211
  Array.from({ length: calendars }, function (_, index) { return (React$1.createElement("div", { className: classNames$1('calendar', view), key: index, ref: ref },
7195
7212
  React$1.createElement(Navigation, { addMonths: index, calendarDate: _calendarDate, locale: locale, navigation: navigation, navNextDoubleIcon: navNextDoubleIcon, navNextIcon: navNextIcon, navPrevDoubleIcon: navPrevDoubleIcon, navPrevIcon: navPrevIcon, navYearFirst: navYearFirst, onMonthClick: function () { return setView('months'); }, onNavigationClick: handleNavigationOnClick, onYearClick: function () { return setView('years'); }, view: view }),
7196
- React$1.createElement(Calendar, { addMonths: index, calendarDate: _calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onCellClick: function (date) { return handleCellOnClick(date, index); }, onCellKeyDown: function (event, date) { return handleCellKeyDown(event, date, index); }, onCellMouseEnter: handleCellMouseEnter, onCellMouseLeave: handleCellMouseLeave, onMonthClick: function (month, view) {
7197
- setCalendarPage(0, 0, month);
7198
- setView(view);
7199
- }, onYearClick: function (date, view) {
7200
- setCalendarDate(date);
7201
- setView(view);
7202
- }, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
7213
+ React$1.createElement(Calendar, { addMonths: index, calendarDate: _calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onCellClick: function (date) { return handleCellOnClick(date, index); }, onCellKeyDown: function (event, date) { return handleCellKeyDown(event, date, index); }, onCellMouseEnter: handleCellMouseEnter, onCellMouseLeave: handleCellMouseLeave, onMonthClick: handleMonthClick, onMonthKeyDown: handleMonthKeyDown, onYearClick: handleYearClick, onYearKeyDown: handleYearKeyDown, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
7203
7214
  });
7204
7215
  CCalendar.propTypes = {
7205
7216
  className: propTypesExports.string,
@@ -9947,11 +9958,12 @@ var PopperManagerWrapper = function (_a) {
9947
9958
  };
9948
9959
  var CDropdownContext = React$1.createContext({});
9949
9960
  var CDropdown = React$1.forwardRef(function (_a, ref) {
9950
- var children = _a.children, alignment = _a.alignment, _b = _a.autoClose, autoClose = _b === void 0 ? true : _b, className = _a.className, dark = _a.dark, direction = _a.direction, onHide = _a.onHide, onShow = _a.onShow, _c = _a.placement, placement = _c === void 0 ? 'bottom-start' : _c, _d = _a.popper, popper = _d === void 0 ? true : _d, _e = _a.variant, variant = _e === void 0 ? 'btn-group' : _e, _f = _a.component, component = _f === void 0 ? 'div' : _f, _g = _a.visible, visible = _g === void 0 ? false : _g, rest = __rest$1(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "onHide", "onShow", "placement", "popper", "variant", "component", "visible"]);
9961
+ var _b;
9962
+ var children = _a.children, alignment = _a.alignment, _c = _a.autoClose, autoClose = _c === void 0 ? true : _c, className = _a.className, dark = _a.dark, direction = _a.direction, onHide = _a.onHide, onShow = _a.onShow, _d = _a.placement, placement = _d === void 0 ? 'bottom-start' : _d, _e = _a.popper, popper = _e === void 0 ? true : _e, _f = _a.portal, portal = _f === void 0 ? false : _f, _g = _a.variant, variant = _g === void 0 ? 'btn-group' : _g, _h = _a.component, component = _h === void 0 ? 'div' : _h, _j = _a.visible, visible = _j === void 0 ? false : _j, rest = __rest$1(_a, ["children", "alignment", "autoClose", "className", "dark", "direction", "onHide", "onShow", "placement", "popper", "portal", "variant", "component", "visible"]);
9951
9963
  var dropdownRef = React$1.useRef(null);
9952
9964
  var dropdownToggleRef = React$1.useRef(null);
9953
9965
  var forkedRef = useForkedRef(ref, dropdownRef);
9954
- var _h = React$1.useState(visible), _visible = _h[0], setVisible = _h[1];
9966
+ var _k = React$1.useState(visible), _visible = _k[0], setVisible = _k[1];
9955
9967
  var Component = variant === 'nav-item' ? 'li' : component;
9956
9968
  // Disable popper if responsive aligment is set.
9957
9969
  if (typeof alignment === 'object') {
@@ -9965,6 +9977,7 @@ var CDropdown = React$1.forwardRef(function (_a, ref) {
9965
9977
  dropdownToggleRef: dropdownToggleRef,
9966
9978
  placement: placement,
9967
9979
  popper: popper,
9980
+ portal: portal,
9968
9981
  variant: variant,
9969
9982
  visible: _visible,
9970
9983
  setVisible: setVisible,
@@ -9977,12 +9990,13 @@ var CDropdown = React$1.forwardRef(function (_a, ref) {
9977
9990
  !_visible && onHide && onHide();
9978
9991
  }, [_visible]);
9979
9992
  return (React$1.createElement(CDropdownContext.Provider, { value: contextValues },
9980
- React$1.createElement(PopperManagerWrapper, { popper: popper }, variant === 'input-group' ? (React$1.createElement(React$1.Fragment, null, children)) : (React$1.createElement(Component, __assign$1({ className: classNames$1(variant === 'nav-item' ? 'nav-item dropdown' : variant, {
9981
- 'dropdown-center': direction === 'center',
9982
- 'dropup dropup-center': direction === 'dropup-center',
9983
- direction: direction && direction !== 'center' && direction !== 'dropup-center',
9984
- show: _visible,
9985
- }, className) }, rest, { ref: forkedRef }), children)))));
9993
+ React$1.createElement(PopperManagerWrapper, { popper: popper }, variant === 'input-group' ? (React$1.createElement(React$1.Fragment, null, children)) : (React$1.createElement(Component, __assign$1({ className: classNames$1(variant === 'nav-item' ? 'nav-item dropdown' : variant, (_b = {
9994
+ 'dropdown-center': direction === 'center',
9995
+ 'dropup dropup-center': direction === 'dropup-center'
9996
+ },
9997
+ _b["".concat(direction)] = direction && direction !== 'center' && direction !== 'dropup-center',
9998
+ _b.show = _visible,
9999
+ _b), className) }, rest, { ref: forkedRef }), children)))));
9986
10000
  });
9987
10001
  var alignmentDirection = propTypesExports.oneOf(['start', 'end']);
9988
10002
  CDropdown.propTypes = {
@@ -10009,14 +10023,27 @@ CDropdown.propTypes = {
10009
10023
  onShow: propTypesExports.func,
10010
10024
  placement: placementPropType,
10011
10025
  popper: propTypesExports.bool,
10026
+ portal: propTypesExports.bool,
10012
10027
  variant: propTypesExports.oneOf(['btn-group', 'dropdown', 'input-group', 'nav-item']),
10013
10028
  visible: propTypesExports.bool,
10014
10029
  };
10015
10030
  CDropdown.displayName = 'CDropdown';
10016
10031
 
10032
+ var alignmentClassNames = function (alignment) {
10033
+ var classNames = [];
10034
+ if (typeof alignment === 'object') {
10035
+ Object.keys(alignment).map(function (key) {
10036
+ classNames.push("dropdown-menu".concat(key === 'xs' ? '' : "-".concat(key), "-").concat(alignment[key]));
10037
+ });
10038
+ }
10039
+ if (typeof alignment === 'string') {
10040
+ classNames.push("dropdown-menu-".concat(alignment));
10041
+ }
10042
+ return classNames;
10043
+ };
10017
10044
  var CDropdownMenu = function (_a) {
10018
10045
  var children = _a.children, className = _a.className, _b = _a.component, Component = _b === void 0 ? 'ul' : _b, rest = __rest$1(_a, ["children", "className", "component"]);
10019
- var _c = React$1.useContext(CDropdownContext), alignment = _c.alignment, autoClose = _c.autoClose, dark = _c.dark, direction = _c.direction, dropdownToggleRef = _c.dropdownToggleRef, placement = _c.placement, popper = _c.popper, visible = _c.visible, setVisible = _c.setVisible;
10046
+ var _c = React$1.useContext(CDropdownContext), alignment = _c.alignment, autoClose = _c.autoClose, dark = _c.dark, direction = _c.direction, dropdownToggleRef = _c.dropdownToggleRef, placement = _c.placement, popper = _c.popper, portal = _c.portal, visible = _c.visible, setVisible = _c.setVisible;
10020
10047
  var dropdownMenuRef = React$1.useRef(null);
10021
10048
  React$1.useEffect(function () {
10022
10049
  visible && window.addEventListener('mouseup', handleMouseUp);
@@ -10065,29 +10092,18 @@ var CDropdownMenu = function (_a) {
10065
10092
  if (alignment === 'end') {
10066
10093
  _placement = 'bottom-end';
10067
10094
  }
10068
- var alignmentClassNames = function (alignment) {
10069
- var classNames = [];
10070
- if (typeof alignment === 'object') {
10071
- Object.keys(alignment).map(function (key) {
10072
- classNames.push("dropdown-menu".concat(key === 'xs' ? '' : "-".concat(key), "-").concat(alignment[key]));
10073
- });
10074
- }
10075
- if (typeof alignment === 'string') {
10076
- classNames.push("dropdown-menu-".concat(alignment));
10077
- }
10078
- return classNames;
10079
- };
10080
- var dropdownMenuComponent = function (style, ref) { return (React$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
10081
- 'dropdown-menu-dark': dark,
10082
- show: visible,
10083
- }, alignment && alignmentClassNames(alignment), className), ref: ref, style: style, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
10084
- ? React$1.Children.map(children, function (child, index) {
10085
- if (React$1.isValidElement(child)) {
10086
- return React$1.createElement("li", { key: index }, React$1.cloneElement(child));
10087
- }
10088
- return;
10089
- })
10090
- : children)); };
10095
+ var dropdownMenuComponent = function (style, ref) { return (React$1.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
10096
+ React$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
10097
+ 'dropdown-menu-dark': dark,
10098
+ show: visible,
10099
+ }, alignment && alignmentClassNames(alignment), className), ref: ref, style: style, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
10100
+ ? React$1.Children.map(children, function (child, index) {
10101
+ if (React$1.isValidElement(child)) {
10102
+ return React$1.createElement("li", { key: index }, React$1.cloneElement(child));
10103
+ }
10104
+ return;
10105
+ })
10106
+ : children))); };
10091
10107
  return popper && visible ? (React$1.createElement(Popper, { innerRef: dropdownMenuRef, placement: _placement }, function (_a) {
10092
10108
  var ref = _a.ref, style = _a.style;
10093
10109
  return dropdownMenuComponent(style, ref);
@@ -11579,6 +11595,7 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
11579
11595
  };
11580
11596
  var handleSearchKeyDown = function (event) {
11581
11597
  if (event.key === 'Enter' && searchValue && allowCreateOptions) {
11598
+ event.preventDefault();
11582
11599
  if (userOption) {
11583
11600
  setSelected(__spreadArray(__spreadArray([], selected, true), userOption, true));
11584
11601
  setUserOptions(__spreadArray(__spreadArray([], userOptions, true), userOption, true));
@@ -11913,11 +11930,9 @@ var COffcanvas = React$1.forwardRef(function (_a, ref) {
11913
11930
  setVisible(visible);
11914
11931
  }, [visible]);
11915
11932
  React$1.useEffect(function () {
11916
- if (_visible) {
11917
- if (!scroll) {
11918
- document.body.style.overflow = 'hidden';
11919
- document.body.style.paddingRight = '0px';
11920
- }
11933
+ if (_visible && !scroll) {
11934
+ document.body.style.overflow = 'hidden';
11935
+ document.body.style.paddingRight = '0px';
11921
11936
  return;
11922
11937
  }
11923
11938
  if (!scroll) {
@@ -13849,12 +13864,104 @@ var getColumnLabel = function (column) {
13849
13864
  : pretifyName(column.key)
13850
13865
  : pretifyName(column);
13851
13866
  };
13867
+ // export const getColumnNames = (columns: (string | Column)[] | undefined, items: Item[]) =>
13868
+ // columns
13869
+ // ? columns.map((column: Column | string) => {
13870
+ // return typeof column === 'object' ? column.key : column
13871
+ // })
13872
+ // : getColumnNamesFromItems(items)
13852
13873
  var getColumnNames = function (columns, items) {
13853
- return columns
13854
- ? columns.map(function (column) {
13855
- return typeof column === 'object' ? column.key : column;
13856
- })
13857
- : getColumnNamesFromItems(items);
13874
+ if (columns) {
13875
+ var _columns = [];
13876
+ for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
13877
+ var column = columns_1[_i];
13878
+ if (typeof column === 'object' && column.children) {
13879
+ _columns.push.apply(_columns, getColumnNames(column.children, []));
13880
+ continue;
13881
+ }
13882
+ typeof column === 'object' ? _columns.push(column.key) : _columns.push(column);
13883
+ }
13884
+ return _columns;
13885
+ }
13886
+ return getColumnNamesFromItems(items);
13887
+ };
13888
+ var getColumns = function (_columns) {
13889
+ var columns = [];
13890
+ for (var _i = 0, _columns_1 = _columns; _i < _columns_1.length; _i++) {
13891
+ var column = _columns_1[_i];
13892
+ if (typeof column === 'object' && column.group && column.children) {
13893
+ columns.push.apply(columns, getColumns(column.children));
13894
+ continue;
13895
+ }
13896
+ if (typeof column === 'object' && column.children) {
13897
+ columns.push.apply(columns, getColumns(column.children));
13898
+ }
13899
+ columns.push(column);
13900
+ }
13901
+ return columns;
13902
+ };
13903
+ var countColumns = function (columns, counter) {
13904
+ if (counter === void 0) { counter = 0; }
13905
+ var _counter = counter;
13906
+ for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
13907
+ var column = columns_2[_i];
13908
+ if (!column.children) {
13909
+ _counter++;
13910
+ }
13911
+ if (column.children) {
13912
+ _counter = countColumns(column.children, _counter);
13913
+ }
13914
+ }
13915
+ return _counter;
13916
+ };
13917
+ var getColumnGroups = function (columns) {
13918
+ var groups = [];
13919
+ var traverseColumns = function (column, deep, colSpan) {
13920
+ if (deep === void 0) { deep = 0; }
13921
+ var groups = [];
13922
+ if (column.children) {
13923
+ for (var _i = 0, _a = column.children; _i < _a.length; _i++) {
13924
+ var _column = _a[_i];
13925
+ if (!_column.group) ;
13926
+ groups.push.apply(groups, traverseColumns(_column, deep + 1));
13927
+ }
13928
+ }
13929
+ if (typeof column === 'object' && column.group) {
13930
+ var children = column.children, group = column.group, rest = __rest$1(column, ["children", "group"]);
13931
+ groups.push(__assign$1(__assign$1({ deep: deep, label: group }, (children && { colspan: countColumns(children) })), rest));
13932
+ }
13933
+ return groups;
13934
+ };
13935
+ if (columns) {
13936
+ for (var _i = 0, columns_3 = columns; _i < columns_3.length; _i++) {
13937
+ var column = columns_3[_i];
13938
+ if (typeof column === 'object' && column.group) {
13939
+ var objects = traverseColumns(column);
13940
+ if (objects) {
13941
+ for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
13942
+ var object = objects_1[_a];
13943
+ var deep = object.deep, rest = __rest$1(object, ["deep"]);
13944
+ if (deep === undefined) {
13945
+ continue;
13946
+ }
13947
+ for (var i = 0; i < deep; i++) {
13948
+ if (groups[i]) {
13949
+ continue;
13950
+ }
13951
+ groups.push([]);
13952
+ }
13953
+ if (groups[deep]) {
13954
+ groups[deep].push(rest);
13955
+ }
13956
+ else {
13957
+ groups.push([rest]);
13958
+ }
13959
+ }
13960
+ }
13961
+ }
13962
+ }
13963
+ }
13964
+ return groups;
13858
13965
  };
13859
13966
  var getColumnNamesFromItems = function (items) {
13860
13967
  return Object.keys(items[0] || {}).filter(function (el) { return el.charAt(0) !== '_'; });
@@ -13936,7 +14043,7 @@ var CSmartTableBody = React$1.forwardRef(function (_a, ref) {
13936
14043
  var colspan = selectable ? columnNames.length + 1 : columnNames.length;
13937
14044
  return (React$1.createElement(CTableBody, __assign$1({}, (clickableRows && {
13938
14045
  style: { cursor: 'pointer' },
13939
- }), rest, { ref: ref }), currentItems.length ? (currentItems.map(function (item, trIndex) {
14046
+ }), rest, { ref: ref }), currentItems.length > 0 ? (currentItems.map(function (item, trIndex) {
13940
14047
  return (React$1.createElement(React$1.Fragment, { key: trIndex },
13941
14048
  React$1.createElement(CTableRow, __assign$1({}, (item._props && __assign$1({}, item._props)), (clickableRows && { tabIndex: 0 }), { onClick: function (event) {
13942
14049
  return onRowClick &&
@@ -13956,7 +14063,8 @@ var CSmartTableBody = React$1.forwardRef(function (_a, ref) {
13956
14063
  scopedColumns[colName] &&
13957
14064
  React$1.cloneElement(scopedColumns[colName](item, trIndex + firstItemOnActivePageIndex), {
13958
14065
  key: index,
13959
- })) || (React$1.createElement(CTableDataCell, __assign$1({}, getTableDataCellProps(item, colName), { key: index }), String(item[colName]))));
14066
+ })) ||
14067
+ (item[colName] && (React$1.createElement(CTableDataCell, __assign$1({}, getTableDataCellProps(item, colName), { key: index }), String(item[colName])))));
13960
14068
  })),
13961
14069
  scopedColumns && scopedColumns.details && (React$1.createElement(React$1.Fragment, null,
13962
14070
  React$1.createElement(CTableRow, null,
@@ -13997,9 +14105,11 @@ CSmartTableCleaner.propTypes = {
13997
14105
  CSmartTableCleaner.displayName = 'CSmartTableCleaner';
13998
14106
 
13999
14107
  var CSmartTableHead = React$1.forwardRef(function (_a, ref) {
14000
- var columnFilter = _a.columnFilter, columnFilterState = _a.columnFilterState, columnSorter = _a.columnSorter, _b = _a.component, Component = _b === void 0 ? CTableHead : _b, columns = _a.columns, handleOnCustomFilterChange = _a.handleOnCustomFilterChange, handleFilterOnChange = _a.handleFilterOnChange, handleFilterOnInput = _a.handleFilterOnInput, handleSelectAllChecked = _a.handleSelectAllChecked, handleSort = _a.handleSort, items = _a.items, selectable = _a.selectable, selectAll = _a.selectAll, selectedAll = _a.selectedAll, sorterState = _a.sorterState, sortingIcon = _a.sortingIcon, sortingIconAscending = _a.sortingIconAscending, sortingIconDescending = _a.sortingIconDescending, rest = __rest$1(_a, ["columnFilter", "columnFilterState", "columnSorter", "component", "columns", "handleOnCustomFilterChange", "handleFilterOnChange", "handleFilterOnInput", "handleSelectAllChecked", "handleSort", "items", "selectable", "selectAll", "selectedAll", "sorterState", "sortingIcon", "sortingIconAscending", "sortingIconDescending"]);
14108
+ var columnFilter = _a.columnFilter, columnFilterState = _a.columnFilterState, columnSorter = _a.columnSorter, _b = _a.component, Component = _b === void 0 ? CTableHead : _b, columns = _a.columns, handleOnCustomFilterChange = _a.handleOnCustomFilterChange, handleFilterOnChange = _a.handleFilterOnChange, handleFilterOnInput = _a.handleFilterOnInput, handleSelectAllChecked = _a.handleSelectAllChecked, handleSort = _a.handleSort, items = _a.items, selectable = _a.selectable, selectAll = _a.selectAll, selectedAll = _a.selectedAll, _c = _a.showGroups, showGroups = _c === void 0 ? true : _c, sorterState = _a.sorterState, sortingIcon = _a.sortingIcon, sortingIconAscending = _a.sortingIconAscending, sortingIconDescending = _a.sortingIconDescending, rest = __rest$1(_a, ["columnFilter", "columnFilterState", "columnSorter", "component", "columns", "handleOnCustomFilterChange", "handleFilterOnChange", "handleFilterOnInput", "handleSelectAllChecked", "handleSort", "items", "selectable", "selectAll", "selectedAll", "showGroups", "sorterState", "sortingIcon", "sortingIconAscending", "sortingIconDescending"]);
14001
14109
  var selectAllcheckboxRef = React$1.useRef(null);
14002
- var _c = React$1.useState(false), refresh = _c[0], setRefresh = _c[1];
14110
+ var _d = React$1.useState(false), refresh = _d[0], setRefresh = _d[1];
14111
+ var _columns = React$1.useMemo(function () { return getColumns(columns); }, [columns]);
14112
+ var groups = React$1.useMemo(function () { return getColumnGroups(columns); }, [columns]);
14003
14113
  React$1.useEffect(function () {
14004
14114
  if (selectedAll === 'indeterminate') {
14005
14115
  if (selectAllcheckboxRef.current)
@@ -14036,27 +14146,33 @@ var CSmartTableHead = React$1.forwardRef(function (_a, ref) {
14036
14146
  return;
14037
14147
  };
14038
14148
  return (React$1.createElement(Component, __assign$1({}, rest, { ref: ref }),
14149
+ showGroups &&
14150
+ groups &&
14151
+ groups.length > 0 &&
14152
+ groups.map(function (row, index) { return (React$1.createElement(CTableRow, { key: index },
14153
+ selectable && React$1.createElement(CTableHeaderCell, null),
14154
+ row.map(function (cell, index) { return (React$1.createElement(CTableHeaderCell, __assign$1({ colSpan: cell.colspan }, getTableHeaderCellProps(cell), { key: index }), cell.label)); }))); }),
14039
14155
  React$1.createElement(CTableRow, null,
14040
14156
  selectable && (React$1.createElement(CTableHeaderCell, null, selectAll && (React$1.createElement(CFormCheck, { checked: typeof selectedAll === 'boolean' ? selectedAll : false, onChange: function () { return handleSelectAllChecked && handleSelectAllChecked(); }, ref: selectAllcheckboxRef })))),
14041
- columns.map(function (column, index) {
14157
+ _columns.map(function (column, index) {
14042
14158
  return (React$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { onClick: function () { return handleSort && handleSort(getColumnKey(column), index); }, style: getTableHeaderCellStyles(column, columnSorter), key: index }),
14043
14159
  React$1.createElement("div", { className: "d-inline" }, getColumnLabel(column)),
14044
14160
  columnSorter &&
14045
- (typeof column !== 'object'
14046
- ? true
14047
- : typeof column.sorter === 'undefined'
14161
+ (typeof column === 'object'
14162
+ ? typeof column.sorter === 'undefined'
14048
14163
  ? true
14049
- : column.sorter) &&
14164
+ : column.sorter
14165
+ : true) &&
14050
14166
  columnSorterIcon(column)));
14051
14167
  })),
14052
14168
  columnFilter && (React$1.createElement(CTableRow, null,
14053
14169
  selectable && React$1.createElement(CTableHeaderCell, null),
14054
- columns.map(function (column, index) {
14055
- return (React$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { key: index }), (typeof column !== 'object'
14056
- ? true
14057
- : typeof column.filter === 'undefined'
14170
+ _columns.map(function (column, index) {
14171
+ return (React$1.createElement(CTableHeaderCell, __assign$1({}, getTableHeaderCellProps(column), { key: index }), (typeof column === 'object'
14172
+ ? column.filter === undefined
14058
14173
  ? true
14059
- : column.filter) ? (typeof column !== 'string' && typeof column.filter === 'function' ? (!refresh &&
14174
+ : column.filter
14175
+ : true) ? (typeof column !== 'string' && typeof column.filter === 'function' ? (!refresh &&
14060
14176
  column.filter(getColumnValues(items, getColumnKey(column)), function (value) {
14061
14177
  return handleOnCustomFilterChange &&
14062
14178
  handleOnCustomFilterChange(getColumnKey(column), value);
@@ -14105,7 +14221,7 @@ var CSmartTable = React$1.forwardRef(function (_a, ref) {
14105
14221
  var _u = React$1.useState({}), columnFilterState = _u[0], setColumnFilterState = _u[1];
14106
14222
  var _v = React$1.useState(), selectedAll = _v[0], setSelectedAll = _v[1];
14107
14223
  var _w = React$1.useState({}), sorterState = _w[0], setSorterState = _w[1];
14108
- var _x = React$1.useState(tableFilterValue ? tableFilterValue : ''), tableFilterState = _x[0], setTableFilterState = _x[1];
14224
+ var _x = React$1.useState(tableFilterValue !== null && tableFilterValue !== void 0 ? tableFilterValue : ''), tableFilterState = _x[0], setTableFilterState = _x[1];
14109
14225
  React$1.useEffect(function () {
14110
14226
  setActivePage(activePage);
14111
14227
  }, [activePage]);
@@ -14168,7 +14284,7 @@ var CSmartTable = React$1.forwardRef(function (_a, ref) {
14168
14284
  setSelectedAll(false);
14169
14285
  return;
14170
14286
  }
14171
- if (_selected.length !== 0 && _selected.length !== _itemsNumber) {
14287
+ if (_selected.length > 0 && _selected.length !== _itemsNumber) {
14172
14288
  setSelectedAll('indeterminate');
14173
14289
  }
14174
14290
  }
@@ -14294,7 +14410,7 @@ var CSmartTable = React$1.forwardRef(function (_a, ref) {
14294
14410
  React$1.createElement(CSmartTableBody, __assign$1({ clickableRows: clickableRows, currentItems: currentItems, firstItemOnActivePageIndex: firstItemOnActivePageIndex, noItemsLabel: noItemsLabel, onRowClick: function (item, index, columnName, event) {
14295
14411
  return clickableRows && onRowClick && onRowClick(item, index, columnName, event);
14296
14412
  }, onRowChecked: function (item, value) { return handleRowChecked(item, value); }, columnNames: columnNames, scopedColumns: scopedColumns, selectable: selectable, selected: _selected }, tableBodyProps)),
14297
- typeof footer === 'boolean' && footer && (React$1.createElement(CSmartTableHead, __assign$1({ component: CTableFoot }, tableFootProps, { columnFilter: false, columnSorter: false, columns: columns !== null && columns !== void 0 ? columns : columnNames, items: _items, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll }))),
14413
+ typeof footer === 'boolean' && footer && (React$1.createElement(CSmartTableHead, __assign$1({ component: CTableFoot }, tableFootProps, { columnFilter: false, columnSorter: false, columns: columns !== null && columns !== void 0 ? columns : columnNames, items: _items, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll, showGroups: false }))),
14298
14414
  Array.isArray(footer) && (React$1.createElement(CTableFoot, __assign$1({}, tableFootProps),
14299
14415
  React$1.createElement(CTableRow, null, footer.map(function (item, index) { return (React$1.createElement(CTableDataCell, __assign$1({}, (typeof item === 'object' && item._props && __assign$1({}, item._props)), { key: index }), typeof item === 'object' ? item.label : item)); }))))),
14300
14416
  loading && (React$1.createElement(CElementCover, { boundaries: [
@@ -14862,7 +14978,6 @@ CWidgetStatsF.displayName = 'CWidgetStatsF';
14862
14978
  exports.CAccordion = CAccordion;
14863
14979
  exports.CAccordionBody = CAccordionBody;
14864
14980
  exports.CAccordionButton = CAccordionButton;
14865
- exports.CAccordionCollapse = CAccordionCollapse;
14866
14981
  exports.CAccordionHeader = CAccordionHeader;
14867
14982
  exports.CAccordionItem = CAccordionItem;
14868
14983
  exports.CAlert = CAlert;