@wavemaker/react-runtime 11.14.3-rc.6401 → 11.14.4-rc.647538
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 +3 -5
- package/actions/notification-action.js +3 -6
- package/components/basic/anchor/index.js +7 -6
- package/components/basic/label/index.js +2 -2
- package/components/basic/search/index.js +3 -7
- package/components/chart/components/barColumnChart/index.js +4 -2
- package/components/chart/components/pieDonutChart/index.js +1 -3
- package/components/chart/index.js +39 -72
- package/components/chart/utils.js +12 -23
- package/components/container/index.js +7 -6
- package/components/container/panel/components/panel-header/index.js +2 -3
- package/components/container/panel/index.js +9 -13
- package/components/container/tabs/index.js +0 -1
- package/components/container/tabs/tab-pane/index.js +3 -39
- package/components/container/wizard/index.js +57 -187
- package/components/container/wizard/utils.js +1 -1
- package/components/container/wizard/wizard-action/index.js +4 -9
- package/components/container/wizard/wizard-step/index.js +8 -21
- package/components/data/form/base-form/index.js +11 -51
- package/components/data/form/form-controller/withFormController.js +10 -7
- package/components/data/list/components/GroupedListItems.js +1 -5
- package/components/data/list/components/ListItemWithTemplate.js +1 -4
- package/components/data/list/hooks/useListEffects.js +14 -34
- package/components/data/list/hooks/useListEventHandlers.js +2 -18
- package/components/data/list/hooks/useListState.js +2 -15
- package/components/data/list/index.js +0 -1
- package/components/data/list/utils/list-helpers.js +5 -3
- package/components/data/list/utils/list-widget-methods.js +1 -1
- package/components/data/live-filter/index.js +5 -6
- package/components/data/live-form/index.js +14 -24
- package/components/data/table/components/TableBody.js +21 -5
- package/components/data/table/components/TableHeader.js +1 -5
- package/components/data/table/index.js +5 -21
- package/components/data/utils/field-data-utils.js +1 -1
- package/components/dialogs/index.js +16 -14
- package/components/input/currency/index.js +7 -11
- package/components/input/default/checkbox/index.js +3 -2
- package/components/input/default/checkboxset/index.js +22 -2
- package/components/input/default/radioset/index.js +4 -5
- package/components/input/epoch/datetime/index.js +2 -6
- package/components/input/epoch/time/index.js +1 -2
- package/components/input/number/index.js +2 -2
- package/components/input/text/util.js +0 -2
- package/components/input/textarea/index.js +24 -22
- package/components/layout/leftnav/index.js +1 -1
- package/components/navbar/nav/index.js +7 -97
- package/components/navbar/nav-item/index.js +2 -5
- package/components/navigation/menu/index.js +12 -73
- package/components/navigation/popover/index.js +0 -2
- package/components/page/error-boundary/index.js +0 -1
- package/components/prefab/container/index.js +3 -10
- package/context/LocalizationProvider.js +0 -1
- package/context/PrefabContext.js +13 -138
- package/context/WidgetProvider.js +2 -2
- package/core/constants/events.js +6 -12
- package/core/constants/index.js +11 -6
- package/core/formatter/number-formatters.js +1 -1
- package/core/proxy-service.js +36 -72
- package/core/util/utils.js +4 -23
- package/higherOrder/BaseApp.js +18 -60
- package/higherOrder/BasePage.js +77 -99
- package/higherOrder/BasePrefab.js +5 -13
- package/higherOrder/withBaseWrapper.js +3 -3
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +13 -20
- package/mui-config/theme.js +0 -3
- package/package-lock.json +747 -704
- package/package.json +3 -3
- package/store/index.js +1 -5
- package/variables/service-variable.js +14 -17
- package/components/chart/hooks/useBarYAxisExtras.js +0 -52
- package/components/chart/hooks/useXAxisConfig.js +0 -98
- package/utils/lib-error-skipper.js +0 -196
|
@@ -120,12 +120,10 @@ 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
|
|
124
123
|
var queryParams = Object.entries(params).filter(function (_ref) {
|
|
125
|
-
var _ref2 = (0, _slicedToArray2["default"])(_ref,
|
|
126
|
-
key = _ref2[0]
|
|
127
|
-
|
|
128
|
-
return key !== "pageName" && value !== undefined && value !== null && value !== "";
|
|
124
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 1),
|
|
125
|
+
key = _ref2[0];
|
|
126
|
+
return key !== "pageName";
|
|
129
127
|
}).map(function (_ref3) {
|
|
130
128
|
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
131
129
|
key = _ref4[0],
|
|
@@ -37,18 +37,15 @@ var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_Ba
|
|
|
37
37
|
(0, _createClass2["default"])(NotificationAction, [{
|
|
38
38
|
key: "prepareToastOptions",
|
|
39
39
|
value: function prepareToastOptions() {
|
|
40
|
-
var
|
|
41
|
-
_String,
|
|
42
|
-
_mergedParams$toaster,
|
|
43
|
-
_this = this;
|
|
40
|
+
var _this = this;
|
|
44
41
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
45
42
|
var configParams = this.config.paramProvider();
|
|
46
43
|
var mergedParams = _objectSpread(_objectSpread({}, configParams), params);
|
|
47
|
-
var alertClass = (
|
|
44
|
+
var alertClass = (mergedParams["class"] || "info").toLowerCase();
|
|
48
45
|
var type = NOTIFICATION_TYPE[alertClass] || "info";
|
|
49
46
|
|
|
50
47
|
// get toast position
|
|
51
|
-
var position =
|
|
48
|
+
var position = mergedParams.toasterPosition || "top right";
|
|
52
49
|
|
|
53
50
|
// Determine duration (0 means stay until dismissed)
|
|
54
51
|
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 _navigation = require("next/navigation");
|
|
21
|
+
var _excluded = ["caption", "iconclass", "styles", "className", "iconheight", "iconwidth", "iconmargin", "iconurl", "iconposition", "badgevalue", "listener", "hyperlink", "encodeurl", "onClick", "shortcutkey", "arialabel", "target"];
|
|
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,9 +51,8 @@ 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,
|
|
55
54
|
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
56
|
-
var path = (0,
|
|
55
|
+
var path = (0, _navigation.usePathname)();
|
|
57
56
|
var _useState = (0, _react.useState)(false),
|
|
58
57
|
isActive = _useState[0],
|
|
59
58
|
setIsActive = _useState[1];
|
|
@@ -114,10 +113,12 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
114
113
|
|
|
115
114
|
// Determine active state
|
|
116
115
|
(0, _react.useEffect)(function () {
|
|
116
|
+
var lastSegment = path.split("/").pop();
|
|
117
|
+
var activeByCaptionMatch = caption && lastSegment && lastSegment.toLowerCase() === String(caption).toLowerCase();
|
|
117
118
|
var activeByHyperlink = doesHyperlinkMatchCurrentPath;
|
|
118
119
|
var activeByNavigationExpr = navigationInfo.isCurrentPage;
|
|
119
|
-
setIsActive(activeByHyperlink || activeByNavigationExpr);
|
|
120
|
-
}, [caption, path, doesHyperlinkMatchCurrentPath, navigationInfo.isCurrentPage
|
|
120
|
+
setIsActive(activeByCaptionMatch || activeByHyperlink || activeByNavigationExpr);
|
|
121
|
+
}, [caption, path, doesHyperlinkMatchCurrentPath, navigationInfo.isCurrentPage]);
|
|
121
122
|
|
|
122
123
|
// Calculate icon position styles
|
|
123
124
|
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
|
|
62
|
+
var _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 =
|
|
80
|
+
var captionString = typeof caption === "string" ? caption : (_JSON$stringify = JSON.stringify(caption)) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : "";
|
|
81
81
|
|
|
82
82
|
// Check if caption contains HTML tags
|
|
83
83
|
var hasHTML = containsHTML(captionString);
|
|
@@ -31,7 +31,6 @@ 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"));
|
|
35
34
|
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"];
|
|
36
35
|
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); }
|
|
37
36
|
var __jsx = _react["default"].createElement;
|
|
@@ -217,7 +216,7 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
217
216
|
if (type === "autocomplete") {
|
|
218
217
|
getDataSource("");
|
|
219
218
|
}
|
|
220
|
-
}, [type]);
|
|
219
|
+
}, [dataset, type]);
|
|
221
220
|
|
|
222
221
|
// Update listen query state when type changes
|
|
223
222
|
(0, _react.useEffect)(function () {
|
|
@@ -620,10 +619,7 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
620
619
|
setMenuOpen(false);
|
|
621
620
|
setSelectedItem(item); // Set the selected item
|
|
622
621
|
setFormattedDataset([]); // Clear the dropdown dataset
|
|
623
|
-
|
|
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
|
-
}
|
|
622
|
+
|
|
627
623
|
if (listener !== null && listener !== void 0 && listener.onChange) {
|
|
628
624
|
listener.onChange(name, {
|
|
629
625
|
datavalue: item.dataObject.value
|
|
@@ -1024,4 +1020,4 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
1024
1020
|
}, "Clear button"), showclear && showclear !== "false" ? renderClearButton() : null, renderDropdown()));
|
|
1025
1021
|
});
|
|
1026
1022
|
Search.displayName = "WmSearch";
|
|
1027
|
-
var _default = exports["default"] = (0,
|
|
1023
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(Search);
|
|
@@ -40,8 +40,7 @@ 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
|
|
44
|
-
shouldShowLegend = _ref.shouldShowLegend;
|
|
43
|
+
viewtype = _ref$viewtype === void 0 ? "Grouped" : _ref$viewtype;
|
|
45
44
|
var isBarChart = type === "Bar"; // Bar = horizontal bars, Column = vertical bars
|
|
46
45
|
var isStacked = viewtype === "Stacked";
|
|
47
46
|
var formatValue = (0, _react.useCallback)(function (label) {
|
|
@@ -50,6 +49,9 @@ var BarColumnChart = exports.BarColumnChart = /*#__PURE__*/(0, _react.memo)(func
|
|
|
50
49
|
}
|
|
51
50
|
return String(label);
|
|
52
51
|
}, [numberFormat]);
|
|
52
|
+
var shouldShowLegend = (0, _react.useMemo)(function () {
|
|
53
|
+
return (0, _utils.isShowLegend)(showlegend);
|
|
54
|
+
}, [showlegend]);
|
|
53
55
|
return __jsx(_recharts.ResponsiveContainer, {
|
|
54
56
|
width: "100%",
|
|
55
57
|
height: "100%"
|
|
@@ -113,11 +113,9 @@ 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(donutratio !== null && donutratio !== void 0 ? donutratio : "60", "%") : 0,
|
|
117
117
|
outerRadius: "80%",
|
|
118
118
|
paddingAngle: 2,
|
|
119
|
-
startAngle: 90,
|
|
120
|
-
endAngle: -270,
|
|
121
119
|
onClick: function onClick(data, index, event) {
|
|
122
120
|
return onChartClick(data, index, event);
|
|
123
121
|
},
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
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,15 +23,12 @@ 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");
|
|
28
26
|
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"];
|
|
29
27
|
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); }
|
|
30
28
|
var __jsx = _react["default"].createElement;
|
|
31
29
|
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; }
|
|
32
30
|
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; }
|
|
33
31
|
var WmChart = function WmChart(props) {
|
|
34
|
-
var _chartContainerRef$cu, _ref, _width, _height;
|
|
35
32
|
var title = props.title,
|
|
36
33
|
_props$type = props.type,
|
|
37
34
|
type = _props$type === void 0 ? "Column" : _props$type,
|
|
@@ -81,7 +78,7 @@ var WmChart = function WmChart(props) {
|
|
|
81
78
|
_props$barspacing = props.barspacing,
|
|
82
79
|
barspacing = _props$barspacing === void 0 ? "medium" : _props$barspacing,
|
|
83
80
|
_props$donutratio = props.donutratio,
|
|
84
|
-
donutratio = _props$donutratio === void 0 ? "
|
|
81
|
+
donutratio = _props$donutratio === void 0 ? "medium" : _props$donutratio,
|
|
85
82
|
bubblesize = props.bubblesize,
|
|
86
83
|
_props$showxdistance = props.showxdistance,
|
|
87
84
|
showxdistance = _props$showxdistance === void 0 ? false : _props$showxdistance,
|
|
@@ -600,26 +597,6 @@ var WmChart = function WmChart(props) {
|
|
|
600
597
|
}
|
|
601
598
|
}, [getAvailableRegions, availableRegions]);
|
|
602
599
|
|
|
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
|
-
|
|
623
600
|
// Single effect to handle all data processing
|
|
624
601
|
(0, _react.useEffect)(function () {
|
|
625
602
|
var data = [];
|
|
@@ -640,15 +617,8 @@ var WmChart = function WmChart(props) {
|
|
|
640
617
|
});
|
|
641
618
|
setXDataKeyArr(dd.flat());
|
|
642
619
|
} 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
|
-
|
|
650
620
|
// Use real dataset
|
|
651
|
-
var processedDataset = (0, _lodash.isArray)(
|
|
621
|
+
var processedDataset = (0, _lodash.isArray)(dataset) ? dataset : [dataset];
|
|
652
622
|
setChartData(processedDataset);
|
|
653
623
|
if (processedDataset.length > 0) {
|
|
654
624
|
data = processChartData(processedDataset);
|
|
@@ -658,7 +628,7 @@ var WmChart = function WmChart(props) {
|
|
|
658
628
|
setupRegions(data);
|
|
659
629
|
setProcessedData(processDataWithFilters(data));
|
|
660
630
|
}
|
|
661
|
-
}, [binddataset, dataset, type,
|
|
631
|
+
}, [binddataset, dataset, type, yaxisdatakey, shape, processDataWithFilters, setupRegions]);
|
|
662
632
|
|
|
663
633
|
// Handle chart data updates - only when NOT using onTransform
|
|
664
634
|
(0, _react.useEffect)(function () {
|
|
@@ -707,34 +677,37 @@ var WmChart = function WmChart(props) {
|
|
|
707
677
|
setSelectedItem(dataObj);
|
|
708
678
|
onSelect === null || onSelect === void 0 || onSelect(event, props, dataObj, selectedChartItem);
|
|
709
679
|
}, [onSelect, props]);
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
680
|
+
var getXAxisConfig = (0, _react.useMemo)(function () {
|
|
681
|
+
return {
|
|
682
|
+
hide: !showxaxis,
|
|
683
|
+
label: {
|
|
684
|
+
value: getDefaultXAxisLabel(),
|
|
685
|
+
position: "insideBottom",
|
|
686
|
+
offset: xaxislabeldistance,
|
|
687
|
+
fill: "#000"
|
|
688
|
+
},
|
|
689
|
+
tick: {
|
|
690
|
+
fontSize: 12,
|
|
691
|
+
fontFamily: "inherit",
|
|
692
|
+
fill: "currentColor"
|
|
693
|
+
},
|
|
694
|
+
tickFormatter: xnumberformat ? function (value) {
|
|
695
|
+
return (0, _utils.formatNumber)(value, xnumberformat);
|
|
696
|
+
} : function (value, index) {
|
|
697
|
+
// BUG FIX 2 & 8: Show actual values instead of indices
|
|
698
|
+
if (xDataKeyArr.length > 0 && index !== undefined && xDataKeyArr[index] !== undefined) {
|
|
699
|
+
return xDataKeyArr[index];
|
|
700
|
+
}
|
|
701
|
+
// console.log('value line 721', value);
|
|
702
|
+
return value;
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
}, [showxaxis, getDefaultXAxisLabel, xnumberformat, xDataKeyArr]);
|
|
734
706
|
var getYAxisConfig = (0, _react.useMemo)(function () {
|
|
735
|
-
return
|
|
736
|
-
hide: !
|
|
707
|
+
return {
|
|
708
|
+
hide: !showyaxis,
|
|
737
709
|
label: {
|
|
710
|
+
value: (0, _utils.truncateText)(getDefaultYAxisLabel(), 20),
|
|
738
711
|
angle: -90,
|
|
739
712
|
position: "insideLeft",
|
|
740
713
|
offset: yaxislabeldistance,
|
|
@@ -747,16 +720,15 @@ var WmChart = function WmChart(props) {
|
|
|
747
720
|
fontSize: 12,
|
|
748
721
|
fontFamily: "inherit",
|
|
749
722
|
fill: "currentColor"
|
|
750
|
-
}
|
|
751
|
-
}, barYAxisExtras), {}, {
|
|
723
|
+
},
|
|
752
724
|
tickFormatter: function tickFormatter(value, index) {
|
|
753
725
|
if (typeof value === "number") {
|
|
754
726
|
return (0, _utils.formatNumber)(value, ynumberformat);
|
|
755
727
|
}
|
|
756
728
|
return value;
|
|
757
729
|
}
|
|
758
|
-
}
|
|
759
|
-
}, [
|
|
730
|
+
};
|
|
731
|
+
}, [showyaxis, getDefaultYAxisLabel, ynumberformat, yaxislabeldistance]);
|
|
760
732
|
var handleRegionChange = (0, _react.useCallback)(function (region) {
|
|
761
733
|
var isDoubleClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
762
734
|
setSelectedRegions(function (prev) {
|
|
@@ -853,8 +825,7 @@ var WmChart = function WmChart(props) {
|
|
|
853
825
|
case "Bar":
|
|
854
826
|
return __jsx(_barColumnChart.BarColumnChart, (0, _extends2["default"])({}, commonProps, {
|
|
855
827
|
type: "Bar",
|
|
856
|
-
viewtype: viewtype
|
|
857
|
-
shouldShowLegend: shouldShowLegend
|
|
828
|
+
viewtype: viewtype
|
|
858
829
|
}));
|
|
859
830
|
case "Line":
|
|
860
831
|
return __jsx(_lineAreaChart.LineAreaChart, (0, _extends2["default"])({}, commonProps, {
|
|
@@ -889,8 +860,7 @@ var WmChart = function WmChart(props) {
|
|
|
889
860
|
onChartClick: handleChartClick,
|
|
890
861
|
onLegendClick: handleLegendClick,
|
|
891
862
|
showLegend: shouldShowLegend,
|
|
892
|
-
centerlabel: centerlabel
|
|
893
|
-
donutratio: donutratio
|
|
863
|
+
centerlabel: centerlabel
|
|
894
864
|
}));
|
|
895
865
|
case "Bubble":
|
|
896
866
|
return __jsx(_bubbleChart.BubbleChart, (0, _extends2["default"])({}, commonProps, {
|
|
@@ -915,10 +885,7 @@ var WmChart = function WmChart(props) {
|
|
|
915
885
|
return __jsx(_material.Box, {
|
|
916
886
|
component: "div",
|
|
917
887
|
className: "app-chart ".concat(className || "", " ").concat(title ? "panel" : ""),
|
|
918
|
-
style: _objectSpread(_objectSpread(
|
|
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
|
-
}),
|
|
888
|
+
style: _objectSpread(_objectSpread({}, styles), fontStyles),
|
|
922
889
|
ref: chartContainerRef,
|
|
923
890
|
id: "wmChart-".concat(type),
|
|
924
891
|
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.
|
|
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;
|
|
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,8 +557,17 @@ var convertToRechartsFormat = exports.convertToRechartsFormat = function convert
|
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
|
|
560
|
-
//
|
|
561
|
-
Array.from(xValuesSet).
|
|
560
|
+
// Sort x values
|
|
561
|
+
var sortedXValues = Array.from(xValuesSet).sort(function (a, b) {
|
|
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) {
|
|
562
571
|
var resultPoint = {
|
|
563
572
|
x: x
|
|
564
573
|
};
|
|
@@ -679,24 +688,4 @@ var truncateText = exports.truncateText = function truncateText(text) {
|
|
|
679
688
|
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
|
|
680
689
|
if (text.length <= maxLength) return text;
|
|
681
690
|
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;
|
|
702
691
|
};
|
|
@@ -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), {}, {
|
|
160
|
+
display: display
|
|
161
|
+
});
|
|
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), {}, {
|
|
166
166
|
display: display || "flex"
|
|
167
|
-
}
|
|
167
|
+
});
|
|
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,7 +180,8 @@ var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
|
180
180
|
id: id,
|
|
181
181
|
hidden: props.hidden
|
|
182
182
|
}, domEvents, {
|
|
183
|
-
name: props.name
|
|
183
|
+
name: props.name,
|
|
184
|
+
hidden: props.hidden
|
|
184
185
|
}), renderPartial ? renderPartial(props, props.onLoad) : children);
|
|
185
186
|
};
|
|
186
187
|
WmContainer.displayName = "WmContainer";
|
|
@@ -17,7 +17,6 @@ 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;
|
|
21
20
|
var _ref$title = _ref.title,
|
|
22
21
|
title = _ref$title === void 0 ? "Title" : _ref$title,
|
|
23
22
|
subheading = _ref.subheading,
|
|
@@ -125,9 +124,9 @@ var PanelHeader = function PanelHeader(_ref) {
|
|
|
125
124
|
}) : __jsx(_ExpandMore["default"], {
|
|
126
125
|
className: "wi-plus"
|
|
127
126
|
})), enablefullscreen && __jsx(_material.IconButton, {
|
|
128
|
-
"aria-label": "Fullscreen
|
|
127
|
+
"aria-label": isFullscreen ? "Exit Fullscreen" : "Fullscreen",
|
|
129
128
|
className: "app-icon panel-action wi",
|
|
130
|
-
title:
|
|
129
|
+
title: isFullscreen ? "Exit Fullscreen" : "Fullscreen",
|
|
131
130
|
onClick: onToggleFullScreen
|
|
132
131
|
}, isFullscreen ? __jsx(_FullscreenExit["default"], {
|
|
133
132
|
className: "wi-fullscreen-exit"
|
|
@@ -35,13 +35,15 @@ var WmPanel = function WmPanel(props) {
|
|
|
35
35
|
fullscreen = _props$fullscreen === void 0 ? false : _props$fullscreen,
|
|
36
36
|
helptext = props.helptext,
|
|
37
37
|
hint = props.hint,
|
|
38
|
-
iconclass = props.iconclass,
|
|
38
|
+
_props$iconclass = props.iconclass,
|
|
39
|
+
iconclass = _props$iconclass === void 0 ? "wi wi-account-circle" : _props$iconclass,
|
|
39
40
|
iconheight = props.iconheight,
|
|
40
41
|
iconmargin = props.iconmargin,
|
|
41
42
|
iconurl = props.iconurl,
|
|
42
43
|
iconwidth = props.iconwidth,
|
|
43
44
|
subheading = props.subheading,
|
|
44
|
-
title = props.title,
|
|
45
|
+
_props$title = props.title,
|
|
46
|
+
title = _props$title === void 0 ? "Title" : _props$title,
|
|
45
47
|
className = props.className,
|
|
46
48
|
style = props.style,
|
|
47
49
|
children = props.children,
|
|
@@ -75,7 +77,6 @@ var WmPanel = function WmPanel(props) {
|
|
|
75
77
|
var _useState2 = (0, _react.useState)(true),
|
|
76
78
|
show = _useState2[0],
|
|
77
79
|
setShow = _useState2[1];
|
|
78
|
-
var hasTriggeredOnLoadRef = (0, _react.useRef)(false);
|
|
79
80
|
|
|
80
81
|
// Manages expand/collapse state
|
|
81
82
|
var _usePanelExpansion = (0, _hooks.usePanelExpansion)(expanded, onExpand, onCollapse, name, listener),
|
|
@@ -133,10 +134,8 @@ var WmPanel = function WmPanel(props) {
|
|
|
133
134
|
// onLoad handler
|
|
134
135
|
(0, _react.useEffect)(function () {
|
|
135
136
|
var _listener$Widgets6;
|
|
136
|
-
if (hasTriggeredOnLoadRef.current || !isExpanded) return;
|
|
137
|
-
hasTriggeredOnLoadRef.current = true;
|
|
138
137
|
onLoad === null || onLoad === void 0 || onLoad(listener === null || listener === void 0 || (_listener$Widgets6 = listener.Widgets) === null || _listener$Widgets6 === void 0 ? void 0 : _listener$Widgets6[name]);
|
|
139
|
-
}, [
|
|
138
|
+
}, []);
|
|
140
139
|
(0, _react.useEffect)(function () {
|
|
141
140
|
if (isExpanded) {
|
|
142
141
|
computeDimensions();
|
|
@@ -157,7 +156,6 @@ var WmPanel = function WmPanel(props) {
|
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
158
|
}, [closable]);
|
|
160
|
-
var showHeader = Boolean(iconurl || iconclass || collapsible || actions && (Array.isArray(actions) ? actions.length > 0 : true) || title || subheading || enablefullscreen);
|
|
161
159
|
|
|
162
160
|
// Panel methods exposed via listener
|
|
163
161
|
var collapse = function collapse() {
|
|
@@ -221,7 +219,7 @@ var WmPanel = function WmPanel(props) {
|
|
|
221
219
|
onMouseOut: handleMouseOut,
|
|
222
220
|
hidden: !show,
|
|
223
221
|
component: "div"
|
|
224
|
-
}, componentProps),
|
|
222
|
+
}, componentProps), __jsx(_material.Box, {
|
|
225
223
|
className: (0, _clsx["default"])("panel-heading", {
|
|
226
224
|
"show-help": helpVisible
|
|
227
225
|
}),
|
|
@@ -253,8 +251,7 @@ var WmPanel = function WmPanel(props) {
|
|
|
253
251
|
onToggleHelp: toggleHelp,
|
|
254
252
|
onClose: handleClose,
|
|
255
253
|
onActionsclick: onActionsclick
|
|
256
|
-
})), __jsx(_material.Box, {
|
|
257
|
-
hidden: !isExpanded,
|
|
254
|
+
})), isExpanded && __jsx(_material.Box, {
|
|
258
255
|
className: "panel-content",
|
|
259
256
|
ref: panelContentRef
|
|
260
257
|
}, __jsx(_material.Box, {
|
|
@@ -279,10 +276,9 @@ var WmPanel = function WmPanel(props) {
|
|
|
279
276
|
var WmPanelFooter = exports.WmPanelFooter = function WmPanelFooter(_ref) {
|
|
280
277
|
var children = _ref.children,
|
|
281
278
|
name = _ref.name;
|
|
282
|
-
return __jsx(
|
|
279
|
+
return __jsx(_material.Box, {
|
|
283
280
|
className: "app-panel-footer panel-footer clearfix",
|
|
284
|
-
"aria-label": name
|
|
285
|
-
name: name
|
|
281
|
+
"aria-label": name
|
|
286
282
|
}, children);
|
|
287
283
|
};
|
|
288
284
|
WmPanelFooter.displayName = "WmPanelFooter";
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.WmTabpane = void 0;
|
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
10
|
var _clsx2 = _interopRequireDefault(require("clsx"));
|
|
12
11
|
var _tabs = require("@base-ui-components/react/tabs");
|
|
13
12
|
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
14
13
|
var _ = require("..");
|
|
15
|
-
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); }
|
|
16
14
|
var __jsx = _react["default"].createElement;
|
|
17
15
|
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
16
|
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; }
|
|
@@ -24,44 +22,10 @@ var WmTabpane = exports.WmTabpane = function WmTabpane(props) {
|
|
|
24
22
|
name = props.name,
|
|
25
23
|
index = props.index;
|
|
26
24
|
var _useTabsContext = (0, _.useTabsContext)(),
|
|
27
|
-
selectedIndex = _useTabsContext.selectedIndex
|
|
28
|
-
setSelectedIndex = _useTabsContext.setSelectedIndex;
|
|
29
|
-
var wasActiveRef = _react["default"].useRef(false);
|
|
30
|
-
var loadedRef = _react["default"].useRef(false);
|
|
31
|
-
(0, _react.useEffect)(function () {
|
|
32
|
-
var _props$listener;
|
|
33
|
-
var isActive = selectedIndex === index;
|
|
34
|
-
var widgetInstance = props === null || props === void 0 || (_props$listener = props.listener) === null || _props$listener === void 0 || (_props$listener = _props$listener.Widgets) === null || _props$listener === void 0 ? void 0 : _props$listener[name];
|
|
35
|
-
if (isActive) {
|
|
36
|
-
if (!loadedRef.current) {
|
|
37
|
-
var _props$onLoad;
|
|
38
|
-
props === null || props === void 0 || (_props$onLoad = props.onLoad) === null || _props$onLoad === void 0 || _props$onLoad.call(props, null, widgetInstance);
|
|
39
|
-
loadedRef.current = true;
|
|
40
|
-
}
|
|
41
|
-
if (!wasActiveRef.current) {
|
|
42
|
-
var _props$onSelect;
|
|
43
|
-
props === null || props === void 0 || (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 || _props$onSelect.call(props, null, widgetInstance, index);
|
|
44
|
-
wasActiveRef.current = true;
|
|
45
|
-
}
|
|
46
|
-
} else if (wasActiveRef.current) {
|
|
47
|
-
var _props$onDeselect;
|
|
48
|
-
props === null || props === void 0 || (_props$onDeselect = props.onDeselect) === null || _props$onDeselect === void 0 || _props$onDeselect.call(props, null, widgetInstance, index);
|
|
49
|
-
wasActiveRef.current = false;
|
|
50
|
-
}
|
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
-
}, [selectedIndex, name]);
|
|
53
|
-
(0, _react.useEffect)(function () {
|
|
54
|
-
if (props.listener && props.listener.onChange) {
|
|
55
|
-
props.listener.onChange(name, {
|
|
56
|
-
select: function select() {
|
|
57
|
-
return setSelectedIndex(index);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, []);
|
|
25
|
+
selectedIndex = _useTabsContext.selectedIndex;
|
|
62
26
|
return __jsx(_tabs.Tabs.Panel, {
|
|
63
27
|
value: index,
|
|
64
|
-
className: (0, _clsx2["default"])(
|
|
28
|
+
className: (0, _clsx2["default"])((_clsx = {
|
|
65
29
|
disabled: disabled
|
|
66
30
|
}, (0, _defineProperty2["default"])(_clsx, className, !!className), (0, _defineProperty2["default"])(_clsx, "active", selectedIndex === index), _clsx)),
|
|
67
31
|
role: "tabpanel",
|