@widergy/energy-ui 2.12.1 → 2.12.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/dist/components/EnergyThemeProvider/index.js +36 -13
- package/dist/components/Loading/constants.js +2 -1
- package/dist/components/Loading/index.js +12 -13
- package/dist/components/Loading/theme.js +2 -4
- package/dist/components/UTAlert/AlertHandler.js +101 -75
- package/dist/components/UTAlert/index.js +87 -65
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +9 -8
- package/dist/components/UTAttachment/constants.js +13 -7
- package/dist/components/UTAttachment/index.js +250 -159
- package/dist/components/UTAttachment/layout.js +27 -26
- package/dist/components/UTAttachment/theme.js +2 -4
- package/dist/components/UTAttachment/utils.js +117 -34
- package/dist/components/UTAutocomplete/components/ListBox/index.js +21 -13
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -9
- package/dist/components/UTAutocomplete/constants.js +23 -12
- package/dist/components/UTAutocomplete/index.js +94 -54
- package/dist/components/UTAutocomplete/theme.js +4 -6
- package/dist/components/UTAvatar/constants.js +3 -2
- package/dist/components/UTAvatar/index.js +17 -18
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
- package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +22 -21
- package/dist/components/UTBarChart/components/Bars/constants.js +6 -3
- package/dist/components/UTBarChart/components/Bars/index.js +80 -70
- package/dist/components/UTBarChart/components/Legend/constants.js +18 -12
- package/dist/components/UTBarChart/components/Legend/index.js +93 -75
- package/dist/components/UTBarChart/components/Legend/utils.js +5 -1
- package/dist/components/UTBarChart/components/Levels/index.js +14 -16
- package/dist/components/UTBarChart/components/Levels/utils.js +27 -25
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +5 -3
- package/dist/components/UTBarChart/components/LinearPlot/index.js +20 -25
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -37
- package/dist/components/UTBarChart/components/Pagination/constants.js +2 -1
- package/dist/components/UTBarChart/components/Pagination/index.js +24 -20
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +32 -21
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +4 -2
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -20
- package/dist/components/UTBarChart/components/XAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/XAxis/index.js +65 -54
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -12
- package/dist/components/UTBarChart/components/YAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/YAxis/index.js +37 -30
- package/dist/components/UTBarChart/components/YAxis/utils.js +6 -4
- package/dist/components/UTBarChart/constants.js +8 -4
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +40 -23
- package/dist/components/UTBarChart/index.js +166 -152
- package/dist/components/UTBarChart/theme.js +2 -4
- package/dist/components/UTBarChart/types.js +19 -10
- package/dist/components/UTBarChart/utils.js +111 -107
- package/dist/components/UTBreadcrumbs/constants.js +31 -23
- package/dist/components/UTBreadcrumbs/index.js +101 -76
- package/dist/components/UTBreadcrumbs/theme.js +2 -4
- package/dist/components/UTButton/constants.js +17 -11
- package/dist/components/UTButton/index.js +31 -28
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +40 -36
- package/dist/components/UTCBUInput/theme.js +2 -4
- package/dist/components/UTCaptcha/index.js +45 -19
- package/dist/components/UTCard/components/UTCardFooter/index.js +16 -15
- package/dist/components/UTCard/index.js +120 -85
- package/dist/components/UTCard/theme.js +12 -11
- package/dist/components/UTCard/types.js +3 -2
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +15 -13
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +10 -5
- package/dist/components/UTCarousel/components/Slider/index.js +273 -204
- package/dist/components/UTCarousel/components/Slider/layout.js +94 -67
- package/dist/components/UTCarousel/index.js +15 -14
- package/dist/components/UTCarousel/theme.js +2 -4
- package/dist/components/UTCheckList/constants.js +2 -1
- package/dist/components/UTCheckList/index.js +93 -72
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +6 -3
- package/dist/components/UTCheckbox/index.js +44 -32
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +6 -3
- package/dist/components/UTConsumptionBar/index.js +80 -53
- package/dist/components/UTCuit/index.js +133 -109
- package/dist/components/UTCuit/theme.js +53 -51
- package/dist/components/UTDatePicker/components/Day/constants.js +2 -1
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +31 -20
- package/dist/components/UTDatePicker/index.js +102 -60
- package/dist/components/UTDatePicker/theme.js +3 -5
- package/dist/components/UTDatePicker/types.js +3 -2
- package/dist/components/UTDatePicker/utils.js +6 -2
- package/dist/components/UTDialog/constants.js +4 -2
- package/dist/components/UTDialog/index.js +37 -38
- package/dist/components/UTDialog/theme.js +2 -4
- package/dist/components/UTDialog/types.js +3 -2
- package/dist/components/UTDotMenu/index.js +61 -39
- package/dist/components/UTEmojiPicker/constants.js +11 -6
- package/dist/components/UTEmojiPicker/index.js +65 -45
- package/dist/components/UTEmojiPicker/theme.js +2 -4
- package/dist/components/UTEmojiPicker/utils.js +51 -21
- package/dist/components/UTExternalLink/constants.js +5 -3
- package/dist/components/UTExternalLink/index.js +15 -18
- package/dist/components/UTExternalLink/theme.js +6 -8
- package/dist/components/UTFileInput/constants.js +4 -2
- package/dist/components/UTFileInput/index.js +31 -7
- package/dist/components/UTFileInput/layout.js +97 -68
- package/dist/components/UTIconButton/index.js +72 -49
- package/dist/components/UTIconButton/theme.js +2 -4
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +58 -53
- package/dist/components/UTImageRadio/constants.js +6 -3
- package/dist/components/UTImageRadio/index.js +47 -39
- package/dist/components/UTImageRadio/theme.js +12 -11
- package/dist/components/UTImageRadio/types.js +3 -2
- package/dist/components/UTImageRadio/utils.js +6 -2
- package/dist/components/UTLabel/constants.js +20 -14
- package/dist/components/UTLabel/index.js +20 -18
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +18 -15
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +11 -8
- package/dist/components/UTMap/components/GoogleMaps/index.js +91 -63
- package/dist/components/UTMap/components/GoogleMaps/styles.js +3 -2
- package/dist/components/UTMap/constants.js +12 -6
- package/dist/components/UTMap/index.js +198 -163
- package/dist/components/UTMap/types.js +6 -4
- package/dist/components/UTMap/utils.js +46 -29
- package/dist/components/UTMap/withGoogleMapScript.js +22 -18
- package/dist/components/UTMenu/index.js +69 -52
- package/dist/components/UTMenu/theme.js +3 -5
- package/dist/components/UTMenu/utils.js +11 -5
- package/dist/components/UTModal/constants.js +13 -9
- package/dist/components/UTModal/index.js +30 -26
- package/dist/components/UTModal/theme.js +2 -4
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -11
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +39 -28
- package/dist/components/UTPagination/components/Pagination/utils.js +14 -8
- package/dist/components/UTPagination/constants.js +6 -3
- package/dist/components/UTPagination/index.js +17 -16
- package/dist/components/UTPagination/theme.js +2 -4
- package/dist/components/UTPanel/index.js +44 -38
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +10 -13
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +19 -22
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +50 -63
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +26 -25
- package/dist/components/UTPasswordField/index.js +23 -26
- package/dist/components/UTPasswordField/theme.js +2 -4
- package/dist/components/UTPhoneInput/constants.js +6 -3
- package/dist/components/UTPhoneInput/index.js +205 -180
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +8 -4
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -24
- package/dist/components/UTPieChart/components/Legend/contants.js +6 -3
- package/dist/components/UTPieChart/components/Legend/index.js +24 -27
- package/dist/components/UTPieChart/constants.js +26 -13
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +33 -15
- package/dist/components/UTPieChart/index.js +76 -73
- package/dist/components/UTPieChart/theme.js +2 -4
- package/dist/components/UTPieChart/utils.js +2 -4
- package/dist/components/UTProgressBar/constants.js +4 -2
- package/dist/components/UTProgressBar/index.js +17 -15
- package/dist/components/UTProgressBar/theme.js +2 -4
- package/dist/components/UTProgressBar/types.js +3 -2
- package/dist/components/UTRadioGroup/index.js +83 -56
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +56 -41
- package/dist/components/UTRating/components/Faces/constants.js +4 -2
- package/dist/components/UTRating/components/Faces/index.js +36 -34
- package/dist/components/UTRating/components/Star/index.js +40 -36
- package/dist/components/UTRating/constants.js +8 -4
- package/dist/components/UTRating/index.js +46 -31
- package/dist/components/UTRating/theme.js +2 -4
- package/dist/components/UTRipple/Ripple.js +39 -22
- package/dist/components/UTRipple/index.js +37 -18
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +8 -4
- package/dist/components/UTSelect/index.js +85 -63
- package/dist/components/UTSelect/stylesJS.js +3 -2
- package/dist/components/UTSelect/theme.js +4 -6
- package/dist/components/UTSelect/utils.js +13 -3
- package/dist/components/UTSidebar/components/ListOption/index.js +49 -34
- package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
- package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
- package/dist/components/UTSidebar/components/Option/constants.js +3 -2
- package/dist/components/UTSidebar/components/Option/index.js +32 -28
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +53 -42
- package/dist/components/UTSidebar/theme.js +2 -4
- package/dist/components/UTSidebar/types.js +10 -5
- package/dist/components/UTSkeleton/index.js +36 -10
- package/dist/components/UTStatus/constants.js +9 -5
- package/dist/components/UTStatus/index.js +15 -16
- package/dist/components/UTStatus/theme.js +49 -66
- package/dist/components/UTSwitch/constants.js +6 -3
- package/dist/components/UTSwitch/index.js +57 -42
- package/dist/components/UTSwitch/theme.js +2 -4
- package/dist/components/UTTable/components/ActionIcons/constants.js +2 -1
- package/dist/components/UTTable/components/ActionIcons/index.js +85 -47
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +12 -10
- package/dist/components/UTTable/components/Cell/index.js +23 -18
- package/dist/components/UTTable/components/HeaderCell/constants.js +3 -2
- package/dist/components/UTTable/components/HeaderCell/index.js +30 -23
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +11 -12
- package/dist/components/UTTable/components/ResponsiveCell/index.js +20 -19
- package/dist/components/UTTable/components/Status/index.js +19 -18
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -10
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +32 -21
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +14 -8
- package/dist/components/UTTable/components/TableFooter/constants.js +2 -1
- package/dist/components/UTTable/components/TableFooter/index.js +15 -15
- package/dist/components/UTTable/components/TableHeader/index.js +11 -11
- package/dist/components/UTTable/components/TableRow/constants.js +6 -3
- package/dist/components/UTTable/components/TableRow/index.js +94 -79
- package/dist/components/UTTable/constants.js +43 -26
- package/dist/components/UTTable/hook.js +26 -11
- package/dist/components/UTTable/index.js +223 -132
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +8 -4
- package/dist/components/UTTable/utils.js +74 -70
- package/dist/components/UTTabs/components/TooltipTab/index.js +30 -20
- package/dist/components/UTTabs/constants.js +8 -4
- package/dist/components/UTTabs/index.js +86 -57
- package/dist/components/UTTabs/theme.js +2 -4
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +6 -3
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +2 -4
- package/dist/components/UTTextInput/constants.js +3 -2
- package/dist/components/UTTextInput/index.js +165 -137
- package/dist/components/UTTextInput/theme.js +4 -6
- package/dist/components/UTThirdPartyCookieChecker/index.js +21 -17
- package/dist/components/UTToggle/components/ToggleOption/index.js +17 -16
- package/dist/components/UTToggle/index.js +26 -25
- package/dist/components/UTToggle/theme.js +2 -4
- package/dist/components/UTTooltip/index.js +30 -23
- package/dist/components/UTTooltip/theme.js +2 -4
- package/dist/components/UTTopbar/components/Notifications/index.js +14 -11
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +31 -28
- package/dist/components/UTTopbar/theme.js +2 -4
- package/dist/components/UTTopbar/types.js +9 -5
- package/dist/components/UTTouchableWithoutFeedback/index.js +27 -14
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +4 -2
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +12 -6
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +18 -8
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +47 -23
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +93 -81
- package/dist/components/UTVirtualizedList/constants.js +8 -4
- package/dist/components/UTVirtualizedList/index.js +38 -26
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +21 -17
- package/dist/components/UTWorkflowContainer/constants.js +6 -3
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +51 -32
- package/dist/components/UTWorkflowContainer/theme.js +53 -60
- package/dist/components/UTWorkflowContainer/types.js +3 -2
- package/dist/components/WithLoading/index.js +15 -10
- package/dist/components/WithTheme/index.js +17 -10
- package/dist/components/WithTheme/layout.js +28 -22
- package/dist/components/WithTouch/index.js +19 -12
- package/dist/constants/UTTable.js +3 -2
- package/dist/index.js +58 -58
- package/dist/theme.js +5 -6
- package/dist/types/commonTypes.js +5 -3
- package/dist/types/consumptionTypes.js +5 -3
- package/dist/types/formTypes.js +7 -4
- package/dist/types/tableTypes.js +3 -2
- package/dist/utils/classesUtils.js +13 -5
- package/dist/utils/componentUtils.js +13 -10
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +11 -13
- package/dist/utils/useScreenSize.js +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,39 +8,40 @@ exports.default = void 0;
|
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = require("prop-types");
|
|
9
10
|
var _commonTypes = require("../../../../types/commonTypes");
|
|
10
|
-
var
|
|
11
|
+
var _useVirtualizedData2 = _interopRequireDefault(require("./hooks/use-virtualized-data"));
|
|
11
12
|
var _utils = require("./utils");
|
|
12
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
var VirtualizedData = function VirtualizedData(_ref) {
|
|
18
|
+
var data = _ref.data,
|
|
19
|
+
elementsPerRow = _ref.elementsPerRow,
|
|
20
|
+
overscan = _ref.overscan,
|
|
21
|
+
itemRenderer = _ref.itemRenderer,
|
|
22
|
+
itemPadding = _ref.itemPadding,
|
|
23
|
+
listViewportRef = _ref.listViewportRef,
|
|
24
|
+
listViewportHeight = _ref.listViewportHeight,
|
|
25
|
+
listViewportWidth = _ref.listViewportWidth,
|
|
26
|
+
effect = _ref.effect,
|
|
27
|
+
reRenderOnChange = _ref.reRenderOnChange,
|
|
28
|
+
headerRenderer = _ref.headerRenderer,
|
|
29
|
+
footerRenderer = _ref.footerRenderer;
|
|
30
|
+
var elementWidth = Math.floor(listViewportWidth / elementsPerRow);
|
|
31
|
+
var rows = (0, _react.useMemo)(function () {
|
|
32
|
+
return (0, _utils.createRows)(data, elementsPerRow);
|
|
33
|
+
}, [data, elementsPerRow]);
|
|
34
|
+
var totalRows = rows.length;
|
|
35
|
+
var configItemRender = (0, _react.useMemo)(function () {
|
|
36
|
+
return {
|
|
37
|
+
itemRenderer: itemRenderer,
|
|
38
|
+
itemPadding: itemPadding,
|
|
39
|
+
elementWidth: elementWidth
|
|
40
|
+
};
|
|
41
|
+
}, [itemRenderer, itemPadding, elementWidth]);
|
|
42
|
+
var _useVirtualizedData = (0, _useVirtualizedData2.default)(rows, totalRows, overscan, listViewportHeight, listViewportWidth, configItemRender, listViewportRef, elementsPerRow, effect, reRenderOnChange),
|
|
43
|
+
virtualizedData = _useVirtualizedData.virtualizedData,
|
|
44
|
+
listHeight = _useVirtualizedData.listHeight;
|
|
43
45
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, headerRenderer && /*#__PURE__*/_react.default.createElement("div", {
|
|
44
46
|
className: _stylesModule.default.header
|
|
45
47
|
}, headerRenderer()), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -67,4 +69,5 @@ VirtualizedData.propTypes = {
|
|
|
67
69
|
headerRenderer: _propTypes.func,
|
|
68
70
|
footerRenderer: _propTypes.func
|
|
69
71
|
};
|
|
70
|
-
var _default =
|
|
72
|
+
var _default = /*#__PURE__*/(0, _react.memo)(VirtualizedData);
|
|
73
|
+
exports.default = _default;
|
|
@@ -9,115 +9,127 @@ var _constants = require("./components/ListRow/constants");
|
|
|
9
9
|
var _ListRow = _interopRequireDefault(require("./components/ListRow"));
|
|
10
10
|
var _constants2 = require("./constants");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable react/no-array-index-key */ /* eslint-disable no-plusplus */
|
|
18
|
+
var createRows = function createRows(data, elementsPerRow) {
|
|
19
|
+
var totalRows = Math.ceil(data.length / elementsPerRow);
|
|
20
|
+
var rows = new Array(totalRows).fill(0).map(function () {
|
|
21
|
+
return [];
|
|
22
|
+
});
|
|
23
|
+
for (var i = 0; i < data.length; i++) {
|
|
19
24
|
rows[Math.floor(i / elementsPerRow)].push(data[i]);
|
|
20
25
|
}
|
|
21
26
|
return rows;
|
|
22
27
|
};
|
|
23
28
|
exports.createRows = createRows;
|
|
24
|
-
|
|
29
|
+
var applyToIndex = function applyToIndex(index, target, object) {
|
|
30
|
+
return index === target ? object : null;
|
|
31
|
+
};
|
|
25
32
|
exports.applyToIndex = applyToIndex;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var createRowRenderer = function createRowRenderer(configItemRender, effect) {
|
|
34
|
+
return function (row, index, updateLedger, ledgerRef) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_ListRow.default, {
|
|
36
|
+
row: row,
|
|
37
|
+
index: index,
|
|
38
|
+
effect: effect,
|
|
39
|
+
configItemRender: configItemRender,
|
|
40
|
+
updateLedger: updateLedger,
|
|
41
|
+
ledgerRef: ledgerRef
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
};
|
|
34
45
|
exports.createRowRenderer = createRowRenderer;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
offset
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
const getFirstIndex = (ledger, scroll) => {
|
|
42
|
-
const offsets = getOffsets(ledger);
|
|
43
|
-
return Math.max(offsets.findIndex(offset => offset > scroll) - 1, 0);
|
|
46
|
+
var getOffsets = function getOffsets(ledger) {
|
|
47
|
+
return Object.values(ledger).map(function (_ref) {
|
|
48
|
+
var offset = _ref.offset;
|
|
49
|
+
return offset;
|
|
50
|
+
});
|
|
44
51
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
var getFirstIndex = function getFirstIndex(ledger, scroll) {
|
|
53
|
+
var offsets = getOffsets(ledger);
|
|
54
|
+
return Math.max(offsets.findIndex(function (offset) {
|
|
55
|
+
return offset > scroll;
|
|
56
|
+
}) - 1, 0);
|
|
57
|
+
};
|
|
58
|
+
var getElementsInViewport = function getElementsInViewport(ledger, scroll, listViewportHeight, firstIndex, totalElements) {
|
|
59
|
+
var offsets = getOffsets(ledger);
|
|
60
|
+
var index = offsets.findIndex(function (offset) {
|
|
61
|
+
return offset > scroll + listViewportHeight;
|
|
62
|
+
});
|
|
48
63
|
return (index !== -1 ? index : totalElements) - 1 - firstIndex;
|
|
49
64
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height
|
|
55
|
-
} = _ref2;
|
|
65
|
+
var getListHeight = function getListHeight(ledger) {
|
|
66
|
+
var values = Object.values(ledger);
|
|
67
|
+
var lastUsableIndex = values.findIndex(function (_ref2) {
|
|
68
|
+
var height = _ref2.height;
|
|
56
69
|
return !height;
|
|
57
70
|
});
|
|
58
|
-
|
|
59
|
-
height =
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
var _ref3 = values[lastUsableIndex !== -1 ? lastUsableIndex : values.length - 1] || {},
|
|
72
|
+
_ref3$height = _ref3.height,
|
|
73
|
+
height = _ref3$height === void 0 ? 0 : _ref3$height,
|
|
74
|
+
_ref3$offset = _ref3.offset,
|
|
75
|
+
offset = _ref3$offset === void 0 ? 0 : _ref3$offset;
|
|
62
76
|
return offset + height;
|
|
63
77
|
};
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
var renderVirtualScreen = function renderVirtualScreen(scrollPosition, overscan, totalElements, listViewportHeight, ledger) {
|
|
79
|
+
var listHeight = getListHeight(ledger);
|
|
66
80
|
if (!listViewportHeight) return {
|
|
67
81
|
virtualScreenStart: 0,
|
|
68
82
|
virtualScreenEnd: Math.min(2 * overscan, totalElements)
|
|
69
83
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
var firstElementIndex = getFirstIndex(ledger, scrollPosition);
|
|
85
|
+
var elementsInViewport = listHeight ? getElementsInViewport(ledger, scrollPosition, listViewportHeight, firstElementIndex, totalElements) : 0;
|
|
86
|
+
var upperScan = Math.min(firstElementIndex, overscan);
|
|
87
|
+
var lowerScan = Math.min(totalElements - (firstElementIndex + elementsInViewport), overscan);
|
|
88
|
+
var normalizedUpperScan = upperScan + overscan - lowerScan;
|
|
89
|
+
var normalizedLowerScan = lowerScan + overscan - upperScan;
|
|
90
|
+
var virtualScreenStart = Math.max(firstElementIndex - normalizedUpperScan, 0);
|
|
91
|
+
var virtualScreenEnd = Math.min(firstElementIndex + elementsInViewport + normalizedLowerScan, totalElements);
|
|
78
92
|
if (virtualScreenEnd - virtualScreenStart >= _constants2.MAX_LIMIT_MULTIPLIER * overscan) virtualScreenEnd = virtualScreenStart + _constants2.DEFAULT_LIMIT_MULTIPLIER * overscan;
|
|
79
93
|
return {
|
|
80
|
-
virtualScreenStart,
|
|
81
|
-
virtualScreenEnd,
|
|
82
|
-
listHeight
|
|
94
|
+
virtualScreenStart: virtualScreenStart,
|
|
95
|
+
virtualScreenEnd: virtualScreenEnd,
|
|
96
|
+
listHeight: listHeight
|
|
83
97
|
};
|
|
84
98
|
};
|
|
85
99
|
exports.renderVirtualScreen = renderVirtualScreen;
|
|
86
|
-
|
|
87
|
-
for (
|
|
100
|
+
var nullifyDataInBetween = function nullifyDataInBetween(data, startIndex, endIndex) {
|
|
101
|
+
for (var i = startIndex; i < endIndex; i++) data[i] = null;
|
|
88
102
|
};
|
|
89
103
|
exports.nullifyDataInBetween = nullifyDataInBetween;
|
|
90
|
-
|
|
91
|
-
for (
|
|
104
|
+
var addVirtualizedElements = function addVirtualizedElements(data, virtualizedData, startIndex, endIndex, rowRenderer, updateLedger, ledgerRef) {
|
|
105
|
+
for (var i = startIndex; i < endIndex; i++) {
|
|
92
106
|
if (!virtualizedData[i]) virtualizedData[i] = rowRenderer(data[i], i, updateLedger, ledgerRef);
|
|
93
107
|
}
|
|
94
108
|
};
|
|
95
109
|
exports.addVirtualizedElements = addVirtualizedElements;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
setLedgerRef(newLedger);
|
|
121
|
-
}
|
|
110
|
+
var updateLedger = function updateLedger(ledgerRef, setLedgerRef) {
|
|
111
|
+
return function (key, height) {
|
|
112
|
+
var _ledgerRef$current;
|
|
113
|
+
var currentHeight = (_ledgerRef$current = ledgerRef.current) === null || _ledgerRef$current === void 0 || (_ledgerRef$current = _ledgerRef$current[key]) === null || _ledgerRef$current === void 0 ? void 0 : _ledgerRef$current.height;
|
|
114
|
+
if (currentHeight !== height) {
|
|
115
|
+
var newLedger = _objectSpread(_objectSpread({}, ledgerRef.current), {}, _defineProperty({}, key, {
|
|
116
|
+
height: height
|
|
117
|
+
}));
|
|
118
|
+
var accumulator = 0;
|
|
119
|
+
var keys = Object.keys(newLedger);
|
|
120
|
+
keys.forEach(function (currentKey, index) {
|
|
121
|
+
if (!newLedger[currentKey].height) {
|
|
122
|
+
newLedger[currentKey].height = height;
|
|
123
|
+
}
|
|
124
|
+
if (index) {
|
|
125
|
+
accumulator += newLedger["".concat(_constants.KEY).concat(index - 1)].height;
|
|
126
|
+
}
|
|
127
|
+
newLedger[currentKey] = _objectSpread(_objectSpread({}, newLedger[currentKey]), {}, {
|
|
128
|
+
offset: accumulator
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
setLedgerRef(newLedger);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
122
134
|
};
|
|
123
135
|
exports.updateLedger = updateLedger;
|
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_OVERSCAN = exports.DEFAULT_ITEM_PADDING = exports.DEFAULT_ELEMENTS_PER_ROW = exports.DEFAULT_EFFECT = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var DEFAULT_ITEM_PADDING = 10;
|
|
8
|
+
exports.DEFAULT_ITEM_PADDING = DEFAULT_ITEM_PADDING;
|
|
9
|
+
var DEFAULT_OVERSCAN = 10;
|
|
10
|
+
exports.DEFAULT_OVERSCAN = DEFAULT_OVERSCAN;
|
|
11
|
+
var DEFAULT_EFFECT = 'fadeIn';
|
|
12
|
+
exports.DEFAULT_EFFECT = DEFAULT_EFFECT;
|
|
13
|
+
var DEFAULT_ELEMENTS_PER_ROW = 1;
|
|
14
|
+
exports.DEFAULT_ELEMENTS_PER_ROW = DEFAULT_ELEMENTS_PER_ROW;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -13,32 +14,42 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
13
14
|
var _constants = require("./constants");
|
|
14
15
|
var _VirtualizedData = _interopRequireDefault(require("./components/VirtualizedData"));
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
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); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
20
|
+
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."); }
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
+
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."); }
|
|
25
|
+
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); }
|
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
var UTVirtualizedList = function UTVirtualizedList(_ref) {
|
|
30
|
+
var data = _ref.data,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
elementsPerRow = _ref.elementsPerRow,
|
|
33
|
+
overscan = _ref.overscan,
|
|
34
|
+
itemRenderer = _ref.itemRenderer,
|
|
35
|
+
itemPadding = _ref.itemPadding,
|
|
36
|
+
NoDataComponent = _ref.NoDataComponent,
|
|
37
|
+
effect = _ref.effect,
|
|
38
|
+
loading = _ref.loading,
|
|
39
|
+
reRenderOnChange = _ref.reRenderOnChange,
|
|
40
|
+
headerRenderer = _ref.headerRenderer,
|
|
41
|
+
footerRenderer = _ref.footerRenderer;
|
|
42
|
+
var _useComponentDimensio = (0, _energyHooks.useComponentDimensions)(),
|
|
43
|
+
listViewportHeight = _useComponentDimensio.height,
|
|
44
|
+
listViewportWidth = _useComponentDimensio.width,
|
|
45
|
+
listViewportRef = _useComponentDimensio.ref;
|
|
46
|
+
var _useState = (0, _react.useState)(false),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
reRender = _useState2[0],
|
|
49
|
+
setReRender = _useState2[1];
|
|
50
|
+
(0, _react.useEffect)(function () {
|
|
40
51
|
setReRender(!reRender);
|
|
41
|
-
},
|
|
52
|
+
}, _toConsumableArray(reRenderOnChange));
|
|
42
53
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
54
|
className: "".concat(_stylesModule.default.container, " ").concat(className),
|
|
44
55
|
ref: listViewportRef
|
|
@@ -81,4 +92,5 @@ UTVirtualizedList.defaultProps = {
|
|
|
81
92
|
elementsPerRow: _constants.DEFAULT_ELEMENTS_PER_ROW,
|
|
82
93
|
reRenderOnChange: []
|
|
83
94
|
};
|
|
84
|
-
var _default =
|
|
95
|
+
var _default = UTVirtualizedList;
|
|
96
|
+
exports.default = _default;
|
|
@@ -10,29 +10,32 @@ var _UTButton = _interopRequireDefault(require("../../../UTButton"));
|
|
|
10
10
|
var _types = require("../../types");
|
|
11
11
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(
|
|
14
|
-
function _interopRequireWildcard(
|
|
13
|
+
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); }
|
|
14
|
+
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
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
16
|
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); }
|
|
16
|
-
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
|
+
var ActionButton = function ActionButton(_ref) {
|
|
17
23
|
var _button$buttonProps;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
25
|
-
return /*#__PURE__*/(0, _react.isValidElement)(button) ? ( /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
24
|
+
var button = _ref.button,
|
|
25
|
+
className = _ref.className,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
isHidden = _ref.isHidden,
|
|
28
|
+
buttonProps = _ref.buttonProps;
|
|
29
|
+
return /*#__PURE__*/(0, _react.isValidElement)(button) ? /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
26
30
|
className: "".concat(button.props.className, " ").concat(isHidden && _stylesModule.default.hiddenButton)
|
|
27
|
-
})
|
|
31
|
+
}) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
28
32
|
disabled: button.disabled,
|
|
29
33
|
hideTextOnResponsive: true,
|
|
30
34
|
onClick: button.onClick
|
|
31
35
|
}, buttonProps, button.buttonProps, {
|
|
32
|
-
classNames: {
|
|
33
|
-
root: "\n ".concat(className, "\n ").concat(isHidden && _stylesModule.default.hiddenButton, "\n ").concat(button === null || button === void 0 || (_button$buttonProps = button.buttonProps) === null || _button$buttonProps === void 0 ? void 0 : _button$buttonProps.className, "\n ")
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
+
classNames: _objectSpread({
|
|
37
|
+
root: "\n ".concat(className, "\n ").concat(isHidden && _stylesModule.default.hiddenButton, "\n ").concat(button === null || button === void 0 || (_button$buttonProps = button.buttonProps) === null || _button$buttonProps === void 0 ? void 0 : _button$buttonProps.className, "\n ")
|
|
38
|
+
}, buttonProps.classNames)
|
|
36
39
|
}), children);
|
|
37
40
|
};
|
|
38
41
|
ActionButton.propTypes = {
|
|
@@ -41,4 +44,5 @@ ActionButton.propTypes = {
|
|
|
41
44
|
isHidden: _propTypes.bool,
|
|
42
45
|
buttonProps: _propTypes.object
|
|
43
46
|
};
|
|
44
|
-
var _default =
|
|
47
|
+
var _default = ActionButton;
|
|
48
|
+
exports.default = _default;
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.STEP = exports.NEXT = exports.BACK = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var NEXT = 'Siguiente';
|
|
8
|
+
exports.NEXT = NEXT;
|
|
9
|
+
var BACK = 'Atrás';
|
|
10
|
+
exports.BACK = BACK;
|
|
11
|
+
var STEP = 'Paso';
|
|
12
|
+
exports.STEP = STEP;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.usePrevious = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(0, _react.useEffect)(()
|
|
8
|
+
var usePrevious = function usePrevious(value) {
|
|
9
|
+
var ref = (0, _react.useRef)();
|
|
10
|
+
(0, _react.useEffect)(function () {
|
|
11
11
|
ref.current = value;
|
|
12
12
|
});
|
|
13
13
|
return ref.current;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -19,39 +20,56 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
19
20
|
var _theme = require("./theme");
|
|
20
21
|
var _usePrevious = require("./hooks/use-previous");
|
|
21
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function _getRequireWildcardCache(
|
|
23
|
-
function _interopRequireWildcard(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
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); }
|
|
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; }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
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."); }
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var UTWorkflowContainer = function UTWorkflowContainer(_ref) {
|
|
32
|
+
var backButton = _ref.backButton,
|
|
33
|
+
children = _ref.children,
|
|
34
|
+
classNames = _ref.classNames,
|
|
35
|
+
_ref$classes = _ref.classes,
|
|
36
|
+
themeClasses = _ref$classes === void 0 ? {} : _ref$classes,
|
|
37
|
+
currentStep = _ref.currentStep,
|
|
38
|
+
extraActions = _ref.extraActions,
|
|
39
|
+
_ref$forceStepNumber = _ref.forceStepNumber,
|
|
40
|
+
forceStepNumber = _ref$forceStepNumber === void 0 ? false : _ref$forceStepNumber,
|
|
41
|
+
hideStepCounter = _ref.hideStepCounter,
|
|
42
|
+
nextButton = _ref.nextButton,
|
|
43
|
+
onExit = _ref.onExit,
|
|
44
|
+
_ref$smallButtons = _ref.smallButtons,
|
|
45
|
+
smallButtons = _ref$smallButtons === void 0 ? false : _ref$smallButtons,
|
|
46
|
+
StepCounter = _ref.stepCounter,
|
|
47
|
+
stepsCount = _ref.stepsCount,
|
|
48
|
+
subtitle = _ref.subtitle,
|
|
49
|
+
title = _ref.title,
|
|
50
|
+
TitleIcon = _ref.TitleIcon,
|
|
51
|
+
_ref$withIcon = _ref.withIcon,
|
|
52
|
+
withIcon = _ref$withIcon === void 0 ? false : _ref$withIcon;
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
return function () {
|
|
55
|
+
return onExit && onExit();
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
var classes = (0, _react.useMemo)(function () {
|
|
59
|
+
return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
|
|
60
|
+
}, [classNames]);
|
|
61
|
+
var BackIcon = backButton.Icon || _ArrowBack.default;
|
|
62
|
+
var NextIcon = nextButton.Icon || _ArrowForward.default;
|
|
63
|
+
var previousStepNumber = (0, _usePrevious.usePrevious)(currentStep);
|
|
64
|
+
var _useState = (0, _react.useState)(currentStep),
|
|
65
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
+
visibleStepNumber = _useState2[0],
|
|
67
|
+
setVisibleStepNumber = _useState2[1];
|
|
68
|
+
var skippedStepsQuantity = currentStep - visibleStepNumber;
|
|
69
|
+
(0, _react.useEffect)(function () {
|
|
52
70
|
if (previousStepNumber) setVisibleStepNumber(visibleStepNumber + Math.sign(currentStep - previousStepNumber));
|
|
53
71
|
}, [currentStep]);
|
|
54
|
-
|
|
72
|
+
var hideActions = (currentStep === 1 && !backButton.isVisible || backButton.isHidden) && hideStepCounter && nextButton.isHidden;
|
|
55
73
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
56
74
|
className: classes.container
|
|
57
75
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -125,4 +143,5 @@ UTWorkflowContainer.propTypes = {
|
|
|
125
143
|
TitleIcon: _propTypes.element,
|
|
126
144
|
withIcon: _propTypes.bool
|
|
127
145
|
};
|
|
128
|
-
var _default =
|
|
146
|
+
var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTWorkflowContainer);
|
|
147
|
+
exports.default = _default;
|