@coreui/react-pro 4.1.0 → 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/README.md +1 -1
- package/dist/components/Types.d.ts +1 -1
- package/dist/components/dropdown/CDropdownToggleCustom.d.ts +15 -0
- package/dist/components/modal/CModal.d.ts +1 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/smart-table/CSmartTableBody.d.ts +3 -3
- package/dist/components/smart-table/CSmartTableInterface.d.ts +9 -15
- package/dist/components/tooltip/CTooltip.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +193 -114
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +193 -113
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/src/components/Types.tsx +2 -2
- package/src/components/dropdown/CDropdown.tsx +2 -2
- package/src/components/dropdown/CDropdownToggleCustom.tsx +81 -0
- package/src/components/modal/CModal.tsx +42 -19
- package/src/components/modal/__tests__/CModal.spec.tsx +1 -1
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.tsx.snap +2 -10
- package/src/components/popover/CPopover.tsx +4 -4
- package/src/components/smart-table/CSmartTable.tsx +57 -103
- package/src/components/smart-table/CSmartTableBody.tsx +9 -4
- package/src/components/smart-table/CSmartTableCleaner.tsx +3 -16
- package/src/components/smart-table/CSmartTableHead.tsx +1 -1
- package/src/components/smart-table/CSmartTableInterface.tsx +10 -15
- package/src/components/tooltip/CTooltip.tsx +2 -2
- package/src/index.ts +2 -0
- package/src/utils/hooks/useForkedRef.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -385,6 +385,8 @@ var ReactPropTypesSecret$7 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
385
385
|
|
|
386
386
|
var ReactPropTypesSecret_1$1 = ReactPropTypesSecret$7;
|
|
387
387
|
|
|
388
|
+
var has$4 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
389
|
+
|
|
388
390
|
/**
|
|
389
391
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
390
392
|
*
|
|
@@ -397,7 +399,7 @@ var printWarning$4 = function() {};
|
|
|
397
399
|
if (process.env.NODE_ENV !== 'production') {
|
|
398
400
|
var ReactPropTypesSecret$6 = ReactPropTypesSecret_1$1;
|
|
399
401
|
var loggedTypeFailures$1 = {};
|
|
400
|
-
var has$3 =
|
|
402
|
+
var has$3 = has$4;
|
|
401
403
|
|
|
402
404
|
printWarning$4 = function(text) {
|
|
403
405
|
var message = 'Warning: ' + text;
|
|
@@ -409,7 +411,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
409
411
|
// This error was thrown as a convenience so that you can use this stack
|
|
410
412
|
// to find the callsite that caused this warning to fire.
|
|
411
413
|
throw new Error(message);
|
|
412
|
-
} catch (x) {}
|
|
414
|
+
} catch (x) { /**/ }
|
|
413
415
|
};
|
|
414
416
|
}
|
|
415
417
|
|
|
@@ -438,7 +440,8 @@ function checkPropTypes$3(typeSpecs, values, location, componentName, getStack)
|
|
|
438
440
|
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
439
441
|
var err = Error(
|
|
440
442
|
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
441
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
|
443
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
444
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
442
445
|
);
|
|
443
446
|
err.name = 'Invariant Violation';
|
|
444
447
|
throw err;
|
|
@@ -497,9 +500,9 @@ var ReactIs$3 = reactIs$1.exports;
|
|
|
497
500
|
var assign$1 = objectAssign$1;
|
|
498
501
|
|
|
499
502
|
var ReactPropTypesSecret$5 = ReactPropTypesSecret_1$1;
|
|
503
|
+
var has$2 = has$4;
|
|
500
504
|
var checkPropTypes$2 = checkPropTypes_1$1;
|
|
501
505
|
|
|
502
|
-
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
503
506
|
var printWarning$3 = function() {};
|
|
504
507
|
|
|
505
508
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -600,6 +603,7 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
600
603
|
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
601
604
|
var ReactPropTypes = {
|
|
602
605
|
array: createPrimitiveTypeChecker('array'),
|
|
606
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
603
607
|
bool: createPrimitiveTypeChecker('boolean'),
|
|
604
608
|
func: createPrimitiveTypeChecker('function'),
|
|
605
609
|
number: createPrimitiveTypeChecker('number'),
|
|
@@ -645,8 +649,9 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
645
649
|
* is prohibitively expensive if they are created too often, such as what
|
|
646
650
|
* happens in oneOfType() for any type before the one that matched.
|
|
647
651
|
*/
|
|
648
|
-
function PropTypeError(message) {
|
|
652
|
+
function PropTypeError(message, data) {
|
|
649
653
|
this.message = message;
|
|
654
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
650
655
|
this.stack = '';
|
|
651
656
|
}
|
|
652
657
|
// Make `instanceof Error` still work for returned errors.
|
|
@@ -681,7 +686,7 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
681
686
|
) {
|
|
682
687
|
printWarning$3(
|
|
683
688
|
'You are manually calling a React.PropTypes validation ' +
|
|
684
|
-
'function for the `' + propFullName + '` prop on `' + componentName
|
|
689
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
685
690
|
'and will throw in the standalone `prop-types` package. ' +
|
|
686
691
|
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
687
692
|
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
@@ -720,7 +725,10 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
720
725
|
// 'of type `object`'.
|
|
721
726
|
var preciseType = getPreciseType(propValue);
|
|
722
727
|
|
|
723
|
-
return new PropTypeError(
|
|
728
|
+
return new PropTypeError(
|
|
729
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
730
|
+
{expectedType: expectedType}
|
|
731
|
+
);
|
|
724
732
|
}
|
|
725
733
|
return null;
|
|
726
734
|
}
|
|
@@ -864,14 +872,19 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
864
872
|
}
|
|
865
873
|
|
|
866
874
|
function validate(props, propName, componentName, location, propFullName) {
|
|
875
|
+
var expectedTypes = [];
|
|
867
876
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
868
877
|
var checker = arrayOfTypeCheckers[i];
|
|
869
|
-
|
|
878
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret$5);
|
|
879
|
+
if (checkerResult == null) {
|
|
870
880
|
return null;
|
|
871
881
|
}
|
|
882
|
+
if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
|
|
883
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
884
|
+
}
|
|
872
885
|
}
|
|
873
|
-
|
|
874
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '
|
|
886
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
887
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
875
888
|
}
|
|
876
889
|
return createChainableTypeChecker(validate);
|
|
877
890
|
}
|
|
@@ -886,6 +899,13 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
886
899
|
return createChainableTypeChecker(validate);
|
|
887
900
|
}
|
|
888
901
|
|
|
902
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
903
|
+
return new PropTypeError(
|
|
904
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
905
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
|
|
889
909
|
function createShapeTypeChecker(shapeTypes) {
|
|
890
910
|
function validate(props, propName, componentName, location, propFullName) {
|
|
891
911
|
var propValue = props[propName];
|
|
@@ -895,8 +915,8 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
895
915
|
}
|
|
896
916
|
for (var key in shapeTypes) {
|
|
897
917
|
var checker = shapeTypes[key];
|
|
898
|
-
if (
|
|
899
|
-
|
|
918
|
+
if (typeof checker !== 'function') {
|
|
919
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
900
920
|
}
|
|
901
921
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$5);
|
|
902
922
|
if (error) {
|
|
@@ -915,16 +935,18 @@ var factoryWithTypeCheckers$1 = function(isValidElement, throwOnDirectAccess) {
|
|
|
915
935
|
if (propType !== 'object') {
|
|
916
936
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
917
937
|
}
|
|
918
|
-
// We need to check all keys in case some are required but missing from
|
|
919
|
-
// props.
|
|
938
|
+
// We need to check all keys in case some are required but missing from props.
|
|
920
939
|
var allKeys = assign$1({}, props[propName], shapeTypes);
|
|
921
940
|
for (var key in allKeys) {
|
|
922
941
|
var checker = shapeTypes[key];
|
|
942
|
+
if (has$2(shapeTypes, key) && typeof checker !== 'function') {
|
|
943
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
944
|
+
}
|
|
923
945
|
if (!checker) {
|
|
924
946
|
return new PropTypeError(
|
|
925
947
|
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
926
948
|
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
927
|
-
'\nValid keys: ' +
|
|
949
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
928
950
|
);
|
|
929
951
|
}
|
|
930
952
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret$5);
|
|
@@ -1109,6 +1131,7 @@ var factoryWithThrowingShims$1 = function() {
|
|
|
1109
1131
|
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1110
1132
|
var ReactPropTypes = {
|
|
1111
1133
|
array: shim,
|
|
1134
|
+
bigint: shim,
|
|
1112
1135
|
bool: shim,
|
|
1113
1136
|
func: shim,
|
|
1114
1137
|
number: shim,
|
|
@@ -2387,6 +2410,7 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, T
|
|
|
2387
2410
|
var CSSTransition$1 = CSSTransition;
|
|
2388
2411
|
|
|
2389
2412
|
// code borrowed from https://github.com/reach/reach-ui
|
|
2413
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2390
2414
|
function useForkedRef() {
|
|
2391
2415
|
var refs = [];
|
|
2392
2416
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -2396,6 +2420,7 @@ function useForkedRef() {
|
|
|
2396
2420
|
if (refs.every(function (ref) { return ref == null; })) {
|
|
2397
2421
|
return null;
|
|
2398
2422
|
}
|
|
2423
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2399
2424
|
return function (node) {
|
|
2400
2425
|
refs.forEach(function (ref) {
|
|
2401
2426
|
assignRef(ref, node);
|
|
@@ -2403,7 +2428,10 @@ function useForkedRef() {
|
|
|
2403
2428
|
};
|
|
2404
2429
|
}, refs);
|
|
2405
2430
|
}
|
|
2406
|
-
|
|
2431
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2432
|
+
function assignRef(ref,
|
|
2433
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2434
|
+
value) {
|
|
2407
2435
|
if (ref == null)
|
|
2408
2436
|
return;
|
|
2409
2437
|
if (isFunction(ref)) {
|
|
@@ -2418,6 +2446,7 @@ function assignRef(ref, value) {
|
|
|
2418
2446
|
}
|
|
2419
2447
|
}
|
|
2420
2448
|
}
|
|
2449
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
2421
2450
|
function isFunction(value) {
|
|
2422
2451
|
return !!(value && {}.toString.call(value) == '[object Function]');
|
|
2423
2452
|
}
|
|
@@ -2601,7 +2630,7 @@ var textColorsPropType = PropTypes$1.oneOfType([
|
|
|
2601
2630
|
PropTypes$1.oneOf(['white', 'muted']),
|
|
2602
2631
|
PropTypes$1.string,
|
|
2603
2632
|
]);
|
|
2604
|
-
var triggerPropType = PropTypes$1.oneOf(['hover', 'focus', 'click']);
|
|
2633
|
+
var triggerPropType = PropTypes$1.oneOf(['hover', 'focus', 'click', 'click-init']);
|
|
2605
2634
|
|
|
2606
2635
|
var CCloseButton = React.forwardRef(function (_a, ref) {
|
|
2607
2636
|
var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest$1(_a, ["className", "disabled", "white"]);
|
|
@@ -3771,13 +3800,21 @@ function mapToStyles(_ref2) {
|
|
|
3771
3800
|
adaptive = _ref2.adaptive,
|
|
3772
3801
|
roundOffsets = _ref2.roundOffsets,
|
|
3773
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;
|
|
3774
3807
|
|
|
3775
|
-
var _ref3 =
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3808
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
3809
|
+
x: x,
|
|
3810
|
+
y: y
|
|
3811
|
+
}) : {
|
|
3812
|
+
x: x,
|
|
3813
|
+
y: y
|
|
3814
|
+
};
|
|
3780
3815
|
|
|
3816
|
+
x = _ref3.x;
|
|
3817
|
+
y = _ref3.y;
|
|
3781
3818
|
var hasX = offsets.hasOwnProperty('x');
|
|
3782
3819
|
var hasY = offsets.hasOwnProperty('y');
|
|
3783
3820
|
var sideX = left;
|
|
@@ -3822,6 +3859,17 @@ function mapToStyles(_ref2) {
|
|
|
3822
3859
|
position: position
|
|
3823
3860
|
}, adaptive && unsetSides);
|
|
3824
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
|
+
|
|
3825
3873
|
if (gpuAcceleration) {
|
|
3826
3874
|
var _Object$assign;
|
|
3827
3875
|
|
|
@@ -3831,9 +3879,9 @@ function mapToStyles(_ref2) {
|
|
|
3831
3879
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
3832
3880
|
}
|
|
3833
3881
|
|
|
3834
|
-
function computeStyles(
|
|
3835
|
-
var state =
|
|
3836
|
-
options =
|
|
3882
|
+
function computeStyles(_ref5) {
|
|
3883
|
+
var state = _ref5.state,
|
|
3884
|
+
options = _ref5.options;
|
|
3837
3885
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
3838
3886
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
3839
3887
|
_options$adaptive = options.adaptive,
|
|
@@ -4132,7 +4180,7 @@ function getClippingParents(element) {
|
|
|
4132
4180
|
|
|
4133
4181
|
|
|
4134
4182
|
return clippingParents.filter(function (clippingParent) {
|
|
4135
|
-
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'
|
|
4183
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
4136
4184
|
});
|
|
4137
4185
|
} // Gets the maximum area that the element is visible in due to any number of
|
|
4138
4186
|
// clipping parents
|
|
@@ -5632,11 +5680,11 @@ var CDropdown = React.forwardRef(function (_a, ref) {
|
|
|
5632
5680
|
React.useEffect(function () {
|
|
5633
5681
|
_visible &&
|
|
5634
5682
|
setTimeout(function () {
|
|
5635
|
-
window.addEventListener('
|
|
5683
|
+
window.addEventListener('mouseup', handleClickOutside);
|
|
5636
5684
|
window.addEventListener('keyup', handleKeyup);
|
|
5637
5685
|
});
|
|
5638
5686
|
return function () {
|
|
5639
|
-
window.removeEventListener('
|
|
5687
|
+
window.removeEventListener('mouseup', handleClickOutside);
|
|
5640
5688
|
window.removeEventListener('keyup', handleKeyup);
|
|
5641
5689
|
};
|
|
5642
5690
|
}, [_visible]);
|
|
@@ -5830,6 +5878,46 @@ CDropdownToggle.propTypes = {
|
|
|
5830
5878
|
};
|
|
5831
5879
|
CDropdownToggle.displayName = 'CDropdownToggle';
|
|
5832
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
|
+
|
|
5833
5921
|
var BREAKPOINTS$3 = [
|
|
5834
5922
|
'xxl',
|
|
5835
5923
|
'xl',
|
|
@@ -6488,11 +6576,12 @@ CModalDialog.displayName = 'CModalDialog';
|
|
|
6488
6576
|
|
|
6489
6577
|
var CModalContext = React.createContext({});
|
|
6490
6578
|
var CModal = React.forwardRef(function (_a, ref) {
|
|
6491
|
-
var children = _a.children, alignment = _a.alignment, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.duration, duration = _c === void 0 ? 150 : _c, fullscreen = _a.fullscreen, _d = _a.keyboard, keyboard = _d === void 0 ? true : _d, onClose = _a.onClose, onClosePrevented = _a.onClosePrevented, onShow = _a.onShow, _e = _a.portal, portal = _e === void 0 ? true : _e, scrollable = _a.scrollable, size = _a.size, _f = _a.transition, transition = _f === void 0 ? true : _f, visible = _a.visible;
|
|
6579
|
+
var children = _a.children, alignment = _a.alignment, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.duration, duration = _c === void 0 ? 150 : _c, fullscreen = _a.fullscreen, _d = _a.keyboard, keyboard = _d === void 0 ? true : _d, onClose = _a.onClose, onClosePrevented = _a.onClosePrevented, onShow = _a.onShow, _e = _a.portal, portal = _e === void 0 ? true : _e, scrollable = _a.scrollable, size = _a.size, _f = _a.transition, transition = _f === void 0 ? true : _f, _g = _a.unmountOnClose, unmountOnClose = _g === void 0 ? true : _g, visible = _a.visible;
|
|
6492
6580
|
var modalRef = React.useRef(null);
|
|
6581
|
+
var modalContentRef = React.useRef(null);
|
|
6493
6582
|
var forkedRef = useForkedRef(ref, modalRef);
|
|
6494
|
-
var
|
|
6495
|
-
var
|
|
6583
|
+
var _h = React.useState(visible), _visible = _h[0], setVisible = _h[1];
|
|
6584
|
+
var _j = React.useState(false), staticBackdrop = _j[0], setStaticBackdrop = _j[1];
|
|
6496
6585
|
React.useEffect(function () {
|
|
6497
6586
|
setVisible(visible);
|
|
6498
6587
|
}, [visible]);
|
|
@@ -6500,6 +6589,14 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6500
6589
|
visible: _visible,
|
|
6501
6590
|
setVisible: setVisible,
|
|
6502
6591
|
};
|
|
6592
|
+
React.useEffect(function () {
|
|
6593
|
+
modalRef.current && modalRef.current.addEventListener('click', handleClickOutside);
|
|
6594
|
+
modalRef.current && modalRef.current.addEventListener('keyup', handleKeyDown);
|
|
6595
|
+
return function () {
|
|
6596
|
+
modalRef.current && modalRef.current.removeEventListener('click', handleClickOutside);
|
|
6597
|
+
modalRef.current && modalRef.current.removeEventListener('keyup', handleKeyDown);
|
|
6598
|
+
};
|
|
6599
|
+
}, [_visible]);
|
|
6503
6600
|
var handleDismiss = function () {
|
|
6504
6601
|
if (backdrop === 'static') {
|
|
6505
6602
|
return setStaticBackdrop(true);
|
|
@@ -6537,6 +6634,12 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6537
6634
|
}
|
|
6538
6635
|
return function () { return document.body.classList.remove('modal-open'); };
|
|
6539
6636
|
}, [_visible]);
|
|
6637
|
+
var handleClickOutside = function (event) {
|
|
6638
|
+
if (modalContentRef.current &&
|
|
6639
|
+
!modalContentRef.current.contains(event.target)) {
|
|
6640
|
+
handleDismiss();
|
|
6641
|
+
}
|
|
6642
|
+
};
|
|
6540
6643
|
var handleKeyDown = React.useCallback(function (event) {
|
|
6541
6644
|
if (event.key === 'Escape' && keyboard) {
|
|
6542
6645
|
return handleDismiss();
|
|
@@ -6545,17 +6648,16 @@ var CModal = React.forwardRef(function (_a, ref) {
|
|
|
6545
6648
|
var modal = function (ref, transitionClass) {
|
|
6546
6649
|
return (React__default["default"].createElement(CModalContext.Provider, { value: contextValues },
|
|
6547
6650
|
React__default["default"].createElement("div", { className: classNames$1(_className, transitionClass), tabIndex: -1, role: "dialog", ref: ref },
|
|
6548
|
-
React__default["default"].createElement(CModalDialog, { alignment: alignment, fullscreen: fullscreen, scrollable: scrollable, size: size
|
|
6549
|
-
React__default["default"].createElement(CModalContent,
|
|
6651
|
+
React__default["default"].createElement(CModalDialog, { alignment: alignment, fullscreen: fullscreen, scrollable: scrollable, size: size },
|
|
6652
|
+
React__default["default"].createElement(CModalContent, { ref: modalContentRef }, children)))));
|
|
6550
6653
|
};
|
|
6551
6654
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6552
|
-
React__default["default"].createElement(
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
})),
|
|
6655
|
+
React__default["default"].createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onClose, unmountOnExit: unmountOnClose, timeout: !transition ? 0 : duration }, function (state) {
|
|
6656
|
+
var transitionClass = getTransitionClass(state);
|
|
6657
|
+
return typeof window !== 'undefined' && portal
|
|
6658
|
+
? ReactDOM.createPortal(modal(forkedRef, transitionClass), document.body)
|
|
6659
|
+
: modal(forkedRef, transitionClass);
|
|
6660
|
+
}),
|
|
6559
6661
|
typeof window !== 'undefined' && portal
|
|
6560
6662
|
? backdrop && ReactDOM.createPortal(React__default["default"].createElement(CBackdrop, { visible: _visible }), document.body)
|
|
6561
6663
|
: backdrop && React__default["default"].createElement(CBackdrop, { visible: _visible })));
|
|
@@ -6578,6 +6680,7 @@ CModal.propTypes = {
|
|
|
6578
6680
|
scrollable: PropTypes$1.bool,
|
|
6579
6681
|
size: PropTypes$1.oneOf(['sm', 'lg', 'xl']),
|
|
6580
6682
|
transition: PropTypes$1.bool,
|
|
6683
|
+
unmountOnClose: PropTypes$1.bool,
|
|
6581
6684
|
visible: PropTypes$1.bool,
|
|
6582
6685
|
};
|
|
6583
6686
|
CModal.displayName = 'CModal';
|
|
@@ -7361,12 +7464,12 @@ var CPopover = function (_a) {
|
|
|
7361
7464
|
};
|
|
7362
7465
|
CPopover.propTypes = {
|
|
7363
7466
|
children: PropTypes$1.any,
|
|
7364
|
-
content: PropTypes$1.node,
|
|
7467
|
+
content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
|
|
7365
7468
|
placement: PropTypes$1.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
7366
7469
|
offset: PropTypes$1.any,
|
|
7367
7470
|
onHide: PropTypes$1.func,
|
|
7368
7471
|
onShow: PropTypes$1.func,
|
|
7369
|
-
title: PropTypes$1.string,
|
|
7472
|
+
title: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
|
|
7370
7473
|
trigger: triggerPropType,
|
|
7371
7474
|
visible: PropTypes$1.bool,
|
|
7372
7475
|
};
|
|
@@ -7673,6 +7776,14 @@ CSidebarHeader.propTypes = {
|
|
|
7673
7776
|
};
|
|
7674
7777
|
CSidebarHeader.displayName = 'CSidebarHeader';
|
|
7675
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
|
+
|
|
7676
7787
|
var CElementCover = React.forwardRef(function (_a, ref) {
|
|
7677
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"]);
|
|
7678
7789
|
var elementCoverRef = React.useRef(null);
|
|
@@ -9096,7 +9207,7 @@ var CIcon = React.forwardRef(function (_a, ref) {
|
|
|
9096
9207
|
var iconName = React.useMemo(function () {
|
|
9097
9208
|
return _icon && typeof _icon === 'string' && _icon.includes('-') ? toCamelCase(_icon) : _icon;
|
|
9098
9209
|
}, [change]);
|
|
9099
|
-
var titleCode = title ? "<title>"
|
|
9210
|
+
var titleCode = title ? "<title>".concat(title, "</title>") : '';
|
|
9100
9211
|
var code = React.useMemo(function () {
|
|
9101
9212
|
if (Array.isArray(_icon)) {
|
|
9102
9213
|
return _icon;
|
|
@@ -9112,13 +9223,13 @@ var CIcon = React.forwardRef(function (_a, ref) {
|
|
|
9112
9223
|
return Array.isArray(code) && code.length > 1 ? code[0] : '64 64';
|
|
9113
9224
|
})();
|
|
9114
9225
|
var viewBox = (function () {
|
|
9115
|
-
return rest['viewBox'] || "0 0 "
|
|
9226
|
+
return rest['viewBox'] || "0 0 ".concat(scale);
|
|
9116
9227
|
})();
|
|
9117
9228
|
// render
|
|
9118
9229
|
var _className = customClassName
|
|
9119
9230
|
? classNames(customClassName)
|
|
9120
9231
|
: classNames('icon', (_b = {},
|
|
9121
|
-
_b["icon-"
|
|
9232
|
+
_b["icon-".concat(size)] = size,
|
|
9122
9233
|
_b["icon-custom-size"] = height || width,
|
|
9123
9234
|
_b), className);
|
|
9124
9235
|
return use ? (React__default["default"].createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", className: _className }, (height && { height: height }), (width && { width: width }), { role: "img" }, rest, { ref: ref }),
|
|
@@ -9153,10 +9264,7 @@ CIcon.propTypes = {
|
|
|
9153
9264
|
CIcon.displayName = 'CIcon';
|
|
9154
9265
|
|
|
9155
9266
|
var CSmartTableCleaner = React.forwardRef(function (_a, ref) {
|
|
9156
|
-
var _b = _a.content, content = _b === void 0 ?
|
|
9157
|
-
'512 512',
|
|
9158
|
-
'<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>',
|
|
9159
|
-
] })) : _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"]);
|
|
9160
9268
|
return (React__default["default"].createElement("button", __assign$1({ type: "button", className: "btn btn-transparent" }, (!isFiltered && {
|
|
9161
9269
|
disabled: true,
|
|
9162
9270
|
tabIndex: -1,
|
|
@@ -9317,7 +9425,7 @@ var CSmartTableHead = React.forwardRef(function (_a, ref) {
|
|
|
9317
9425
|
CSmartTableHead.propTypes = {
|
|
9318
9426
|
columnFilter: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.object]),
|
|
9319
9427
|
columnFilterState: PropTypes$1.object,
|
|
9320
|
-
columnSorter: PropTypes$1.bool,
|
|
9428
|
+
columnSorter: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.object]),
|
|
9321
9429
|
component: PropTypes$1.elementType,
|
|
9322
9430
|
children: PropTypes$1.node,
|
|
9323
9431
|
columns: PropTypes$1.arrayOf(PropTypes$1.oneOfType([PropTypes$1.any, PropTypes$1.string])).isRequired,
|
|
@@ -9353,46 +9461,34 @@ CSmartTableItemsPerPageSelector.displayName = 'CSmartTableItemsPerPageSelector';
|
|
|
9353
9461
|
|
|
9354
9462
|
var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
9355
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
|
|
9356
|
-
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: [
|
|
9357
|
-
'512 512',
|
|
9358
|
-
'<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>',
|
|
9359
|
-
], key: "csv" })) : _h, _j = _a.sortingIconAscending, sortingIconAscending = _j === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
|
|
9360
|
-
'512 512',
|
|
9361
|
-
'<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>',
|
|
9362
|
-
], key: "cat" })) : _j, _k = _a.sortingIconDescending, sortingIconDescending = _k === void 0 ? (React__default["default"].createElement(CIcon, { width: 18, icon: [
|
|
9363
|
-
'512 512',
|
|
9364
|
-
'<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>',
|
|
9365
|
-
], 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
|
|
9366
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"]);
|
|
9367
9466
|
// instance data
|
|
9368
|
-
var compData = React.useRef({ firstRun: true, columnFiltered: 0, changeItems: 0 }).current;
|
|
9369
|
-
var previousSorterValue = React.useRef();
|
|
9370
|
-
var previousItemsValue = React.useRef();
|
|
9371
9467
|
var _o = React.useState(activePage), _activePage = _o[0], setActivePage = _o[1];
|
|
9372
9468
|
var _p = React.useState([]), _items = _p[0], setItems = _p[1];
|
|
9373
9469
|
var _q = React.useState(itemsPerPage), _itemsPerPage = _q[0], setItemsPerPage = _q[1];
|
|
9374
|
-
var _r = React.useState(
|
|
9470
|
+
var _r = React.useState({}), columnFilterState = _r[0], setColumnFilterState = _r[1];
|
|
9375
9471
|
var _s = React.useState(), selectedAll = _s[0], setSelectedAll = _s[1];
|
|
9376
|
-
var _t = React.useState(
|
|
9472
|
+
var _t = React.useState({}), sorterState = _t[0], setSorterState = _t[1];
|
|
9377
9473
|
var _u = React.useState(tableFilterValue ? tableFilterValue : ''), tableFilterState = _u[0], setTableFilterState = _u[1];
|
|
9474
|
+
// watch
|
|
9378
9475
|
React.useMemo(function () {
|
|
9379
|
-
if (
|
|
9380
|
-
|
|
9381
|
-
setSorterState(__assign$1({}, sorterValue));
|
|
9476
|
+
if (items && items.length < _itemsPerPage * _activePage - _itemsPerPage) {
|
|
9477
|
+
setActivePage(1);
|
|
9382
9478
|
}
|
|
9383
|
-
|
|
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)]);
|
|
9384
9485
|
React.useMemo(function () {
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
setItems(items === null || items === void 0 ? void 0 : items.map(function (item, index) {
|
|
9392
|
-
return __assign$1(__assign$1({}, item), { _id: index });
|
|
9393
|
-
}));
|
|
9394
|
-
}
|
|
9395
|
-
}, [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]);
|
|
9396
9492
|
// functions
|
|
9397
9493
|
var isSortable = function (i) {
|
|
9398
9494
|
var isDataColumn = itemsDataColumns.includes(rawColumnNames[i]);
|
|
@@ -9474,15 +9570,7 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
|
9474
9570
|
: genCols; //! || el
|
|
9475
9571
|
var itemsDataColumns = rawColumnNames.filter(function (name) { return genCols.includes(name); });
|
|
9476
9572
|
// variables
|
|
9477
|
-
React.useMemo(function () {
|
|
9478
|
-
compData.columnFiltered++;
|
|
9479
|
-
}, [
|
|
9480
|
-
JSON.stringify(columnFilter),
|
|
9481
|
-
JSON.stringify(columnFilterState),
|
|
9482
|
-
itemsDataColumns.join(''),
|
|
9483
|
-
compData.changeItems,
|
|
9484
|
-
]);
|
|
9485
|
-
var columnFiltered = React.useMemo(function () {
|
|
9573
|
+
var filteredColumns = React.useMemo(function () {
|
|
9486
9574
|
var items = _items;
|
|
9487
9575
|
if (columnFilter && typeof columnFilter === 'object' && columnFilter.external) {
|
|
9488
9576
|
return items;
|
|
@@ -9497,9 +9585,9 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
|
9497
9585
|
}
|
|
9498
9586
|
});
|
|
9499
9587
|
return items;
|
|
9500
|
-
}, [
|
|
9501
|
-
var
|
|
9502
|
-
var items =
|
|
9588
|
+
}, [JSON.stringify(columnFilterState), JSON.stringify(_items)]);
|
|
9589
|
+
var filteredTable = React.useMemo(function () {
|
|
9590
|
+
var items = filteredColumns;
|
|
9503
9591
|
if (!tableFilterState ||
|
|
9504
9592
|
(tableFilter && typeof tableFilter === 'object' && tableFilter.external)) {
|
|
9505
9593
|
return items;
|
|
@@ -9510,23 +9598,16 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
|
9510
9598
|
return !!itemsDataColumns.find(function (key) { return valueContainFilter(item[key]); });
|
|
9511
9599
|
});
|
|
9512
9600
|
return items;
|
|
9513
|
-
}, [
|
|
9514
|
-
compData.columnFiltered,
|
|
9515
|
-
tableFilterState,
|
|
9516
|
-
JSON.stringify(tableFilter),
|
|
9517
|
-
JSON.stringify(columnFiltered),
|
|
9518
|
-
]);
|
|
9601
|
+
}, [tableFilterState, JSON.stringify(tableFilterValue), JSON.stringify(filteredColumns)]);
|
|
9519
9602
|
var sortedItems = React.useMemo(function () {
|
|
9520
9603
|
var col = sorterState === null || sorterState === void 0 ? void 0 : sorterState.column;
|
|
9521
9604
|
if (!col ||
|
|
9522
9605
|
!itemsDataColumns.includes(col) ||
|
|
9523
9606
|
(columnSorter && typeof columnSorter === 'object' && columnSorter.external)) {
|
|
9524
|
-
return
|
|
9607
|
+
return filteredTable;
|
|
9525
9608
|
}
|
|
9526
|
-
//if values in column are to be sorted by numeric value they all have to be type number
|
|
9527
|
-
// const flip = sorterState.asc ? 1 : -1
|
|
9528
9609
|
var flip = sorterState.state === 'asc' ? 1 : sorterState.state === 'desc' ? -1 : 0;
|
|
9529
|
-
var sorted =
|
|
9610
|
+
var sorted = filteredTable.slice().sort(function (item, item2) {
|
|
9530
9611
|
var value = item[col];
|
|
9531
9612
|
var value2 = item2[col];
|
|
9532
9613
|
var a = typeof value === 'number' ? value : String(value).toLowerCase();
|
|
@@ -9534,7 +9615,13 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
|
9534
9615
|
return a > b ? 1 * flip : b > a ? -1 * flip : 0;
|
|
9535
9616
|
});
|
|
9536
9617
|
return sorted;
|
|
9537
|
-
}, [
|
|
9618
|
+
}, [
|
|
9619
|
+
JSON.stringify(filteredTable),
|
|
9620
|
+
JSON.stringify(sorterState),
|
|
9621
|
+
JSON.stringify(columnSorter),
|
|
9622
|
+
JSON.stringify(filteredColumns),
|
|
9623
|
+
JSON.stringify(_items),
|
|
9624
|
+
]);
|
|
9538
9625
|
var numberOfPages = _itemsPerPage ? Math.ceil(sortedItems.length / _itemsPerPage) : 1;
|
|
9539
9626
|
var firstItemOnActivePageIndex = _activePage ? (_activePage - 1) * _itemsPerPage : 0;
|
|
9540
9627
|
var itemsOnActivePage = sortedItems.slice(firstItemOnActivePageIndex, firstItemOnActivePageIndex + _itemsPerPage);
|
|
@@ -9558,16 +9645,8 @@ var CSmartTable = React.forwardRef(function (_a, ref) {
|
|
|
9558
9645
|
onTableFilterChange && onTableFilterChange(tableFilterState);
|
|
9559
9646
|
}, [tableFilterState]);
|
|
9560
9647
|
React.useEffect(function () {
|
|
9561
|
-
|
|
9648
|
+
onFilteredItemsChange && onFilteredItemsChange(sortedItems);
|
|
9562
9649
|
}, [JSON.stringify(sortedItems)]);
|
|
9563
|
-
// watch
|
|
9564
|
-
React.useMemo(function () { return setItemsPerPage(itemsPerPage); }, [itemsPerPage]);
|
|
9565
|
-
React.useMemo(function () {
|
|
9566
|
-
return JSON.stringify(previousSorterValue.current) !== JSON.stringify(sorterValue) &&
|
|
9567
|
-
setSorterState(__assign$1({}, sorterValue));
|
|
9568
|
-
}, [sorterValue]);
|
|
9569
|
-
React.useMemo(function () { return setColumnFilterState(__assign$1({}, columnFilterValue)); }, [columnFilterValue]);
|
|
9570
|
-
compData.firstRun = false;
|
|
9571
9650
|
var handleRowChecked = function (id, value) {
|
|
9572
9651
|
var newArr = __spreadArray([], _items, true);
|
|
9573
9652
|
newArr[id]._selected = value;
|
|
@@ -9909,7 +9988,7 @@ var CTooltip = function (_a) {
|
|
|
9909
9988
|
};
|
|
9910
9989
|
CTooltip.propTypes = {
|
|
9911
9990
|
children: PropTypes$1.any,
|
|
9912
|
-
content: PropTypes$1.node,
|
|
9991
|
+
content: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.node]),
|
|
9913
9992
|
placement: PropTypes$1.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
9914
9993
|
onHide: PropTypes$1.func,
|
|
9915
9994
|
onShow: PropTypes$1.func,
|
|
@@ -10092,6 +10171,7 @@ exports.CDropdownItem = CDropdownItem;
|
|
|
10092
10171
|
exports.CDropdownItemPlain = CDropdownItemPlain;
|
|
10093
10172
|
exports.CDropdownMenu = CDropdownMenu;
|
|
10094
10173
|
exports.CDropdownToggle = CDropdownToggle;
|
|
10174
|
+
exports.CDropdownToggleCustom = CDropdownToggleCustom;
|
|
10095
10175
|
exports.CFooter = CFooter;
|
|
10096
10176
|
exports.CForm = CForm;
|
|
10097
10177
|
exports.CFormCheck = CFormCheck;
|