@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,75 +1,99 @@
|
|
|
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 _Form = require("./Form");
|
|
15
|
+
|
|
11
16
|
var _FormElementWrapper = _interopRequireDefault(require("./FormElementWrapper"));
|
|
12
|
-
|
|
17
|
+
|
|
18
|
+
var _excluded = ["label", "name", "min", "max", "className", "value", "defaultValue", "appearance", "onChange", "disabled", "showBubble", "inputStyle", "bubbleStyle"];
|
|
19
|
+
|
|
13
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
14
22
|
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); }
|
|
23
|
+
|
|
15
24
|
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; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
function
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
22
34
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
23
36
|
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."); }
|
|
37
|
+
|
|
24
38
|
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); }
|
|
25
|
-
|
|
26
|
-
function
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
27
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
28
46
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
47
|
+
|
|
29
48
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
49
|
+
|
|
30
50
|
var RangeSlider = function RangeSlider(props) {
|
|
31
51
|
var label = props.label,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
name = props.name,
|
|
53
|
+
min = props.min,
|
|
54
|
+
max = props.max,
|
|
55
|
+
className = props.className,
|
|
56
|
+
value = props.value,
|
|
57
|
+
defaultValue = props.defaultValue,
|
|
58
|
+
appearance = props.appearance,
|
|
59
|
+
onChange = props.onChange,
|
|
60
|
+
disabled = props.disabled,
|
|
61
|
+
showBubble = props.showBubble,
|
|
62
|
+
_props$inputStyle = props.inputStyle,
|
|
63
|
+
inputStyle = _props$inputStyle === void 0 ? {} : _props$inputStyle,
|
|
64
|
+
_props$bubbleStyle = props.bubbleStyle,
|
|
65
|
+
bubbleStyle = _props$bubbleStyle === void 0 ? {} : _props$bubbleStyle,
|
|
66
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
67
|
+
|
|
48
68
|
var _useContext = (0, _react.useContext)(_Form.FormContext),
|
|
49
|
-
|
|
69
|
+
onValueChange = _useContext.onValueChange;
|
|
70
|
+
|
|
50
71
|
var _useState = (0, _react.useState)(value || defaultValue),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
val = _useState2[0],
|
|
74
|
+
setVal = _useState2[1];
|
|
75
|
+
|
|
54
76
|
var postFormValueChange = function postFormValueChange(value) {
|
|
55
77
|
typeof onValueChange === "function" && onValueChange(name, value);
|
|
56
78
|
};
|
|
57
|
-
var onInputChange = function onInputChange(event) {
|
|
58
|
-
var value = event.target.value;
|
|
59
79
|
|
|
60
|
-
|
|
80
|
+
var onInputChange = function onInputChange(event) {
|
|
81
|
+
var value = event.target.value; // TODO : do validations
|
|
61
82
|
|
|
62
83
|
if (typeof onChange === "function") {
|
|
63
84
|
onChange(value);
|
|
64
85
|
}
|
|
86
|
+
|
|
65
87
|
postFormValueChange(value);
|
|
66
88
|
setVal(value);
|
|
67
89
|
};
|
|
90
|
+
|
|
68
91
|
(0, _react.useEffect)(function () {
|
|
69
92
|
/* set the initial form element value in the form context */
|
|
70
93
|
var postValue = typeof onChange === "function" ? value : defaultValue;
|
|
71
94
|
postFormValueChange(postValue);
|
|
72
95
|
}, [value, defaultValue]);
|
|
96
|
+
|
|
73
97
|
var inputProps = _objectSpread(_objectSpread({
|
|
74
98
|
type: "range",
|
|
75
99
|
min: min,
|
|
@@ -79,15 +103,17 @@ var RangeSlider = function RangeSlider(props) {
|
|
|
79
103
|
id: name,
|
|
80
104
|
defaultValue: defaultValue,
|
|
81
105
|
disabled: disabled,
|
|
82
|
-
className: "RCB-form-el RCB-input-range ".concat(
|
|
106
|
+
className: "RCB-form-el RCB-input-range ".concat(className),
|
|
83
107
|
onChange: onInputChange
|
|
84
108
|
}, restProps), {}, {
|
|
85
109
|
showBubble: showBubble
|
|
86
110
|
});
|
|
111
|
+
|
|
87
112
|
if (typeof onChange === "function") {
|
|
88
113
|
/* make it a controlled component if onChange function is given */
|
|
89
114
|
inputProps.value = value;
|
|
90
115
|
}
|
|
116
|
+
|
|
91
117
|
return /*#__PURE__*/_react["default"].createElement(_FormElementWrapper["default"], {
|
|
92
118
|
className: className,
|
|
93
119
|
appearance: appearance
|
|
@@ -104,32 +130,42 @@ var RangeSlider = function RangeSlider(props) {
|
|
|
104
130
|
disabled: disabled
|
|
105
131
|
}))));
|
|
106
132
|
};
|
|
133
|
+
|
|
107
134
|
RangeSlider.propTypes = {
|
|
108
|
-
/** Pass any additional classNames to Input component container */
|
|
109
|
-
className: _propTypes["default"].string,
|
|
110
135
|
/** Pass any additional classNames to Input component */
|
|
111
|
-
|
|
136
|
+
className: _propTypes["default"].string,
|
|
137
|
+
|
|
112
138
|
/** Minimum value for range slider */
|
|
113
139
|
min: _propTypes["default"].string.isRequired,
|
|
140
|
+
|
|
114
141
|
/** Maximum value for range slider */
|
|
115
142
|
max: _propTypes["default"].string.isRequired,
|
|
143
|
+
|
|
116
144
|
/** Label for the input element */
|
|
117
145
|
label: _propTypes["default"].string,
|
|
146
|
+
|
|
118
147
|
/** Unique ID for the input element */
|
|
119
148
|
name: _propTypes["default"].string.isRequired,
|
|
149
|
+
|
|
120
150
|
/** Will be used only with onChange function, or else ignored */
|
|
121
151
|
value: _propTypes["default"].any,
|
|
122
152
|
defaultValue: _propTypes["default"].any,
|
|
153
|
+
|
|
123
154
|
/** Define the appearance of the form element. Accepted values are either "inline" or "block" */
|
|
124
155
|
appearance: _propTypes["default"].oneOf(["inline", "block"]),
|
|
156
|
+
|
|
125
157
|
/** Becomes a controlled component if onChange function is given */
|
|
126
158
|
onChange: _propTypes["default"].func,
|
|
159
|
+
|
|
127
160
|
/** Custom Style changes of slider track */
|
|
128
161
|
inputStyle: _propTypes["default"].object,
|
|
162
|
+
|
|
129
163
|
/** Custom Style changes of value bubble */
|
|
130
164
|
bubbleStyle: _propTypes["default"].object,
|
|
165
|
+
|
|
131
166
|
/** Show bubble with values */
|
|
132
167
|
showBubble: _propTypes["default"].bool,
|
|
168
|
+
|
|
133
169
|
/** Indicates if the slider is disabled or enabled */
|
|
134
170
|
disabled: _propTypes["default"].bool
|
|
135
171
|
};
|
|
@@ -1,52 +1,74 @@
|
|
|
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"] = exports.DefaultDropdownItem = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
10
14
|
var _reactWindow = require("react-window");
|
|
15
|
+
|
|
11
16
|
var _reactWindowInfiniteLoader = _interopRequireDefault(require("react-window-infinite-loader"));
|
|
17
|
+
|
|
12
18
|
var _dataLoader = _interopRequireDefault(require("../../core/dataLoader"));
|
|
19
|
+
|
|
13
20
|
var _utils = _interopRequireDefault(require("../../core/utils"));
|
|
14
|
-
|
|
21
|
+
|
|
22
|
+
var _excluded = ["selectedItems", "selectItem", "idAttribute", "nameAttribute", "DropdownItem", "requestId", "requestParams", "responseFormatter", "pageNoKey", "perPageKey", "pageSize", "maxHeight", "searchAttribute", "searchQuery", "getUrlParams", "serverListClassName", "ddItemHeight", "minPageNo", "delay", "loadImmediately"];
|
|
23
|
+
|
|
15
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
16
26
|
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); }
|
|
27
|
+
|
|
17
28
|
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; }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
23
36
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
+
|
|
24
38
|
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."); }
|
|
39
|
+
|
|
25
40
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
41
|
+
|
|
26
42
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
43
|
+
|
|
27
44
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
45
|
+
|
|
28
46
|
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."); }
|
|
47
|
+
|
|
29
48
|
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); }
|
|
30
|
-
|
|
31
|
-
function
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
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; }
|
|
53
|
+
|
|
32
54
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
55
|
+
|
|
33
56
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
57
|
+
|
|
34
58
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
36
|
-
/* eslint-disable react/prop-types */
|
|
37
59
|
|
|
60
|
+
/* eslint-disable react/prop-types */
|
|
38
61
|
var DefaultDropdownItem = function DefaultDropdownItem(props) {
|
|
39
62
|
var index = props.index,
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
style = props.style,
|
|
64
|
+
data = props.data;
|
|
42
65
|
var items = data.items,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
showClippedContentTitle = data.showClippedContentTitle;
|
|
66
|
+
isItemLoaded = data.isItemLoaded,
|
|
67
|
+
selectItem = data.selectItem,
|
|
68
|
+
_data$selectedItems = data.selectedItems,
|
|
69
|
+
selectedItems = _data$selectedItems === void 0 ? [] : _data$selectedItems,
|
|
70
|
+
idAttribute = data.idAttribute,
|
|
71
|
+
nameAttribute = data.nameAttribute;
|
|
50
72
|
var itemData = items[index] || {};
|
|
51
73
|
var idValue = itemData[idAttribute];
|
|
52
74
|
var name = itemData[nameAttribute];
|
|
@@ -55,118 +77,140 @@ var DefaultDropdownItem = function DefaultDropdownItem(props) {
|
|
|
55
77
|
}) ? true : false;
|
|
56
78
|
var className = "RCB-list-item " + (isSelected ? "selected" : "");
|
|
57
79
|
var content = name;
|
|
80
|
+
|
|
58
81
|
if (!isItemLoaded(index)) {
|
|
59
82
|
content = "Loading...";
|
|
60
83
|
}
|
|
61
|
-
|
|
84
|
+
|
|
85
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
86
|
style: style,
|
|
63
87
|
onClick: function onClick() {
|
|
64
88
|
return selectItem(itemData);
|
|
65
|
-
}
|
|
66
|
-
}, showClippedContentTitle ? {
|
|
67
|
-
title: content
|
|
68
|
-
} : {}, {
|
|
89
|
+
},
|
|
69
90
|
className: className
|
|
70
|
-
}
|
|
91
|
+
}, content);
|
|
71
92
|
};
|
|
93
|
+
|
|
72
94
|
exports.DefaultDropdownItem = DefaultDropdownItem;
|
|
95
|
+
|
|
73
96
|
var ServerPaginatedDDList = function ServerPaginatedDDList(props) {
|
|
74
97
|
var selectedItems = props.selectedItems,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
selectItem = props.selectItem,
|
|
99
|
+
idAttribute = props.idAttribute,
|
|
100
|
+
nameAttribute = props.nameAttribute,
|
|
101
|
+
DropdownItem = props.DropdownItem,
|
|
102
|
+
requestId = props.requestId,
|
|
103
|
+
requestParams = props.requestParams,
|
|
104
|
+
responseFormatter = props.responseFormatter,
|
|
105
|
+
pageNoKey = props.pageNoKey,
|
|
106
|
+
perPageKey = props.perPageKey,
|
|
107
|
+
pageSize = props.pageSize,
|
|
108
|
+
maxHeight = props.maxHeight,
|
|
109
|
+
searchAttribute = props.searchAttribute,
|
|
110
|
+
searchQuery = props.searchQuery,
|
|
111
|
+
getUrlParams = props.getUrlParams,
|
|
112
|
+
serverListClassName = props.serverListClassName,
|
|
113
|
+
ddItemHeight = props.ddItemHeight,
|
|
114
|
+
minPageNo = props.minPageNo,
|
|
115
|
+
_props$delay = props.delay,
|
|
116
|
+
delay = _props$delay === void 0 ? 500 : _props$delay,
|
|
117
|
+
_props$loadImmediatel = props.loadImmediately,
|
|
118
|
+
loadImmediately = _props$loadImmediatel === void 0 ? true : _props$loadImmediatel,
|
|
119
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
120
|
+
|
|
98
121
|
var _useState = (0, _react.useState)([]),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
123
|
+
items = _useState2[0],
|
|
124
|
+
setItems = _useState2[1];
|
|
125
|
+
|
|
102
126
|
var _useState3 = (0, _react.useState)(loadImmediately ? 1 : 0),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
128
|
+
itemsResetCounter = _useState4[0],
|
|
129
|
+
setItemsResetCounter = _useState4[1];
|
|
130
|
+
|
|
106
131
|
var _useState5 = (0, _react.useState)(null),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
132
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
133
|
+
total = _useState6[0],
|
|
134
|
+
setTotal = _useState6[1];
|
|
135
|
+
|
|
110
136
|
var _useState7 = (0, _react.useState)(false),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
138
|
+
hasNextPage = _useState8[0],
|
|
139
|
+
setHasNextPage = _useState8[1];
|
|
140
|
+
|
|
114
141
|
var _useState9 = (0, _react.useState)(false),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
142
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
143
|
+
isNextPageLoading = _useState10[0],
|
|
144
|
+
setIsNextPageLoading = _useState10[1];
|
|
145
|
+
|
|
118
146
|
var debouncedFn = (0, _react.useRef)();
|
|
147
|
+
|
|
119
148
|
var getDefaultPageNo = function getDefaultPageNo() {
|
|
120
149
|
return minPageNo !== null && minPageNo !== void 0 ? minPageNo : 1;
|
|
121
150
|
};
|
|
151
|
+
|
|
122
152
|
var pageNoRef = (0, _react.useRef)(getDefaultPageNo());
|
|
123
153
|
var searchRef = (0, _react.useRef)(searchQuery);
|
|
154
|
+
|
|
124
155
|
var onDataLoaded = function onDataLoaded(response) {
|
|
125
156
|
var apiResponse = response;
|
|
126
157
|
setIsNextPageLoading(false);
|
|
158
|
+
|
|
127
159
|
if (!loadImmediately && searchRef.current === "") {
|
|
128
160
|
setItems([]);
|
|
129
161
|
setTotal(null);
|
|
130
162
|
return false;
|
|
131
163
|
}
|
|
164
|
+
|
|
132
165
|
if (typeof responseFormatter === "function") {
|
|
133
166
|
apiResponse = responseFormatter(response);
|
|
134
167
|
}
|
|
168
|
+
|
|
135
169
|
var _apiResponse = apiResponse,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
170
|
+
entries = _apiResponse.entries,
|
|
171
|
+
_apiResponse$total = _apiResponse.total,
|
|
172
|
+
total = _apiResponse$total === void 0 ? 0 : _apiResponse$total;
|
|
173
|
+
|
|
139
174
|
if (entries === null) {
|
|
140
175
|
entries = [];
|
|
141
176
|
}
|
|
177
|
+
|
|
142
178
|
var totalEntries = [].concat(_toConsumableArray(items), _toConsumableArray(entries));
|
|
179
|
+
|
|
143
180
|
if (totalEntries.length < total) {
|
|
144
181
|
setHasNextPage(true);
|
|
145
182
|
} else {
|
|
146
183
|
setHasNextPage(false);
|
|
147
184
|
}
|
|
185
|
+
|
|
148
186
|
setItems(totalEntries);
|
|
149
187
|
setTotal(total);
|
|
150
188
|
};
|
|
189
|
+
|
|
151
190
|
var makeAPICall = function makeAPICall() {
|
|
152
191
|
var _objectSpread2;
|
|
192
|
+
|
|
153
193
|
setIsNextPageLoading(true);
|
|
194
|
+
|
|
154
195
|
var def = _dataLoader["default"].getRequestDef({
|
|
155
196
|
requestId: requestId,
|
|
156
197
|
params: _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, pageNoKey, pageNoRef.current), _defineProperty(_objectSpread2, perPageKey, pageSize), _objectSpread2), searchRef.current && _defineProperty({}, searchAttribute, searchRef.current)), requestParams),
|
|
157
198
|
urlParams: getUrlParams()
|
|
158
199
|
});
|
|
200
|
+
|
|
159
201
|
def.done(onDataLoaded);
|
|
160
202
|
return def;
|
|
161
203
|
};
|
|
162
|
-
|
|
163
204
|
/* Callback to be invoked when more rows must be loaded.
|
|
164
205
|
It should return a Promise that is resolved once all data has finished loading.
|
|
165
206
|
*/
|
|
207
|
+
|
|
208
|
+
|
|
166
209
|
var loadNextPage = function loadNextPage() {
|
|
167
210
|
pageNoRef.current = pageNoRef.current + 1;
|
|
168
211
|
return makeAPICall();
|
|
169
212
|
};
|
|
213
|
+
|
|
170
214
|
(0, _react.useEffect)(function () {
|
|
171
215
|
/* not the first call */
|
|
172
216
|
if (itemsResetCounter > 0) {
|
|
@@ -187,8 +231,10 @@ var ServerPaginatedDDList = function ServerPaginatedDDList(props) {
|
|
|
187
231
|
if (!debouncedFn.current) {
|
|
188
232
|
debouncedFn.current = _utils["default"].debounce(startSearchCallBack, delay);
|
|
189
233
|
}
|
|
234
|
+
|
|
190
235
|
debouncedFn.current();
|
|
191
236
|
}, []);
|
|
237
|
+
|
|
192
238
|
var startSearchCallBack = function startSearchCallBack() {
|
|
193
239
|
pageNoRef.current = getDefaultPageNo();
|
|
194
240
|
setItems([]);
|
|
@@ -196,53 +242,50 @@ var ServerPaginatedDDList = function ServerPaginatedDDList(props) {
|
|
|
196
242
|
setItemsResetCounter(function (prevItemsResetCounter) {
|
|
197
243
|
return prevItemsResetCounter + 1;
|
|
198
244
|
});
|
|
199
|
-
};
|
|
245
|
+
}; // If there are more items to be loaded then add an extra row to hold a loading indicator.
|
|
200
246
|
|
|
201
|
-
// If there are more items to be loaded then add an extra row to hold a loading indicator.
|
|
202
|
-
var itemCount = hasNextPage ? items.length + 1 : items.length;
|
|
203
247
|
|
|
204
|
-
// Only load 1 page of items at a time.
|
|
248
|
+
var itemCount = hasNextPage ? items.length + 1 : items.length; // Only load 1 page of items at a time.
|
|
205
249
|
// Pass an empty callback to InfiniteLoader in case it asks us to load more than once.
|
|
206
|
-
var loadMoreItems = isNextPageLoading ? function () {} : loadNextPage;
|
|
207
250
|
|
|
208
|
-
// Every row is loaded except for our loading indicator row.
|
|
251
|
+
var loadMoreItems = isNextPageLoading ? function () {} : loadNextPage; // Every row is loaded except for our loading indicator row.
|
|
252
|
+
|
|
209
253
|
var isItemLoaded = function isItemLoaded(index) {
|
|
210
254
|
return !hasNextPage || index < items.length;
|
|
211
255
|
};
|
|
256
|
+
|
|
212
257
|
var listProps = _objectSpread({
|
|
213
258
|
selectItem: selectItem,
|
|
214
259
|
selectedItems: selectedItems,
|
|
215
260
|
idAttribute: idAttribute,
|
|
216
261
|
nameAttribute: nameAttribute,
|
|
217
262
|
items: items,
|
|
218
|
-
isItemLoaded: isItemLoaded
|
|
219
|
-
showClippedContentTitle: showClippedContentTitle
|
|
263
|
+
isItemLoaded: isItemLoaded
|
|
220
264
|
}, restProps);
|
|
265
|
+
|
|
221
266
|
if (total === null) {
|
|
222
267
|
return [];
|
|
223
268
|
}
|
|
269
|
+
|
|
224
270
|
if (total === 0) {
|
|
225
271
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
226
272
|
className: "RCB-no-data"
|
|
227
273
|
}, "No data found");
|
|
228
274
|
}
|
|
229
|
-
|
|
230
|
-
// Function responsible for tracking the loaded state of each item.
|
|
275
|
+
|
|
276
|
+
return /*#__PURE__*/_react["default"].createElement(_reactWindowInfiniteLoader["default"] // Function responsible for tracking the loaded state of each item.
|
|
231
277
|
, {
|
|
232
|
-
isItemLoaded: isItemLoaded
|
|
233
|
-
// Number of rows in list; can be arbitrary high number if actual number is unknown.
|
|
278
|
+
isItemLoaded: isItemLoaded // Number of rows in list; can be arbitrary high number if actual number is unknown.
|
|
234
279
|
,
|
|
235
280
|
itemCount: total,
|
|
236
|
-
loadMoreItems: loadMoreItems
|
|
237
|
-
// Minimum number of rows to be loaded at a time; defaults to 10. This property can be used to batch requests to reduce HTTP requests.
|
|
281
|
+
loadMoreItems: loadMoreItems // Minimum number of rows to be loaded at a time; defaults to 10. This property can be used to batch requests to reduce HTTP requests.
|
|
238
282
|
,
|
|
239
|
-
minimumBatchSize: pageSize
|
|
240
|
-
// Threshold at which to pre-fetch data; defaults to 15. A threshold of 15 means that data will start loading when a user scrolls within 15 rows.
|
|
283
|
+
minimumBatchSize: pageSize // Threshold at which to pre-fetch data; defaults to 15. A threshold of 15 means that data will start loading when a user scrolls within 15 rows.
|
|
241
284
|
,
|
|
242
285
|
threshold: pageSize
|
|
243
286
|
}, function (_ref2) {
|
|
244
287
|
var onItemsRendered = _ref2.onItemsRendered,
|
|
245
|
-
|
|
288
|
+
ref = _ref2.ref;
|
|
246
289
|
return /*#__PURE__*/_react["default"].createElement(_reactWindow.FixedSizeList, {
|
|
247
290
|
itemCount: itemCount,
|
|
248
291
|
itemSize: ddItemHeight,
|
|
@@ -254,6 +297,7 @@ var ServerPaginatedDDList = function ServerPaginatedDDList(props) {
|
|
|
254
297
|
}, DropdownItem);
|
|
255
298
|
});
|
|
256
299
|
};
|
|
300
|
+
|
|
257
301
|
ServerPaginatedDDList.propTypes = {
|
|
258
302
|
ddItemHeight: _propTypes["default"].number
|
|
259
303
|
};
|
|
@@ -261,7 +305,7 @@ ServerPaginatedDDList.defaultProps = {
|
|
|
261
305
|
DropdownItem: DefaultDropdownItem,
|
|
262
306
|
ddItemHeight: 30
|
|
263
307
|
};
|
|
264
|
-
|
|
265
308
|
/* eslint-enable react/prop-types */
|
|
309
|
+
|
|
266
310
|
var _default = ServerPaginatedDDList;
|
|
267
311
|
exports["default"] = _default;
|