@coreui/react-pro 4.1.3 → 4.1.4

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
@@ -879,7 +879,7 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
879
879
  if (checkerResult == null) {
880
880
  return null;
881
881
  }
882
- if (checkerResult.data.hasOwnProperty('expectedType')) {
882
+ if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
883
883
  expectedTypes.push(checkerResult.data.expectedType);
884
884
  }
885
885
  }
@@ -2630,7 +2630,7 @@ var textColorsPropType = PropTypes$1.oneOfType([
2630
2630
  PropTypes$1.oneOf(['white', 'muted']),
2631
2631
  PropTypes$1.string,
2632
2632
  ]);
2633
- var triggerPropType = PropTypes$1.oneOf(['hover', 'focus', 'click']);
2633
+ var triggerPropType = PropTypes$1.oneOf(['hover', 'focus', 'click', 'click-init']);
2634
2634
 
2635
2635
  var CCloseButton = React.forwardRef(function (_a, ref) {
2636
2636
  var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest$1(_a, ["className", "disabled", "white"]);
@@ -3800,13 +3800,21 @@ function mapToStyles(_ref2) {
3800
3800
  adaptive = _ref2.adaptive,
3801
3801
  roundOffsets = _ref2.roundOffsets,
3802
3802
  isFixed = _ref2.isFixed;
3803
+ var _offsets$x = offsets.x,
3804
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
3805
+ _offsets$y = offsets.y,
3806
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
3803
3807
 
3804
- var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
3805
- _ref3$x = _ref3.x,
3806
- x = _ref3$x === void 0 ? 0 : _ref3$x,
3807
- _ref3$y = _ref3.y,
3808
- y = _ref3$y === void 0 ? 0 : _ref3$y;
3808
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
3809
+ x: x,
3810
+ y: y
3811
+ }) : {
3812
+ x: x,
3813
+ y: y
3814
+ };
3809
3815
 
3816
+ x = _ref3.x;
3817
+ y = _ref3.y;
3810
3818
  var hasX = offsets.hasOwnProperty('x');
3811
3819
  var hasY = offsets.hasOwnProperty('y');
3812
3820
  var sideX = left;
@@ -3851,6 +3859,17 @@ function mapToStyles(_ref2) {
3851
3859
  position: position
3852
3860
  }, adaptive && unsetSides);
3853
3861
 
