@widergy/energy-ui 2.12.2 → 2.12.3
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 +13 -36
- package/dist/components/Loading/constants.js +1 -2
- package/dist/components/Loading/index.js +13 -12
- package/dist/components/Loading/theme.js +4 -2
- package/dist/components/UTAlert/AlertHandler.js +75 -101
- package/dist/components/UTAlert/index.js +65 -87
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +8 -9
- package/dist/components/UTAttachment/constants.js +7 -13
- package/dist/components/UTAttachment/index.js +159 -250
- package/dist/components/UTAttachment/layout.js +26 -27
- package/dist/components/UTAttachment/theme.js +4 -2
- package/dist/components/UTAttachment/utils.js +34 -117
- package/dist/components/UTAutocomplete/components/ListBox/index.js +13 -21
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +9 -11
- package/dist/components/UTAutocomplete/constants.js +12 -23
- package/dist/components/UTAutocomplete/index.js +54 -94
- package/dist/components/UTAutocomplete/theme.js +6 -4
- package/dist/components/UTAvatar/constants.js +2 -3
- package/dist/components/UTAvatar/index.js +18 -17
- 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 +21 -22
- package/dist/components/UTBarChart/components/Bars/constants.js +3 -6
- package/dist/components/UTBarChart/components/Bars/index.js +70 -80
- package/dist/components/UTBarChart/components/Legend/constants.js +12 -18
- package/dist/components/UTBarChart/components/Legend/index.js +75 -93
- package/dist/components/UTBarChart/components/Legend/utils.js +1 -5
- package/dist/components/UTBarChart/components/Levels/index.js +16 -14
- package/dist/components/UTBarChart/components/Levels/utils.js +25 -27
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +3 -5
- package/dist/components/UTBarChart/components/LinearPlot/index.js +25 -20
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +37 -39
- package/dist/components/UTBarChart/components/Pagination/constants.js +1 -2
- package/dist/components/UTBarChart/components/Pagination/index.js +20 -24
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +21 -32
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +2 -4
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +20 -19
- package/dist/components/UTBarChart/components/XAxis/constants.js +1 -2
- package/dist/components/UTBarChart/components/XAxis/index.js +54 -65
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +12 -11
- package/dist/components/UTBarChart/components/YAxis/constants.js +1 -2
- package/dist/components/UTBarChart/components/YAxis/index.js +30 -37
- package/dist/components/UTBarChart/components/YAxis/utils.js +4 -6
- package/dist/components/UTBarChart/constants.js +4 -8
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +23 -40
- package/dist/components/UTBarChart/index.js +152 -166
- package/dist/components/UTBarChart/theme.js +4 -2
- package/dist/components/UTBarChart/types.js +10 -19
- package/dist/components/UTBarChart/utils.js +107 -111
- package/dist/components/UTBreadcrumbs/constants.js +23 -31
- package/dist/components/UTBreadcrumbs/index.js +76 -101
- package/dist/components/UTBreadcrumbs/theme.js +4 -2
- package/dist/components/UTButton/constants.js +11 -17
- package/dist/components/UTButton/index.js +28 -31
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +36 -40
- package/dist/components/UTCBUInput/theme.js +4 -2
- package/dist/components/UTCaptcha/index.js +19 -45
- package/dist/components/UTCard/components/UTCardFooter/index.js +15 -16
- package/dist/components/UTCard/index.js +85 -120
- package/dist/components/UTCard/theme.js +11 -12
- package/dist/components/UTCard/types.js +2 -3
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +13 -15
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +5 -10
- package/dist/components/UTCarousel/components/Slider/index.js +204 -273
- package/dist/components/UTCarousel/components/Slider/layout.js +67 -94
- package/dist/components/UTCarousel/index.js +14 -15
- package/dist/components/UTCarousel/theme.js +4 -2
- package/dist/components/UTCheckList/constants.js +1 -2
- package/dist/components/UTCheckList/index.js +72 -93
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +3 -6
- package/dist/components/UTCheckbox/index.js +32 -44
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +3 -6
- package/dist/components/UTConsumptionBar/index.js +53 -80
- package/dist/components/UTCuit/index.js +109 -133
- package/dist/components/UTCuit/theme.js +51 -53
- package/dist/components/UTDatePicker/components/Day/constants.js +1 -2
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +20 -31
- package/dist/components/UTDatePicker/index.js +60 -102
- package/dist/components/UTDatePicker/theme.js +5 -3
- package/dist/components/UTDatePicker/types.js +2 -3
- package/dist/components/UTDatePicker/utils.js +2 -6
- package/dist/components/UTDialog/constants.js +2 -4
- package/dist/components/UTDialog/index.js +38 -37
- package/dist/components/UTDialog/theme.js +4 -2
- package/dist/components/UTDialog/types.js +2 -3
- package/dist/components/UTDotMenu/index.js +39 -61
- package/dist/components/UTEmojiPicker/constants.js +6 -11
- package/dist/components/UTEmojiPicker/index.js +45 -65
- package/dist/components/UTEmojiPicker/theme.js +4 -2
- package/dist/components/UTEmojiPicker/utils.js +21 -51
- package/dist/components/UTExternalLink/constants.js +3 -5
- package/dist/components/UTExternalLink/index.js +18 -15
- package/dist/components/UTExternalLink/theme.js +8 -6
- package/dist/components/UTFileInput/constants.js +2 -4
- package/dist/components/UTFileInput/index.js +7 -31
- package/dist/components/UTFileInput/layout.js +68 -97
- package/dist/components/UTIconButton/index.js +49 -72
- package/dist/components/UTIconButton/theme.js +4 -2
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +53 -58
- package/dist/components/UTImageRadio/constants.js +3 -6
- package/dist/components/UTImageRadio/index.js +39 -47
- package/dist/components/UTImageRadio/theme.js +11 -12
- package/dist/components/UTImageRadio/types.js +2 -3
- package/dist/components/UTImageRadio/utils.js +2 -6
- package/dist/components/UTLabel/constants.js +14 -20
- package/dist/components/UTLabel/index.js +18 -20
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +15 -18
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +8 -11
- package/dist/components/UTMap/components/GoogleMaps/index.js +63 -91
- package/dist/components/UTMap/components/GoogleMaps/styles.js +2 -3
- package/dist/components/UTMap/constants.js +6 -12
- package/dist/components/UTMap/index.js +163 -198
- package/dist/components/UTMap/types.js +4 -6
- package/dist/components/UTMap/utils.js +29 -46
- package/dist/components/UTMap/withGoogleMapScript.js +18 -22
- package/dist/components/UTMenu/index.js +52 -69
- package/dist/components/UTMenu/theme.js +5 -3
- package/dist/components/UTMenu/utils.js +5 -11
- package/dist/components/UTModal/constants.js +9 -13
- package/dist/components/UTModal/index.js +26 -30
- package/dist/components/UTModal/theme.js +4 -2
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +11 -10
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +7 -13
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +28 -39
- package/dist/components/UTPagination/components/Pagination/utils.js +8 -14
- package/dist/components/UTPagination/constants.js +3 -6
- package/dist/components/UTPagination/index.js +16 -17
- package/dist/components/UTPagination/theme.js +4 -2
- package/dist/components/UTPanel/index.js +38 -44
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +13 -10
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +22 -19
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +63 -50
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +25 -26
- package/dist/components/UTPasswordField/index.js +26 -23
- package/dist/components/UTPasswordField/theme.js +4 -2
- package/dist/components/UTPhoneInput/constants.js +3 -6
- package/dist/components/UTPhoneInput/index.js +180 -205
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -8
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +24 -23
- package/dist/components/UTPieChart/components/Legend/contants.js +3 -6
- package/dist/components/UTPieChart/components/Legend/index.js +27 -24
- package/dist/components/UTPieChart/constants.js +13 -26
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +15 -33
- package/dist/components/UTPieChart/index.js +73 -76
- package/dist/components/UTPieChart/theme.js +4 -2
- package/dist/components/UTPieChart/utils.js +4 -2
- package/dist/components/UTProgressBar/constants.js +2 -4
- package/dist/components/UTProgressBar/index.js +15 -17
- package/dist/components/UTProgressBar/theme.js +4 -2
- package/dist/components/UTProgressBar/types.js +2 -3
- package/dist/components/UTRadioGroup/index.js +56 -83
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +41 -56
- package/dist/components/UTRating/components/Faces/constants.js +2 -4
- package/dist/components/UTRating/components/Faces/index.js +34 -36
- package/dist/components/UTRating/components/Star/index.js +36 -40
- package/dist/components/UTRating/constants.js +4 -8
- package/dist/components/UTRating/index.js +31 -46
- package/dist/components/UTRating/theme.js +4 -2
- package/dist/components/UTRipple/Ripple.js +22 -39
- package/dist/components/UTRipple/index.js +18 -37
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +4 -8
- package/dist/components/UTSelect/index.js +63 -85
- package/dist/components/UTSelect/stylesJS.js +2 -3
- package/dist/components/UTSelect/theme.js +6 -4
- package/dist/components/UTSelect/utils.js +3 -13
- package/dist/components/UTSidebar/components/ListOption/index.js +34 -49
- 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 +2 -3
- package/dist/components/UTSidebar/components/Option/index.js +28 -32
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +42 -53
- package/dist/components/UTSidebar/theme.js +4 -2
- package/dist/components/UTSidebar/types.js +5 -10
- package/dist/components/UTSkeleton/index.js +10 -36
- package/dist/components/UTStatus/constants.js +5 -9
- package/dist/components/UTStatus/index.js +16 -15
- package/dist/components/UTStatus/theme.js +66 -49
- package/dist/components/UTSwitch/constants.js +3 -6
- package/dist/components/UTSwitch/index.js +42 -57
- package/dist/components/UTSwitch/theme.js +4 -2
- package/dist/components/UTTable/components/ActionIcons/constants.js +1 -2
- package/dist/components/UTTable/components/ActionIcons/index.js +47 -85
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +10 -12
- package/dist/components/UTTable/components/Cell/index.js +18 -23
- package/dist/components/UTTable/components/HeaderCell/constants.js +2 -3
- package/dist/components/UTTable/components/HeaderCell/index.js +23 -30
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +12 -11
- package/dist/components/UTTable/components/ResponsiveCell/index.js +19 -20
- package/dist/components/UTTable/components/Status/index.js +18 -19
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +10 -9
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +7 -13
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +21 -32
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +8 -14
- package/dist/components/UTTable/components/TableFooter/constants.js +1 -2
- 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 +3 -6
- package/dist/components/UTTable/components/TableRow/index.js +82 -95
- package/dist/components/UTTable/components/TableRow/styles.module.scss +8 -1
- package/dist/components/UTTable/components/TableRow/utils.js +15 -0
- package/dist/components/UTTable/constants.js +26 -43
- package/dist/components/UTTable/hook.js +11 -26
- package/dist/components/UTTable/index.js +129 -220
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +4 -8
- package/dist/components/UTTable/utils.js +70 -74
- package/dist/components/UTTabs/components/TooltipTab/index.js +20 -30
- package/dist/components/UTTabs/constants.js +4 -8
- package/dist/components/UTTabs/index.js +57 -86
- package/dist/components/UTTabs/theme.js +4 -2
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +3 -6
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +4 -2
- package/dist/components/UTTextInput/constants.js +2 -3
- package/dist/components/UTTextInput/index.js +137 -165
- package/dist/components/UTTextInput/theme.js +6 -4
- package/dist/components/UTThirdPartyCookieChecker/index.js +17 -21
- package/dist/components/UTToggle/components/ToggleOption/index.js +16 -17
- package/dist/components/UTToggle/index.js +25 -26
- package/dist/components/UTToggle/theme.js +4 -2
- package/dist/components/UTTooltip/index.js +23 -30
- package/dist/components/UTTooltip/theme.js +4 -2
- package/dist/components/UTTopbar/components/Notifications/index.js +11 -14
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +28 -31
- package/dist/components/UTTopbar/theme.js +4 -2
- package/dist/components/UTTopbar/types.js +5 -9
- package/dist/components/UTTouchableWithoutFeedback/index.js +14 -27
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -12
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +8 -18
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +23 -47
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +81 -93
- package/dist/components/UTVirtualizedList/constants.js +4 -8
- package/dist/components/UTVirtualizedList/index.js +26 -38
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +17 -21
- package/dist/components/UTWorkflowContainer/constants.js +3 -6
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +32 -51
- package/dist/components/UTWorkflowContainer/theme.js +60 -53
- package/dist/components/UTWorkflowContainer/types.js +2 -3
- package/dist/components/WithLoading/index.js +10 -15
- package/dist/components/WithTheme/index.js +10 -17
- package/dist/components/WithTheme/layout.js +22 -28
- package/dist/components/WithTouch/index.js +12 -19
- package/dist/constants/UTTable.js +2 -3
- package/dist/index.js +58 -58
- package/dist/theme.js +6 -5
- package/dist/types/commonTypes.js +3 -5
- package/dist/types/consumptionTypes.js +3 -5
- package/dist/types/formTypes.js +4 -7
- package/dist/types/tableTypes.js +2 -3
- package/dist/utils/classesUtils.js +5 -13
- package/dist/utils/componentUtils.js +10 -13
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +13 -11
- package/dist/utils/useScreenSize.js +2 -3
- package/package.json +1 -1
package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js
CHANGED
|
@@ -10,56 +10,33 @@ var _constants = require("../constants");
|
|
|
10
10
|
var _utils = require("../utils");
|
|
11
11
|
var _useLedger = _interopRequireDefault(require("./use-ledger"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
var useVirtualizedData = function useVirtualizedData(data, totalElements, overscan, listViewportHeight, listViewportWidth, configItemRender, listViewportRef, elementsPerRow, effect, reRenderOnChange) {
|
|
24
|
-
var _useState = (0, _react.useState)(false),
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
shouldReRender = _useState2[0],
|
|
27
|
-
setShouldReRender = _useState2[1];
|
|
28
|
-
var _useState3 = (0, _react.useState)(0),
|
|
29
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
-
scroll = _useState4[0],
|
|
31
|
-
setScroll = _useState4[1];
|
|
32
|
-
var _useState5 = (0, _react.useState)([]),
|
|
33
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
-
virtualizedData = _useState6[0],
|
|
35
|
-
setVirtualizedData = _useState6[1];
|
|
36
|
-
var _useHeightLedger = (0, _useLedger.default)(data),
|
|
37
|
-
_useHeightLedger2 = _slicedToArray(_useHeightLedger, 2),
|
|
38
|
-
heightLedger = _useHeightLedger2[0],
|
|
39
|
-
setHeightLedger = _useHeightLedger2[1];
|
|
40
|
-
var updateScroll = function updateScroll(_ref) {
|
|
41
|
-
var target = _ref.target;
|
|
13
|
+
const useVirtualizedData = (data, totalElements, overscan, listViewportHeight, listViewportWidth, configItemRender, listViewportRef, elementsPerRow, effect, reRenderOnChange) => {
|
|
14
|
+
const [shouldReRender, setShouldReRender] = (0, _react.useState)(false);
|
|
15
|
+
const [scroll, setScroll] = (0, _react.useState)(0);
|
|
16
|
+
const [virtualizedData, setVirtualizedData] = (0, _react.useState)([]);
|
|
17
|
+
const [heightLedger, setHeightLedger] = (0, _useLedger.default)(data);
|
|
18
|
+
const updateScroll = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
target
|
|
21
|
+
} = _ref;
|
|
42
22
|
if (target === listViewportRef.current) {
|
|
43
|
-
|
|
23
|
+
const currentScroll = target.scrollTop;
|
|
44
24
|
setScroll(currentScroll);
|
|
45
25
|
}
|
|
46
26
|
};
|
|
47
27
|
(0, _energyHooks.useScrollbarThrottle)(updateScroll, listViewportRef, _constants.SCROLL_THROTTLE_DELAY);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(0, _react.useEffect)(function () {
|
|
28
|
+
const rowRenderer = (0, _react.useCallback)((0, _utils.createRowRenderer)(configItemRender, effect), [configItemRender, effect]);
|
|
29
|
+
const {
|
|
30
|
+
virtualScreenStart,
|
|
31
|
+
virtualScreenEnd,
|
|
32
|
+
listHeight
|
|
33
|
+
} = (0, _react.useMemo)(() => (0, _utils.renderVirtualScreen)(scroll, overscan, totalElements, listViewportHeight, heightLedger.current), [scroll, overscan, totalElements, heightLedger.current, listViewportHeight]);
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
56
35
|
setShouldReRender(true);
|
|
57
36
|
}, [listViewportWidth, rowRenderer, elementsPerRow, heightLedger.current, data, reRenderOnChange]);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(0, _react.useEffect)(function () {
|
|
62
|
-
var newVirtualizedData = shouldReRender ? new Array(totalElements).fill(null) : _toConsumableArray(virtualizedData);
|
|
37
|
+
const ledgerUpdater = (0, _react.useMemo)(() => (0, _utils.updateLedger)(heightLedger, setHeightLedger), [heightLedger, setHeightLedger]);
|
|
38
|
+
(0, _react.useEffect)(() => {
|
|
39
|
+
const newVirtualizedData = shouldReRender ? new Array(totalElements).fill(null) : [...virtualizedData];
|
|
63
40
|
(0, _utils.nullifyDataInBetween)(newVirtualizedData, 0, virtualScreenStart);
|
|
64
41
|
(0, _utils.nullifyDataInBetween)(newVirtualizedData, virtualScreenEnd, newVirtualizedData.length);
|
|
65
42
|
(0, _utils.addVirtualizedElements)(data, newVirtualizedData, virtualScreenStart, virtualScreenEnd, rowRenderer, ledgerUpdater, heightLedger);
|
|
@@ -67,9 +44,8 @@ var useVirtualizedData = function useVirtualizedData(data, totalElements, oversc
|
|
|
67
44
|
if (shouldReRender) setShouldReRender(false);
|
|
68
45
|
}, [virtualScreenStart, virtualScreenEnd, shouldReRender, ledgerUpdater]);
|
|
69
46
|
return {
|
|
70
|
-
virtualizedData
|
|
71
|
-
listHeight
|
|
47
|
+
virtualizedData,
|
|
48
|
+
listHeight
|
|
72
49
|
};
|
|
73
50
|
};
|
|
74
|
-
var _default = useVirtualizedData;
|
|
75
|
-
exports.default = _default;
|
|
51
|
+
var _default = exports.default = useVirtualizedData;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,40 +7,39 @@ exports.default = void 0;
|
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _propTypes = require("prop-types");
|
|
10
9
|
var _commonTypes = require("../../../../types/commonTypes");
|
|
11
|
-
var
|
|
10
|
+
var _useVirtualizedData = _interopRequireDefault(require("./hooks/use-virtualized-data"));
|
|
12
11
|
var _utils = require("./utils");
|
|
13
12
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
function _getRequireWildcardCache(
|
|
16
|
-
function _interopRequireWildcard(
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
listHeight = _useVirtualizedData.listHeight;
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
const VirtualizedData = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
data,
|
|
19
|
+
elementsPerRow,
|
|
20
|
+
overscan,
|
|
21
|
+
itemRenderer,
|
|
22
|
+
itemPadding,
|
|
23
|
+
listViewportRef,
|
|
24
|
+
listViewportHeight,
|
|
25
|
+
listViewportWidth,
|
|
26
|
+
effect,
|
|
27
|
+
reRenderOnChange,
|
|
28
|
+
headerRenderer,
|
|
29
|
+
footerRenderer
|
|
30
|
+
} = _ref;
|
|
31
|
+
const elementWidth = Math.floor(listViewportWidth / elementsPerRow);
|
|
32
|
+
const rows = (0, _react.useMemo)(() => (0, _utils.createRows)(data, elementsPerRow), [data, elementsPerRow]);
|
|
33
|
+
const totalRows = rows.length;
|
|
34
|
+
const configItemRender = (0, _react.useMemo)(() => ({
|
|
35
|
+
itemRenderer,
|
|
36
|
+
itemPadding,
|
|
37
|
+
elementWidth
|
|
38
|
+
}), [itemRenderer, itemPadding, elementWidth]);
|
|
39
|
+
const {
|
|
40
|
+
virtualizedData,
|
|
41
|
+
listHeight
|
|
42
|
+
} = (0, _useVirtualizedData.default)(rows, totalRows, overscan, listViewportHeight, listViewportWidth, configItemRender, listViewportRef, elementsPerRow, effect, reRenderOnChange);
|
|
45
43
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, headerRenderer && /*#__PURE__*/_react.default.createElement("div", {
|
|
46
44
|
className: _stylesModule.default.header
|
|
47
45
|
}, headerRenderer()), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -69,5 +67,4 @@ VirtualizedData.propTypes = {
|
|
|
69
67
|
headerRenderer: _propTypes.func,
|
|
70
68
|
footerRenderer: _propTypes.func
|
|
71
69
|
};
|
|
72
|
-
var _default = /*#__PURE__*/(0, _react.memo)(VirtualizedData);
|
|
73
|
-
exports.default = _default;
|
|
70
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(VirtualizedData);
|
|
@@ -9,127 +9,115 @@ 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
|
-
|
|
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++) {
|
|
12
|
+
/* eslint-disable react/no-array-index-key */
|
|
13
|
+
/* eslint-disable no-plusplus */
|
|
14
|
+
|
|
15
|
+
const createRows = (data, elementsPerRow) => {
|
|
16
|
+
const totalRows = Math.ceil(data.length / elementsPerRow);
|
|
17
|
+
const rows = new Array(totalRows).fill(0).map(() => []);
|
|
18
|
+
for (let i = 0; i < data.length; i++) {
|
|
24
19
|
rows[Math.floor(i / elementsPerRow)].push(data[i]);
|
|
25
20
|
}
|
|
26
21
|
return rows;
|
|
27
22
|
};
|
|
28
23
|
exports.createRows = createRows;
|
|
29
|
-
|
|
30
|
-
return index === target ? object : null;
|
|
31
|
-
};
|
|
24
|
+
const applyToIndex = (index, target, object) => index === target ? object : null;
|
|
32
25
|
exports.applyToIndex = applyToIndex;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ledgerRef: ledgerRef
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
};
|
|
26
|
+
const createRowRenderer = (configItemRender, effect) => (row, index, updateLedger, ledgerRef) => /*#__PURE__*/_react.default.createElement(_ListRow.default, {
|
|
27
|
+
row: row,
|
|
28
|
+
index: index,
|
|
29
|
+
effect: effect,
|
|
30
|
+
configItemRender: configItemRender,
|
|
31
|
+
updateLedger: updateLedger,
|
|
32
|
+
ledgerRef: ledgerRef
|
|
33
|
+
});
|
|
45
34
|
exports.createRowRenderer = createRowRenderer;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return Math.max(offsets.findIndex(
|
|
55
|
-
return offset > scroll;
|
|
56
|
-
}) - 1, 0);
|
|
35
|
+
const getOffsets = ledger => Object.values(ledger).map(_ref => {
|
|
36
|
+
let {
|
|
37
|
+
offset
|
|
38
|
+
} = _ref;
|
|
39
|
+
return offset;
|
|
40
|
+
});
|
|
41
|
+
const getFirstIndex = (ledger, scroll) => {
|
|
42
|
+
const offsets = getOffsets(ledger);
|
|
43
|
+
return Math.max(offsets.findIndex(offset => offset > scroll) - 1, 0);
|
|
57
44
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return offset > scroll + listViewportHeight;
|
|
62
|
-
});
|
|
45
|
+
const getElementsInViewport = (ledger, scroll, listViewportHeight, firstIndex, totalElements) => {
|
|
46
|
+
const offsets = getOffsets(ledger);
|
|
47
|
+
const index = offsets.findIndex(offset => offset > scroll + listViewportHeight);
|
|
63
48
|
return (index !== -1 ? index : totalElements) - 1 - firstIndex;
|
|
64
49
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
const getListHeight = ledger => {
|
|
51
|
+
const values = Object.values(ledger);
|
|
52
|
+
const lastUsableIndex = values.findIndex(_ref2 => {
|
|
53
|
+
let {
|
|
54
|
+
height
|
|
55
|
+
} = _ref2;
|
|
69
56
|
return !height;
|
|
70
57
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
offset = _ref3$offset === void 0 ? 0 : _ref3$offset;
|
|
58
|
+
const {
|
|
59
|
+
height = 0,
|
|
60
|
+
offset = 0
|
|
61
|
+
} = values[lastUsableIndex !== -1 ? lastUsableIndex : values.length - 1] || {};
|
|
76
62
|
return offset + height;
|
|
77
63
|
};
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
const renderVirtualScreen = (scrollPosition, overscan, totalElements, listViewportHeight, ledger) => {
|
|
65
|
+
const listHeight = getListHeight(ledger);
|
|
80
66
|
if (!listViewportHeight) return {
|
|
81
67
|
virtualScreenStart: 0,
|
|
82
68
|
virtualScreenEnd: Math.min(2 * overscan, totalElements)
|
|
83
69
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
70
|
+
const firstElementIndex = getFirstIndex(ledger, scrollPosition);
|
|
71
|
+
const elementsInViewport = listHeight ? getElementsInViewport(ledger, scrollPosition, listViewportHeight, firstElementIndex, totalElements) : 0;
|
|
72
|
+
const upperScan = Math.min(firstElementIndex, overscan);
|
|
73
|
+
const lowerScan = Math.min(totalElements - (firstElementIndex + elementsInViewport), overscan);
|
|
74
|
+
const normalizedUpperScan = upperScan + overscan - lowerScan;
|
|
75
|
+
const normalizedLowerScan = lowerScan + overscan - upperScan;
|
|
76
|
+
const virtualScreenStart = Math.max(firstElementIndex - normalizedUpperScan, 0);
|
|
77
|
+
let virtualScreenEnd = Math.min(firstElementIndex + elementsInViewport + normalizedLowerScan, totalElements);
|
|
92
78
|
if (virtualScreenEnd - virtualScreenStart >= _constants2.MAX_LIMIT_MULTIPLIER * overscan) virtualScreenEnd = virtualScreenStart + _constants2.DEFAULT_LIMIT_MULTIPLIER * overscan;
|
|
93
79
|
return {
|
|
94
|
-
virtualScreenStart
|
|
95
|
-
virtualScreenEnd
|
|
96
|
-
listHeight
|
|
80
|
+
virtualScreenStart,
|
|
81
|
+
virtualScreenEnd,
|
|
82
|
+
listHeight
|
|
97
83
|
};
|
|
98
84
|
};
|
|
99
85
|
exports.renderVirtualScreen = renderVirtualScreen;
|
|
100
|
-
|
|
101
|
-
for (
|
|
86
|
+
const nullifyDataInBetween = (data, startIndex, endIndex) => {
|
|
87
|
+
for (let i = startIndex; i < endIndex; i++) data[i] = null;
|
|
102
88
|
};
|
|
103
89
|
exports.nullifyDataInBetween = nullifyDataInBetween;
|
|
104
|
-
|
|
105
|
-
for (
|
|
90
|
+
const addVirtualizedElements = (data, virtualizedData, startIndex, endIndex, rowRenderer, updateLedger, ledgerRef) => {
|
|
91
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
106
92
|
if (!virtualizedData[i]) virtualizedData[i] = rowRenderer(data[i], i, updateLedger, ledgerRef);
|
|
107
93
|
}
|
|
108
94
|
};
|
|
109
95
|
exports.addVirtualizedElements = addVirtualizedElements;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
96
|
+
const updateLedger = (ledgerRef, setLedgerRef) => (key, height) => {
|
|
97
|
+
var _ledgerRef$current;
|
|
98
|
+
const 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;
|
|
99
|
+
if (currentHeight !== height) {
|
|
100
|
+
const newLedger = {
|
|
101
|
+
...ledgerRef.current,
|
|
102
|
+
[key]: {
|
|
103
|
+
height
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
let accumulator = 0;
|
|
107
|
+
const keys = Object.keys(newLedger);
|
|
108
|
+
keys.forEach((currentKey, index) => {
|
|
109
|
+
if (!newLedger[currentKey].height) {
|
|
110
|
+
newLedger[currentKey].height = height;
|
|
111
|
+
}
|
|
112
|
+
if (index) {
|
|
113
|
+
accumulator += newLedger["".concat(_constants.KEY).concat(index - 1)].height;
|
|
114
|
+
}
|
|
115
|
+
newLedger[currentKey] = {
|
|
116
|
+
...newLedger[currentKey],
|
|
117
|
+
offset: accumulator
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
setLedgerRef(newLedger);
|
|
121
|
+
}
|
|
134
122
|
};
|
|
135
123
|
exports.updateLedger = updateLedger;
|
|
@@ -4,11 +4,7 @@ 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
|
-
exports.
|
|
9
|
-
|
|
10
|
-
exports.
|
|
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;
|
|
7
|
+
const DEFAULT_ITEM_PADDING = exports.DEFAULT_ITEM_PADDING = 10;
|
|
8
|
+
const DEFAULT_OVERSCAN = exports.DEFAULT_OVERSCAN = 10;
|
|
9
|
+
const DEFAULT_EFFECT = exports.DEFAULT_EFFECT = 'fadeIn';
|
|
10
|
+
const DEFAULT_ELEMENTS_PER_ROW = exports.DEFAULT_ELEMENTS_PER_ROW = 1;
|
|
@@ -1,6 +1,5 @@
|
|
|
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -14,42 +13,32 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
14
13
|
var _constants = require("./constants");
|
|
15
14
|
var _VirtualizedData = _interopRequireDefault(require("./components/VirtualizedData"));
|
|
16
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
function _getRequireWildcardCache(
|
|
18
|
-
function _interopRequireWildcard(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 () {
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
const UTVirtualizedList = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
data,
|
|
21
|
+
className,
|
|
22
|
+
elementsPerRow,
|
|
23
|
+
overscan,
|
|
24
|
+
itemRenderer,
|
|
25
|
+
itemPadding,
|
|
26
|
+
NoDataComponent,
|
|
27
|
+
effect,
|
|
28
|
+
loading,
|
|
29
|
+
reRenderOnChange,
|
|
30
|
+
headerRenderer,
|
|
31
|
+
footerRenderer
|
|
32
|
+
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
height: listViewportHeight,
|
|
35
|
+
width: listViewportWidth,
|
|
36
|
+
ref: listViewportRef
|
|
37
|
+
} = (0, _energyHooks.useComponentDimensions)();
|
|
38
|
+
const [reRender, setReRender] = (0, _react.useState)(false);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
51
40
|
setReRender(!reRender);
|
|
52
|
-
},
|
|
41
|
+
}, [...reRenderOnChange]);
|
|
53
42
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
43
|
className: "".concat(_stylesModule.default.container, " ").concat(className),
|
|
55
44
|
ref: listViewportRef
|
|
@@ -92,5 +81,4 @@ UTVirtualizedList.defaultProps = {
|
|
|
92
81
|
elementsPerRow: _constants.DEFAULT_ELEMENTS_PER_ROW,
|
|
93
82
|
reRenderOnChange: []
|
|
94
83
|
};
|
|
95
|
-
var _default = UTVirtualizedList;
|
|
96
|
-
exports.default = _default;
|
|
84
|
+
var _default = exports.default = UTVirtualizedList;
|
|
@@ -10,32 +10,29 @@ 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(
|
|
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); }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
15
|
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); }
|
|
17
|
-
|
|
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) {
|
|
16
|
+
const ActionButton = _ref => {
|
|
23
17
|
var _button$buttonProps;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
let {
|
|
19
|
+
button,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
isHidden,
|
|
23
|
+
buttonProps
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/(0, _react.isValidElement)(button) ? ( /*#__PURE__*/(0, _react.cloneElement)(button, {
|
|
30
26
|
className: "".concat(button.props.className, " ").concat(isHidden && _stylesModule.default.hiddenButton)
|
|
31
|
-
}) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
27
|
+
})) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
32
28
|
disabled: button.disabled,
|
|
33
29
|
hideTextOnResponsive: true,
|
|
34
30
|
onClick: button.onClick
|
|
35
31
|
}, buttonProps, button.buttonProps, {
|
|
36
|
-
classNames:
|
|
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
|
-
|
|
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
|
+
...buttonProps.classNames
|
|
35
|
+
}
|
|
39
36
|
}), children);
|
|
40
37
|
};
|
|
41
38
|
ActionButton.propTypes = {
|
|
@@ -44,5 +41,4 @@ ActionButton.propTypes = {
|
|
|
44
41
|
isHidden: _propTypes.bool,
|
|
45
42
|
buttonProps: _propTypes.object
|
|
46
43
|
};
|
|
47
|
-
var _default = ActionButton;
|
|
48
|
-
exports.default = _default;
|
|
44
|
+
var _default = exports.default = ActionButton;
|
|
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.STEP = exports.NEXT = exports.BACK = void 0;
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
exports.BACK = BACK;
|
|
11
|
-
var STEP = 'Paso';
|
|
12
|
-
exports.STEP = STEP;
|
|
7
|
+
const NEXT = exports.NEXT = 'Siguiente';
|
|
8
|
+
const BACK = exports.BACK = 'Atrás';
|
|
9
|
+
const STEP = exports.STEP = 'Paso';
|
|
@@ -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
|
+
const usePrevious = value => {
|
|
9
|
+
const ref = (0, _react.useRef)();
|
|
10
|
+
(0, _react.useEffect)(() => {
|
|
11
11
|
ref.current = value;
|
|
12
12
|
});
|
|
13
13
|
return ref.current;
|