@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
|
@@ -7,67 +7,81 @@ exports.getPages = exports.getMinValue = exports.getMaxValues = exports.getMaxVa
|
|
|
7
7
|
var _array = require("@widergy/web-utils/lib/array");
|
|
8
8
|
var d3 = _interopRequireWildcard(require("d3"));
|
|
9
9
|
var _constants = require("./constants");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var _excluded = ["x"],
|
|
11
|
+
_excluded2 = ["x"];
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
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 getPages = function getPages() {
|
|
23
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
|
+
var pagination = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
25
|
return Math.ceil(data.length / pagination);
|
|
16
26
|
};
|
|
17
27
|
exports.getPages = getPages;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
var getFormattedData = function getFormattedData() {
|
|
29
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
30
|
+
var pagination = arguments.length > 1 ? arguments[1] : undefined;
|
|
31
|
+
var index = arguments.length > 2 ? arguments[2] : undefined;
|
|
22
32
|
return data.slice(index * pagination, (index + 1) * pagination);
|
|
23
33
|
};
|
|
24
34
|
exports.getFormattedData = getFormattedData;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return linearData.filter(_ref
|
|
30
|
-
|
|
31
|
-
xCoordinate
|
|
32
|
-
} = _ref;
|
|
35
|
+
var getFormattedLinearData = function getFormattedLinearData() {
|
|
36
|
+
var linearData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
37
|
+
var currentPage = arguments.length > 1 ? arguments[1] : undefined;
|
|
38
|
+
var pagination = arguments.length > 2 ? arguments[2] : undefined;
|
|
39
|
+
return linearData.filter(function (_ref) {
|
|
40
|
+
var xCoordinate = _ref.xCoordinate;
|
|
33
41
|
return Math.floor(xCoordinate / pagination) === currentPage;
|
|
34
|
-
}).map((item, i)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
}).map(function (item, i) {
|
|
43
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
44
|
+
xCoordinate: i
|
|
45
|
+
});
|
|
46
|
+
});
|
|
38
47
|
};
|
|
39
48
|
exports.getFormattedLinearData = getFormattedLinearData;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
49
|
+
var getMaxValue = function getMaxValue(dataSet) {
|
|
50
|
+
return dataSet && !(0, _array.isEmpty)(dataSet) && (d3.max(dataSet, function (_ref2) {
|
|
51
|
+
var value = _ref2.value;
|
|
52
|
+
return value;
|
|
53
|
+
}) || 0);
|
|
54
|
+
};
|
|
46
55
|
exports.getMaxValue = getMaxValue;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
value
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
56
|
+
var getMinValue = function getMinValue(dataSet) {
|
|
57
|
+
return dataSet && !(0, _array.isEmpty)(dataSet) && d3.min(dataSet, function (_ref3) {
|
|
58
|
+
var value = _ref3.value;
|
|
59
|
+
return value;
|
|
60
|
+
}) || 0;
|
|
61
|
+
};
|
|
53
62
|
exports.getMinValue = getMinValue;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
var maxValueOrDefault = function maxValueOrDefault(value) {
|
|
64
|
+
return value === 0 ? _constants.DEFAULT_MAX_VALUE : value;
|
|
65
|
+
};
|
|
66
|
+
var getMaxValues = function getMaxValues(flatBarData, flatLinearData, levels) {
|
|
67
|
+
return {
|
|
68
|
+
maxLinearValue: maxValueOrDefault(getMaxValue(flatLinearData)),
|
|
69
|
+
maxBarValue: maxValueOrDefault(Math.max(getMaxValue(flatBarData), getMaxValue(levels)))
|
|
70
|
+
};
|
|
71
|
+
};
|
|
59
72
|
exports.getMaxValues = getMaxValues;
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
var calculateTotalWidth = function calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) {
|
|
74
|
+
var minimumNeededWidth = dataLength * groups * (minBarWidth + 2 * padding) + marginLeft + marginRight;
|
|
62
75
|
return Math.max(containerWidth, minimumNeededWidth);
|
|
63
76
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
axisPadding = _constants.DEFAULT_AXIS_PADDING,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
var getGraphAttributes = function getGraphAttributes(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, minBarWidth, dataLength, padding, groups, spacingOptions) {
|
|
78
|
+
var totalWidth = minBarWidth ? calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) : containerWidth;
|
|
79
|
+
var _spacingOptions$axisP = spacingOptions.axisPadding,
|
|
80
|
+
axisPadding = _spacingOptions$axisP === void 0 ? _constants.DEFAULT_AXIS_PADDING : _spacingOptions$axisP,
|
|
81
|
+
_spacingOptions$scrol = spacingOptions.scrollPadding,
|
|
82
|
+
scrollPadding = _spacingOptions$scrol === void 0 ? _constants.DEFAULT_SCROLL_PADDING : _spacingOptions$scrol,
|
|
83
|
+
_spacingOptions$margi = spacingOptions.marginTop,
|
|
84
|
+
marginTop = _spacingOptions$margi === void 0 ? _constants.DEFAULT_MARGIN_TOP : _spacingOptions$margi;
|
|
71
85
|
return {
|
|
72
86
|
TOTAL_WIDTH: totalWidth,
|
|
73
87
|
TOTAL_HEIGHT: containerHeight,
|
|
@@ -78,87 +92,77 @@ const getGraphAttributes = (containerWidth, containerHeight, marginLeft, marginR
|
|
|
78
92
|
};
|
|
79
93
|
};
|
|
80
94
|
exports.getGraphAttributes = getGraphAttributes;
|
|
81
|
-
|
|
95
|
+
var flattenBarData = function flattenBarData(data) {
|
|
82
96
|
var _data$0$;
|
|
83
|
-
return data && Array.isArray((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.values) ? data.flat().map(_ref4
|
|
84
|
-
|
|
85
|
-
values
|
|
86
|
-
} = _ref4;
|
|
97
|
+
return data && Array.isArray((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.values) ? data.flat().map(function (_ref4) {
|
|
98
|
+
var values = _ref4.values;
|
|
87
99
|
return values;
|
|
88
100
|
}).flat() : data.flat();
|
|
89
101
|
};
|
|
90
|
-
|
|
102
|
+
var flattenAndReduceBarData = function flattenAndReduceBarData(data) {
|
|
91
103
|
var _data$0$2;
|
|
92
|
-
return data && (Array.isArray((_data$0$2 = data[0][0]) === null || _data$0$2 === void 0 ? void 0 : _data$0$2.values) ? data.flat().map(_ref5
|
|
93
|
-
|
|
94
|
-
values
|
|
95
|
-
} = _ref5;
|
|
104
|
+
return data && (Array.isArray((_data$0$2 = data[0][0]) === null || _data$0$2 === void 0 ? void 0 : _data$0$2.values) ? data.flat().map(function (_ref5) {
|
|
105
|
+
var values = _ref5.values;
|
|
96
106
|
return {
|
|
97
|
-
value: values.reduce((acc, _ref6)
|
|
98
|
-
|
|
99
|
-
value
|
|
100
|
-
} = _ref6;
|
|
107
|
+
value: values.reduce(function (acc, _ref6) {
|
|
108
|
+
var value = _ref6.value;
|
|
101
109
|
return acc + value;
|
|
102
110
|
}, 0)
|
|
103
111
|
};
|
|
104
112
|
}) : data.flat());
|
|
105
113
|
};
|
|
106
114
|
exports.flattenAndReduceBarData = flattenAndReduceBarData;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
data
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
var flattenLinearData = function flattenLinearData(linearData) {
|
|
116
|
+
return linearData === null || linearData === void 0 ? void 0 : linearData.map(function (_ref7) {
|
|
117
|
+
var data = _ref7.data;
|
|
118
|
+
return data;
|
|
119
|
+
}).flat();
|
|
120
|
+
};
|
|
121
|
+
var flattenData = function flattenData(barData, linearData) {
|
|
122
|
+
return {
|
|
123
|
+
flatBarData: flattenBarData(barData),
|
|
124
|
+
flatLinearData: flattenLinearData(linearData)
|
|
125
|
+
};
|
|
126
|
+
};
|
|
117
127
|
exports.flattenData = flattenData;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
var getFormattedDecorators = function getFormattedDecorators(xAxis) {
|
|
129
|
+
var decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
130
|
+
var currentPage = arguments.length > 2 ? arguments[2] : undefined;
|
|
131
|
+
var pagination = arguments.length > 3 ? arguments[3] : undefined;
|
|
122
132
|
if (pagination) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
x
|
|
128
|
-
} = _ref8;
|
|
133
|
+
var rangeStart = currentPage * pagination;
|
|
134
|
+
var rangeEnd = (currentPage + 1) * pagination;
|
|
135
|
+
var validDecorators = pagination ? decorators.filter(function (_ref8) {
|
|
136
|
+
var x = _ref8.x;
|
|
129
137
|
return rangeStart <= x && rangeEnd > x;
|
|
130
138
|
}) : decorators;
|
|
131
|
-
return validDecorators.map(_ref9
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} = _ref9;
|
|
136
|
-
return {
|
|
139
|
+
return validDecorators.map(function (_ref9) {
|
|
140
|
+
var x = _ref9.x,
|
|
141
|
+
config = _objectWithoutProperties(_ref9, _excluded);
|
|
142
|
+
return _objectSpread({
|
|
137
143
|
x: pagination ? xAxis(x - currentPage * pagination) : xAxis(x),
|
|
138
|
-
id: x
|
|
139
|
-
|
|
140
|
-
};
|
|
144
|
+
id: x
|
|
145
|
+
}, config);
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
|
-
return decorators.map(_ref10
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
return decorators.map(function (_ref10) {
|
|
149
|
+
var x = _ref10.x,
|
|
150
|
+
config = _objectWithoutProperties(_ref10, _excluded2);
|
|
151
|
+
return _objectSpread({
|
|
152
|
+
x: xAxis(x)
|
|
153
|
+
}, config);
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
exports.getFormattedDecorators = getFormattedDecorators;
|
|
157
|
+
var getGrid = function getGrid(ticks, maxValue) {
|
|
158
|
+
return new Array(ticks).fill(0).map(function (_, index) {
|
|
148
159
|
return {
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
value: maxValue - index * maxValue / (ticks - 1),
|
|
161
|
+
type: 'grid'
|
|
151
162
|
};
|
|
163
|
+
}).filter(function (_ref11) {
|
|
164
|
+
var value = _ref11.value;
|
|
165
|
+
return !!value;
|
|
152
166
|
});
|
|
153
167
|
};
|
|
154
|
-
exports.getFormattedDecorators = getFormattedDecorators;
|
|
155
|
-
const getGrid = (ticks, maxValue) => new Array(ticks).fill(0).map((_, index) => ({
|
|
156
|
-
value: maxValue - index * maxValue / (ticks - 1),
|
|
157
|
-
type: 'grid'
|
|
158
|
-
})).filter(_ref11 => {
|
|
159
|
-
let {
|
|
160
|
-
value
|
|
161
|
-
} = _ref11;
|
|
162
|
-
return !!value;
|
|
163
|
-
});
|
|
164
168
|
exports.getGrid = getGrid;
|
|
@@ -4,36 +4,44 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_SEPARATOR = exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = exports.DEFAULT_ELIPSIS = exports.COMPONENTS_THEME_PROPS = exports.COLOR_THEMES_MAPPER = exports.COLOR_THEMES = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var _COMPONENTS_THEME_PRO;
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
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); }
|
|
12
|
+
var DEFAULT_SEPARATOR = '/';
|
|
13
|
+
exports.DEFAULT_SEPARATOR = DEFAULT_SEPARATOR;
|
|
14
|
+
var DEFAULT_ELIPSIS = '...';
|
|
15
|
+
exports.DEFAULT_ELIPSIS = DEFAULT_ELIPSIS;
|
|
16
|
+
var DEFAULT_ELIPSIS_WIDTH_ESTIMATE = 100;
|
|
17
|
+
exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = DEFAULT_ELIPSIS_WIDTH_ESTIMATE;
|
|
18
|
+
var COLOR_THEMES = {
|
|
11
19
|
DARK: 'dark',
|
|
12
20
|
LIGHT: 'light'
|
|
13
21
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
label: {
|
|
20
|
-
colorTheme: 'gray'
|
|
21
|
-
}
|
|
22
|
+
exports.COLOR_THEMES = COLOR_THEMES;
|
|
23
|
+
var COMPONENTS_THEME_PROPS = (_COMPONENTS_THEME_PRO = {}, _defineProperty(_COMPONENTS_THEME_PRO, COLOR_THEMES.DARK, {
|
|
24
|
+
button: {
|
|
25
|
+
colorTheme: 'secondary'
|
|
22
26
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
colorTheme: 'negative'
|
|
26
|
-
},
|
|
27
|
-
label: {
|
|
28
|
-
colorTheme: 'negative',
|
|
29
|
-
shade: '03'
|
|
30
|
-
}
|
|
27
|
+
label: {
|
|
28
|
+
colorTheme: 'gray'
|
|
31
29
|
}
|
|
32
|
-
}
|
|
30
|
+
}), _defineProperty(_COMPONENTS_THEME_PRO, COLOR_THEMES.LIGHT, {
|
|
31
|
+
button: {
|
|
32
|
+
colorTheme: 'negative'
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
colorTheme: 'negative',
|
|
36
|
+
shade: '03'
|
|
37
|
+
}
|
|
38
|
+
}), _COMPONENTS_THEME_PRO);
|
|
33
39
|
|
|
34
40
|
// temporary mapper for compatibility with 'buttonColorTheme' attribute in office-web-edenor
|
|
35
|
-
|
|
41
|
+
exports.COMPONENTS_THEME_PROPS = COMPONENTS_THEME_PROPS;
|
|
42
|
+
var COLOR_THEMES_MAPPER = {
|
|
36
43
|
negative: COLOR_THEMES.LIGHT,
|
|
37
44
|
primary: COLOR_THEMES.DARK,
|
|
38
45
|
secondary: COLOR_THEMES.DARK
|
|
39
|
-
};
|
|
46
|
+
};
|
|
47
|
+
exports.COLOR_THEMES_MAPPER = COLOR_THEMES_MAPPER;
|
|
@@ -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
|
});
|
|
@@ -15,107 +16,130 @@ var _constants = require("./constants");
|
|
|
15
16
|
var _theme = require("./theme");
|
|
16
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
20
21
|
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); }
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
+
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."); }
|
|
24
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
25
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
|
|
33
|
+
var breadcrumbs = _ref.breadcrumbs,
|
|
34
|
+
themeClasses = _ref.classes,
|
|
35
|
+
classNames = _ref.classNames,
|
|
36
|
+
_ref$colorTheme = _ref.colorTheme,
|
|
37
|
+
colorTheme = _ref$colorTheme === void 0 ? _constants.COLOR_THEMES.DARK : _ref$colorTheme,
|
|
38
|
+
_ref$disableMenu = _ref.disableMenu,
|
|
39
|
+
disableMenu = _ref$disableMenu === void 0 ? false : _ref$disableMenu,
|
|
40
|
+
_ref$elipsis = _ref.elipsis,
|
|
41
|
+
elipsis = _ref$elipsis === void 0 ? _constants.DEFAULT_ELIPSIS : _ref$elipsis,
|
|
42
|
+
_ref$elipsisWidthEsti = _ref.elipsisWidthEstimate,
|
|
43
|
+
elipsisWidthEstimate = _ref$elipsisWidthEsti === void 0 ? _constants.DEFAULT_ELIPSIS_WIDTH_ESTIMATE : _ref$elipsisWidthEsti,
|
|
44
|
+
_ref$firstItemOverflo = _ref.firstItemOverflow,
|
|
45
|
+
firstItemOverflow = _ref$firstItemOverflo === void 0 ? false : _ref$firstItemOverflo,
|
|
46
|
+
_ref$menuProps = _ref.menuProps,
|
|
47
|
+
menuProps = _ref$menuProps === void 0 ? {} : _ref$menuProps,
|
|
48
|
+
onRedirect = _ref.onRedirect,
|
|
49
|
+
_ref$separator = _ref.separator,
|
|
50
|
+
separator = _ref$separator === void 0 ? _constants.DEFAULT_SEPARATOR : _ref$separator;
|
|
51
|
+
var classes = (0, _react.useMemo)(function () {
|
|
52
|
+
return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
|
|
53
|
+
}, [classNames]);
|
|
54
|
+
var containerRef = (0, _react.useRef)();
|
|
55
|
+
var _useState = (0, _react.useState)(breadcrumbs),
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
content = _useState2[0],
|
|
58
|
+
setContent = _useState2[1];
|
|
59
|
+
var _useState3 = (0, _react.useState)({
|
|
60
|
+
anchor: null,
|
|
61
|
+
items: []
|
|
62
|
+
}),
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
menu = _useState4[0],
|
|
65
|
+
setMenu = _useState4[1];
|
|
66
|
+
var getSectionsTotalWidth = function getSectionsTotalWidth(ref) {
|
|
67
|
+
return _toConsumableArray(ref.current.children).reduce(function (total, currentChildren) {
|
|
68
|
+
return total + currentChildren.offsetWidth;
|
|
69
|
+
}, 0);
|
|
70
|
+
};
|
|
71
|
+
var getItemsBeforeCollapse = function getItemsBeforeCollapse(ref) {
|
|
72
|
+
var sections = _toConsumableArray(ref.current.children);
|
|
73
|
+
var containerWidth = ref.current.offsetWidth;
|
|
74
|
+
var itemsBeforeCollapse = 1;
|
|
75
|
+
var accumulatedWidth = 0;
|
|
76
|
+
var firstItemWidth = sections[0].offsetWidth;
|
|
77
|
+
var lastItemWidth = sections[sections.length - 2].offsetWidth;
|
|
78
|
+
var availableWidth = containerWidth - firstItemWidth - lastItemWidth - elipsisWidthEstimate;
|
|
79
|
+
sections.slice(1).forEach(function (section) {
|
|
54
80
|
accumulatedWidth += section.offsetWidth;
|
|
55
81
|
if (accumulatedWidth <= availableWidth) itemsBeforeCollapse += 1;
|
|
56
82
|
});
|
|
57
83
|
return itemsBeforeCollapse;
|
|
58
84
|
};
|
|
59
|
-
|
|
85
|
+
var truncate = function truncate() {
|
|
60
86
|
if (!containerRef.current) return;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = containerRef.current;
|
|
64
|
-
const childrenTotalWidth = getSectionsTotalWidth(containerRef);
|
|
87
|
+
var containerWidth = containerRef.current.offsetWidth;
|
|
88
|
+
var childrenTotalWidth = getSectionsTotalWidth(containerRef);
|
|
65
89
|
if (childrenTotalWidth > containerWidth) {
|
|
66
|
-
setContent(prevContent
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
label
|
|
70
|
-
} = _ref2;
|
|
90
|
+
setContent(function (prevContent) {
|
|
91
|
+
var isCollapsed = prevContent.some(function (_ref2) {
|
|
92
|
+
var label = _ref2.label;
|
|
71
93
|
return label === elipsis;
|
|
72
94
|
});
|
|
73
95
|
if (isCollapsed) return prevContent;
|
|
74
96
|
if (prevContent.length <= 2) return prevContent;
|
|
75
|
-
|
|
76
|
-
return [
|
|
97
|
+
var itemsBeforeCollapse = getItemsBeforeCollapse(containerRef);
|
|
98
|
+
return [].concat(_toConsumableArray(prevContent.slice(0, itemsBeforeCollapse)), [{
|
|
77
99
|
label: elipsis,
|
|
78
100
|
menuItems: prevContent.slice(itemsBeforeCollapse, prevContent.length - 1)
|
|
79
|
-
}, prevContent[prevContent.length - 1]];
|
|
101
|
+
}, prevContent[prevContent.length - 1]]);
|
|
80
102
|
});
|
|
81
103
|
}
|
|
82
104
|
};
|
|
83
|
-
(0, _react.useEffect)(()
|
|
105
|
+
(0, _react.useEffect)(function () {
|
|
84
106
|
setContent(breadcrumbs);
|
|
85
107
|
}, [breadcrumbs]);
|
|
86
|
-
(0, _react.useEffect)(()
|
|
87
|
-
if (containerRef.current) window.requestAnimationFrame(()
|
|
108
|
+
(0, _react.useEffect)(function () {
|
|
109
|
+
if (containerRef.current) window.requestAnimationFrame(function () {
|
|
110
|
+
return truncate();
|
|
111
|
+
});
|
|
88
112
|
}, [content]);
|
|
89
|
-
(0, _react.useEffect)(()
|
|
113
|
+
(0, _react.useEffect)(function () {
|
|
90
114
|
window.addEventListener('resize', truncate);
|
|
91
|
-
return ()
|
|
115
|
+
return function () {
|
|
116
|
+
return window.removeEventListener('resize', truncate);
|
|
117
|
+
};
|
|
92
118
|
}, []);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
119
|
+
var handleCloseMenu = function handleCloseMenu() {
|
|
120
|
+
return setMenu({
|
|
121
|
+
anchor: null,
|
|
122
|
+
items: []
|
|
123
|
+
});
|
|
124
|
+
};
|
|
97
125
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
98
126
|
className: _stylesModule.default.breadcrumbs,
|
|
99
127
|
ref: containerRef
|
|
100
|
-
}, content.map((_ref3, index)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} = _ref3;
|
|
108
|
-
const handleClick = event => {
|
|
128
|
+
}, content.map(function (_ref3, index) {
|
|
129
|
+
var buttonColorTheme = _ref3.buttonColorTheme,
|
|
130
|
+
itemClassName = _ref3.itemClassName,
|
|
131
|
+
label = _ref3.label,
|
|
132
|
+
menuItems = _ref3.menuItems,
|
|
133
|
+
route = _ref3.route;
|
|
134
|
+
var handleClick = function handleClick(event) {
|
|
109
135
|
if (menuItems) setMenu({
|
|
110
136
|
anchor: event.currentTarget,
|
|
111
|
-
items:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
route: menuItemRoute
|
|
115
|
-
} = _ref4;
|
|
137
|
+
items: _toConsumableArray(menuItems).map(function (_ref4) {
|
|
138
|
+
var menuItemLabel = _ref4.label,
|
|
139
|
+
menuItemRoute = _ref4.route;
|
|
116
140
|
return {
|
|
117
141
|
label: menuItemLabel,
|
|
118
|
-
onClick: ()
|
|
142
|
+
onClick: function onClick() {
|
|
119
143
|
setContent(breadcrumbs);
|
|
120
144
|
handleCloseMenu();
|
|
121
145
|
onRedirect(menuItemRoute);
|
|
@@ -124,9 +148,9 @@ const UTBreadcrumbs = _ref => {
|
|
|
124
148
|
})
|
|
125
149
|
});else onRedirect(route);
|
|
126
150
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
151
|
+
var isLast = index === content.length - 1;
|
|
152
|
+
var overflowControl = index === 0 && firstItemOverflow;
|
|
153
|
+
var colorThemesDefinition = buttonColorTheme ? _constants.COMPONENTS_THEME_PROPS[_constants.COLOR_THEMES_MAPPER[buttonColorTheme]] : _constants.COMPONENTS_THEME_PROPS[colorTheme];
|
|
130
154
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
131
155
|
className: "".concat(_stylesModule.default.section, " ").concat(overflowControl && _stylesModule.default.firstItem),
|
|
132
156
|
key: "".concat(route, "-").concat(label)
|
|
@@ -169,4 +193,5 @@ UTBreadcrumbs.propTypes = {
|
|
|
169
193
|
menuProps: _propTypes.object,
|
|
170
194
|
separator: _propTypes.string
|
|
171
195
|
};
|
|
172
|
-
var _default =
|
|
196
|
+
var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBreadcrumbs);
|
|
197
|
+
exports.default = _default;
|
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.retrieveStyle = void 0;
|
|
7
7
|
var _classesUtils = require("../../utils/classesUtils");
|
|
8
|
-
|
|
8
|
+
var retrieveStyle = function retrieveStyle(_ref) {
|
|
9
9
|
var _theme$UTBreadcrumbs;
|
|
10
|
-
|
|
11
|
-
theme
|
|
12
|
-
} = _ref;
|
|
10
|
+
var theme = _ref.theme;
|
|
13
11
|
return {
|
|
14
12
|
separator: {
|
|
15
13
|
margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 || (_theme$UTBreadcrumbs = theme.UTBreadcrumbs) === null || _theme$UTBreadcrumbs === void 0 || (_theme$UTBreadcrumbs = _theme$UTBreadcrumbs.separator) === null || _theme$UTBreadcrumbs === void 0 ? void 0 : _theme$UTBreadcrumbs.margin) || '0 12px')
|