3862
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3863
+ x: x,
3864
+ y: y
3865
+ }) : {
3866
+ x: x,
3867
+ y: y
3868
+ };
3869
+
3870
+ x = _ref4.x;
3871
+ y = _ref4.y;
3872
+
3854
3873
  if (gpuAcceleration) {
3855
3874
  var _Object$assign;
3856
3875
 
@@ -3860,9 +3879,9 @@ function mapToStyles(_ref2) {
3860
3879
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
3861
3880
  }
3862
3881
 
3863
- function computeStyles(_ref4) {
3864
- var state = _ref4.state,
3865
- options = _ref4.options;
3882
+ function computeStyles(_ref5) {
3883
+ var state = _ref5.state,
3884
+ options = _ref5.options;
3866
3885
  var _options$gpuAccelerat = options.gpuAcceleration,
3867
3886
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
3868
3887
  _options$adaptive = options.adaptive,
@@ -4161,7 +4180,7 @@ function getClippingParents(element) {
4161
4180
 
4162
4181
 
4163
4182
  return clippingParents.filter(function (clippingParent) {
4164
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle$1(clippingParent).position !== 'static' : true);
4183
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
4165
4184
  });
4166
4185
  } // Gets the maximum area that the element is visible in due to any number of
4167
4186
  // clipping parents
@@ -5661,11 +5680,11 @@ var CDropdown = React.forwardRef(function (_a, ref) {
5661
5680
  React.useEffect(function () {
5662
5681
  _visible &&
5663
5682
  setTimeout(function () {
5664
- window.addEventListener('click', handleClickOutside);
5683
+ window.addEventListener('mouseup', handleClickOutside);
5665
5684
  window.addEventListener('keyup', handleKeyup);
5666
5685
  });
5667
5686
  return function () {
5668
- window.removeEventListener('click', handleClickOutside);
5687
+ window.removeEventListener('mouseup', handleClickOutside);
5669
5688
  window.removeEventListener('keyup', handleKeyup);
5670
5689
  };
5671
5690
  }, [_visible]);
@@ -5859,6 +5878,46 @@ CDropdownToggle.propTypes = {
5859
5878
  };
5860
5879
  CDropdownToggle.displayName = 'CDropdownToggle';
5861
5880
 
5881
+ var CDropdownToggleCustom = function (_a) {
5882
+ var children = _a.children, className = _a.className, disabled = _a.disabled, _b = _a.trigger, trigger = _b === void 0 ? 'click' : _b, rest = __rest$1(_a, ["children", "className", "disabled", "trigger"]);
5883
+ var _c = React.useContext(CDropdownContext), popper = _c.popper, visible = _c.visible, setVisible = _c.setVisible;
5884
+ var _className = classNames$1(className);
5885
+ var triggers = __assign$1(__assign$1(__assign$1({}, ((trigger === 'click' || trigger.includes('click')) &&
5886
+ !disabled && {
5887
+ onClick: function (event) {
5888
+ event.preventDefault();
5889
+ setVisible(!visible);
5890
+ },
5891
+ })), ((trigger === 'click-init' || trigger.includes('click-init')) &&
5892
+ !disabled && {
5893
+ onClick: function (event) {
5894
+ event.preventDefault();
5895
+ setVisible(true);
5896
+ },
5897
+ })), ((trigger === 'focus' || trigger.includes('focus')) &&
5898
+ !disabled && {
5899
+ onFocus: function () { return setVisible(true); },
5900
+ onBlur: function () { return setVisible(false); },
5901
+ }));
5902
+ var togglerProps = __assign$1({ className: _className, 'aria-expanded': visible }, triggers);
5903
+ // We use any because Toggler can be `a` as well as `button`.
5904
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5905
+ var Toggler = function (ref) {
5906
+ return (React__default["default"].createElement("div", __assign$1({}, togglerProps, rest, { ref: ref }), children));
5907
+ };
5908
+ return popper ? React__default["default"].createElement(Reference, null, function (_a) {
5909
+ var ref = _a.ref;
5910
+ return Toggler(ref);
5911
+ }) : Toggler();
5912
+ };
5913
+ CDropdownToggleCustom.propTypes = {
5914
+ children: PropTypes$1.node,
5915
+ className: PropTypes$1.string,
5916
+ disabled: PropTypes$1.bool,
5917
+ trigger: triggerPropType,
5918
+ };
5919
+ CDropdownToggleCustom.displayName = 'CDropdownToggleCustom';
5920
+
5862
5921
  var BREAKPOINTS$3 = [
5863
5922
  'xxl',
5864
5923
  'xl',
@@ -7717,6 +7776,14 @@ CSidebarHeader.propTypes = {
7717
7776
  };
7718
7777
  CSidebarHeader.displayName = 'CSidebarHeader';
7719
7778
 
7779
+ const cilArrowBottom = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='367.997 338.75 271.999 434.747 271.999 17.503 239.999 17.503 239.999 434.745 144.003 338.75 121.376 361.377 256 496 390.624 361.377 367.997 338.75' class='ci-primary'/>"];
7780
+
7781
+ const cilArrowTop = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='390.624 150.625 256 16 121.376 150.625 144.004 173.252 240.001 77.254 240.001 495.236 272.001 495.236 272.001 77.257 367.996 173.252 390.624 150.625' class='ci-primary'/>"];
7782
+
7783
+ const cilFilterX = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='40 16 40 53.828 109.024 136 150.815 136 76.896 48 459.51 48 304 242.388 304 401.373 241.373 464 240 464 240 368 208 368 208 496 254.627 496 336 414.627 336 253.612 496 53.612 496 16 40 16' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='166.403 248.225 226.864 187.763 204.237 165.135 143.775 225.597 83.313 165.135 60.687 187.763 121.148 248.225 60.687 308.687 83.313 331.314 143.775 270.852 204.237 331.314 226.864 308.687 166.403 248.225' class='ci-primary'/>"];
7784
+
7785
+ const cilSwapVertical = ["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='384 433.373 384 160 352 160 352 434.51 282.177 364.687 259.55 387.313 367.432 495.196 475.313 387.313 452.687 364.687 384 433.373' class='ci-primary'/><polygon fill='var(--ci-primary-color, currentColor)' points='159.432 17.372 51.55 125.255 74.177 147.882 144 78.059 144 352 176 352 176 79.195 244.687 147.882 267.313 125.255 159.432 17.372' class='ci-primary'/>"];
7786
+
7720
7787
  var CElementCover = React.forwardRef(function (_a, ref) {
7721
7788
  var children = _a.children, className = _a.className, boundaries = _a.boundaries, _b = _a.opacity, opacity = _b === void 0 ? 0.4 : _b, rest = __rest$1(_a, ["children", "className", "boundaries", "opacity"]);
7722
7789
  var elementCoverRef = React.useRef(null);
@@ -9197,10 +9264,7 @@ CIcon.propTypes = {
9197
9264
  CIcon.displayName = 'CIcon';
9198
9265
 
9199
9266
  var CSmartTableCleaner = React.forwardRef(function (_a, ref) {
9200
- var _b = _a.content, content = _b === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
9201
- '512 512',
9202
- '<polygon fill="var(--ci-primary-color, currentColor)" points="40 16 40 53.828 109.024 136 150.815 136 76.896 48 459.51 48 304 242.388 304 401.373 241.373 464 240 464 240 368 208 368 208 496 254.627 496 336 414.627 336 253.612 496 53.612 496 16 40 16" class="ci-primary"></polygon><polygon fill="var(--ci-primary-color, currentColor)" points="166.403 248.225 226.864 187.763 204.237 165.135 143.775 225.597 83.313 165.135 60.687 187.763 121.148 248.225 60.687 308.687 83.313 331.314 143.775 270.852 204.237 331.314 226.864 308.687 166.403 248.225" class="ci-primary"></polygon>',
9203
- ] })) : _b, isFiltered = _a.isFiltered, rest = __rest$1(_a, ["content", "isFiltered"]);
9267
+ var _b = _a.content, content = _b === void 0 ? React__default["default"].createElement(CIcon, { width: 18, icon: cilFilterX }) : _b, isFiltered = _a.isFiltered, rest = __rest$1(_a, ["content", "isFiltered"]);
9204
9268
  return (React__default["default"].createElement("button", __assign$1({ type: "button", className: "btn btn-transparent" }, (!isFiltered && {
9205
9269
  disabled: true,
9206
9270
  tabIndex: -1,
@@ -9397,46 +9461,34 @@ CSmartTableItemsPerPageSelector.displayName = 'CSmartTableItemsPerPageSelector';
9397
9461
 
9398
9462
  var CSmartTable = React.forwardRef(function (_a, ref) {
9399
9463
  var _b = _a.activePage, activePage = _b === void 0 ? 1 : _b, cleaner = _a.cleaner, clickableRows = _a.clickableRows, columnFilter = _a.columnFilter, columnFilterValue = _a.columnFilterValue, // TODO: consider to use only columnFilter prop
9400
- columns = _a.columns, columnSorter = _a.columnSorter, footer = _a.footer, _c = _a.header, header = _c === void 0 ? true : _c, items = _a.items, _d = _a.itemsPerPage, itemsPerPage = _d === void 0 ? 10 : _d, _e = _a.itemsPerPageLabel, itemsPerPageLabel = _e === void 0 ? 'Items per page:' : _e, _f = _a.itemsPerPageOptions, itemsPerPageOptions = _f === void 0 ? [5, 10, 20, 50] : _f, itemsPerPageSelect = _a.itemsPerPageSelect, loading = _a.loading, _g = _a.noItemsLabel, noItemsLabel = _g === void 0 ? 'No items found' : _g, onActivePageChange = _a.onActivePageChange, onColumnFilterChange = _a.onColumnFilterChange, onFilteredItemsChange = _a.onFilteredItemsChange, onItemsPerPageChange = _a.onItemsPerPageChange, onRowClick = _a.onRowClick, onSelectedItemsChange = _a.onSelectedItemsChange, onSorterChange = _a.onSorterChange, onTableFilterChange = _a.onTableFilterChange, pagination = _a.pagination, paginationProps = _a.paginationProps, scopedColumns = _a.scopedColumns, selectable = _a.selectable, sorterValue = _a.sorterValue, _h = _a.sortingIcon, sortingIcon = _h === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
9401
- '512 512',
9402
- '<polygon fill="var(--ci-primary-color, currentColor)" points="384 433.373 384 160 352 160 352 434.51 282.177 364.687 259.55 387.313 367.432 495.196 475.313 387.313 452.687 364.687 384 433.373" class="ci-primary"></polygon><polygon fill="var(--ci-primary-color, currentColor)" points="159.432 17.372 51.55 125.255 74.177 147.882 144 78.059 144 352 176 352 176 79.195 244.687 147.882 267.313 125.255 159.432 17.372" class="ci-primary"></polygon>',
9403
- ], key: "csv" })) : _h, _j = _a.sortingIconAscending, sortingIconAscending = _j === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
9404
- '512 512',
9405
- '<polygon fill="var(--ci-primary-color, currentColor)" points="390.624 150.625 256 16 121.376 150.625 144.004 173.252 240.001 77.254 240.001 495.236 272.001 495.236 272.001 77.257 367.996 173.252 390.624 150.625" class="ci-primary"></polygon>',
9406
- ], key: "cat" })) : _j, _k = _a.sortingIconDescending, sortingIconDescending = _k === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
9407
- '512 512',
9408
- '<polygon fill="var(--ci-primary-color, currentColor)" points="367.997 338.75 271.999 434.747 271.999 17.503 239.999 17.503 239.999 434.745 144.003 338.75 121.376 361.377 256 496 390.624 361.377 367.997 338.75" class="ci-primary"></polygon>',
9409
- ], key: "cab" })) : _k, tableBodyProps = _a.tableBodyProps, tableFootProps = _a.tableFootProps, tableFilter = _a.tableFilter, _l = _a.tableFilterLabel, tableFilterLabel = _l === void 0 ? 'Filter:' : _l, _m = _a.tableFilterPlaceholder, tableFilterPlaceholder = _m === void 0 ? 'type string...' : _m, tableFilterValue = _a.tableFilterValue, // TODO: consider to use only tableFilter prop
9464
+ columns = _a.columns, columnSorter = _a.columnSorter, footer = _a.footer, _c = _a.header, header = _c === void 0 ? true : _c, items = _a.items, _d = _a.itemsPerPage, itemsPerPage = _d === void 0 ? 10 : _d, _e = _a.itemsPerPageLabel, itemsPerPageLabel = _e === void 0 ? 'Items per page:' : _e, _f = _a.itemsPerPageOptions, itemsPerPageOptions = _f === void 0 ? [5, 10, 20, 50] : _f, itemsPerPageSelect = _a.itemsPerPageSelect, loading = _a.loading, _g = _a.noItemsLabel, noItemsLabel = _g === void 0 ? 'No items found' : _g, onActivePageChange = _a.onActivePageChange, onColumnFilterChange = _a.onColumnFilterChange, onFilteredItemsChange = _a.onFilteredItemsChange, onItemsPerPageChange = _a.onItemsPerPageChange, onRowClick = _a.onRowClick, onSelectedItemsChange = _a.onSelectedItemsChange, onSorterChange = _a.onSorterChange, onTableFilterChange = _a.onTableFilterChange, pagination = _a.pagination, paginationProps = _a.paginationProps, scopedColumns = _a.scopedColumns, selectable = _a.selectable, sorterValue = _a.sorterValue, _h = _a.sortingIcon, sortingIcon = _h === void 0 ? React__default["default"].createElement(CIcon, { width: 18, icon: cilSwapVertical, key: "csv" }) : _h, _j = _a.sortingIconAscending, sortingIconAscending = _j === void 0 ? React__default["default"].createElement(CIcon, { width: 18, icon: cilArrowTop, key: "cat" }) : _j, _k = _a.sortingIconDescending, sortingIconDescending = _k === void 0 ? React__default["default"].createElement(CIcon, { width: 18, icon: cilArrowBottom, key: "cab" }) : _k, tableBodyProps = _a.tableBodyProps, tableFootProps = _a.tableFootProps, tableFilter = _a.tableFilter, _l = _a.tableFilterLabel, tableFilterLabel = _l === void 0 ? 'Filter:' : _l, _m = _a.tableFilterPlaceholder, tableFilterPlaceholder = _m === void 0 ? 'type string...' : _m, tableFilterValue = _a.tableFilterValue, // TODO: consider to use only tableFilter prop
9410
9465
  tableHeadProps = _a.tableHeadProps, tableProps = _a.tableProps, rest = __rest$1(_a, ["activePage", "cleaner", "clickableRows", "columnFilter", "columnFilterValue", "columns", "columnSorter", "footer", "header", "items", "itemsPerPage", "itemsPerPageLabel", "itemsPerPageOptions", "itemsPerPageSelect", "loading", "noItemsLabel", "onActivePageChange", "onColumnFilterChange", "onFilteredItemsChange", "onItemsPerPageChange", "onRowClick", "onSelectedItemsChange", "onSorterChange", "onTableFilterChange", "pagination", "paginationProps", "scopedColumns", "selectable", "sorterValue", "sortingIcon", "sortingIconAscending", "sortingIconDescending", "tableBodyProps", "tableFootProps", "tableFilter", "tableFilterLabel", "tableFilterPlaceholder", "tableFilterValue", "tableHeadProps", "tableProps"]);
9411
9466
  // instance data
9412
- var compData = React.useRef({ firstRun: true, columnFiltered: 0, changeItems: 0 }).current;
9413
- var previousSorterValue = React.useRef();
9414
- var previousItemsValue = React.useRef();
9415
9467
  var _o = React.useState(activePage), _activePage = _o[0], setActivePage = _o[1];
9416
9468
  var _p = React.useState([]), _items = _p[0], setItems = _p[1];
9417
9469
  var _q = React.useState(itemsPerPage), _itemsPerPage = _q[0], setItemsPerPage = _q[1];
9418
- var _r = React.useState(columnFilterValue ? columnFilterValue : {}), columnFilterState = _r[0], setColumnFilterState = _r[1];
9470
+ var _r = React.useState({}), columnFilterState = _r[0], setColumnFilterState = _r[1];
9419
9471
  var _s = React.useState(), selectedAll = _s[0], setSelectedAll = _s[1];
9420
- var _t = React.useState(previousSorterValue.current || {}), sorterState = _t[0], setSorterState = _t[1];
9472
+ var _t = React.useState({}), sorterState = _t[0], setSorterState = _t[1];
9421
9473
  var _u = React.useState(tableFilterValue ? tableFilterValue : ''), tableFilterState = _u[0], setTableFilterState = _u[1];
9474
+ // watch
9422
9475
  React.useMemo(function () {
9423
- if (JSON.stringify(previousSorterValue.current) !== JSON.stringify(sorterValue)) {
9424
- previousSorterValue.current = sorterValue;
9425
- setSorterState(__assign$1({}, sorterValue));
9476
+ if (items && items.length < _itemsPerPage * _activePage - _itemsPerPage) {
9477
+ setActivePage(1);
9426
9478
  }
9427
- }, [sorterValue]);
9479
+ // Create the internal array of items
9480
+ Array.isArray(items) &&
9481
+ setItems(items === null || items === void 0 ? void 0 : items.map(function (item, index) {
9482
+ return __assign$1(__assign$1({}, item), { _id: index });
9483
+ }));
9484
+ }, [JSON.stringify(items)]);
9428
9485
  React.useMemo(function () {
9429
- if (JSON.stringify(previousItemsValue.current) !== JSON.stringify(items)) {
9430
- if (items && items.length < _itemsPerPage * _activePage - _itemsPerPage) {
9431
- setActivePage(1);
9432
- }
9433
- previousItemsValue.current = items;
9434
- Array.isArray(items) &&
9435
- setItems(items === null || items === void 0 ? void 0 : items.map(function (item, index) {
9436
- return __assign$1(__assign$1({}, item), { _id: index });
9437
- }));
9438
- }
9439
- }, [items]);
9486
+ columnFilterValue && setColumnFilterState(columnFilterValue);
9487
+ }, [JSON.stringify(columnFilterValue)]);
9488
+ React.useMemo(function () {
9489
+ setSorterState(__assign$1({}, sorterValue));
9490
+ }, [JSON.stringify(sorterValue)]);
9491
+ React.useMemo(function () { return setItemsPerPage(itemsPerPage); }, [itemsPerPage]);
9440
9492
  // functions
