@wavemaker/react-runtime 11.14.1-rc.240 → 11.14.2-rc.6311
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/actions/navigation-action.js +5 -3
- package/actions/notification-action.js +6 -3
- package/components/basic/anchor/index.js +6 -7
- package/components/basic/label/index.js +2 -2
- package/components/basic/search/index.js +7 -3
- package/components/chart/components/barColumnChart/index.js +2 -4
- package/components/chart/components/pieDonutChart/index.js +3 -1
- package/components/chart/hooks/useBarYAxisExtras.js +52 -0
- package/components/chart/hooks/useXAxisConfig.js +98 -0
- package/components/chart/index.js +72 -39
- package/components/chart/utils.js +23 -12
- package/components/container/index.js +6 -7
- package/components/container/panel/components/panel-header/index.js +3 -2
- package/components/container/panel/index.js +13 -9
- package/components/container/tabs/index.js +1 -0
- package/components/container/tabs/tab-pane/index.js +39 -3
- package/components/container/wizard/index.js +187 -57
- package/components/container/wizard/utils.js +1 -1
- package/components/container/wizard/wizard-action/index.js +9 -4
- package/components/container/wizard/wizard-step/index.js +21 -8
- package/components/data/form/base-form/index.js +51 -11
- package/components/data/form/form-controller/withFormController.js +7 -10
- package/components/data/list/components/GroupedListItems.js +5 -1
- package/components/data/list/components/ListItemWithTemplate.js +4 -1
- package/components/data/list/hooks/useListEffects.js +34 -14
- package/components/data/list/hooks/useListEventHandlers.js +18 -2
- package/components/data/list/hooks/useListState.js +15 -2
- package/components/data/list/index.js +1 -0
- package/components/data/list/utils/list-helpers.js +3 -5
- package/components/data/list/utils/list-widget-methods.js +1 -1
- package/components/data/live-filter/index.js +6 -5
- package/components/data/live-form/index.js +24 -14
- package/components/data/table/components/TableBody.js +5 -21
- package/components/data/table/components/TableHeader.js +5 -1
- package/components/data/table/index.js +21 -5
- package/components/data/utils/field-data-utils.js +1 -1
- package/components/dialogs/index.js +14 -16
- package/components/input/currency/index.js +11 -7
- package/components/input/default/checkbox/index.js +2 -3
- package/components/input/default/checkboxset/index.js +2 -22
- package/components/input/default/radioset/index.js +5 -4
- package/components/input/epoch/datetime/index.js +6 -2
- package/components/input/epoch/time/index.js +2 -1
- package/components/input/number/index.js +2 -2
- package/components/input/text/util.js +2 -0
- package/components/input/textarea/index.js +22 -24
- package/components/layout/leftnav/index.js +1 -1
- package/components/navbar/nav/index.js +97 -7
- package/components/navbar/nav-item/index.js +5 -2
- package/components/navigation/menu/index.js +73 -12
- package/components/navigation/popover/index.js +2 -0
- package/components/page/error-boundary/index.js +1 -0
- package/components/prefab/container/index.js +10 -3
- package/context/LocalizationProvider.js +1 -0
- package/context/PrefabContext.js +138 -13
- package/context/WidgetProvider.js +2 -2
- package/core/constants/events.js +12 -6
- package/core/constants/index.js +6 -11
- package/core/formatter/number-formatters.js +1 -1
- package/core/proxy-service.js +72 -36
- package/core/util/utils.js +23 -4
- package/higherOrder/BaseApp.js +60 -18
- package/higherOrder/BasePage.js +99 -77
- package/higherOrder/BasePrefab.js +13 -5
- package/higherOrder/withBaseWrapper.js +3 -3
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +20 -13
- package/mui-config/theme.js +3 -0
- package/package-lock.json +88 -165
- package/package.json +3 -3
- package/store/index.js +5 -1
- package/utils/lib-error-skipper.js +196 -0
- package/variables/service-variable.js +17 -14
|
@@ -120,10 +120,12 @@ var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAc
|
|
|
120
120
|
var cleanPageName = pageName.replace(/^\//, "");
|
|
121
121
|
|
|
122
122
|
// Prepare query params if any exist
|
|
123
|
+
// Filter out undefined/null values
|
|
123
124
|
var queryParams = Object.entries(params).filter(function (_ref) {
|
|
124
|
-
var _ref2 = (0, _slicedToArray2["default"])(_ref,
|
|
125
|
-
key = _ref2[0]
|
|
126
|
-
|
|
125
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
126
|
+
key = _ref2[0],
|
|
127
|
+
value = _ref2[1];
|
|
128
|
+
return key !== "pageName" && value !== undefined && value !== null && value !== "";
|
|
127
129
|
}).map(function (_ref3) {
|
|
128
130
|
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
129
131
|
key = _ref4[0],
|
|
@@ -37,15 +37,18 @@ var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_Ba
|
|
|
37
37
|
(0, _createClass2["default"])(NotificationAction, [{
|
|
38
38
|
key: "prepareToastOptions",
|
|
39
39
|
value: function prepareToastOptions() {
|
|
40
|
-
var
|
|
40
|
+
var _String$toLowerCase,
|
|
41
|
+
_String,
|
|
42
|
+
_mergedParams$toaster,
|
|
43
|
+
_this = this;
|
|
41
44
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
42
45
|
var configParams = this.config.paramProvider();
|
|
43
46
|
var mergedParams = _objectSpread(_objectSpread({}, configParams), params);
|
|
44
|
-
var alertClass = (mergedParams["class"] ||
|
|
47
|
+
var alertClass = (_String$toLowerCase = (_String = String(mergedParams["class"])) === null || _String === void 0 ? void 0 : _String.toLowerCase()) !== null && _String$toLowerCase !== void 0 ? _String$toLowerCase : "info";
|
|
45
48
|
var type = NOTIFICATION_TYPE[alertClass] || "info";
|
|
46
49
|
|
|
47
50
|
// get toast position
|
|
48
|
-
var position = mergedParams.toasterPosition
|
|
51
|
+
var position = (_mergedParams$toaster = mergedParams.toasterPosition) !== null && _mergedParams$toaster !== void 0 ? _mergedParams$toaster : "top right";
|
|
49
52
|
|
|
50
53
|
// Determine duration (0 means stay until dismissed)
|
|
51
54
|
var duration = parseInt(String(mergedParams.duration));
|
|
@@ -17,8 +17,8 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
|
17
17
|
var _Link = _interopRequireDefault(require("@mui/material/Link"));
|
|
18
18
|
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
19
19
|
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
20
|
-
var
|
|
21
|
-
var _excluded = ["caption", "iconclass", "styles", "className", "iconheight", "iconwidth", "iconmargin", "iconurl", "iconposition", "badgevalue", "listener", "hyperlink", "encodeurl", "onClick", "shortcutkey", "arialabel", "target"];
|
|
20
|
+
var _utils = require("../../../core/util/utils");
|
|
21
|
+
var _excluded = ["caption", "iconclass", "styles", "className", "iconheight", "iconwidth", "iconmargin", "iconurl", "iconposition", "badgevalue", "listener", "hyperlink", "encodeurl", "onClick", "shortcutkey", "arialabel", "target", "itemLink"];
|
|
22
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
23
23
|
var __jsx = _react["default"].createElement;
|
|
24
24
|
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; }
|
|
@@ -51,8 +51,9 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
51
51
|
shortcutkey = props.shortcutkey,
|
|
52
52
|
arialabel = props.arialabel,
|
|
53
53
|
target = props.target,
|
|
54
|
+
itemLink = props.itemLink,
|
|
54
55
|
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
55
|
-
var path = (0,
|
|
56
|
+
var path = (0, _utils.getCurrentPath)();
|
|
56
57
|
var _useState = (0, _react.useState)(false),
|
|
57
58
|
isActive = _useState[0],
|
|
58
59
|
setIsActive = _useState[1];
|
|
@@ -113,12 +114,10 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
113
114
|
|
|
114
115
|
// Determine active state
|
|
115
116
|
(0, _react.useEffect)(function () {
|
|
116
|
-
var lastSegment = path.split("/").pop();
|
|
117
|
-
var activeByCaptionMatch = caption && lastSegment && lastSegment.toLowerCase() === String(caption).toLowerCase();
|
|
118
117
|
var activeByHyperlink = doesHyperlinkMatchCurrentPath;
|
|
119
118
|
var activeByNavigationExpr = navigationInfo.isCurrentPage;
|
|
120
|
-
setIsActive(
|
|
121
|
-
}, [caption, path, doesHyperlinkMatchCurrentPath, navigationInfo.isCurrentPage]);
|
|
119
|
+
setIsActive(activeByHyperlink || activeByNavigationExpr);
|
|
120
|
+
}, [caption, path, doesHyperlinkMatchCurrentPath, navigationInfo.isCurrentPage, itemLink]);
|
|
122
121
|
|
|
123
122
|
// Calculate icon position styles
|
|
124
123
|
var iconPositionStyles = (0, _react.useMemo)(function () {
|
|
@@ -59,7 +59,7 @@ var parseCaption = function parseCaption(caption) {
|
|
|
59
59
|
return parts;
|
|
60
60
|
};
|
|
61
61
|
var WmLabel = exports.WmLabel = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
62
|
-
var _JSON$stringify;
|
|
62
|
+
var _ref, _JSON$stringify;
|
|
63
63
|
var _props$required = props.required,
|
|
64
64
|
required = _props$required === void 0 ? false : _props$required,
|
|
65
65
|
_props$trustAs = props.trustAs,
|
|
@@ -77,7 +77,7 @@ var WmLabel = exports.WmLabel = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
77
77
|
var ownerState = {
|
|
78
78
|
type: type
|
|
79
79
|
};
|
|
80
|
-
var captionString = typeof caption === "string" ? caption : (_JSON$stringify = JSON.stringify(caption)) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : "";
|
|
80
|
+
var captionString = (_ref = typeof caption === "string" ? caption : (_JSON$stringify = JSON.stringify(caption)) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : "") === null || _ref === void 0 ? void 0 : _ref.replace(/ |undefined|null/gi, " ");
|
|
81
81
|
|
|
82
82
|
// Check if caption contains HTML tags
|
|
83
83
|
var hasHTML = containsHTML(captionString);
|
|
@@ -31,6 +31,7 @@ var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/
|
|
|
31
31
|
var _lodash = require("lodash");
|
|
32
32
|
var _transformedDatasetUtils = require("@wavemaker/react-runtime/utils/transformedDataset-utils");
|
|
33
33
|
var _providers = require("./providers");
|
|
34
|
+
var _withFormController = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form/form-controller/withFormController"));
|
|
34
35
|
var _excluded = ["showclear", "debouncetime", "searchkey", "searchon", "matchmode", "minchars", "limit", "tabindex", "placeholder", "dropup", "readonly", "datavalue", "dataset", "datafield", "displayfield", "disabled", "autofocus", "type", "showsearchicon", "showbackbutton", "imagewidth", "width", "displaylabel", "displayimagesrc", "displayexpression", "datacompletemsg", "loadingdatamsg", "clearsearchiconclass", "backsearchiconclass", "searchiconclass", "navsearchbar", "class", "shortcutkey", "required", "hint", "arialabel", "onBeforeservicecall", "onBlur", "onChange", "onFocus", "onSelect", "onSubmit", "onClear", "onSearch", "onDatasetready", "conditionalstyles", "styles", "name", "listener", "value", "datasetItems", "selectedItems", "displayValue", "groupedData", "handleHeaderClick", "toggleAllHeaders", "isDestroyed", "validation", "casesensitive", "isUpdateRequired", "onQuerySearch"];
|
|
35
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
36
37
|
var __jsx = _react["default"].createElement;
|
|
@@ -216,7 +217,7 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
216
217
|
if (type === "autocomplete") {
|
|
217
218
|
getDataSource("");
|
|
218
219
|
}
|
|
219
|
-
}, [
|
|
220
|
+
}, [type]);
|
|
220
221
|
|
|
221
222
|
// Update listen query state when type changes
|
|
222
223
|
(0, _react.useEffect)(function () {
|
|
@@ -619,7 +620,10 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
619
620
|
setMenuOpen(false);
|
|
620
621
|
setSelectedItem(item); // Set the selected item
|
|
621
622
|
setFormattedDataset([]); // Clear the dropdown dataset
|
|
622
|
-
|
|
623
|
+
if (onChange && listener !== null && listener !== void 0 && listener.Widgets && name && name in (listener === null || listener === void 0 ? void 0 : listener.Widgets)) {
|
|
624
|
+
var _item$dataObject, _item$dataObject2;
|
|
625
|
+
onChange(undefined, listener.Widgets[name], (_item$dataObject = item.dataObject) === null || _item$dataObject === void 0 ? void 0 : _item$dataObject.value, (_item$dataObject2 = item.dataObject) === null || _item$dataObject2 === void 0 ? void 0 : _item$dataObject2.value);
|
|
626
|
+
}
|
|
623
627
|
if (listener !== null && listener !== void 0 && listener.onChange) {
|
|
624
628
|
listener.onChange(name, {
|
|
625
629
|
datavalue: item.dataObject.value
|
|
@@ -1020,4 +1024,4 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
1020
1024
|
}, "Clear button"), showclear && showclear !== "false" ? renderClearButton() : null, renderDropdown()));
|
|
1021
1025
|
});
|
|
1022
1026
|
Search.displayName = "WmSearch";
|
|
1023
|
-
var _default = exports["default"] = (0, _withBaseWrapper["default"])(Search);
|
|
1027
|
+
var _default = exports["default"] = (0, _withFormController["default"])((0, _withBaseWrapper["default"])(Search));
|
|
@@ -40,7 +40,8 @@ var BarColumnChart = exports.BarColumnChart = /*#__PURE__*/(0, _react.memo)(func
|
|
|
40
40
|
legendtype = _ref.legendtype,
|
|
41
41
|
availableRegions = _ref.availableRegions,
|
|
42
42
|
_ref$viewtype = _ref.viewtype,
|
|
43
|
-
viewtype = _ref$viewtype === void 0 ? "Grouped" : _ref$viewtype
|
|
43
|
+
viewtype = _ref$viewtype === void 0 ? "Grouped" : _ref$viewtype,
|
|
44
|
+
shouldShowLegend = _ref.shouldShowLegend;
|
|
44
45
|
var isBarChart = type === "Bar"; // Bar = horizontal bars, Column = vertical bars
|
|
45
46
|
var isStacked = viewtype === "Stacked";
|
|
46
47
|
var formatValue = (0, _react.useCallback)(function (label) {
|
|
@@ -49,9 +50,6 @@ var BarColumnChart = exports.BarColumnChart = /*#__PURE__*/(0, _react.memo)(func
|
|
|
49
50
|
}
|
|
50
51
|
return String(label);
|
|
51
52
|
}, [numberFormat]);
|
|
52
|
-
var shouldShowLegend = (0, _react.useMemo)(function () {
|
|
53
|
-
return (0, _utils.isShowLegend)(showlegend);
|
|
54
|
-
}, [showlegend]);
|
|
55
53
|
return __jsx(_recharts.ResponsiveContainer, {
|
|
56
54
|
width: "100%",
|
|
57
55
|
height: "100%"
|
|
@@ -113,9 +113,11 @@ var PieDonutChart = exports.PieDonutChart = function PieDonutChart(_ref2) {
|
|
|
113
113
|
nameKey: "name",
|
|
114
114
|
cx: "50%",
|
|
115
115
|
cy: "50%",
|
|
116
|
-
innerRadius: type === "Donut" ? "".concat(
|
|
116
|
+
innerRadius: type === "Donut" ? "".concat(Math.round((0, _utils.normalizeDonutRatio)(donutratio) * 100), "%") : 0,
|
|
117
117
|
outerRadius: "80%",
|
|
118
118
|
paddingAngle: 2,
|
|
119
|
+
startAngle: 90,
|
|
120
|
+
endAngle: -270,
|
|
119
121
|
onClick: function onClick(data, index, event) {
|
|
120
122
|
return onChartClick(data, index, event);
|
|
121
123
|
},
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useBarYAxisExtras = useBarYAxisExtras;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
10
|
+
var __jsx = _react["default"].createElement;
|
|
11
|
+
function useBarYAxisExtras(typeOrOptions) {
|
|
12
|
+
var options = typeof typeOrOptions === "string" ? {
|
|
13
|
+
type: typeOrOptions
|
|
14
|
+
} : typeOrOptions;
|
|
15
|
+
var type = options.type,
|
|
16
|
+
_options$chartWidth = options.chartWidth,
|
|
17
|
+
chartWidth = _options$chartWidth === void 0 ? 0 : _options$chartWidth,
|
|
18
|
+
_options$yAxisWidthRa = options.yAxisWidthRatio,
|
|
19
|
+
yAxisWidthRatio = _options$yAxisWidthRa === void 0 ? 0.15 : _options$yAxisWidthRa;
|
|
20
|
+
return (0, _react.useMemo)(function () {
|
|
21
|
+
if (type !== "Bar") {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
var tickFontSize = 12;
|
|
25
|
+
var avgCharWidth = 7;
|
|
26
|
+
var calculateMaxChars = function calculateMaxChars() {
|
|
27
|
+
var availableWidth = chartWidth * yAxisWidthRatio;
|
|
28
|
+
var maxChars = Math.floor(availableWidth / avgCharWidth);
|
|
29
|
+
return Math.max(5, Math.min(30, maxChars));
|
|
30
|
+
};
|
|
31
|
+
var maxChars = calculateMaxChars();
|
|
32
|
+
var YTick = function YTick(_ref) {
|
|
33
|
+
var _payload$value;
|
|
34
|
+
var x = _ref.x,
|
|
35
|
+
y = _ref.y,
|
|
36
|
+
payload = _ref.payload;
|
|
37
|
+
var full = String((_payload$value = payload === null || payload === void 0 ? void 0 : payload.value) !== null && _payload$value !== void 0 ? _payload$value : "");
|
|
38
|
+
var text = full.length > maxChars ? full.slice(0, maxChars - 1) + "…" : full;
|
|
39
|
+
return __jsx("g", {
|
|
40
|
+
transform: "translate(".concat(x, ",").concat(y, ")")
|
|
41
|
+
}, __jsx("text", {
|
|
42
|
+
dy: 4,
|
|
43
|
+
textAnchor: "end",
|
|
44
|
+
fontSize: tickFontSize,
|
|
45
|
+
fill: "currentColor"
|
|
46
|
+
}, __jsx("title", null, full), text));
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
tick: __jsx(YTick, null)
|
|
50
|
+
};
|
|
51
|
+
}, [type, chartWidth, yAxisWidthRatio]);
|
|
52
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useXAxisConfig = useXAxisConfig;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
13
|
+
var __jsx = _react["default"].createElement;
|
|
14
|
+
function useXAxisConfig(_ref) {
|
|
15
|
+
var _chartContainerRef$cu2;
|
|
16
|
+
var type = _ref.type,
|
|
17
|
+
processedData = _ref.processedData,
|
|
18
|
+
xDataKeyArr = _ref.xDataKeyArr,
|
|
19
|
+
chartContainerRef = _ref.chartContainerRef,
|
|
20
|
+
getDefaultXAxisLabel = _ref.getDefaultXAxisLabel,
|
|
21
|
+
xnumberformat = _ref.xnumberformat,
|
|
22
|
+
showxaxis = _ref.showxaxis,
|
|
23
|
+
xaxislabeldistance = _ref.xaxislabeldistance;
|
|
24
|
+
var xAxisConfig = (0, _react.useMemo)(function () {
|
|
25
|
+
var _chartContainerRef$cu;
|
|
26
|
+
var tickFontSize = 12;
|
|
27
|
+
var numTicks = type === "Bar" ? 5 : Math.max(1, processedData && processedData.length || xDataKeyArr.length || 1);
|
|
28
|
+
var containerWidth = ((_chartContainerRef$cu = chartContainerRef.current) === null || _chartContainerRef$cu === void 0 ? void 0 : _chartContainerRef$cu.clientWidth) || 300;
|
|
29
|
+
var maxWidthPx = Math.max(40, Math.floor((containerWidth - 60) / numTicks));
|
|
30
|
+
var approxCharWidth = tickFontSize * 0.8; // heuristic for average character width
|
|
31
|
+
var maxChars = Math.max(3, Math.floor(maxWidthPx / approxCharWidth));
|
|
32
|
+
|
|
33
|
+
// Estimate overlap risk from actual labels we will render
|
|
34
|
+
var rawLabels = (processedData || []).map(function (d) {
|
|
35
|
+
return d === null || d === void 0 ? void 0 : d.x;
|
|
36
|
+
});
|
|
37
|
+
var displayLabels = rawLabels.length > 0 ? rawLabels.map(function (val, idx) {
|
|
38
|
+
var _v;
|
|
39
|
+
var v = val;
|
|
40
|
+
if (xnumberformat && typeof v === "number") {
|
|
41
|
+
v = (0, _utils.formatNumber)(v, xnumberformat);
|
|
42
|
+
} else if (xDataKeyArr.length > 0 && xDataKeyArr[idx] !== undefined) {
|
|
43
|
+
v = xDataKeyArr[idx];
|
|
44
|
+
}
|
|
45
|
+
return String((_v = v) !== null && _v !== void 0 ? _v : "");
|
|
46
|
+
}) : (xDataKeyArr || []).map(function (v) {
|
|
47
|
+
return String(v !== null && v !== void 0 ? v : "");
|
|
48
|
+
});
|
|
49
|
+
var maxLabelChars = displayLabels.length ? Math.max.apply(Math, (0, _toConsumableArray2["default"])(displayLabels.map(function (s) {
|
|
50
|
+
return s.length;
|
|
51
|
+
}))) : 0;
|
|
52
|
+
var mayOverlap = maxLabelChars * approxCharWidth > maxWidthPx;
|
|
53
|
+
var shouldStagger = type !== "Bar" && mayOverlap;
|
|
54
|
+
var XAxisTickWithTooltip = function XAxisTickWithTooltip(_ref2) {
|
|
55
|
+
var _displayValue;
|
|
56
|
+
var x = _ref2.x,
|
|
57
|
+
y = _ref2.y,
|
|
58
|
+
payload = _ref2.payload,
|
|
59
|
+
index = _ref2.index;
|
|
60
|
+
var rawValue = payload === null || payload === void 0 ? void 0 : payload.value;
|
|
61
|
+
// Preserve existing mapping/formatting behavior
|
|
62
|
+
var displayValue = rawValue;
|
|
63
|
+
if (xnumberformat && typeof rawValue === "number") {
|
|
64
|
+
displayValue = (0, _utils.formatNumber)(rawValue, xnumberformat);
|
|
65
|
+
} else if (xDataKeyArr.length > 0 && typeof index === "number" && xDataKeyArr[index] !== undefined) {
|
|
66
|
+
displayValue = xDataKeyArr[index];
|
|
67
|
+
}
|
|
68
|
+
var fullText = String((_displayValue = displayValue) !== null && _displayValue !== void 0 ? _displayValue : "");
|
|
69
|
+
var needsEllipsis = fullText.length > maxChars;
|
|
70
|
+
var truncatedText = needsEllipsis ? fullText.slice(0, Math.max(0, maxChars - 1)) + "…" : fullText;
|
|
71
|
+
var textAnchor = "middle";
|
|
72
|
+
return __jsx("g", {
|
|
73
|
+
transform: "translate(".concat(x, ",").concat(y, ")")
|
|
74
|
+
}, __jsx("text", {
|
|
75
|
+
textAnchor: textAnchor,
|
|
76
|
+
fontSize: tickFontSize,
|
|
77
|
+
fill: "currentColor"
|
|
78
|
+
}, __jsx("title", null, fullText), truncatedText));
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
hide: !showxaxis,
|
|
82
|
+
label: {
|
|
83
|
+
// value: getDefaultXAxisLabel(),
|
|
84
|
+
position: "insideBottom",
|
|
85
|
+
offset: xaxislabeldistance,
|
|
86
|
+
fill: "#000"
|
|
87
|
+
},
|
|
88
|
+
// Ensure all x-axis labels render
|
|
89
|
+
interval: 0,
|
|
90
|
+
// Provide extra space only when staggering is needed
|
|
91
|
+
height: type === "Bar" ? undefined : shouldStagger ? 40 : undefined,
|
|
92
|
+
tickMargin: 8,
|
|
93
|
+
// Custom tick that truncates with ellipsis and shows full text in native tooltip
|
|
94
|
+
tick: __jsx(XAxisTickWithTooltip, null)
|
|
95
|
+
};
|
|
96
|
+
}, [type, processedData, xDataKeyArr, (_chartContainerRef$cu2 = chartContainerRef.current) === null || _chartContainerRef$cu2 === void 0 ? void 0 : _chartContainerRef$cu2.clientWidth, getDefaultXAxisLabel, xnumberformat, showxaxis, xaxislabeldistance]);
|
|
97
|
+
return xAxisConfig;
|
|
98
|
+
}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -23,12 +23,15 @@ var _lineAreaChart = require("./components/lineAreaChart");
|
|
|
23
23
|
var _bubbleChart = require("./components/bubbleChart");
|
|
24
24
|
var _cumulativeLineChart = require("./components/cumulativeLineChart");
|
|
25
25
|
var _pieDonutChart = require("./components/pieDonutChart");
|
|
26
|
+
var _useXAxisConfig = require("./hooks/useXAxisConfig");
|
|
27
|
+
var _useBarYAxisExtras = require("./hooks/useBarYAxisExtras");
|
|
26
28
|
var _excluded = ["title", "type", "subheading", "datavalue", "groupby", "aggregation", "aggregationcolumn", "orderby", "xaxisdatakey", "xaxislabel", "xnumberformat", "xdigits", "xdateformat", "xaxislabeldistance", "xunits", "yaxisdatakey", "yaxislabel", "ynumberformat", "ydigits", "yaxislabeldistance", "yunits", "iconclass", "nodatamessage", "loadingdatamsg", "tooltips", "showlegend", "showlabelsoutside", "showvalues", "staggerlabels", "reducexticks", "showlabels", "labeltype", "barspacing", "donutratio", "bubblesize", "showxdistance", "showydistance", "areaviewtype", "interpolation", "centerlabel", "customcolors", "theme", "offset", "offsettop", "offsetbottom", "offsetright", "offsetleft", "showxaxis", "showyaxis", "linethickness", "highlightpoints", "formattype", "dataset", "datasource", "width", "height", "shape", "onSelect", "onTransform", "onBeforerender", "xdomain", "ydomain", "labelthreshold", "legendtype", "viewtype", "fontsize", "fontunit", "color", "fontfamily", "fontweight", "fontstyle", "textdecoration", "className", "show", "styles", "name"];
|
|
27
29
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
28
30
|
var __jsx = _react["default"].createElement;
|
|
29
31
|
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; }
|
|
30
32
|
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) { (0, _defineProperty2["default"])(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; }
|
|
31
33
|
var WmChart = function WmChart(props) {
|
|
34
|
+
var _chartContainerRef$cu, _ref, _width, _height;
|
|
32
35
|
var title = props.title,
|
|
33
36
|
_props$type = props.type,
|
|
34
37
|
type = _props$type === void 0 ? "Column" : _props$type,
|
|
@@ -78,7 +81,7 @@ var WmChart = function WmChart(props) {
|
|
|
78
81
|
_props$barspacing = props.barspacing,
|
|
79
82
|
barspacing = _props$barspacing === void 0 ? "medium" : _props$barspacing,
|
|
80
83
|
_props$donutratio = props.donutratio,
|
|
81
|
-
donutratio = _props$donutratio === void 0 ? "
|
|
84
|
+
donutratio = _props$donutratio === void 0 ? "small" : _props$donutratio,
|
|
82
85
|
bubblesize = props.bubblesize,
|
|
83
86
|
_props$showxdistance = props.showxdistance,
|
|
84
87
|
showxdistance = _props$showxdistance === void 0 ? false : _props$showxdistance,
|
|
@@ -597,6 +600,26 @@ var WmChart = function WmChart(props) {
|
|
|
597
600
|
}
|
|
598
601
|
}, [getAvailableRegions, availableRegions]);
|
|
599
602
|
|
|
603
|
+
// Transform object with labels/values arrays to array of objects format
|
|
604
|
+
var transformObjectToArray = (0, _react.useCallback)(function (data, xKey, yKey) {
|
|
605
|
+
// Check if data is an object with arrays (like {labels: [...], values: [...]})
|
|
606
|
+
if (!(0, _lodash.isArray)(data) && (0, _lodash.isObject)(data)) {
|
|
607
|
+
var dataObj = data;
|
|
608
|
+
if (dataObj[xKey] && dataObj[yKey] && (0, _lodash.isArray)(dataObj[xKey]) && (0, _lodash.isArray)(dataObj[yKey])) {
|
|
609
|
+
var xArray = dataObj[xKey];
|
|
610
|
+
var yArray = dataObj[yKey];
|
|
611
|
+
// Transform to array of objects: [{labels: '2025-W43', values: 13.97}, ...]
|
|
612
|
+
return xArray.map(function (xVal, index) {
|
|
613
|
+
var result = {};
|
|
614
|
+
result[xKey] = xVal;
|
|
615
|
+
result[yKey] = yArray[index];
|
|
616
|
+
return result;
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return data;
|
|
621
|
+
}, []);
|
|
622
|
+
|
|
600
623
|
// Single effect to handle all data processing
|
|
601
624
|
(0, _react.useEffect)(function () {
|
|
602
625
|
var data = [];
|
|
@@ -617,8 +640,15 @@ var WmChart = function WmChart(props) {
|
|
|
617
640
|
});
|
|
618
641
|
setXDataKeyArr(dd.flat());
|
|
619
642
|
} else if (dataset) {
|
|
643
|
+
var _yaxisdatakey$split$;
|
|
644
|
+
// Transform object format to array format if needed
|
|
645
|
+
// Check if dataset is an object with arrays matching xaxisdatakey and yaxisdatakey
|
|
646
|
+
var xKey = xaxisdatakey || "labels";
|
|
647
|
+
var yKey = (yaxisdatakey === null || yaxisdatakey === void 0 || (_yaxisdatakey$split$ = yaxisdatakey.split(",")[0]) === null || _yaxisdatakey$split$ === void 0 ? void 0 : _yaxisdatakey$split$.trim()) || "values";
|
|
648
|
+
var transformedDataset = transformObjectToArray(dataset, xKey, yKey);
|
|
649
|
+
|
|
620
650
|
// Use real dataset
|
|
621
|
-
var processedDataset = (0, _lodash.isArray)(
|
|
651
|
+
var processedDataset = (0, _lodash.isArray)(transformedDataset) ? transformedDataset : [transformedDataset];
|
|
622
652
|
setChartData(processedDataset);
|
|
623
653
|
if (processedDataset.length > 0) {
|
|
624
654
|
data = processChartData(processedDataset);
|
|
@@ -628,7 +658,7 @@ var WmChart = function WmChart(props) {
|
|
|
628
658
|
setupRegions(data);
|
|
629
659
|
setProcessedData(processDataWithFilters(data));
|
|
630
660
|
}
|
|
631
|
-
}, [binddataset, dataset, type, yaxisdatakey, shape, processDataWithFilters, setupRegions]);
|
|
661
|
+
}, [binddataset, dataset, type, xaxisdatakey, yaxisdatakey, shape, processDataWithFilters, setupRegions, transformObjectToArray]);
|
|
632
662
|
|
|
633
663
|
// Handle chart data updates - only when NOT using onTransform
|
|
634
664
|
(0, _react.useEffect)(function () {
|
|
@@ -677,37 +707,34 @@ var WmChart = function WmChart(props) {
|
|
|
677
707
|
setSelectedItem(dataObj);
|
|
678
708
|
onSelect === null || onSelect === void 0 || onSelect(event, props, dataObj, selectedChartItem);
|
|
679
709
|
}, [onSelect, props]);
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
};
|
|
705
|
-
}, [showxaxis, getDefaultXAxisLabel, xnumberformat, xDataKeyArr]);
|
|
710
|
+
|
|
711
|
+
// For Bar charts the categorical axis is Y; reduce label crowding and add ellipsis + tooltip
|
|
712
|
+
var barYAxisExtras = (0, _useBarYAxisExtras.useBarYAxisExtras)({
|
|
713
|
+
type: type,
|
|
714
|
+
chartWidth: (_chartContainerRef$cu = chartContainerRef.current) === null || _chartContainerRef$cu === void 0 ? void 0 : _chartContainerRef$cu.offsetWidth
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// For Bar charts, categorical axis is Y and numeric axis is X. Align visibility with Angular semantics.
|
|
718
|
+
var xAxisShow = (0, _react.useMemo)(function () {
|
|
719
|
+
return type === "Bar" ? showyaxis : showxaxis;
|
|
720
|
+
}, [type, showyaxis, showxaxis]);
|
|
721
|
+
var yAxisShow = (0, _react.useMemo)(function () {
|
|
722
|
+
return type === "Bar" ? showxaxis : showyaxis;
|
|
723
|
+
}, [type, showxaxis, showyaxis]);
|
|
724
|
+
var getXAxisConfig = (0, _useXAxisConfig.useXAxisConfig)({
|
|
725
|
+
type: type,
|
|
726
|
+
processedData: processedData,
|
|
727
|
+
xDataKeyArr: xDataKeyArr,
|
|
728
|
+
chartContainerRef: chartContainerRef,
|
|
729
|
+
getDefaultXAxisLabel: getDefaultXAxisLabel,
|
|
730
|
+
xnumberformat: xnumberformat,
|
|
731
|
+
showxaxis: xAxisShow,
|
|
732
|
+
xaxislabeldistance: xaxislabeldistance
|
|
733
|
+
});
|
|
706
734
|
var getYAxisConfig = (0, _react.useMemo)(function () {
|
|
707
|
-
return {
|
|
708
|
-
hide: !
|
|
735
|
+
return _objectSpread(_objectSpread({
|
|
736
|
+
hide: !yAxisShow,
|
|
709
737
|
label: {
|
|
710
|
-
value: (0, _utils.truncateText)(getDefaultYAxisLabel(), 20),
|
|
711
738
|
angle: -90,
|
|
712
739
|
position: "insideLeft",
|
|
713
740
|
offset: yaxislabeldistance,
|
|
@@ -720,15 +747,16 @@ var WmChart = function WmChart(props) {
|
|
|
720
747
|
fontSize: 12,
|
|
721
748
|
fontFamily: "inherit",
|
|
722
749
|
fill: "currentColor"
|
|
723
|
-
}
|
|
750
|
+
}
|
|
751
|
+
}, barYAxisExtras), {}, {
|
|
724
752
|
tickFormatter: function tickFormatter(value, index) {
|
|
725
753
|
if (typeof value === "number") {
|
|
726
754
|
return (0, _utils.formatNumber)(value, ynumberformat);
|
|
727
755
|
}
|
|
728
756
|
return value;
|
|
729
757
|
}
|
|
730
|
-
};
|
|
731
|
-
}, [
|
|
758
|
+
});
|
|
759
|
+
}, [yAxisShow, getDefaultYAxisLabel, ynumberformat, yaxislabeldistance, processedData]);
|
|
732
760
|
var handleRegionChange = (0, _react.useCallback)(function (region) {
|
|
733
761
|
var isDoubleClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
734
762
|
setSelectedRegions(function (prev) {
|
|
@@ -825,7 +853,8 @@ var WmChart = function WmChart(props) {
|
|
|
825
853
|
case "Bar":
|
|
826
854
|
return __jsx(_barColumnChart.BarColumnChart, (0, _extends2["default"])({}, commonProps, {
|
|
827
855
|
type: "Bar",
|
|
828
|
-
viewtype: viewtype
|
|
856
|
+
viewtype: viewtype,
|
|
857
|
+
shouldShowLegend: shouldShowLegend
|
|
829
858
|
}));
|
|
830
859
|
case "Line":
|
|
831
860
|
return __jsx(_lineAreaChart.LineAreaChart, (0, _extends2["default"])({}, commonProps, {
|
|
@@ -860,7 +889,8 @@ var WmChart = function WmChart(props) {
|
|
|
860
889
|
onChartClick: handleChartClick,
|
|
861
890
|
onLegendClick: handleLegendClick,
|
|
862
891
|
showLegend: shouldShowLegend,
|
|
863
|
-
centerlabel: centerlabel
|
|
892
|
+
centerlabel: centerlabel,
|
|
893
|
+
donutratio: donutratio
|
|
864
894
|
}));
|
|
865
895
|
case "Bubble":
|
|
866
896
|
return __jsx(_bubbleChart.BubbleChart, (0, _extends2["default"])({}, commonProps, {
|
|
@@ -885,7 +915,10 @@ var WmChart = function WmChart(props) {
|
|
|
885
915
|
return __jsx(_material.Box, {
|
|
886
916
|
component: "div",
|
|
887
917
|
className: "app-chart ".concat(className || "", " ").concat(title ? "panel" : ""),
|
|
888
|
-
style: _objectSpread(_objectSpread({}, styles), fontStyles),
|
|
918
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styles), fontStyles), {}, {
|
|
919
|
+
width: (_ref = (_width = styles === null || styles === void 0 ? void 0 : styles.width) !== null && _width !== void 0 ? _width : width) !== null && _ref !== void 0 ? _ref : height,
|
|
920
|
+
height: (_height = styles === null || styles === void 0 ? void 0 : styles.height) !== null && _height !== void 0 ? _height : height
|
|
921
|
+
}),
|
|
889
922
|
ref: chartContainerRef,
|
|
890
923
|
id: "wmChart-".concat(type),
|
|
891
924
|
name: name
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.truncateText = exports.triggerFn = exports.prettifyLabels = exports.isShowLegend = exports.isPieType = exports.isPieChart = exports.isNumberType = exports.isLineTypeChart = exports.isLineChart = exports.isEmptyObject = exports.isDonutChart = exports.isCumulativeLineChart = exports.isColumnChart = exports.isChartDataJSON = exports.isChartDataArray = exports.isBubbleChart = exports.isBarChart = exports.isAxisDomainSupported = exports.isAreaChart = exports.getSampleData = exports.getRadiusValue = exports.getNumberFormatedData = exports.getLodashOrderByFormat = exports.getLegendPopupStyle = exports.getDateList = exports.getDateFormatedData = exports.getBarSpacingValue = exports.formatNumber = exports.convertToRechartsFormat = exports.allShapes = exports.SAMPLE_DATA = exports.NONE = void 0;
|
|
7
|
+
exports.truncateText = exports.triggerFn = exports.prettifyLabels = exports.normalizeDonutRatio = exports.isShowLegend = exports.isPieType = exports.isPieChart = exports.isNumberType = exports.isLineTypeChart = exports.isLineChart = exports.isEmptyObject = exports.isDonutChart = exports.isCumulativeLineChart = exports.isColumnChart = exports.isChartDataJSON = exports.isChartDataArray = exports.isBubbleChart = exports.isBarChart = exports.isAxisDomainSupported = exports.isAreaChart = exports.getSampleData = exports.getRadiusValue = exports.getNumberFormatedData = exports.getLodashOrderByFormat = exports.getLegendPopupStyle = exports.getDateList = exports.getDateFormatedData = exports.getBarSpacingValue = exports.formatNumber = exports.convertToRechartsFormat = exports.allShapes = exports.SAMPLE_DATA = exports.NONE = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _forEach = _interopRequireDefault(require("lodash-es/forEach"));
|
|
@@ -557,17 +557,8 @@ var convertToRechartsFormat = exports.convertToRechartsFormat = function convert
|
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
|
|
560
|
-
//
|
|
561
|
-
|
|
562
|
-
// Handle different data types for sorting
|
|
563
|
-
if (typeof a === "number" && typeof b === "number") {
|
|
564
|
-
return a - b;
|
|
565
|
-
}
|
|
566
|
-
return String(a).localeCompare(String(b));
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
// Create data points for each x value
|
|
570
|
-
sortedXValues.forEach(function (x) {
|
|
560
|
+
// Create data points for each x value in the preserved order
|
|
561
|
+
Array.from(xValuesSet).forEach(function (x) {
|
|
571
562
|
var resultPoint = {
|
|
572
563
|
x: x
|
|
573
564
|
};
|
|
@@ -688,4 +679,24 @@ var truncateText = exports.truncateText = function truncateText(text) {
|
|
|
688
679
|
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
689
680
|
if (text.length <= maxLength) return text;
|
|
690
681
|
return text.substring(0, maxLength) + "...";
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
// Normalize donut ratio from various inputs to a numeric ratio (0-1)
|
|
685
|
+
var normalizeDonutRatio = exports.normalizeDonutRatio = function normalizeDonutRatio(value) {
|
|
686
|
+
var fallback = 0.6;
|
|
687
|
+
if (value === undefined || value === null) {
|
|
688
|
+
return fallback;
|
|
689
|
+
}
|
|
690
|
+
if (typeof value === "number") {
|
|
691
|
+
return value > 1 ? value / 100 : value;
|
|
692
|
+
}
|
|
693
|
+
var val = String(value).toLowerCase().trim();
|
|
694
|
+
if (val === "small") return 0.3;
|
|
695
|
+
if (val === "medium") return 0.6;
|
|
696
|
+
if (val === "large") return 0.7;
|
|
697
|
+
var parsed = parseFloat(val);
|
|
698
|
+
if (!isNaN(parsed)) {
|
|
699
|
+
return parsed > 1 ? parsed / 100 : parsed;
|
|
700
|
+
}
|
|
701
|
+
return fallback;
|
|
691
702
|
};
|
|
@@ -156,15 +156,15 @@ var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
|
156
156
|
var computedStyles = (0, _react.useMemo)(function () {
|
|
157
157
|
var base = alignment && alignmentMatrix[alignment];
|
|
158
158
|
if (!base) {
|
|
159
|
-
return _objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), {}, {
|
|
160
|
-
display: display
|
|
161
|
-
});
|
|
159
|
+
return _objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), {}, (0, _defineProperty2["default"])({
|
|
160
|
+
display: display || props.direction ? "flex" : ""
|
|
161
|
+
}, "flex-flow", direction || "row"));
|
|
162
162
|
}
|
|
163
163
|
var alignmentStyles = (0, _alignmentUtils.calculateAlignmentStyles)(alignmentMatrix, alignment, direction, wrap);
|
|
164
164
|
var spacingStyles = (0, _alignmentUtils.calculateSpacingStyles)(alignmentMatrix, gap, columngap, alignment, direction, wrap);
|
|
165
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), alignmentStyles), spacingStyles), {}, {
|
|
165
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), alignmentStyles), spacingStyles), {}, (0, _defineProperty2["default"])({
|
|
166
166
|
display: display || "flex"
|
|
167
|
-
});
|
|
167
|
+
}, "flex-flow", direction || "row"));
|
|
168
168
|
}, [styles, customStyles, alignment, direction, wrap, gap, columngap, display]);
|
|
169
169
|
(0, _react.useEffect)(function () {
|
|
170
170
|
if (props !== null && props !== void 0 && props.onLoad && !isLoaded.current) {
|
|
@@ -180,8 +180,7 @@ var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
|
180
180
|
id: id,
|
|
181
181
|
hidden: props.hidden
|
|
182
182
|
}, domEvents, {
|
|
183
|
-
name: props.name
|
|
184
|
-
hidden: props.hidden
|
|
183
|
+
name: props.name
|
|
185
184
|
}), renderPartial ? renderPartial(props, props.onLoad) : children);
|
|
186
185
|
};
|
|
187
186
|
WmContainer.displayName = "WmContainer";
|
|
@@ -17,6 +17,7 @@ var _HelpOutline = _interopRequireDefault(require("@mui/icons-material/HelpOutli
|
|
|
17
17
|
var _menu = _interopRequireDefault(require("@wavemaker/react-runtime/components/navigation/menu"));
|
|
18
18
|
var __jsx = _react["default"].createElement; // Icons
|
|
19
19
|
var PanelHeader = function PanelHeader(_ref) {
|
|
20
|
+
var _listener$appLocale$L, _listener$appLocale, _listener$appLocale$L2, _listener$appLocale2;
|
|
20
21
|
var _ref$title = _ref.title,
|
|
21
22
|
title = _ref$title === void 0 ? "Title" : _ref$title,
|
|
22
23
|
subheading = _ref.subheading,
|
|
@@ -124,9 +125,9 @@ var PanelHeader = function PanelHeader(_ref) {
|
|
|
124
125
|
}) : __jsx(_ExpandMore["default"], {
|
|
125
126
|
className: "wi-plus"
|
|
126
127
|
})), enablefullscreen && __jsx(_material.IconButton, {
|
|
127
|
-
"aria-label":
|
|
128
|
+
"aria-label": "Fullscreen/Exit",
|
|
128
129
|
className: "app-icon panel-action wi",
|
|
129
|
-
title:
|
|
130
|
+
title: "".concat((_listener$appLocale$L = listener === null || listener === void 0 || (_listener$appLocale = listener.appLocale) === null || _listener$appLocale === void 0 ? void 0 : _listener$appLocale.LABEL_FULLSCREEN) !== null && _listener$appLocale$L !== void 0 ? _listener$appLocale$L : "Fullscreen", "/").concat((_listener$appLocale$L2 = listener === null || listener === void 0 || (_listener$appLocale2 = listener.appLocale) === null || _listener$appLocale2 === void 0 ? void 0 : _listener$appLocale2.LABEL_EXITFULLSCREEN) !== null && _listener$appLocale$L2 !== void 0 ? _listener$appLocale$L2 : "Exit Fullscreen"),
|
|
130
131
|
onClick: onToggleFullScreen
|
|
131
132
|
}, isFullscreen ? __jsx(_FullscreenExit["default"], {
|
|
132
133
|
className: "wi-fullscreen-exit"
|