@wavemaker/react-runtime 11.14.3-rc.6401 → 11.15.0-2.247
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/base-action.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +73 -18
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +31 -11
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +4 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +985 -183
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +67 -45
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +51 -18
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -52
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +209 -72
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +105 -32
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +85 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +41 -3
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +423 -331
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
|
@@ -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.normalizeGapValue = exports.isAutoValue = exports.getDirectionalAlignment = exports.getBaseAlignment = exports.formatPixelValue = exports.createBaseFlexStyles = exports.calculateWrapSpacing = exports.calculateSpacingStyles = exports.calculateNoWrapSpacing = exports.calculateAlignmentStyles = void 0;
|
|
7
|
+
exports.normalizeGapValue = exports.isAutoValue = exports.getDirectionalAlignment = exports.getBaseAlignment = exports.formatPixelValue = exports.createBaseFlexStyles = exports.calculateWrapSpacing = exports.calculateSpacingStyles = exports.calculatePositionStyles = exports.calculateNoWrapSpacing = exports.calculateClipBehaviour = exports.calculateAlignmentStyles = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
@@ -180,4 +180,59 @@ var calculateSpacingStyles = exports.calculateSpacingStyles = function calculate
|
|
|
180
180
|
return calculateNoWrapSpacing(gap, normalizedGap, base, justifyContent, alignItems);
|
|
181
181
|
}
|
|
182
182
|
return calculateWrapSpacing(gap, columngap, normalizedGap, normalizedColumnGap, normalizedRowGap, justifyContent, alignItems);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Calculates overflow and clip content styles based on overflow type and clipContent setting
|
|
187
|
+
*/
|
|
188
|
+
var calculateClipBehaviour = exports.calculateClipBehaviour = function calculateClipBehaviour(overflow, clipContent) {
|
|
189
|
+
var overflowLower = overflow === null || overflow === void 0 ? void 0 : overflow.toLowerCase();
|
|
190
|
+
var styles = {};
|
|
191
|
+
switch (overflowLower) {
|
|
192
|
+
case "vertical":
|
|
193
|
+
styles.overflowX = "hidden";
|
|
194
|
+
styles.overflowY = "scroll";
|
|
195
|
+
break;
|
|
196
|
+
case "horizontal":
|
|
197
|
+
styles.overflowX = "scroll";
|
|
198
|
+
styles.overflowY = "hidden";
|
|
199
|
+
break;
|
|
200
|
+
case "both directions":
|
|
201
|
+
styles.overflow = "scroll";
|
|
202
|
+
break;
|
|
203
|
+
case "no scrolling":
|
|
204
|
+
if (clipContent) {
|
|
205
|
+
styles.overflow = "hidden";
|
|
206
|
+
} else {
|
|
207
|
+
styles.overflow = "";
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
default:
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
return styles;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Calculates position and z-index styles
|
|
218
|
+
*/
|
|
219
|
+
var calculatePositionStyles = exports.calculatePositionStyles = function calculatePositionStyles(position, zIndex) {
|
|
220
|
+
var styles = {};
|
|
221
|
+
if (position === "sticky") {
|
|
222
|
+
// Apply sticky styles
|
|
223
|
+
styles.position = "sticky";
|
|
224
|
+
styles.top = "0"; // Sticks to top when scrolling vertically
|
|
225
|
+
styles.left = "0"; // Sticks to left when scrolling horizontally
|
|
226
|
+
if (zIndex !== undefined) {
|
|
227
|
+
styles.zIndex = zIndex;
|
|
228
|
+
}
|
|
229
|
+
} else if (position) {
|
|
230
|
+
// Set position if explicitly provided
|
|
231
|
+
styles.position = position;
|
|
232
|
+
// Only apply z-index if position is not static/relative
|
|
233
|
+
if (zIndex !== undefined && position !== "static" && position !== "relative") {
|
|
234
|
+
styles.zIndex = zIndex;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return styles;
|
|
183
238
|
};
|
|
@@ -9,9 +9,11 @@ exports["default"] = exports.WmContainer = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
13
|
var _clsx2 = require("clsx");
|
|
13
14
|
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
14
15
|
var _alignmentUtils = require("./alignment-utils");
|
|
16
|
+
var _excluded = ["className", "styles", "children", "renderPartial", "id", "direction", "wrap", "alignment", "gap", "columngap", "clipcontent", "position", "zindex"];
|
|
15
17
|
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
18
|
var __jsx = _react["default"].createElement;
|
|
17
19
|
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; }
|
|
@@ -70,20 +72,22 @@ var alignmentMatrix = {
|
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
73
|
-
var _clsx;
|
|
74
75
|
var className = props.className,
|
|
75
76
|
styles = props.styles,
|
|
76
77
|
children = props.children,
|
|
77
78
|
renderPartial = props.renderPartial,
|
|
78
79
|
id = props.id,
|
|
79
|
-
display = props.display,
|
|
80
80
|
_props$direction = props.direction,
|
|
81
|
-
direction = _props$direction === void 0 ? "
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
alignment =
|
|
81
|
+
direction = _props$direction === void 0 ? "" : _props$direction,
|
|
82
|
+
wrap = props.wrap,
|
|
83
|
+
_props$alignment = props.alignment,
|
|
84
|
+
alignment = _props$alignment === void 0 ? "" : _props$alignment,
|
|
85
85
|
gap = props.gap,
|
|
86
|
-
columngap = props.columngap
|
|
86
|
+
columngap = props.columngap,
|
|
87
|
+
clipcontent = props.clipcontent,
|
|
88
|
+
position = props.position,
|
|
89
|
+
zindex = props.zindex,
|
|
90
|
+
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
87
91
|
var isLoaded = (0, _react.useRef)(false);
|
|
88
92
|
function handleClick(event) {
|
|
89
93
|
var _props$onClick;
|
|
@@ -151,21 +155,45 @@ var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
|
151
155
|
var _styles$backgroundIma;
|
|
152
156
|
customStyles.backgroundImage = "".concat(styles !== null && styles !== void 0 && (_styles$backgroundIma = styles.backgroundImage) !== null && _styles$backgroundIma !== void 0 && _styles$backgroundIma.includes("url(") ? styles === null || styles === void 0 ? void 0 : styles.backgroundImage : "url(" + (styles === null || styles === void 0 ? void 0 : styles.backgroundImage) + ")");
|
|
153
157
|
}
|
|
158
|
+
var hasAlignmentRelatedProps = Boolean(direction || wrap || alignment || gap != null || columngap != null || position != null && position !== "" || clipcontent != null && clipcontent !== "");
|
|
154
159
|
|
|
155
160
|
// Memoize the computed styles for performance
|
|
156
161
|
var computedStyles = (0, _react.useMemo)(function () {
|
|
157
|
-
var
|
|
162
|
+
var _props$styles, _props$styles2, _props$styles3, _props$styles4, _props$styles5, _props$styles6, _props$styles7;
|
|
163
|
+
if (!hasAlignmentRelatedProps) {
|
|
164
|
+
return _objectSpread(_objectSpread({}, styles), customStyles);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// When alignment-related props are used, apply defaults for direction/alignment/wrap if not defined
|
|
168
|
+
var effectiveDirection = direction || "row";
|
|
169
|
+
var effectiveAlignment = alignment || "top-left";
|
|
170
|
+
var effectiveWrap = wrap !== null && wrap !== void 0 ? wrap : false;
|
|
171
|
+
var base = alignmentMatrix[effectiveAlignment];
|
|
158
172
|
if (!base) {
|
|
159
|
-
return _objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), {
|
|
160
|
-
display:
|
|
161
|
-
|
|
173
|
+
return _objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), {
|
|
174
|
+
display: "flex",
|
|
175
|
+
flexDirection: effectiveDirection || "",
|
|
176
|
+
flexWrap: effectiveWrap ? "wrap" : "nowrap"
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
var alignmentStyles = (0, _alignmentUtils.calculateAlignmentStyles)(alignmentMatrix, effectiveAlignment, effectiveDirection, effectiveWrap);
|
|
180
|
+
var spacingStyles = (0, _alignmentUtils.calculateSpacingStyles)(alignmentMatrix, gap, columngap, effectiveAlignment, effectiveDirection, effectiveWrap);
|
|
181
|
+
var clipStyles = (0, _alignmentUtils.calculateClipBehaviour)(((_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.overflow) || "", clipcontent);
|
|
182
|
+
var positionStyles = (0, _alignmentUtils.calculatePositionStyles)(position, zindex);
|
|
183
|
+
|
|
184
|
+
// Apply flex-shrink: 0 when width/height are fixed values (not '100%' or 'fit-content')
|
|
185
|
+
var flexShrinkStyles = {};
|
|
186
|
+
if ((_props$styles2 = props.styles) !== null && _props$styles2 !== void 0 && _props$styles2.width && ((_props$styles3 = props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.width) !== "fit-content" && ((_props$styles4 = props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.width) !== "100%") {
|
|
187
|
+
flexShrinkStyles.flexShrink = 0;
|
|
188
|
+
}
|
|
189
|
+
if ((_props$styles5 = props.styles) !== null && _props$styles5 !== void 0 && _props$styles5.height && ((_props$styles6 = props.styles) === null || _props$styles6 === void 0 ? void 0 : _props$styles6.height) !== "fit-content" && ((_props$styles7 = props.styles) === null || _props$styles7 === void 0 ? void 0 : _props$styles7.height) !== "100%") {
|
|
190
|
+
flexShrinkStyles.flexShrink = 0;
|
|
162
191
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, [styles, customStyles, alignment, direction, wrap, gap, columngap, display]);
|
|
192
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles), customStyles), alignmentStyles), spacingStyles), clipStyles), positionStyles), flexShrinkStyles), {}, {
|
|
193
|
+
display: "flex",
|
|
194
|
+
flexWrap: effectiveWrap ? "wrap" : "nowrap"
|
|
195
|
+
});
|
|
196
|
+
}, [hasAlignmentRelatedProps, styles, customStyles, alignment, direction, wrap, gap, columngap, clipcontent, position, zindex]);
|
|
169
197
|
(0, _react.useEffect)(function () {
|
|
170
198
|
if (props !== null && props !== void 0 && props.onLoad && !isLoaded.current) {
|
|
171
199
|
var _props$onLoad;
|
|
@@ -175,11 +203,12 @@ var WmContainer = exports.WmContainer = function WmContainer(props) {
|
|
|
175
203
|
}, [props === null || props === void 0 ? void 0 : props.onLoad]);
|
|
176
204
|
return __jsx("div", (0, _extends2["default"])({
|
|
177
205
|
style: computedStyles,
|
|
178
|
-
className: (0, _clsx2.clsx)((
|
|
206
|
+
className: (0, _clsx2.clsx)((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, className || "", Boolean(className)), DEFAULT_CLASS, !(className !== null && className !== void 0 && className.split(" ").includes("form-elements")))),
|
|
179
207
|
"data-widget-id": props["data-widget-id"],
|
|
180
208
|
id: id,
|
|
181
|
-
hidden: props.hidden
|
|
182
|
-
|
|
209
|
+
hidden: props.hidden,
|
|
210
|
+
show: props.show
|
|
211
|
+
}, domEvents, rest, {
|
|
183
212
|
name: props.name
|
|
184
213
|
}), renderPartial ? renderPartial(props, props.onLoad) : children);
|
|
185
214
|
};
|
|
@@ -21,8 +21,7 @@ var PanelHeader = function PanelHeader(_ref) {
|
|
|
21
21
|
var _ref$title = _ref.title,
|
|
22
22
|
title = _ref$title === void 0 ? "Title" : _ref$title,
|
|
23
23
|
subheading = _ref.subheading,
|
|
24
|
-
|
|
25
|
-
iconclass = _ref$iconclass === void 0 ? "wi wi-account-circle" : _ref$iconclass,
|
|
24
|
+
iconclass = _ref.iconclass,
|
|
26
25
|
iconurl = _ref.iconurl,
|
|
27
26
|
iconwidth = _ref.iconwidth,
|
|
28
27
|
iconheight = _ref.iconheight,
|
|
@@ -47,8 +46,8 @@ var PanelHeader = function PanelHeader(_ref) {
|
|
|
47
46
|
onToggleHelp = _ref.onToggleHelp,
|
|
48
47
|
onClose = _ref.onClose,
|
|
49
48
|
onActionsclick = _ref.onActionsclick;
|
|
50
|
-
var handleActionItemClick = function handleActionItemClick(
|
|
51
|
-
onActionsclick === null || onActionsclick === void 0 || onActionsclick(
|
|
49
|
+
var handleActionItemClick = function handleActionItemClick(item) {
|
|
50
|
+
onActionsclick === null || onActionsclick === void 0 || onActionsclick(item);
|
|
52
51
|
};
|
|
53
52
|
return __jsx(_material.Box, {
|
|
54
53
|
className: "panel-title"
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = exports.WmPanelFooter = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -15,9 +16,11 @@ var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
|
15
16
|
var _hooks = require("./hooks");
|
|
16
17
|
var _panelHeader = _interopRequireDefault(require("./components/panel-header"));
|
|
17
18
|
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
18
|
-
var _excluded = ["actions", "badgetype", "badgevalue", "closable", "collapsible", "enablefullscreen", "expanded", "fullscreen", "helptext", "hint", "iconclass", "iconheight", "iconmargin", "iconurl", "iconwidth", "subheading", "title", "className", "style", "children", "height", "name", "itemlabel", "itemlink", "itemicon", "itemchildren", "onActionsclick", "onClose", "onCollapse", "onExpand", "onExitfullscreen", "onFullscreen", "onLoad", "
|
|
19
|
+
var _excluded = ["actions", "badgetype", "badgevalue", "closable", "collapsible", "enablefullscreen", "expanded", "fullscreen", "helptext", "hint", "iconclass", "iconheight", "iconmargin", "iconurl", "iconwidth", "subheading", "title", "className", "style", "children", "height", "name", "itemlabel", "itemlink", "itemicon", "itemchildren", "onActionsclick", "onClose", "onCollapse", "onExpand", "onExitfullscreen", "onFullscreen", "onLoad", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "onPropertyChange", "listener", "Widgets"];
|
|
19
20
|
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); }
|
|
20
21
|
var __jsx = _react["default"].createElement;
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
21
24
|
var WmPanel = function WmPanel(props) {
|
|
22
25
|
var actions = props.actions,
|
|
23
26
|
_props$badgetype = props.badgetype,
|
|
@@ -58,10 +61,10 @@ var WmPanel = function WmPanel(props) {
|
|
|
58
61
|
onExitfullscreen = props.onExitfullscreen,
|
|
59
62
|
onFullscreen = props.onFullscreen,
|
|
60
63
|
onLoad = props.onLoad,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
onMouseEnter = props.onMouseEnter,
|
|
65
|
+
onMouseLeave = props.onMouseLeave,
|
|
66
|
+
onMouseOut = props.onMouseOut,
|
|
67
|
+
onMouseOver = props.onMouseOver,
|
|
65
68
|
onPropertyChange = props.onPropertyChange,
|
|
66
69
|
listener = props.listener,
|
|
67
70
|
Widgets = props.Widgets,
|
|
@@ -115,19 +118,19 @@ var WmPanel = function WmPanel(props) {
|
|
|
115
118
|
};
|
|
116
119
|
var handleMouseEnter = function handleMouseEnter(event) {
|
|
117
120
|
var _listener$Widgets2;
|
|
118
|
-
|
|
121
|
+
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter(event, listener === null || listener === void 0 || (_listener$Widgets2 = listener.Widgets) === null || _listener$Widgets2 === void 0 ? void 0 : _listener$Widgets2[name]);
|
|
119
122
|
};
|
|
120
123
|
var handleMouseLeave = function handleMouseLeave(event) {
|
|
121
124
|
var _listener$Widgets3;
|
|
122
|
-
|
|
125
|
+
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave(event, listener === null || listener === void 0 || (_listener$Widgets3 = listener.Widgets) === null || _listener$Widgets3 === void 0 ? void 0 : _listener$Widgets3[name]);
|
|
123
126
|
};
|
|
124
127
|
var handleMouseOver = function handleMouseOver(event) {
|
|
125
128
|
var _listener$Widgets4;
|
|
126
|
-
|
|
129
|
+
onMouseOver === null || onMouseOver === void 0 || onMouseOver(event, listener === null || listener === void 0 || (_listener$Widgets4 = listener.Widgets) === null || _listener$Widgets4 === void 0 ? void 0 : _listener$Widgets4[name]);
|
|
127
130
|
};
|
|
128
131
|
var handleMouseOut = function handleMouseOut(event) {
|
|
129
132
|
var _listener$Widgets5;
|
|
130
|
-
|
|
133
|
+
onMouseOut === null || onMouseOut === void 0 || onMouseOut(event, listener === null || listener === void 0 || (_listener$Widgets5 = listener.Widgets) === null || _listener$Widgets5 === void 0 ? void 0 : _listener$Widgets5[name]);
|
|
131
134
|
};
|
|
132
135
|
|
|
133
136
|
// onLoad handler
|
|
@@ -221,7 +224,9 @@ var WmPanel = function WmPanel(props) {
|
|
|
221
224
|
onMouseOut: handleMouseOut,
|
|
222
225
|
hidden: !show,
|
|
223
226
|
component: "div"
|
|
224
|
-
}, componentProps
|
|
227
|
+
}, componentProps, {
|
|
228
|
+
style: _objectSpread(_objectSpread({}, props.styles), props.conditionalstyle)
|
|
229
|
+
}), showHeader && __jsx(_material.Box, {
|
|
225
230
|
className: (0, _clsx["default"])("panel-heading", {
|
|
226
231
|
"show-help": helpVisible
|
|
227
232
|
}),
|
|
@@ -0,0 +1,33 @@
|
|
|
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["default"] = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
13
|
+
var _lodashEs = require("lodash-es");
|
|
14
|
+
var _excluded = ["name", "show", "children"];
|
|
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
|
+
var __jsx = _react["default"].createElement;
|
|
17
|
+
var WmRepeatTemplate = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
18
|
+
var name = props.name,
|
|
19
|
+
show = props.show,
|
|
20
|
+
children = props.children,
|
|
21
|
+
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
22
|
+
return __jsx("div", (0, _extends2["default"])({
|
|
23
|
+
className: "app-repeat-item",
|
|
24
|
+
hidden: show
|
|
25
|
+
}, restProps), children);
|
|
26
|
+
}, function (prev, next) {
|
|
27
|
+
var keys = ["name", "show", "children", "restProps"];
|
|
28
|
+
return keys.every(function (key) {
|
|
29
|
+
return (0, _lodashEs.isEqual)(prev[key], next[key]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
WmRepeatTemplate.displayName = "WmRepeatTemplate";
|
|
33
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmRepeatTemplate);
|
|
@@ -18,6 +18,7 @@ var _tabPane = _interopRequireDefault(require("@wavemaker/react-runtime/componen
|
|
|
18
18
|
var _props = require("./props");
|
|
19
19
|
var _statePersistance = require("@wavemaker/react-runtime/utils/state-persistance");
|
|
20
20
|
var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
21
|
+
var _utils = require("./utils");
|
|
21
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); }
|
|
22
23
|
var __jsx = _react["default"].createElement;
|
|
23
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; }
|
|
@@ -63,12 +64,32 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
63
64
|
var _useState = (0, _react.useState)(defaultpaneindex || 0),
|
|
64
65
|
selectedIndex = _useState[0],
|
|
65
66
|
setSelectedIndex = _useState[1];
|
|
67
|
+
var _useState2 = (0, _react.useState)(new Set()),
|
|
68
|
+
hiddenTabNames = _useState2[0],
|
|
69
|
+
setHiddenTabNames = _useState2[1];
|
|
70
|
+
// Track which tab indices have been rendered at least once (for dynamic tabs)
|
|
71
|
+
var _useState3 = (0, _react.useState)(new Set(defaultpaneindex !== undefined ? [defaultpaneindex] : [0])),
|
|
72
|
+
renderedTabIndices = _useState3[0],
|
|
73
|
+
setRenderedTabIndices = _useState3[1];
|
|
66
74
|
|
|
67
75
|
// Keep currentSelectedIndex ref in sync with state
|
|
68
76
|
(0, _react.useEffect)(function () {
|
|
69
77
|
currentSelectedIndex.current = selectedIndex;
|
|
70
78
|
}, [selectedIndex]);
|
|
71
79
|
|
|
80
|
+
// Track which tabs have been rendered (for dynamic tabs to maintain state)
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
if (type === "dynamic" && (dataset === null || dataset === void 0 ? void 0 : dataset.length) > 0) {
|
|
83
|
+
setRenderedTabIndices(function (prev) {
|
|
84
|
+
var newSet = new Set(prev);
|
|
85
|
+
if (selectedIndex >= 0 && selectedIndex < dataset.length) {
|
|
86
|
+
newSet.add(selectedIndex);
|
|
87
|
+
}
|
|
88
|
+
return newSet;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, [selectedIndex, type, dataset]);
|
|
92
|
+
|
|
72
93
|
// Helper function to change tab with proper state management
|
|
73
94
|
var changeTab = function changeTab(newIndex) {
|
|
74
95
|
if (newIndex >= 0 && newIndex < panesCount.current && newIndex !== currentSelectedIndex.current) {
|
|
@@ -125,11 +146,11 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
125
146
|
return ((_dataset$currentIndex = dataset[currentIndex]) === null || _dataset$currentIndex === void 0 ? void 0 : _dataset$currentIndex.name) || null;
|
|
126
147
|
}
|
|
127
148
|
|
|
128
|
-
// For static tabs,
|
|
129
|
-
var
|
|
130
|
-
var activeChild =
|
|
149
|
+
// For static tabs, compute from visible children
|
|
150
|
+
var visibleChildren = (0, _utils.filterVisibleChildren)(children, hiddenTabNames);
|
|
151
|
+
var activeChild = visibleChildren[currentIndex];
|
|
131
152
|
return (activeChild === null || activeChild === void 0 || (_activeChild$props = activeChild.props) === null || _activeChild$props === void 0 ? void 0 : _activeChild$props.name) || null;
|
|
132
|
-
}, [type, dataset, children]);
|
|
153
|
+
}, [type, dataset, children, hiddenTabNames]);
|
|
133
154
|
|
|
134
155
|
// get the active tab widget from listener
|
|
135
156
|
var getActiveTab = _react["default"].useCallback(function () {
|
|
@@ -148,6 +169,24 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
148
169
|
},
|
|
149
170
|
goToTab: function goToTab(tabNumber) {
|
|
150
171
|
_goToTab(tabNumber);
|
|
172
|
+
},
|
|
173
|
+
getActiveTabIndex: function getActiveTabIndex() {
|
|
174
|
+
return currentSelectedIndex.current;
|
|
175
|
+
},
|
|
176
|
+
removePane: function removePane(TabName) {
|
|
177
|
+
(0, _utils.handleRemovePane)({
|
|
178
|
+
type: type,
|
|
179
|
+
dataset: dataset,
|
|
180
|
+
children: children,
|
|
181
|
+
hiddenTabNames: hiddenTabNames,
|
|
182
|
+
TabName: TabName,
|
|
183
|
+
selectedIndex: selectedIndex,
|
|
184
|
+
currentSelectedIndex: currentSelectedIndex,
|
|
185
|
+
panesCountRef: panesCount,
|
|
186
|
+
setHiddenTabNames: setHiddenTabNames,
|
|
187
|
+
setSelectedIndex: setSelectedIndex,
|
|
188
|
+
saveStateToStorage: saveStateToStorage
|
|
189
|
+
});
|
|
151
190
|
}
|
|
152
191
|
});
|
|
153
192
|
}
|
|
@@ -198,6 +237,14 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
198
237
|
// Rendering Helpers
|
|
199
238
|
// ============================================================================
|
|
200
239
|
|
|
240
|
+
var handleTabHeaderClick = _react["default"].useCallback(function (e, item, index) {
|
|
241
|
+
if (item !== null && item !== void 0 && item.disabled) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (item !== null && item !== void 0 && item.onHeaderclick) {
|
|
245
|
+
item.onHeaderclick(e, listener === null || listener === void 0 ? void 0 : listener.Widgets[name], index);
|
|
246
|
+
}
|
|
247
|
+
}, []);
|
|
201
248
|
var renderTabHeader = _react["default"].useCallback(function (item, index) {
|
|
202
249
|
return __jsx(_tabs.Tabs.Tab, (0, _extends2["default"])({}, item, {
|
|
203
250
|
title: item.title || item.name || "Tab ".concat(index + 1),
|
|
@@ -227,7 +274,10 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
227
274
|
"aria-selected": selectedIndex === index,
|
|
228
275
|
"aria-disabled": item.disabled,
|
|
229
276
|
"aria-hidden": item.show === false,
|
|
230
|
-
"aria-controls": "tabpanel-".concat(index)
|
|
277
|
+
"aria-controls": "tabpanel-".concat(index),
|
|
278
|
+
onClick: function onClick(e) {
|
|
279
|
+
return handleTabHeaderClick(e, item, index);
|
|
280
|
+
}
|
|
231
281
|
}, item.paneicon && __jsx("i", {
|
|
232
282
|
className: "app-icon ".concat(item.paneicon)
|
|
233
283
|
}), __jsx(_Typography["default"], {
|
|
@@ -271,14 +321,20 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
271
321
|
return headers;
|
|
272
322
|
}, [dataset, render, renderTabHeader]);
|
|
273
323
|
var renderStaticTabs = _react["default"].useCallback(function () {
|
|
274
|
-
|
|
275
|
-
|
|
324
|
+
// Consider only panes with show !== false and not hidden via internal state
|
|
325
|
+
var visibleChildren = (0, _utils.filterVisibleChildren)(children, hiddenTabNames);
|
|
326
|
+
panesCount.current = visibleChildren.length;
|
|
327
|
+
return visibleChildren.map(function (child, index) {
|
|
328
|
+
var _child$props, _Widgets;
|
|
276
329
|
if (!child) return null;
|
|
330
|
+
var paneName = child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.name;
|
|
331
|
+
var latestWidgetState = paneName ? (listener === null || listener === void 0 || (_Widgets = listener.Widgets) === null || _Widgets === void 0 ? void 0 : _Widgets[paneName]) || {} : {};
|
|
332
|
+
var itemProps = _objectSpread(_objectSpread({}, child.props), latestWidgetState);
|
|
277
333
|
return __jsx(_react["default"].Fragment, {
|
|
278
334
|
key: index
|
|
279
|
-
}, renderTabHeader(
|
|
335
|
+
}, renderTabHeader(itemProps, index));
|
|
280
336
|
});
|
|
281
|
-
}, [children, renderTabHeader]);
|
|
337
|
+
}, [children, renderTabHeader, hiddenTabNames]);
|
|
282
338
|
var renderTabs = _react["default"].useMemo(function () {
|
|
283
339
|
return type === "dynamic" && (dataset === null || dataset === void 0 ? void 0 : dataset.length) > 0 ? renderDynamicTabs() : renderStaticTabs();
|
|
284
340
|
}, [type, dataset, renderDynamicTabs, renderStaticTabs]);
|
|
@@ -302,23 +358,32 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
302
358
|
};
|
|
303
359
|
var renderTabPanels = function renderTabPanels() {
|
|
304
360
|
if (type === "dynamic" && (dataset === null || dataset === void 0 ? void 0 : dataset.length) > 0) {
|
|
305
|
-
|
|
361
|
+
// Render all previously visited tabs, but hide inactive ones to maintain state
|
|
362
|
+
return Array.from(renderedTabIndices).filter(function (index) {
|
|
363
|
+
return index >= 0 && index < dataset.length;
|
|
364
|
+
}).map(function (index) {
|
|
365
|
+
var item = dataset[index];
|
|
366
|
+
var isActive = selectedIndex === index;
|
|
306
367
|
return __jsx(_react["default"].Fragment, {
|
|
307
368
|
key: index
|
|
308
|
-
}, render ? render(item, index, dataset) : __jsx(_tabPane["default"], (0, _extends2["default"])({}, item, {
|
|
369
|
+
}, render ? __jsx(_react["default"].Fragment, null, render(item, index, dataset, isActive)) : __jsx(_tabPane["default"], (0, _extends2["default"])({}, item, {
|
|
309
370
|
key: index,
|
|
310
371
|
value: selectedIndex,
|
|
311
372
|
listener: listener // Pass the updated listener context
|
|
312
373
|
,
|
|
313
374
|
className: (0, _clsx["default"])("tab-pane", {
|
|
314
|
-
active:
|
|
375
|
+
active: isActive,
|
|
315
376
|
disabled: item.disabled,
|
|
316
377
|
hidden: item.show === false
|
|
317
|
-
})
|
|
378
|
+
}),
|
|
379
|
+
index: index
|
|
318
380
|
})));
|
|
319
381
|
});
|
|
320
382
|
}
|
|
321
|
-
|
|
383
|
+
|
|
384
|
+
// For static tabs, render only visible panes
|
|
385
|
+
var visibleChildren = (0, _utils.filterVisibleChildren)(children, hiddenTabNames);
|
|
386
|
+
return visibleChildren;
|
|
322
387
|
};
|
|
323
388
|
if (type === "dynamic" && (dataset === null || dataset === void 0 ? void 0 : dataset.length) <= 0) {
|
|
324
389
|
return __jsx("div", null, nodatamessage);
|
|
@@ -373,6 +438,10 @@ var WmTabs = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
|
373
438
|
}, function (prev, next) {
|
|
374
439
|
var keys = ["dataset", "defaultpaneindex", "justified", "tabsposition", "nodatamessage", "statehandler", "autotabactivation", "transition", "type", "iconposition", "render", "selectedindex", "children"];
|
|
375
440
|
return keys.every(function (key) {
|
|
441
|
+
// Never deep-compare children; treat as referential bcz the children will have listener props attached cause infinite comparion.
|
|
442
|
+
if (key === "children") {
|
|
443
|
+
return prev[key] === next[key];
|
|
444
|
+
}
|
|
376
445
|
return (0, _isEqual["default"])(prev[key], next[key]);
|
|
377
446
|
});
|
|
378
447
|
});
|
|
@@ -17,12 +17,13 @@ var __jsx = _react["default"].createElement;
|
|
|
17
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
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) { (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; }
|
|
19
19
|
var WmTabpane = exports.WmTabpane = function WmTabpane(props) {
|
|
20
|
-
var _clsx;
|
|
21
20
|
var className = props.className,
|
|
22
21
|
disabled = props.disabled,
|
|
23
22
|
renderPartial = props.renderPartial,
|
|
24
23
|
name = props.name,
|
|
25
|
-
index = props.index
|
|
24
|
+
index = props.index,
|
|
25
|
+
listener = props.listener,
|
|
26
|
+
item = props.item;
|
|
26
27
|
var _useTabsContext = (0, _.useTabsContext)(),
|
|
27
28
|
selectedIndex = _useTabsContext.selectedIndex,
|
|
28
29
|
setSelectedIndex = _useTabsContext.setSelectedIndex;
|
|
@@ -51,28 +52,50 @@ var WmTabpane = exports.WmTabpane = function WmTabpane(props) {
|
|
|
51
52
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
53
|
}, [selectedIndex, name]);
|
|
53
54
|
(0, _react.useEffect)(function () {
|
|
54
|
-
if (
|
|
55
|
-
|
|
55
|
+
if (listener && listener.onChange) {
|
|
56
|
+
listener.onChange(name, {
|
|
56
57
|
select: function select() {
|
|
57
58
|
return setSelectedIndex(index);
|
|
59
|
+
},
|
|
60
|
+
isActive: selectedIndex === index,
|
|
61
|
+
deselect: function deselect() {
|
|
62
|
+
return setSelectedIndex(-1);
|
|
58
63
|
}
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
|
-
}, []);
|
|
62
|
-
|
|
66
|
+
}, [selectedIndex]);
|
|
67
|
+
var isDisabled = (0, _react.useMemo)(function () {
|
|
68
|
+
return item === undefined ? false : Boolean(item === null || item === void 0 ? void 0 : item.disabled);
|
|
69
|
+
}, [item]);
|
|
70
|
+
var isHidden = (0, _react.useMemo)(function () {
|
|
71
|
+
return item === undefined ? false : (item === null || item === void 0 ? void 0 : item.show) === false;
|
|
72
|
+
}, [item]);
|
|
73
|
+
return __jsx("div", {
|
|
74
|
+
style: {
|
|
75
|
+
display: selectedIndex === index ? "block" : "none"
|
|
76
|
+
},
|
|
77
|
+
className: (0, _clsx2["default"])("tab-pane", {
|
|
78
|
+
active: selectedIndex === index,
|
|
79
|
+
disabled: isDisabled,
|
|
80
|
+
hidden: isHidden
|
|
81
|
+
})
|
|
82
|
+
}, __jsx(_tabs.Tabs.Panel, {
|
|
63
83
|
value: index,
|
|
64
|
-
|
|
84
|
+
keepMounted: true,
|
|
85
|
+
className: (0, _clsx2["default"])("tab-pane", (0, _defineProperty2["default"])((0, _defineProperty2["default"])({
|
|
65
86
|
disabled: disabled
|
|
66
|
-
},
|
|
87
|
+
}, className, !!className), "active", selectedIndex === index)),
|
|
67
88
|
role: "tabpanel",
|
|
68
89
|
style: _objectSpread({
|
|
69
90
|
width: "100%"
|
|
70
91
|
}, props === null || props === void 0 ? void 0 : props.styles),
|
|
71
|
-
"data-pane-name": name
|
|
92
|
+
"data-pane-name": name,
|
|
93
|
+
title: props === null || props === void 0 ? void 0 : props.title,
|
|
94
|
+
name: name
|
|
72
95
|
}, __jsx("div", {
|
|
73
96
|
className: "tab-body",
|
|
74
97
|
"data-widget-id": props["data-widget-id"]
|
|
75
|
-
}, renderPartial ? renderPartial(props, props.onLoad) : props.children));
|
|
98
|
+
}, renderPartial ? renderPartial(props, props.onLoad) : props.children)));
|
|
76
99
|
};
|
|
77
100
|
WmTabpane.displayName = "WmTabpane";
|
|
78
101
|
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmTabpane);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.handleRemovePane = exports.filterVisibleChildren = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var filterVisibleChildren = exports.filterVisibleChildren = function filterVisibleChildren(children, hiddenTabNames) {
|
|
10
|
+
return _react["default"].Children.toArray(children).filter(function (c) {
|
|
11
|
+
var _c$props;
|
|
12
|
+
var nm = c === null || c === void 0 || (_c$props = c.props) === null || _c$props === void 0 ? void 0 : _c$props.name;
|
|
13
|
+
var isHidden = nm ? hiddenTabNames.has(nm) : false;
|
|
14
|
+
return c && c.props && c.props.show !== false && !isHidden;
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var handleRemovePane = exports.handleRemovePane = function handleRemovePane(_ref) {
|
|
18
|
+
var _visibleBefore$select;
|
|
19
|
+
var type = _ref.type,
|
|
20
|
+
dataset = _ref.dataset,
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
hiddenTabNames = _ref.hiddenTabNames,
|
|
23
|
+
TabName = _ref.TabName,
|
|
24
|
+
selectedIndex = _ref.selectedIndex,
|
|
25
|
+
currentSelectedIndex = _ref.currentSelectedIndex,
|
|
26
|
+
panesCountRef = _ref.panesCountRef,
|
|
27
|
+
setHiddenTabNames = _ref.setHiddenTabNames,
|
|
28
|
+
setSelectedIndex = _ref.setSelectedIndex,
|
|
29
|
+
saveStateToStorage = _ref.saveStateToStorage;
|
|
30
|
+
// Dynamic mode: mutate dataset
|
|
31
|
+
if (type === "dynamic" && dataset) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Static mode: mark hidden in internal state and adjust selection if needed
|
|
36
|
+
var visibleBefore = filterVisibleChildren(children, hiddenTabNames);
|
|
37
|
+
var activeName = (_visibleBefore$select = visibleBefore[selectedIndex]) === null || _visibleBefore$select === void 0 || (_visibleBefore$select = _visibleBefore$select.props) === null || _visibleBefore$select === void 0 ? void 0 : _visibleBefore$select.name;
|
|
38
|
+
setHiddenTabNames(function (prev) {
|
|
39
|
+
var next = new Set(prev);
|
|
40
|
+
next.add(TabName);
|
|
41
|
+
return next;
|
|
42
|
+
});
|
|
43
|
+
if (activeName === TabName) {
|
|
44
|
+
var newIndex = Math.max(0, currentSelectedIndex.current - 1);
|
|
45
|
+
currentSelectedIndex.current = newIndex;
|
|
46
|
+
setSelectedIndex(newIndex);
|
|
47
|
+
saveStateToStorage(newIndex);
|
|
48
|
+
} else {
|
|
49
|
+
setSelectedIndex(currentSelectedIndex.current);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -91,7 +91,8 @@ var CustomStepLabel = exports.CustomStepLabel = /*#__PURE__*/(0, _react.memo)(fu
|
|
|
91
91
|
}, step.title)), step.subtitle && __jsx(_material.Typography, {
|
|
92
92
|
component: "span",
|
|
93
93
|
className: "subtitle-wrapper",
|
|
94
|
-
variant: "caption"
|
|
94
|
+
variant: "caption",
|
|
95
|
+
title: step.subtitle
|
|
95
96
|
}, __jsx(_material.Box, {
|
|
96
97
|
component: "span",
|
|
97
98
|
className: "step-title"
|