9441
9493
  var isSortable = function (i) {
9442
9494
  var isDataColumn = itemsDataColumns.includes(rawColumnNames[i]);
@@ -9518,15 +9570,7 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
9518
9570
  : genCols; //! || el
9519
9571
  var itemsDataColumns = rawColumnNames.filter(function (name) { return genCols.includes(name); });
9520
9572
  // variables
9521
- React.useMemo(function () {
9522
- compData.columnFiltered++;
9523
- }, [
9524
- JSON.stringify(columnFilter),
9525
- JSON.stringify(columnFilterState),
9526
- itemsDataColumns.join(''),
9527
- compData.changeItems,
9528
- ]);
9529
- var columnFiltered = React.useMemo(function () {
9573
+ var filteredColumns = React.useMemo(function () {
9530
9574
  var items = _items;
9531
9575
  if (columnFilter && typeof columnFilter === 'object' && columnFilter.external) {
9532
9576
  return items;
@@ -9541,9 +9585,9 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
9541
9585
  }
9542
9586
  });
9543
9587
  return items;
9544
- }, [compData.columnFiltered, _items]);
9545
- var tableFiltered = React.useMemo(function () {
9546
- var items = columnFiltered;
9588
+ }, [JSON.stringify(columnFilterState), JSON.stringify(_items)]);
9589
+ var filteredTable = React.useMemo(function () {
9590
+ var items = filteredColumns;
9547
9591
  if (!tableFilterState ||
9548
9592
  (tableFilter && typeof tableFilter === 'object' && tableFilter.external)) {
9549
9593
  return items;
@@ -9554,23 +9598,16 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
9554
9598
  return !!itemsDataColumns.find(function (key) { return valueContainFilter(item[key]); });
9555
9599
  });
9556
9600
  return items;
9557
- }, [
9558
- compData.columnFiltered,
9559
- tableFilterState,
9560
- JSON.stringify(tableFilter),
9561
- JSON.stringify(columnFiltered),
9562
- ]);
9601
+ }, [tableFilterState, JSON.stringify(tableFilterValue), JSON.stringify(filteredColumns)]);
9563
9602
  var sortedItems = React.useMemo(function () {
9564
9603
  var col = sorterState === null || sorterState === void 0 ? void 0 : sorterState.column;
9565
9604
  if (!col ||
9566
9605
  !itemsDataColumns.includes(col) ||
9567
9606
  (columnSorter && typeof columnSorter === 'object' && columnSorter.external)) {
9568
- return tableFiltered;
9607
+ return filteredTable;
9569
9608
  }
9570
- //if values in column are to be sorted by numeric value they all have to be type number
9571
- // const flip = sorterState.asc ? 1 : -1
9572
9609
  var flip = sorterState.state === 'asc' ? 1 : sorterState.state === 'desc' ? -1 : 0;
9573
- var sorted = tableFiltered.slice().sort(function (item, item2) {
9610
+ var sorted = filteredTable.slice().sort(function (item, item2) {
9574
9611
  var value = item[col];
9575
9612
  var value2 = item2[col];
9576
9613
  var a = typeof value === 'number' ? value : String(value).toLowerCase();
@@ -9578,7 +9615,13 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
9578
9615
  return a > b ? 1 * flip : b > a ? -1 * flip : 0;
9579
9616
  });
9580
9617
  return sorted;
9581
- }, [JSON.stringify(tableFiltered), JSON.stringify(sorterState), JSON.stringify(columnSorter)]);
9618
+ }, [
9619
+ JSON.stringify(filteredTable),
9620
+ JSON.stringify(sorterState),
9621
+ JSON.stringify(columnSorter),
9622
+ JSON.stringify(filteredColumns),
9623
+ JSON.stringify(_items),
9624
+ ]);
9582
9625
  var numberOfPages = _itemsPerPage ? Math.ceil(sortedItems.length / _itemsPerPage) : 1;
