@unbxd-ui/unbxd-react-components 0.2.105 → 0.2.107-beta.2
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/.babelrc +4 -0
- package/.eslintrc.js +38 -0
- package/CONTRIBUTE.md +105 -0
- package/components/Accordian/Accordian.js +45 -13
- package/components/Accordian/Accordian.stories.js +25 -6
- package/components/Accordian/index.js +3 -0
- package/components/Button/Button.js +26 -9
- package/components/Button/Button.stories.js +14 -1
- package/components/Button/DropdownButton.js +31 -9
- package/components/Button/DropdownButton.stories.js +23 -6
- package/components/Button/index.js +8 -1
- package/components/DataLoader/DataLoader.js +40 -10
- package/components/DataLoader/DataLoader.stories.js +30 -5
- package/components/DataLoader/index.js +3 -0
- package/components/Form/Checkbox.js +42 -14
- package/components/Form/DragDropFileUploader.js +42 -12
- package/components/Form/Dropdown.js +181 -104
- package/components/Form/FileUploader.js +32 -10
- package/components/Form/Form.js +45 -15
- package/components/Form/FormElementWrapper.js +7 -2
- package/components/Form/Input.js +72 -27
- package/components/Form/RadioList.js +48 -17
- package/components/Form/RangeSlider.js +73 -37
- package/components/Form/ServerPaginatedDDList.js +130 -86
- package/components/Form/Textarea.js +43 -18
- package/components/Form/Toggle.js +48 -16
- package/components/Form/index.js +30 -18
- package/components/Form/stories/Checkbox.stories.js +12 -1
- package/components/Form/stories/DragDropFileUploader.stories.js +8 -0
- package/components/Form/stories/Dropdown.stories.js +24 -6
- package/components/Form/stories/FileUploader.stories.js +8 -0
- package/components/Form/stories/FormDefault.stories.js +21 -1
- package/components/Form/stories/RadioList.stories.js +12 -1
- package/components/Form/stories/RangeSlider.stories.js +15 -1
- package/components/Form/stories/TextInput.stories.js +19 -3
- package/components/Form/stories/Textarea.stories.js +12 -1
- package/components/Form/stories/Toggle.stories.js +7 -0
- package/components/Form/stories/form.stories.js +40 -3
- package/components/InlineModal/InlineModal.js +51 -14
- package/components/InlineModal/InlineModal.stories.js +14 -2
- package/components/InlineModal/index.js +6 -1
- package/components/List/List.js +24 -9
- package/components/List/index.js +3 -0
- package/components/List/list.stories.js +10 -0
- package/components/Modal/Modal.js +49 -17
- package/components/Modal/Modal.stories.js +15 -1
- package/components/Modal/index.js +3 -0
- package/components/NotificationComponent/NotificationComponent.js +34 -11
- package/components/NotificationComponent/NotificationComponent.stories.js +6 -0
- package/components/NotificationComponent/index.js +3 -0
- package/components/ProgressBar/ProgressBar.js +11 -2
- package/components/ProgressBar/ProgressBar.stories.js +6 -0
- package/components/ProgressBar/index.js +3 -0
- package/components/Table/BaseTable.js +134 -69
- package/components/Table/PaginationComponent.js +23 -11
- package/components/Table/Table.js +149 -68
- package/components/Table/Table.stories.js +67 -22
- package/components/Table/index.js +4 -0
- package/components/TabsComponent/TabsComponent.js +57 -20
- package/components/TabsComponent/TabsComponent.stories.js +16 -0
- package/components/TabsComponent/index.js +3 -0
- package/components/Tooltip/Tooltip.js +47 -25
- package/components/Tooltip/Tooltip.stories.js +6 -0
- package/components/Tooltip/index.js +3 -0
- package/components/core.css +1 -3
- package/components/index.js +17 -1
- package/components/theme.css +0 -2
- package/lib/Readme.md +82 -0
- package/lib/components/Accordian/Accordian.js +117 -0
- package/lib/components/Accordian/Accordian.stories.js +137 -0
- package/lib/components/Accordian/index.js +10 -0
- package/lib/components/Button/Button.js +84 -0
- package/lib/components/Button/Button.stories.js +89 -0
- package/lib/components/Button/DropdownButton.js +77 -0
- package/lib/components/Button/DropdownButton.stories.js +51 -0
- package/lib/components/Button/index.js +32 -0
- package/lib/components/DataLoader/DataLoader.js +88 -0
- package/lib/components/DataLoader/DataLoader.stories.js +77 -0
- package/lib/components/DataLoader/index.js +10 -0
- package/lib/components/Form/Checkbox.js +93 -0
- package/lib/components/Form/DragDropFileUploader.js +85 -0
- package/lib/components/Form/Dropdown.js +478 -0
- package/lib/components/Form/FileUploader.js +81 -0
- package/lib/components/Form/Form.js +106 -0
- package/lib/components/Form/FormElementWrapper.js +27 -0
- package/lib/components/Form/Input.js +140 -0
- package/lib/components/Form/RadioList.js +111 -0
- package/lib/components/Form/RangeSlider.js +142 -0
- package/lib/components/Form/ServerPaginatedDDList.js +267 -0
- package/lib/components/Form/Textarea.js +95 -0
- package/lib/components/Form/Toggle.js +117 -0
- package/lib/components/Form/index.js +73 -0
- package/lib/components/Form/stories/Checkbox.stories.js +54 -0
- package/lib/components/Form/stories/DragDropFileUploader.stories.js +27 -0
- package/lib/components/Form/stories/Dropdown.stories.js +114 -0
- package/lib/components/Form/stories/FileUploader.stories.js +31 -0
- package/lib/components/Form/stories/FormDefault.stories.js +117 -0
- package/lib/components/Form/stories/RadioList.stories.js +55 -0
- package/lib/components/Form/stories/RangeSlider.stories.js +82 -0
- package/lib/components/Form/stories/TextInput.stories.js +79 -0
- package/lib/components/Form/stories/Textarea.stories.js +48 -0
- package/lib/components/Form/stories/Toggle.stories.js +25 -0
- package/lib/components/Form/stories/form.stories.js +240 -0
- package/lib/components/InlineModal/InlineModal.js +146 -0
- package/lib/components/InlineModal/InlineModal.stories.js +61 -0
- package/lib/components/InlineModal/index.js +24 -0
- package/lib/components/List/List.js +76 -0
- package/lib/components/List/index.js +10 -0
- package/lib/components/List/list.stories.js +38 -0
- package/lib/components/Modal/Modal.js +117 -0
- package/lib/components/Modal/Modal.stories.js +55 -0
- package/lib/components/Modal/index.js +10 -0
- package/lib/components/NotificationComponent/NotificationComponent.js +76 -0
- package/lib/components/NotificationComponent/NotificationComponent.stories.js +29 -0
- package/lib/components/NotificationComponent/index.js +10 -0
- package/lib/components/ProgressBar/ProgressBar.js +49 -0
- package/lib/components/ProgressBar/ProgressBar.stories.js +21 -0
- package/lib/components/ProgressBar/index.js +10 -0
- package/lib/components/Table/BaseTable.js +352 -0
- package/lib/components/Table/PaginationComponent.js +87 -0
- package/lib/components/Table/Table.js +333 -0
- package/lib/components/Table/Table.stories.js +204 -0
- package/lib/components/Table/index.js +17 -0
- package/lib/components/TabsComponent/TabsComponent.js +134 -0
- package/lib/components/TabsComponent/TabsComponent.stories.js +65 -0
- package/lib/components/TabsComponent/index.js +10 -0
- package/lib/components/Tooltip/Tooltip.js +102 -0
- package/lib/components/Tooltip/Tooltip.stories.js +25 -0
- package/lib/components/Tooltip/index.js +10 -0
- package/lib/components/core.css +3 -0
- package/lib/components/core.scss +29 -0
- package/lib/components/index.js +159 -0
- package/lib/components/theme.css +3 -0
- package/lib/components/theme.scss +11 -0
- package/lib/package-lock.json +20607 -0
- package/lib/package.json +94 -0
- package/package.json +1 -1
- package/src/Intro.stories.mdx +119 -0
- package/src/components/Accordian/Accordian.js +89 -0
- package/src/components/Accordian/Accordian.stories.js +92 -0
- package/src/components/Accordian/accordianCore.css +1 -0
- package/src/components/Accordian/accordianCore.scss +8 -0
- package/src/components/Accordian/accordianTheme.css +1 -0
- package/src/components/Accordian/accordianTheme.scss +6 -0
- package/src/components/Accordian/index.js +3 -0
- package/src/components/Button/Button.js +67 -0
- package/src/components/Button/Button.stories.js +103 -0
- package/src/components/Button/DropdownButton.js +60 -0
- package/src/components/Button/DropdownButton.stories.js +38 -0
- package/src/components/Button/button.css +1 -0
- package/src/components/Button/buttonTheme.css +1 -0
- package/src/components/Button/buttonTheme.scss +45 -0
- package/src/components/Button/index.js +5 -0
- package/src/components/DataLoader/DataLoader.js +86 -0
- package/src/components/DataLoader/DataLoader.stories.js +72 -0
- package/src/components/DataLoader/index.js +3 -0
- package/src/components/Form/Checkbox.js +73 -0
- package/src/components/Form/DragDropFileUploader.js +67 -0
- package/src/components/Form/Dropdown.js +430 -0
- package/src/components/Form/FileUploader.js +64 -0
- package/src/components/Form/Form.js +83 -0
- package/src/components/Form/FormElementWrapper.js +22 -0
- package/src/components/Form/Input.js +121 -0
- package/src/components/Form/RadioList.js +86 -0
- package/src/components/Form/RangeSlider.js +100 -0
- package/src/components/Form/ServerPaginatedDDList.js +231 -0
- package/src/components/Form/Textarea.js +76 -0
- package/src/components/Form/Toggle.js +96 -0
- package/src/components/Form/form.css +1 -0
- package/src/components/Form/formCore.css +1 -0
- package/src/components/Form/formCore.scss +142 -0
- package/src/components/Form/formTheme.css +1 -0
- package/src/components/Form/formTheme.scss +27 -0
- package/src/components/Form/index.js +13 -0
- package/src/components/Form/stories/Checkbox.stories.js +41 -0
- package/src/components/Form/stories/DragDropFileUploader.stories.js +21 -0
- package/src/components/Form/stories/Dropdown.stories.js +124 -0
- package/src/components/Form/stories/FileUploader.stories.js +21 -0
- package/src/components/Form/stories/FormDefault.stories.js +87 -0
- package/src/components/Form/stories/RadioList.stories.js +48 -0
- package/src/components/Form/stories/RangeSlider.stories.js +84 -0
- package/src/components/Form/stories/TextInput.stories.js +77 -0
- package/src/components/Form/stories/Textarea.stories.js +43 -0
- package/src/components/Form/stories/Toggle.stories.js +14 -0
- package/src/components/Form/stories/form.stories.js +216 -0
- package/src/components/InlineModal/InlineModal.js +135 -0
- package/src/components/InlineModal/InlineModal.stories.js +54 -0
- package/src/components/InlineModal/index.js +4 -0
- package/src/components/InlineModal/inlineModal.css +1 -0
- package/src/components/InlineModal/inlineModalCore.css +1 -0
- package/src/components/InlineModal/inlineModalCore.scss +31 -0
- package/src/components/InlineModal/inlineModalTheme.css +1 -0
- package/src/components/InlineModal/inlineModalTheme.scss +16 -0
- package/src/components/List/List.js +72 -0
- package/src/components/List/index.js +3 -0
- package/src/components/List/list.css +1 -0
- package/src/components/List/list.stories.js +28 -0
- package/src/components/List/listCore.css +1 -0
- package/src/components/List/listCore.scss +6 -0
- package/src/components/List/listTheme.css +0 -0
- package/src/components/List/listTheme.scss +0 -0
- package/src/components/Modal/Modal.js +99 -0
- package/src/components/Modal/Modal.stories.js +54 -0
- package/src/components/Modal/index.js +3 -0
- package/src/components/Modal/modal.css +1 -0
- package/src/components/Modal/modalCore.css +1 -0
- package/src/components/Modal/modalCore.scss +34 -0
- package/src/components/Modal/modalTheme.css +0 -0
- package/src/components/Modal/modalTheme.scss +0 -0
- package/src/components/NotificationComponent/NotificationComponent.js +58 -0
- package/src/components/NotificationComponent/NotificationComponent.stories.js +28 -0
- package/src/components/NotificationComponent/index.js +3 -0
- package/src/components/NotificationComponent/notificationComponent.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.scss +30 -0
- package/src/components/ProgressBar/ProgressBar.js +45 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +14 -0
- package/src/components/ProgressBar/index.js +3 -0
- package/src/components/ProgressBar/progressBar.css +1 -0
- package/src/components/ProgressBar/progressBarCore.css +1 -0
- package/src/components/ProgressBar/progressBarCore.scss +14 -0
- package/src/components/ProgressBar/progressBarTheme.css +0 -0
- package/src/components/ProgressBar/progressBarTheme.scss +0 -0
- package/src/components/Table/BaseTable.js +306 -0
- package/src/components/Table/PaginationComponent.js +73 -0
- package/src/components/Table/Table.js +295 -0
- package/src/components/Table/Table.stories.js +198 -0
- package/src/components/Table/index.js +8 -0
- package/src/components/Table/table.css +1 -0
- package/src/components/Table/tableCore.css +1 -0
- package/src/components/Table/tableCore.scss +94 -0
- package/src/components/Table/tableTheme.css +1 -0
- package/src/components/Table/tableTheme.scss +34 -0
- package/src/components/TabsComponent/TabsComponent.js +99 -0
- package/src/components/TabsComponent/TabsComponent.stories.js +69 -0
- package/src/components/TabsComponent/index.js +3 -0
- package/src/components/TabsComponent/tabs.css +1 -0
- package/src/components/TabsComponent/tabsCore.css +1 -0
- package/src/components/TabsComponent/tabsCore.scss +59 -0
- package/src/components/TabsComponent/tabsTheme.css +0 -0
- package/src/components/TabsComponent/tabsTheme.scss +0 -0
- package/src/components/Tooltip/Tooltip.js +87 -0
- package/src/components/Tooltip/Tooltip.stories.js +16 -0
- package/src/components/Tooltip/index.js +3 -0
- package/src/components/Tooltip/tooltipCore.css +1 -0
- package/src/components/Tooltip/tooltipCore.scss +22 -0
- package/src/components/Tooltip/tooltipTheme.css +1 -0
- package/src/components/Tooltip/tooltipTheme.scss +21 -0
- package/src/components/core.css +1 -0
- package/src/components/core.scss +29 -0
- package/src/components/index.js +38 -0
- package/src/components/theme.css +1 -0
- package/src/components/theme.scss +11 -0
- package/src/core/Validators.js +34 -0
- package/src/core/customHooks.js +20 -0
- package/src/core/dataLoader.js +143 -0
- package/src/core/dataLoader.stories.js +123 -0
- package/src/core/index.js +3 -0
- package/src/core/utils.js +95 -0
- package/src/index.js +68 -0
- package/vscode-templates/NewStoryTemplate.stories.js +8 -0
- /package/{Readme.md → README.md} +0 -0
- /package/{components → lib/components}/Accordian/accordianCore.css +0 -0
- /package/{components → lib/components}/Accordian/accordianTheme.css +0 -0
- /package/{components → lib/components}/Button/buttonTheme.css +0 -0
- /package/{components → lib/components}/Form/formCore.css +0 -0
- /package/{components → lib/components}/Form/formTheme.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalCore.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalTheme.css +0 -0
- /package/{components → lib/components}/List/listCore.css +0 -0
- /package/{components → lib/components}/List/listTheme.css +0 -0
- /package/{components → lib/components}/Modal/modalCore.css +0 -0
- /package/{components → lib/components}/Modal/modalTheme.css +0 -0
- /package/{components → lib/components}/NotificationComponent/notificationTheme.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarCore.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarTheme.css +0 -0
- /package/{components → lib/components}/Table/tableCore.css +0 -0
- /package/{components → lib/components}/Table/tableTheme.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsCore.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsTheme.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipCore.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipTheme.css +0 -0
- /package/{core → lib/core}/Validators.js +0 -0
- /package/{core → lib/core}/customHooks.js +0 -0
- /package/{core → lib/core}/dataLoader.js +0 -0
- /package/{core → lib/core}/dataLoader.stories.js +0 -0
- /package/{core → lib/core}/index.js +0 -0
- /package/{core → lib/core}/utils.js +0 -0
- /package/{index.js → lib/index.js} +0 -0
|
@@ -1,43 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
11
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
12
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
13
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
14
22
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
+
|
|
15
24
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
|
|
17
|
-
function
|
|
25
|
+
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
27
|
+
|
|
28
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
29
|
+
|
|
18
30
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
19
32
|
var NotificationComponent = function NotificationComponent(props) {
|
|
20
33
|
var _useState = (0, _react.useState)(false),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
hideMessage = _useState2[0],
|
|
36
|
+
setHideMessage = _useState2[1];
|
|
37
|
+
|
|
24
38
|
var appearance = props.appearance,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
children = props.children,
|
|
40
|
+
messageId = props.messageId,
|
|
41
|
+
fadeOut = props.fadeOut,
|
|
42
|
+
fadeOutTime = props.fadeOutTime,
|
|
43
|
+
className = props.className;
|
|
30
44
|
var fadeOutMessage = typeof fadeOut !== "undefined" ? fadeOut : appearance === "success";
|
|
31
45
|
var timerID;
|
|
46
|
+
|
|
32
47
|
var clearMessage = function clearMessage() {
|
|
33
48
|
setHideMessage(true);
|
|
34
49
|
};
|
|
50
|
+
|
|
35
51
|
var setClearMessageTimeout = function setClearMessageTimeout() {
|
|
36
52
|
if (fadeOutMessage) {
|
|
37
53
|
timerID && clearTimeout(timerID);
|
|
38
54
|
timerID = setTimeout(clearMessage, fadeOutTime);
|
|
39
55
|
}
|
|
40
56
|
};
|
|
57
|
+
|
|
41
58
|
(0, _react.useEffect)(function () {
|
|
42
59
|
/* RUN ONCE */
|
|
43
60
|
setClearMessageTimeout();
|
|
@@ -47,6 +64,7 @@ var NotificationComponent = function NotificationComponent(props) {
|
|
|
47
64
|
setHideMessage(false);
|
|
48
65
|
setClearMessageTimeout();
|
|
49
66
|
}, [messageId]);
|
|
67
|
+
|
|
50
68
|
if (hideMessage) {
|
|
51
69
|
return null;
|
|
52
70
|
} else {
|
|
@@ -55,15 +73,20 @@ var NotificationComponent = function NotificationComponent(props) {
|
|
|
55
73
|
}, children);
|
|
56
74
|
}
|
|
57
75
|
};
|
|
76
|
+
|
|
58
77
|
NotificationComponent.propTypes = {
|
|
59
78
|
/** Pass any additional classNames to Notification component */
|
|
60
79
|
className: _propTypes["default"].string,
|
|
80
|
+
|
|
61
81
|
/* Unique ID to represent this particular message */
|
|
62
82
|
messageId: _propTypes["default"].number,
|
|
83
|
+
|
|
63
84
|
/* Appearance of the notification message */
|
|
64
85
|
appearance: _propTypes["default"].oneOf(["error", "warning", "success", "info"]),
|
|
86
|
+
|
|
65
87
|
/* Should the message fadeout after (fadeOutTime)ms or not. Default true for success messages only. */
|
|
66
88
|
fadeOut: _propTypes["default"].bool,
|
|
89
|
+
|
|
67
90
|
/* fadeout timer, in milliseconds */
|
|
68
91
|
fadeOutTime: _propTypes["default"].number
|
|
69
92
|
};
|
|
@@ -4,13 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _NotificationComponent = _interopRequireDefault(require("./NotificationComponent"));
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
10
14
|
var _default = {
|
|
11
15
|
title: "NotificationComponent"
|
|
12
16
|
};
|
|
13
17
|
exports["default"] = _default;
|
|
18
|
+
|
|
14
19
|
var SimpleUsage = function SimpleUsage() {
|
|
15
20
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
16
21
|
appearance: "success",
|
|
@@ -26,4 +31,5 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
26
31
|
messageId: 4
|
|
27
32
|
}, "The job is scheduled. You will get a notification once it is completed."));
|
|
28
33
|
};
|
|
34
|
+
|
|
29
35
|
exports.SimpleUsage = SimpleUsage;
|
|
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
|
|
7
8
|
var _NotificationComponent = _interopRequireDefault(require("./NotificationComponent"));
|
|
9
|
+
|
|
8
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
9
12
|
var _default = _NotificationComponent["default"];
|
|
10
13
|
exports["default"] = _default;
|
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
10
14
|
var ProgressBar = function ProgressBar(props) {
|
|
11
15
|
var progress = props.progress,
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
height = props.height,
|
|
17
|
+
className = props.className;
|
|
14
18
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
15
19
|
className: "RCB-progress-bar ".concat(className),
|
|
16
20
|
style: {
|
|
@@ -23,21 +27,26 @@ var ProgressBar = function ProgressBar(props) {
|
|
|
23
27
|
}
|
|
24
28
|
}));
|
|
25
29
|
};
|
|
30
|
+
|
|
26
31
|
ProgressBar.propTypes = {
|
|
27
32
|
/** Pass any additional classNames to ProgressBar component */
|
|
28
33
|
className: _propTypes["default"].string,
|
|
34
|
+
|
|
29
35
|
/** Progress value, must be a value between 1 to 100 */
|
|
30
36
|
progress: function progress(props, propName, componentName) {
|
|
31
37
|
if (typeof props[propName] === "undefined") {
|
|
32
38
|
return new Error("Prop `" + propName + "` is required");
|
|
33
39
|
}
|
|
40
|
+
|
|
34
41
|
if (typeof props[propName] !== "number") {
|
|
35
42
|
return new Error("Prop `" + propName + "` must be a number");
|
|
36
43
|
}
|
|
44
|
+
|
|
37
45
|
if (props[propName] < 0 || props[propName] > 100) {
|
|
38
46
|
return new Error("Invalid prop `" + propName + "` supplied to" + " `" + componentName + "`. Value must be between 0 to 100.");
|
|
39
47
|
}
|
|
40
48
|
},
|
|
49
|
+
|
|
41
50
|
/** Height of the progress bar. Values must be valid CSS height values like 40px or 20% etc. */
|
|
42
51
|
height: _propTypes["default"].string
|
|
43
52
|
};
|
|
@@ -4,13 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.SimpleUsage = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
|
|
11
|
+
|
|
9
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
10
14
|
var _default = {
|
|
11
15
|
title: "ProgressBar"
|
|
12
16
|
};
|
|
13
17
|
exports["default"] = _default;
|
|
18
|
+
|
|
14
19
|
var SimpleUsage = function SimpleUsage() {
|
|
15
20
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
16
21
|
className: "progress-container"
|
|
@@ -18,4 +23,5 @@ var SimpleUsage = function SimpleUsage() {
|
|
|
18
23
|
progress: 40
|
|
19
24
|
}));
|
|
20
25
|
};
|
|
26
|
+
|
|
21
27
|
exports.SimpleUsage = SimpleUsage;
|
|
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
|
|
7
8
|
var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
|
|
9
|
+
|
|
8
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
9
12
|
var _default = _ProgressBar["default"];
|
|
10
13
|
exports["default"] = _default;
|
|
@@ -1,59 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
10
14
|
var _utils = _interopRequireDefault(require("../../core/utils"));
|
|
15
|
+
|
|
11
16
|
var _Checkbox = _interopRequireDefault(require("../Form/Checkbox"));
|
|
17
|
+
|
|
12
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
13
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
14
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
15
24
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
25
|
+
|
|
16
26
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
|
|
17
28
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
+
|
|
18
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
31
|
+
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
24
38
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
25
40
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
26
42
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
|
|
28
|
-
function
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
29
48
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
-
|
|
49
|
+
|
|
50
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
51
|
+
|
|
31
52
|
var DEFAULT_CHECKBOX_CONFIG = {
|
|
32
53
|
enabled: false,
|
|
33
54
|
showInHeader: true
|
|
34
55
|
};
|
|
56
|
+
|
|
35
57
|
var DefaultNoDataComponent = function DefaultNoDataComponent() {
|
|
36
58
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
59
|
className: "RCB-no-data"
|
|
38
60
|
}, "No data found");
|
|
39
61
|
};
|
|
40
|
-
|
|
41
62
|
/* eslint-disable react/prop-types */
|
|
42
63
|
|
|
64
|
+
|
|
43
65
|
var getTDValue = function getTDValue(_ref) {
|
|
44
66
|
var columnValue = _ref.columnValue,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
_ref$rowData = _ref.rowData,
|
|
68
|
+
rowData = _ref$rowData === void 0 ? {} : _ref$rowData,
|
|
69
|
+
_ref$columnConfig = _ref.columnConfig,
|
|
70
|
+
columnConfig = _ref$columnConfig === void 0 ? {} : _ref$columnConfig,
|
|
71
|
+
_ref$tdProps = _ref.tdProps,
|
|
72
|
+
tdProps = _ref$tdProps === void 0 ? {} : _ref$tdProps;
|
|
51
73
|
var key = columnConfig.key,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
valueFormatter = columnConfig.valueFormatter,
|
|
75
|
+
ColumnComponent = columnConfig.ColumnComponent,
|
|
76
|
+
_columnConfig$compone = columnConfig.componentProps,
|
|
77
|
+
componentProps = _columnConfig$compone === void 0 ? {} : _columnConfig$compone;
|
|
56
78
|
var tdValue = columnValue;
|
|
79
|
+
|
|
57
80
|
if (typeof valueFormatter === "function") {
|
|
58
81
|
tdValue = valueFormatter({
|
|
59
82
|
value: columnValue,
|
|
@@ -64,38 +87,46 @@ var getTDValue = function getTDValue(_ref) {
|
|
|
64
87
|
record: rowData
|
|
65
88
|
}, componentProps));
|
|
66
89
|
}
|
|
90
|
+
|
|
67
91
|
return /*#__PURE__*/_react["default"].createElement("td", _extends({
|
|
68
92
|
key: key
|
|
69
93
|
}, tdProps), tdValue);
|
|
70
94
|
};
|
|
95
|
+
|
|
71
96
|
var ExpandableTR = function ExpandableTR(props) {
|
|
72
97
|
var rowIndex = props.rowIndex,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
rowData = props.rowData,
|
|
99
|
+
columnConfigs = props.columnConfigs,
|
|
100
|
+
isEven = props.isEven,
|
|
101
|
+
ExpandedRowComponent = props.ExpandedRowComponent,
|
|
102
|
+
showCheckbox = props.showCheckbox,
|
|
103
|
+
checkboxChangeCounter = props.checkboxChangeCounter,
|
|
104
|
+
checkboxValue = props.checkboxValue,
|
|
105
|
+
onSelectionChange = props.onSelectionChange;
|
|
106
|
+
|
|
81
107
|
var _useState = (0, _react.useState)(checkboxValue || false),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
108
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
109
|
+
selected = _useState2[0],
|
|
110
|
+
setSelected = _useState2[1];
|
|
111
|
+
|
|
85
112
|
var _useState3 = (0, _react.useState)(false),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
113
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
114
|
+
isExpanded = _useState4[0],
|
|
115
|
+
setIsExpanded = _useState4[1];
|
|
116
|
+
|
|
89
117
|
var onChange = function onChange(value) {
|
|
90
118
|
setSelected(value);
|
|
91
119
|
onSelectionChange(rowData, value);
|
|
92
120
|
};
|
|
121
|
+
|
|
93
122
|
(0, _react.useEffect)(function () {
|
|
94
123
|
setSelected(checkboxValue);
|
|
95
124
|
}, [checkboxChangeCounter, checkboxValue]);
|
|
125
|
+
|
|
96
126
|
var toggleExpanded = function toggleExpanded() {
|
|
97
127
|
setIsExpanded(!isExpanded);
|
|
98
128
|
};
|
|
129
|
+
|
|
99
130
|
var className = "RCB-tr RCB-parent-row " + (isEven ? "RCB-even-tr" : "RCB-odd-tr");
|
|
100
131
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("tr", {
|
|
101
132
|
className: className
|
|
@@ -134,28 +165,34 @@ var ExpandableTR = function ExpandableTR(props) {
|
|
|
134
165
|
parentRecord: rowData
|
|
135
166
|
}))));
|
|
136
167
|
};
|
|
168
|
+
|
|
137
169
|
ExpandableTR.propTypes = {
|
|
138
170
|
ExpandedRowComponent: _propTypes["default"].any.isRequired // TODO : check for a React Component
|
|
171
|
+
|
|
139
172
|
};
|
|
140
173
|
|
|
141
174
|
var TR = function TR(props) {
|
|
142
175
|
var rowIndex = props.rowIndex,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
176
|
+
rowData = props.rowData,
|
|
177
|
+
columnConfigs = props.columnConfigs,
|
|
178
|
+
isEven = props.isEven,
|
|
179
|
+
showCheckbox = props.showCheckbox,
|
|
180
|
+
checkboxChangeCounter = props.checkboxChangeCounter,
|
|
181
|
+
checkboxValue = props.checkboxValue,
|
|
182
|
+
onSelectionChange = props.onSelectionChange;
|
|
183
|
+
|
|
150
184
|
var _useState5 = (0, _react.useState)(checkboxValue || false),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
185
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
186
|
+
selected = _useState6[0],
|
|
187
|
+
setSelected = _useState6[1];
|
|
188
|
+
|
|
154
189
|
var className = "RCB-tr " + (isEven ? "RCB-even-tr" : "RCB-odd-tr");
|
|
190
|
+
|
|
155
191
|
var onChange = function onChange(value) {
|
|
156
192
|
setSelected(value);
|
|
157
193
|
onSelectionChange(rowData, value);
|
|
158
194
|
};
|
|
195
|
+
|
|
159
196
|
(0, _react.useEffect)(function () {
|
|
160
197
|
setSelected(checkboxValue);
|
|
161
198
|
}, [checkboxChangeCounter, checkboxValue]);
|
|
@@ -178,35 +215,43 @@ var TR = function TR(props) {
|
|
|
178
215
|
});
|
|
179
216
|
}));
|
|
180
217
|
};
|
|
218
|
+
|
|
181
219
|
var BaseTable = function BaseTable(props, ref) {
|
|
182
220
|
var className = props.className,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
221
|
+
records = props.records,
|
|
222
|
+
columnConfigs = props.columnConfigs,
|
|
223
|
+
idAttribute = props.idAttribute,
|
|
224
|
+
checkboxConfig = props.checkboxConfig,
|
|
225
|
+
isExpandableTable = props.isExpandableTable,
|
|
226
|
+
ExpandedRowComponent = props.ExpandedRowComponent,
|
|
227
|
+
noDataComponent = props.noDataComponent,
|
|
228
|
+
sortByConfig = props.sortByConfig,
|
|
229
|
+
resetPageNo = props.resetPageNo;
|
|
230
|
+
|
|
192
231
|
var _DEFAULT_CHECKBOX_CON = _objectSpread(_objectSpread({}, DEFAULT_CHECKBOX_CONFIG), checkboxConfig || {}),
|
|
193
|
-
|
|
194
|
-
|
|
232
|
+
showCheckbox = _DEFAULT_CHECKBOX_CON.enabled,
|
|
233
|
+
showInHeader = _DEFAULT_CHECKBOX_CON.showInHeader;
|
|
234
|
+
|
|
195
235
|
var sortBy = sortByConfig.sortBy,
|
|
196
|
-
|
|
236
|
+
sortOrder = sortByConfig.sortOrder;
|
|
237
|
+
|
|
197
238
|
var _useState7 = (0, _react.useState)(false),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
239
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
240
|
+
checkboxValue = _useState8[0],
|
|
241
|
+
setCheckboxValue = _useState8[1];
|
|
242
|
+
|
|
201
243
|
var _useState9 = (0, _react.useState)(0),
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
244
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
245
|
+
checkboxChangeCounter = _useState10[0],
|
|
246
|
+
setChangeCounter = _useState10[1];
|
|
247
|
+
|
|
205
248
|
var _useState11 = (0, _react.useState)([]),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
249
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
250
|
+
selected = _useState12[0],
|
|
251
|
+
setSelected = _useState12[1];
|
|
252
|
+
|
|
209
253
|
var RowComponent = isExpandableTable ? ExpandableTR : TR;
|
|
254
|
+
|
|
210
255
|
var onSelectionChange = function onSelectionChange(record, checked) {
|
|
211
256
|
if (checked) {
|
|
212
257
|
/* add to selected array */
|
|
@@ -219,26 +264,32 @@ var BaseTable = function BaseTable(props, ref) {
|
|
|
219
264
|
setSelected(newSelected);
|
|
220
265
|
}
|
|
221
266
|
};
|
|
267
|
+
|
|
222
268
|
var getSelectedRows = function getSelectedRows() {
|
|
223
269
|
return selected;
|
|
224
270
|
};
|
|
271
|
+
|
|
225
272
|
var updateCheckboxValue = function updateCheckboxValue(newValue) {
|
|
226
273
|
setCheckboxValue(newValue);
|
|
227
274
|
setChangeCounter(checkboxChangeCounter + 1);
|
|
228
275
|
};
|
|
276
|
+
|
|
229
277
|
var resetSelected = function resetSelected() {
|
|
230
278
|
updateCheckboxValue(false);
|
|
231
279
|
setSelected([]);
|
|
232
280
|
};
|
|
281
|
+
|
|
233
282
|
var toggleSelectAll = function toggleSelectAll() {
|
|
234
283
|
var checked = !checkboxValue;
|
|
235
284
|
updateCheckboxValue(checked);
|
|
285
|
+
|
|
236
286
|
if (checked) {
|
|
237
287
|
setSelected(records);
|
|
238
288
|
} else {
|
|
239
289
|
setSelected([]);
|
|
240
290
|
}
|
|
241
291
|
};
|
|
292
|
+
|
|
242
293
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
243
294
|
return {
|
|
244
295
|
getSelectedRows: getSelectedRows,
|
|
@@ -246,6 +297,7 @@ var BaseTable = function BaseTable(props, ref) {
|
|
|
246
297
|
resetPageNo: resetPageNo
|
|
247
298
|
};
|
|
248
299
|
});
|
|
300
|
+
|
|
249
301
|
if (records.length === 0) {
|
|
250
302
|
return noDataComponent;
|
|
251
303
|
} else {
|
|
@@ -264,27 +316,32 @@ var BaseTable = function BaseTable(props, ref) {
|
|
|
264
316
|
onChange: toggleSelectAll
|
|
265
317
|
})) : /*#__PURE__*/_react["default"].createElement("th", null)), columnConfigs.map(function (columnObj) {
|
|
266
318
|
var key = columnObj.key,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
319
|
+
label = columnObj.label,
|
|
320
|
+
sortable = columnObj.sortable,
|
|
321
|
+
headerClassName = columnObj.headerClassName;
|
|
270
322
|
var className = "RCB-th";
|
|
271
323
|
var thAttrs = {};
|
|
324
|
+
|
|
272
325
|
if (sortable) {
|
|
273
326
|
className += " RCB-th-sortable";
|
|
327
|
+
|
|
274
328
|
if (sortBy === key) {
|
|
275
329
|
className += " RCB-th-".concat(sortOrder.toLowerCase());
|
|
276
330
|
} else {
|
|
277
331
|
className += " RCB-th-sort";
|
|
278
332
|
}
|
|
333
|
+
|
|
279
334
|
thAttrs = {
|
|
280
335
|
onClick: function onClick() {
|
|
281
336
|
props.onSort(columnObj);
|
|
282
337
|
}
|
|
283
338
|
};
|
|
284
339
|
}
|
|
340
|
+
|
|
285
341
|
if (headerClassName) {
|
|
286
342
|
className += " ".concat(headerClassName);
|
|
287
343
|
}
|
|
344
|
+
|
|
288
345
|
return /*#__PURE__*/_react["default"].createElement("th", _extends({
|
|
289
346
|
className: className,
|
|
290
347
|
key: key
|
|
@@ -305,28 +362,33 @@ var BaseTable = function BaseTable(props, ref) {
|
|
|
305
362
|
})));
|
|
306
363
|
}
|
|
307
364
|
};
|
|
308
|
-
BaseTable = /*#__PURE__*/(0, _react.forwardRef)(BaseTable);
|
|
309
365
|
|
|
366
|
+
BaseTable = /*#__PURE__*/(0, _react.forwardRef)(BaseTable);
|
|
310
367
|
/* eslint-enable react/prop-types */
|
|
311
368
|
|
|
312
369
|
BaseTable.propTypes = {
|
|
313
370
|
/** Pass any additional classNames to Table component */
|
|
314
371
|
className: _propTypes["default"].string,
|
|
372
|
+
|
|
315
373
|
/** Array containing table row data */
|
|
316
374
|
records: function records(props, propName) {
|
|
317
375
|
if (props["paginationType"] == "CLIENT") {
|
|
318
376
|
if (!props[propName]) {
|
|
319
377
|
return new Error("Please provide the table records for paginationType 'CLIENT'!");
|
|
320
378
|
}
|
|
379
|
+
|
|
321
380
|
if (Object.prototype.toString.call(props[propName]) !== "[object Array]") {
|
|
322
381
|
return new Error("'records' must be an array");
|
|
323
382
|
}
|
|
324
383
|
}
|
|
325
384
|
},
|
|
385
|
+
|
|
326
386
|
/** Array containing the table columns config */
|
|
327
387
|
columnConfigs: _propTypes["default"].array.isRequired,
|
|
388
|
+
|
|
328
389
|
/** ID attribute key to use when rendering the dropdown items */
|
|
329
390
|
idAttribute: _propTypes["default"].string,
|
|
391
|
+
|
|
330
392
|
/* Config to display checkbox in the first column of the table
|
|
331
393
|
* {
|
|
332
394
|
enabled: false, // turn this on to display checkbox in first column of the table
|
|
@@ -334,10 +396,13 @@ BaseTable.propTypes = {
|
|
|
334
396
|
}
|
|
335
397
|
*/
|
|
336
398
|
checkboxConfig: _propTypes["default"].object,
|
|
399
|
+
|
|
337
400
|
/** set to "true" if table rows are expandable */
|
|
338
401
|
isExpandableTable: _propTypes["default"].bool,
|
|
402
|
+
|
|
339
403
|
/** Component to be rendered on expanding a row */
|
|
340
404
|
ExpandedRowComponent: _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Element), _propTypes["default"].func]),
|
|
405
|
+
|
|
341
406
|
/** Component to be rendered if the table has no data */
|
|
342
407
|
noDataComponent: _propTypes["default"].any
|
|
343
408
|
};
|