@unbxd-ui/unbxd-react-components 0.2.104 → 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 -87
- 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,38 +1,63 @@
|
|
|
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 _InlineModal = _interopRequireWildcard(require("../InlineModal"));
|
|
15
|
+
|
|
11
16
|
var _List = _interopRequireDefault(require("../List"));
|
|
17
|
+
|
|
12
18
|
var _Form = require("./Form");
|
|
19
|
+
|
|
13
20
|
var _FormElementWrapper = _interopRequireDefault(require("./FormElementWrapper"));
|
|
21
|
+
|
|
14
22
|
var _ServerPaginatedDDList = _interopRequireDefault(require("./ServerPaginatedDDList"));
|
|
23
|
+
|
|
15
24
|
var _utils = _interopRequireDefault(require("../../core/utils"));
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
|
|
26
|
+
var _excluded = ["items", "selectedItems", "selectItem", "idAttribute", "nameAttribute", "DropdownItem", "ListHeaderItem"],
|
|
27
|
+
_excluded2 = ["halign", "label", "showLabel", "name", "SelectionSummary", "className", "value", "defaultValue", "onChange", "disabled", "options", "showSearch", "searchPlaceholder", "idAttribute", "nameAttribute", "noSelectionLabel", "appearance", "multiSelect", "DropdownItem", "validations", "paginationType", "requestId", "requestParams", "pageNoKey", "perPageKey", "pageSize", "searchAttribute", "maxHeight", "responseFormatter", "getUrlParams", "showCreateCTA", "createCTAComponent", "onCreateCTAClick", "serverListClassName", "showClear", "onClear", "minPageNo", "ListHeaderItem", "onSearchChange"];
|
|
28
|
+
|
|
18
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
+
|
|
19
31
|
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); }
|
|
32
|
+
|
|
20
33
|
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; }
|
|
34
|
+
|
|
21
35
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
36
|
+
|
|
22
37
|
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."); }
|
|
38
|
+
|
|
23
39
|
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); }
|
|
24
|
-
|
|
25
|
-
function
|
|
40
|
+
|
|
41
|
+
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; }
|
|
42
|
+
|
|
43
|
+
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; }
|
|
44
|
+
|
|
26
45
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
-
|
|
46
|
+
|
|
47
|
+
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); }
|
|
48
|
+
|
|
28
49
|
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; }
|
|
50
|
+
|
|
29
51
|
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; }
|
|
52
|
+
|
|
30
53
|
var convertToArray = function convertToArray(value) {
|
|
31
54
|
if (!value) {
|
|
32
55
|
return [];
|
|
33
56
|
}
|
|
57
|
+
|
|
34
58
|
return Array.isArray(value) ? value : [value];
|
|
35
59
|
};
|
|
60
|
+
|
|
36
61
|
var getFilteredOptions = function getFilteredOptions() {
|
|
37
62
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
38
63
|
var searchQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
@@ -42,23 +67,26 @@ var getFilteredOptions = function getFilteredOptions() {
|
|
|
42
67
|
return nameValue.indexOf(searchQuery.toLowerCase()) !== -1;
|
|
43
68
|
});
|
|
44
69
|
};
|
|
45
|
-
|
|
46
70
|
/* eslint-disable react/prop-types */
|
|
71
|
+
|
|
72
|
+
|
|
47
73
|
var DefaultSelectionSummary = function DefaultSelectionSummary(_ref) {
|
|
48
74
|
var _ref$selectedItems = _ref.selectedItems,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
75
|
+
selectedItems = _ref$selectedItems === void 0 ? [] : _ref$selectedItems,
|
|
76
|
+
multiSelect = _ref.multiSelect,
|
|
77
|
+
noSelectionLabel = _ref.noSelectionLabel,
|
|
78
|
+
nameAttribute = _ref.nameAttribute,
|
|
79
|
+
showClear = _ref.showClear,
|
|
80
|
+
clearSelectedItems = _ref.clearSelectedItems;
|
|
55
81
|
var summaryString = "";
|
|
56
82
|
var selectedCount = selectedItems.length;
|
|
83
|
+
|
|
57
84
|
if (multiSelect) {
|
|
58
85
|
summaryString = selectedCount ? "".concat(selectedCount, " selected") : noSelectionLabel;
|
|
59
86
|
} else {
|
|
60
87
|
summaryString = selectedCount ? selectedItems[0][nameAttribute] : noSelectionLabel;
|
|
61
88
|
}
|
|
89
|
+
|
|
62
90
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
63
91
|
className: "RCB-dd-label"
|
|
64
92
|
}, summaryString), /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -70,57 +98,48 @@ var DefaultSelectionSummary = function DefaultSelectionSummary(_ref) {
|
|
|
70
98
|
className: "RCB-select-arrow"
|
|
71
99
|
})));
|
|
72
100
|
};
|
|
101
|
+
|
|
73
102
|
var DefaultDropdownItem = function DefaultDropdownItem(props) {
|
|
74
103
|
var itemData = props.itemData,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
showClippedContentTitle = props.showClippedContentTitle;
|
|
104
|
+
selectItem = props.selectItem,
|
|
105
|
+
_props$selectedItems = props.selectedItems,
|
|
106
|
+
selectedItems = _props$selectedItems === void 0 ? [] : _props$selectedItems,
|
|
107
|
+
idAttribute = props.idAttribute,
|
|
108
|
+
nameAttribute = props.nameAttribute;
|
|
81
109
|
var idValue = itemData[idAttribute];
|
|
82
110
|
var name = itemData[nameAttribute];
|
|
83
111
|
var isSelected = selectedItems.find(function (obj) {
|
|
84
112
|
return obj[idAttribute] === idValue;
|
|
85
113
|
}) ? true : false;
|
|
86
114
|
var className = "RCB-list-item " + (isSelected ? "selected" : "");
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
title: name
|
|
94
|
-
}, name);
|
|
95
|
-
} else {
|
|
96
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
97
|
-
onClick: function onClick() {
|
|
98
|
-
return selectItem(itemData);
|
|
99
|
-
},
|
|
100
|
-
className: className
|
|
101
|
-
}, name);
|
|
102
|
-
}
|
|
115
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return selectItem(itemData);
|
|
118
|
+
},
|
|
119
|
+
className: className
|
|
120
|
+
}, name);
|
|
103
121
|
};
|
|
122
|
+
|
|
104
123
|
exports.DefaultDropdownItem = DefaultDropdownItem;
|
|
105
124
|
DefaultDropdownItem.propTypes = {
|
|
106
125
|
itemData: _propTypes["default"].object.isRequired,
|
|
107
126
|
selectItem: _propTypes["default"].func.isRequired,
|
|
108
127
|
selectedItems: _propTypes["default"].array,
|
|
109
128
|
idAttribute: _propTypes["default"].string,
|
|
110
|
-
nameAttribute: _propTypes["default"].string
|
|
111
|
-
showClippedContentTitle: _propTypes["default"].bool
|
|
129
|
+
nameAttribute: _propTypes["default"].string
|
|
112
130
|
};
|
|
131
|
+
|
|
113
132
|
var NormalList = function NormalList(_ref2) {
|
|
114
133
|
var _ref2$items = _ref2.items,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
135
|
+
selectedItems = _ref2.selectedItems,
|
|
136
|
+
selectItem = _ref2.selectItem,
|
|
137
|
+
idAttribute = _ref2.idAttribute,
|
|
138
|
+
nameAttribute = _ref2.nameAttribute,
|
|
139
|
+
DropdownItem = _ref2.DropdownItem,
|
|
140
|
+
ListHeaderItem = _ref2.ListHeaderItem,
|
|
141
|
+
restProps = _objectWithoutProperties(_ref2, _excluded);
|
|
142
|
+
|
|
124
143
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, items.length ? ListHeaderItem : "", /*#__PURE__*/_react["default"].createElement(_List["default"], _extends({
|
|
125
144
|
items: items
|
|
126
145
|
}, restProps, {
|
|
@@ -128,93 +147,103 @@ var NormalList = function NormalList(_ref2) {
|
|
|
128
147
|
ListItem: DropdownItem,
|
|
129
148
|
selectedItems: selectedItems,
|
|
130
149
|
selectItem: selectItem,
|
|
131
|
-
showClippedContentTitle: showClippedContentTitle,
|
|
132
150
|
idAttribute: idAttribute,
|
|
133
151
|
nameAttribute: nameAttribute
|
|
134
152
|
})));
|
|
135
153
|
};
|
|
154
|
+
|
|
136
155
|
NormalList.defaultProps = {
|
|
137
156
|
DropdownItem: DefaultDropdownItem
|
|
138
157
|
};
|
|
139
|
-
|
|
140
158
|
/* eslint-enable react/prop-types */
|
|
141
159
|
|
|
142
160
|
var Dropdown = function Dropdown(props, ref) {
|
|
143
161
|
var halign = props.halign,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
162
|
+
label = props.label,
|
|
163
|
+
showLabel = props.showLabel,
|
|
164
|
+
name = props.name,
|
|
165
|
+
SelectionSummary = props.SelectionSummary,
|
|
166
|
+
className = props.className,
|
|
167
|
+
value = props.value,
|
|
168
|
+
defaultValue = props.defaultValue,
|
|
169
|
+
onChange = props.onChange,
|
|
170
|
+
disabled = props.disabled,
|
|
171
|
+
options = props.options,
|
|
172
|
+
showSearch = props.showSearch,
|
|
173
|
+
searchPlaceholder = props.searchPlaceholder,
|
|
174
|
+
idAttribute = props.idAttribute,
|
|
175
|
+
nameAttribute = props.nameAttribute,
|
|
176
|
+
noSelectionLabel = props.noSelectionLabel,
|
|
177
|
+
appearance = props.appearance,
|
|
178
|
+
multiSelect = props.multiSelect,
|
|
179
|
+
DropdownItem = props.DropdownItem,
|
|
180
|
+
validations = props.validations,
|
|
181
|
+
paginationType = props.paginationType,
|
|
182
|
+
requestId = props.requestId,
|
|
183
|
+
requestParams = props.requestParams,
|
|
184
|
+
pageNoKey = props.pageNoKey,
|
|
185
|
+
perPageKey = props.perPageKey,
|
|
186
|
+
pageSize = props.pageSize,
|
|
187
|
+
searchAttribute = props.searchAttribute,
|
|
188
|
+
maxHeight = props.maxHeight,
|
|
189
|
+
responseFormatter = props.responseFormatter,
|
|
190
|
+
getUrlParams = props.getUrlParams,
|
|
191
|
+
showCreateCTA = props.showCreateCTA,
|
|
192
|
+
createCTAComponent = props.createCTAComponent,
|
|
193
|
+
onCreateCTAClick = props.onCreateCTAClick,
|
|
194
|
+
serverListClassName = props.serverListClassName,
|
|
195
|
+
showClear = props.showClear,
|
|
196
|
+
onClear = props.onClear,
|
|
197
|
+
minPageNo = props.minPageNo,
|
|
198
|
+
ListHeaderItem = props.ListHeaderItem,
|
|
199
|
+
propSearchChange = props.onSearchChange,
|
|
200
|
+
restProps = _objectWithoutProperties(props, _excluded2);
|
|
201
|
+
|
|
184
202
|
var _useState = (0, _react.useState)(""),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
203
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
204
|
+
searchQuery = _useState2[0],
|
|
205
|
+
setSearchQuery = _useState2[1];
|
|
206
|
+
|
|
188
207
|
var debouncedFn = (0, _react.useRef)();
|
|
189
208
|
var searchIpRef = (0, _react.useRef)();
|
|
190
209
|
var initialSelected = [];
|
|
191
210
|
var initialValue = typeof onChange === "function" ? value : defaultValue;
|
|
211
|
+
|
|
192
212
|
if (typeof initialValue !== "undefined") {
|
|
193
213
|
initialSelected = convertToArray(initialValue);
|
|
194
214
|
}
|
|
195
|
-
|
|
196
215
|
/* array of selected item objects */
|
|
216
|
+
|
|
217
|
+
|
|
197
218
|
var _useState3 = (0, _react.useState)(initialSelected),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
219
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
220
|
+
selectedItems = _useState4[0],
|
|
221
|
+
setSelectedItems = _useState4[1];
|
|
222
|
+
|
|
201
223
|
var _useContext = (0, _react.useContext)(_Form.FormContext),
|
|
202
|
-
|
|
224
|
+
onValueChange = _useContext.onValueChange;
|
|
225
|
+
|
|
203
226
|
var inlineModalRef = (0, _react.useRef)();
|
|
227
|
+
|
|
204
228
|
var hideModal = function hideModal() {
|
|
205
229
|
inlineModalRef.current.hideModal();
|
|
206
230
|
};
|
|
231
|
+
|
|
207
232
|
var postFormValueChange = function postFormValueChange(value) {
|
|
208
233
|
var _utils$checkIfValid = _utils["default"].checkIfValid(value, validations),
|
|
209
|
-
|
|
234
|
+
error = _utils$checkIfValid.error;
|
|
235
|
+
|
|
210
236
|
typeof onValueChange === "function" && onValueChange(name, value, error);
|
|
211
237
|
};
|
|
238
|
+
|
|
212
239
|
var selectItem = function selectItem(item) {
|
|
213
240
|
var id = item[idAttribute];
|
|
241
|
+
|
|
214
242
|
if (multiSelect) {
|
|
215
243
|
var isPresent = selectedItems.find(function (obj) {
|
|
216
244
|
return obj[idAttribute] === id;
|
|
217
245
|
});
|
|
246
|
+
|
|
218
247
|
if (!isPresent) {
|
|
219
248
|
selectedItems.push(item);
|
|
220
249
|
postFormValueChange(selectedItems);
|
|
@@ -225,33 +254,44 @@ var Dropdown = function Dropdown(props, ref) {
|
|
|
225
254
|
postFormValueChange(item);
|
|
226
255
|
typeof onChange === "function" && onChange(item);
|
|
227
256
|
/* close the dropdown */
|
|
257
|
+
|
|
228
258
|
hideModal();
|
|
229
259
|
}
|
|
260
|
+
|
|
230
261
|
setSelectedItems(selectedItems);
|
|
231
262
|
};
|
|
263
|
+
|
|
232
264
|
(0, _react.useEffect)(function () {
|
|
233
265
|
/* set the initial form element value in the form context */
|
|
234
266
|
var postValue = typeof onChange === "function" ? value : defaultValue;
|
|
267
|
+
|
|
235
268
|
if (typeof postValue !== "undefined") {
|
|
236
269
|
var arrayPostValue = convertToArray(postValue);
|
|
237
270
|
postValue = multiSelect ? arrayPostValue : postValue;
|
|
238
271
|
setSelectedItems(arrayPostValue);
|
|
239
272
|
}
|
|
273
|
+
|
|
240
274
|
postFormValueChange(postValue);
|
|
241
275
|
}, [value, defaultValue]);
|
|
276
|
+
|
|
242
277
|
var debouncedSearchChange = function debouncedSearchChange(value) {
|
|
243
278
|
setSearchQuery(value);
|
|
279
|
+
|
|
244
280
|
if (typeof propSearchChange === "function") {
|
|
245
281
|
propSearchChange(value);
|
|
246
282
|
}
|
|
247
283
|
};
|
|
284
|
+
|
|
248
285
|
var onSearchChange = function onSearchChange(event) {
|
|
249
286
|
event.persist();
|
|
287
|
+
|
|
250
288
|
if (!debouncedFn.current) {
|
|
251
289
|
debouncedFn.current = _utils["default"].debounce(debouncedSearchChange, 300);
|
|
252
290
|
}
|
|
291
|
+
|
|
253
292
|
return debouncedFn.current(event.target.value);
|
|
254
293
|
};
|
|
294
|
+
|
|
255
295
|
var onModalStateChange = function onModalStateChange(isModalOpen) {
|
|
256
296
|
if (isModalOpen && showSearch) {
|
|
257
297
|
searchIpRef.current && searchIpRef.current.focus();
|
|
@@ -260,22 +300,24 @@ var Dropdown = function Dropdown(props, ref) {
|
|
|
260
300
|
setSearchQuery("");
|
|
261
301
|
}
|
|
262
302
|
};
|
|
303
|
+
|
|
263
304
|
var clearSelectedItems = function clearSelectedItems(evnt) {
|
|
264
305
|
evnt.stopPropagation();
|
|
265
306
|
setSelectedItems([]);
|
|
266
307
|
typeof onClear === "function" && onClear();
|
|
267
308
|
typeof onChange === "function" && onChange(null);
|
|
268
309
|
/** Close modal after reset */
|
|
310
|
+
|
|
269
311
|
hideModal();
|
|
270
312
|
};
|
|
313
|
+
|
|
271
314
|
var commonAttributes = {
|
|
272
315
|
selectedItems: selectedItems,
|
|
273
316
|
selectItem: selectItem,
|
|
274
317
|
idAttribute: idAttribute,
|
|
275
318
|
nameAttribute: nameAttribute,
|
|
276
319
|
DropdownItem: DropdownItem,
|
|
277
|
-
ListHeaderItem: ListHeaderItem
|
|
278
|
-
showClippedContentTitle: showClippedContentTitle
|
|
320
|
+
ListHeaderItem: ListHeaderItem
|
|
279
321
|
};
|
|
280
322
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
281
323
|
return {
|
|
@@ -332,67 +374,86 @@ var Dropdown = function Dropdown(props, ref) {
|
|
|
332
374
|
className: "RCB-dd-create-cta",
|
|
333
375
|
onClick: onCreateCTAClick
|
|
334
376
|
}, createCTAComponent))));
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
// const VALUE_SHAPE = PropTypes.shape({
|
|
377
|
+
}; // const VALUE_SHAPE = PropTypes.shape({
|
|
338
378
|
// id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
339
379
|
// name: PropTypes.string
|
|
340
380
|
// });
|
|
341
381
|
|
|
382
|
+
|
|
342
383
|
Dropdown = /*#__PURE__*/(0, _react.forwardRef)(Dropdown);
|
|
343
384
|
Dropdown.propTypes = {
|
|
344
385
|
/** Pass any additional classNames to Dropdown component */
|
|
345
386
|
className: _propTypes["default"].string,
|
|
387
|
+
|
|
346
388
|
/** Pass infinite fixed list classname to Dropdown component */
|
|
347
389
|
serverListClassName: _propTypes["default"].string,
|
|
390
|
+
|
|
348
391
|
/** Horizontal alignment of the dropdown body */
|
|
349
392
|
halign: _propTypes["default"].oneOf(["left", "right"]),
|
|
393
|
+
|
|
350
394
|
/** Label for the dropdown element */
|
|
351
395
|
label: _propTypes["default"].string,
|
|
396
|
+
|
|
352
397
|
/** indicates whether to show or hide label */
|
|
353
398
|
showLabel: _propTypes["default"].bool,
|
|
399
|
+
|
|
354
400
|
/** Unique ID for the input element */
|
|
355
401
|
name: _propTypes["default"].string.isRequired,
|
|
402
|
+
|
|
356
403
|
/** Label for dropdown activator */
|
|
357
404
|
noSelectionLabel: _propTypes["default"].string,
|
|
405
|
+
|
|
358
406
|
/** Selection items list */
|
|
359
407
|
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
360
408
|
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
361
409
|
name: _propTypes["default"].string
|
|
362
410
|
})),
|
|
411
|
+
|
|
363
412
|
/** array of selected item objects, only considered if onChange event is given */
|
|
364
413
|
value: _propTypes["default"].any,
|
|
414
|
+
|
|
365
415
|
/** array of default selected item objects */
|
|
366
416
|
defaultValue: _propTypes["default"].any,
|
|
367
417
|
onChange: _propTypes["default"].func,
|
|
418
|
+
|
|
368
419
|
/** pass true if dropdown has to be disabled */
|
|
369
420
|
disabled: _propTypes["default"].bool,
|
|
421
|
+
|
|
370
422
|
/* set to true if you want search ability for dropdown items */
|
|
371
423
|
showSearch: _propTypes["default"].bool,
|
|
424
|
+
|
|
372
425
|
/* placeholder to show in the search box */
|
|
373
426
|
searchPlaceholder: _propTypes["default"].string,
|
|
427
|
+
|
|
374
428
|
/** Is dropdown multi select or single select */
|
|
375
429
|
multiSelect: _propTypes["default"].bool,
|
|
430
|
+
|
|
376
431
|
/** ID attribute key to use when rendering the dropdown items, if the ID attribute is other than "id" */
|
|
377
432
|
idAttribute: _propTypes["default"].string,
|
|
433
|
+
|
|
378
434
|
/** name attribute key to use when rendering the dropdown items, if the name attribute is other than "name" */
|
|
379
435
|
nameAttribute: _propTypes["default"].string,
|
|
380
|
-
|
|
381
|
-
showClippedContentTitle: _propTypes["default"].bool,
|
|
436
|
+
|
|
382
437
|
/** Provide a custom element for rendering dropdown item */
|
|
383
438
|
DropdownItem: _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Element), _propTypes["default"].func]),
|
|
439
|
+
|
|
384
440
|
/** Pass true to show a create CTA at the end of the dropdown */
|
|
385
441
|
showCreateCTA: _propTypes["default"].bool,
|
|
442
|
+
|
|
386
443
|
/** Customize the create CTA HTML by passing a createCTAComponent */
|
|
387
444
|
createCTAComponent: _propTypes["default"].any,
|
|
445
|
+
|
|
388
446
|
/** Callback that gets called when Create CTA button is clicked */
|
|
389
447
|
onCreateCTAClick: _propTypes["default"].func,
|
|
448
|
+
|
|
390
449
|
/** Pass this component to customise the selection summary HTML.
|
|
391
450
|
* The array of selected item objects will be sent as props
|
|
392
451
|
*/
|
|
393
452
|
SelectionSummary: _propTypes["default"].func,
|
|
453
|
+
|
|
394
454
|
/** Define the appearance of the form element. Accepted values are either "inline" or "block" */
|
|
395
455
|
appearance: _propTypes["default"].oneOf(["inline", "block"]),
|
|
456
|
+
|
|
396
457
|
/** Array of validations to perform on the form element value.
|
|
397
458
|
* If the validation fails, you will get an "error" field in the form onSubmit event */
|
|
398
459
|
validations: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
@@ -400,30 +461,41 @@ Dropdown.propTypes = {
|
|
|
400
461
|
message: _propTypes["default"].string.isRequired,
|
|
401
462
|
validator: _propTypes["default"].func
|
|
402
463
|
})),
|
|
464
|
+
|
|
403
465
|
/** Type of pagination for the dropdown list items. Send "SERVER" for server side pagination */
|
|
404
466
|
paginationType: _propTypes["default"].oneOf(["NONE", "SERVER"]),
|
|
467
|
+
|
|
405
468
|
/** If paginationType is "SERVER", pass the requestId for the server request */
|
|
406
469
|
requestId: function requestId(props, propName) {
|
|
407
470
|
if (props["paginationType"] == "SERVER" && (!props[propName] || typeof props[propName] === "undefined")) {
|
|
408
471
|
return new Error("Please provide a requestId for paginationType 'SERVER'!");
|
|
409
472
|
}
|
|
410
473
|
},
|
|
474
|
+
|
|
411
475
|
/** If paginationType is "SERVER", pass any additional params to be sent to the server request */
|
|
412
476
|
requestParams: _propTypes["default"].object,
|
|
477
|
+
|
|
413
478
|
/** If paginationType is "SERVER", pass the pageNo. attribute to be sent to the server request */
|
|
414
479
|
pageNoKey: _propTypes["default"].string,
|
|
480
|
+
|
|
415
481
|
/** If paginationType is "SERVER", pass the pageSize attribute to be sent to the server request */
|
|
416
482
|
perPageKey: _propTypes["default"].string,
|
|
483
|
+
|
|
417
484
|
/** If paginationType is "SERVER", max height of the dropdown container */
|
|
418
485
|
maxHeight: _propTypes["default"].number,
|
|
486
|
+
|
|
419
487
|
/** If paginationType is "SERVER", height of each dropdown item */
|
|
420
488
|
ddItemHeight: _propTypes["default"].number,
|
|
489
|
+
|
|
421
490
|
/** If paginationType is "SERVER", max number of items to show for one page in the dropdown container */
|
|
422
491
|
pageSize: _propTypes["default"].number,
|
|
492
|
+
|
|
423
493
|
/** Default page number to use for server paginated list */
|
|
424
494
|
minPageNo: _propTypes["default"].number,
|
|
495
|
+
|
|
425
496
|
/** If paginationType is "SERVER" & showSearch is true, pass the search attribute to be sent to the server request */
|
|
426
497
|
searchAttribute: _propTypes["default"].string,
|
|
498
|
+
|
|
427
499
|
/** If paginationType is "SERVER",
|
|
428
500
|
* component expects the response to be of the form
|
|
429
501
|
* { [pageNoKey]: <pageNo>, [perPageKey]: <pageSize>, total: <totalCount>, entries: [{}] }
|
|
@@ -431,14 +503,19 @@ Dropdown.propTypes = {
|
|
|
431
503
|
* Input to this function is the response received from your API
|
|
432
504
|
* */
|
|
433
505
|
responseFormatter: _propTypes["default"].func,
|
|
506
|
+
|
|
434
507
|
/** If paginationType is "SERVER", function that is expected to return the URL Params object */
|
|
435
508
|
getUrlParams: _propTypes["default"].func,
|
|
509
|
+
|
|
436
510
|
/** Show the optional clear button for resetting selections */
|
|
437
511
|
showClear: _propTypes["default"].bool,
|
|
512
|
+
|
|
438
513
|
/** Custom on clear function */
|
|
439
514
|
onClear: _propTypes["default"].func,
|
|
515
|
+
|
|
440
516
|
/** Callback on query search in dropdown */
|
|
441
517
|
onSearchChange: _propTypes["default"].func,
|
|
518
|
+
|
|
442
519
|
/** List header Component */
|
|
443
520
|
ListHeaderItem: _propTypes["default"].string
|
|
444
521
|
};
|
|
@@ -1,36 +1,51 @@
|
|
|
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"));
|
|
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; }
|
|
15
|
-
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
16
26
|
var FileUploader = function FileUploader(props) {
|
|
17
27
|
var label = props.label,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
name = props.name,
|
|
29
|
+
multiple = props.multiple,
|
|
30
|
+
accept = props.accept,
|
|
31
|
+
className = props.className,
|
|
32
|
+
appearance = props.appearance,
|
|
33
|
+
onChange = props.onChange,
|
|
34
|
+
children = props.children;
|
|
35
|
+
|
|
25
36
|
var _useContext = (0, _react.useContext)(_Form.FormContext),
|
|
26
|
-
|
|
37
|
+
onValueChange = _useContext.onValueChange;
|
|
38
|
+
|
|
27
39
|
var onFileChange = function onFileChange(event) {
|
|
28
40
|
var value = event.target.files;
|
|
41
|
+
|
|
29
42
|
if (typeof onChange === "function") {
|
|
30
43
|
onChange(value);
|
|
31
44
|
}
|
|
45
|
+
|
|
32
46
|
typeof onValueChange === "function" && onValueChange(name, value);
|
|
33
47
|
};
|
|
48
|
+
|
|
34
49
|
var inputProps = {
|
|
35
50
|
type: "file",
|
|
36
51
|
label: label,
|
|
@@ -55,19 +70,26 @@ var FileUploader = function FileUploader(props) {
|
|
|
55
70
|
className: "RCB-no-pointer"
|
|
56
71
|
}, children)));
|
|
57
72
|
};
|
|
73
|
+
|
|
58
74
|
FileUploader.propTypes = {
|
|
59
75
|
/** Pass any additional classNames to Input component */
|
|
60
76
|
className: _propTypes["default"].string,
|
|
77
|
+
|
|
61
78
|
/** Label for the input element */
|
|
62
79
|
label: _propTypes["default"].string,
|
|
80
|
+
|
|
63
81
|
/** Unique ID for the input element */
|
|
64
82
|
name: _propTypes["default"].string.isRequired,
|
|
83
|
+
|
|
65
84
|
/** set to true to upload multiple files at once */
|
|
66
85
|
multiple: _propTypes["default"].bool,
|
|
86
|
+
|
|
67
87
|
/** mime type of the acceptable files */
|
|
68
88
|
accept: _propTypes["default"].string,
|
|
89
|
+
|
|
69
90
|
/** Define the appearance of the form element. Accepted values are either "inline" or "block" */
|
|
70
91
|
appearance: _propTypes["default"].oneOf(["inline", "block"]),
|
|
92
|
+
|
|
71
93
|
/** Becomes a controlled component if onChange function is given */
|
|
72
94
|
onChange: _propTypes["default"].func
|
|
73
95
|
};
|