9583
9626
  var firstItemOnActivePageIndex = _activePage ? (_activePage - 1) * _itemsPerPage : 0;
9584
9627
  var itemsOnActivePage = sortedItems.slice(firstItemOnActivePageIndex, firstItemOnActivePageIndex + _itemsPerPage);
@@ -9602,16 +9645,8 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
9602
9645
  onTableFilterChange && onTableFilterChange(tableFilterState);
9603
9646
  }, [tableFilterState]);
9604
9647
  React.useEffect(function () {
9605
- !compData.firstRun && onFilteredItemsChange && onFilteredItemsChange(sortedItems);
9648
+ onFilteredItemsChange && onFilteredItemsChange(sortedItems);
9606
9649
  }, [JSON.stringify(sortedItems)]);
9607
- // watch
9608
- React.useMemo(function () { return setItemsPerPage(itemsPerPage); }, [itemsPerPage]);
9609
- React.useMemo(function () {
9610
- return JSON.stringify(previousSorterValue.current) !== JSON.stringify(sorterValue) &&
9611
- setSorterState(__assign$1({}, sorterValue));
9612
- }, [sorterValue]);
9613
- React.useMemo(function () { return setColumnFilterState(__assign$1({}, columnFilterValue)); }, [columnFilterValue]);
9614
- compData.firstRun = false;
9615
9650
  var handleRowChecked = function (id, value) {
9616
9651
  var newArr = __spreadArray([], _items, true);
9617
9652
  newArr[id]._selected = value;
@@ -10136,6 +10171,7 @@ exports.CDropdownItem = CDropdownItem;
10136
10171
  exports.CDropdownItemPlain = CDropdownItemPlain;
10137
10172
  exports.CDropdownMenu = CDropdownMenu;
10138
10173
  exports.CDropdownToggle = CDropdownToggle;
10174
+ exports.CDropdownToggleCustom = CDropdownToggleCustom;
10139
10175
  exports.CFooter = CFooter;
10140
10176
  exports.CForm = CForm;
10141
10177
  exports.CFormCheck = CFormCheck;