@wavemaker/react-runtime 11.14.2-1.245 → 12.0.0-next.28533
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 +32 -10
- 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 +26 -9
- 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 +1 -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/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- 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 +991 -180
- 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 +54 -33
- 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 +23 -7
- 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 -51
- 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 +147 -70
- 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 +99 -26
- 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 +84 -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 +5 -0
- 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 +711 -669
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
var
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
@@ -10,11 +10,13 @@ exports["default"] = void 0;
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
15
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
16
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
16
17
|
var _List = _interopRequireDefault(require("@mui/material/List"));
|
|
17
18
|
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
19
|
+
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
18
20
|
var _components = require("@wavemaker/react-runtime/components/data/pagination/components");
|
|
19
21
|
var _components2 = require("./components");
|
|
20
22
|
var _common = require("@wavemaker/react-runtime/components/common");
|
|
@@ -24,14 +26,14 @@ var _listHelpers = require("./utils/list-helpers");
|
|
|
24
26
|
var _utils = require("../table/utils");
|
|
25
27
|
var _listWidgetMethods = require("./utils/list-widget-methods");
|
|
26
28
|
var _types = require("../types");
|
|
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" !=
|
|
29
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _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); }
|
|
28
30
|
var __jsx = _react["default"].createElement;
|
|
29
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
32
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // Import hooks
|
|
31
33
|
// Import components
|
|
32
34
|
// Import utilities
|
|
33
35
|
var WmList = function WmList(props) {
|
|
34
|
-
var _paginationState$pagi5, _paginationState$pagi6;
|
|
36
|
+
var _listener$Widgets, _paginationState$pagi5, _paginationState$pagi6;
|
|
35
37
|
// ==================== PROPS DESTRUCTURING ====================
|
|
36
38
|
var className = props.className,
|
|
37
39
|
styles = props.styles,
|
|
@@ -39,6 +41,8 @@ var WmList = function WmList(props) {
|
|
|
39
41
|
height = props.height,
|
|
40
42
|
_props$tabIndex = props.tabIndex,
|
|
41
43
|
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
44
|
+
_props$hidden = props.hidden,
|
|
45
|
+
hidden = _props$hidden === void 0 ? false : _props$hidden,
|
|
42
46
|
_props$name = props.name,
|
|
43
47
|
name = _props$name === void 0 ? "list" : _props$name,
|
|
44
48
|
_props$boundarylinks = props.boundarylinks,
|
|
@@ -87,7 +91,7 @@ var WmList = function WmList(props) {
|
|
|
87
91
|
_props$showrecordcoun = props.showrecordcount,
|
|
88
92
|
showrecordcount = _props$showrecordcoun === void 0 ? _constants.LIST_DEFAULTS.SHOW_RECORD_COUNT : _props$showrecordcoun,
|
|
89
93
|
_props$allowpagesizec = props.allowpagesizechange,
|
|
90
|
-
allowpagesizechange = _props$allowpagesizec === void 0 ?
|
|
94
|
+
allowpagesizechange = _props$allowpagesizec === void 0 ? false : _props$allowpagesizec,
|
|
91
95
|
_props$pagesizeoption = props.pagesizeoptions,
|
|
92
96
|
pagesizeoptions = _props$pagesizeoption === void 0 ? "5,10,20,50,100" : _props$pagesizeoption,
|
|
93
97
|
_props$paginationclas = props.paginationclass,
|
|
@@ -116,7 +120,7 @@ var WmList = function WmList(props) {
|
|
|
116
120
|
horizontalalign = _props$horizontalalig === void 0 ? _constants.LIST_ALIGN.LEFT : _props$horizontalalig,
|
|
117
121
|
itemsperrow = props.itemsperrow,
|
|
118
122
|
_props$statehandler = props.statehandler,
|
|
119
|
-
statehandler = _props$statehandler === void 0 ? "
|
|
123
|
+
statehandler = _props$statehandler === void 0 ? "none" : _props$statehandler,
|
|
120
124
|
onSelect = props.onSelect,
|
|
121
125
|
onClick = props.onClick,
|
|
122
126
|
onDblclick = props.onDblclick,
|
|
@@ -132,6 +136,9 @@ var WmList = function WmList(props) {
|
|
|
132
136
|
renderItem = props.renderItem,
|
|
133
137
|
children = props.children,
|
|
134
138
|
listener = props.listener;
|
|
139
|
+
var Widgets = (0, _WidgetProvider.useWidgetProxy)();
|
|
140
|
+
// ==================== STATE INITIALIZATION ====================
|
|
141
|
+
var widgetInstance = Widgets[name];
|
|
135
142
|
|
|
136
143
|
// ==================== DATASOURCE SUBSCRIPTION ====================
|
|
137
144
|
// Disable state management for On-Demand and Scroll navigation
|
|
@@ -148,21 +155,28 @@ var WmList = function WmList(props) {
|
|
|
148
155
|
}
|
|
149
156
|
});
|
|
150
157
|
|
|
151
|
-
//
|
|
152
|
-
var widgetInstance = listener === null || listener === void 0 ? void 0 : listener.Widgets[name];
|
|
158
|
+
// Get proxy from page context for reactive widget access
|
|
153
159
|
|
|
154
160
|
// is dataset from modal variable
|
|
155
161
|
var _useState = (0, _react.useState)(false),
|
|
156
162
|
isDatasetFromModalVariable = _useState[0],
|
|
157
163
|
setIsDatasetFromModalVariable = _useState[1];
|
|
158
164
|
|
|
159
|
-
//
|
|
165
|
+
// Calculate hash of dataset content to detect mutations
|
|
166
|
+
// This runs every render but is lightweight compared to recalculating safeDataset
|
|
167
|
+
var datasetHash = Array.isArray(dataset) && (dataset !== null && dataset !== void 0 ? dataset : []).map(function (item, idx) {
|
|
168
|
+
if (!item || (0, _typeof2["default"])(item) !== "object") {
|
|
169
|
+
return "".concat(idx, ":").concat(item);
|
|
170
|
+
}
|
|
171
|
+
// Hash all object values
|
|
172
|
+
return "".concat(idx, ":").concat(Object.values(item).join("-"));
|
|
173
|
+
}).join("|");
|
|
160
174
|
var safeDataset = (0, _react.useMemo)(function () {
|
|
161
175
|
var data = (0, _listHelpers.getSafeDataset)(dataset);
|
|
162
176
|
return (0, _utils.addUniqueRowIds)(data, {
|
|
163
177
|
type: "list"
|
|
164
178
|
});
|
|
165
|
-
}, [
|
|
179
|
+
}, [datasetHash]);
|
|
166
180
|
|
|
167
181
|
// Initial render tracking
|
|
168
182
|
var _useState2 = (0, _react.useState)(true),
|
|
@@ -189,17 +203,23 @@ var WmList = function WmList(props) {
|
|
|
189
203
|
|
|
190
204
|
// Determine if we're using server-side pagination
|
|
191
205
|
// Check if datasource is API-aware (server-side) rather than checking runtime pagination data
|
|
192
|
-
var isServerSidePagination = (0, _react.
|
|
206
|
+
var isServerSidePagination = (0, _react.useCallback)(function () {
|
|
207
|
+
if (navigation === _constants.LIST_NAVIGATION_TYPES.NONE) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
193
210
|
return !!(datasource && datasource.execute && datasource.execute(_types.DataSource.Operation.IS_PAGEABLE));
|
|
194
|
-
}, [datasource]);
|
|
195
|
-
|
|
211
|
+
}, [datasource, navigation]);
|
|
212
|
+
var _useState7 = (0, _react.useState)(false),
|
|
213
|
+
isListCleared = _useState7[0],
|
|
214
|
+
setIsListCleared = _useState7[1];
|
|
196
215
|
// Use accumulated data for On-Demand navigation, otherwise use regular dataset
|
|
197
216
|
var effectiveDataset = (0, _react.useMemo)(function () {
|
|
217
|
+
if (isListCleared) return [];
|
|
198
218
|
if (navigation === _constants.LIST_NAVIGATION_TYPES.ON_DEMAND && datasource && accumulatedData.length > 0) {
|
|
199
219
|
return accumulatedData;
|
|
200
220
|
}
|
|
201
221
|
return safeDataset;
|
|
202
|
-
}, [navigation, datasource, accumulatedData, safeDataset]);
|
|
222
|
+
}, [navigation, datasource, accumulatedData, safeDataset, isListCleared]);
|
|
203
223
|
|
|
204
224
|
// ==================== STATE PERSISTENCE ====================
|
|
205
225
|
// Restore persisted state before initializing hooks
|
|
@@ -243,7 +263,7 @@ var WmList = function WmList(props) {
|
|
|
243
263
|
var persistedPageSize = persisted.pagesize || pagesize;
|
|
244
264
|
|
|
245
265
|
// Set datasource maxResults if we have a persisted pageSize and datasource
|
|
246
|
-
if (persisted.pagesize && isServerSidePagination && datasource && datasource.maxResults !== undefined) {
|
|
266
|
+
if (persisted.pagesize && isServerSidePagination() && datasource && datasource.maxResults !== undefined) {
|
|
247
267
|
datasource.maxResults = persistedPageSize;
|
|
248
268
|
}
|
|
249
269
|
return {
|
|
@@ -259,7 +279,7 @@ var WmList = function WmList(props) {
|
|
|
259
279
|
initialSelectedItems: [],
|
|
260
280
|
initialActualPageSize: actualPageSize
|
|
261
281
|
};
|
|
262
|
-
}, [name, statehandler, pagesize, navigation, isServerSidePagination, datasource]),
|
|
282
|
+
}, [name, statehandler, pagesize, navigation, isServerSidePagination(), datasource]),
|
|
263
283
|
initialPage = _useMemo.initialPage,
|
|
264
284
|
initialPageSize = _useMemo.initialPageSize,
|
|
265
285
|
initialSelectedItems = _useMemo.initialSelectedItems,
|
|
@@ -267,9 +287,9 @@ var WmList = function WmList(props) {
|
|
|
267
287
|
|
|
268
288
|
// ==================== PAGE RESTORE STATE ====================
|
|
269
289
|
// Store the restored page number until pagination state is ready
|
|
270
|
-
var
|
|
271
|
-
restoredPageNumber =
|
|
272
|
-
setRestoredPageNumber =
|
|
290
|
+
var _useState8 = (0, _react.useState)(null),
|
|
291
|
+
restoredPageNumber = _useState8[0],
|
|
292
|
+
setRestoredPageNumber = _useState8[1];
|
|
273
293
|
|
|
274
294
|
// ==================== DATA PROCESSING HOOKS ====================
|
|
275
295
|
// Process dataset with ordering and transformations
|
|
@@ -344,14 +364,11 @@ var WmList = function WmList(props) {
|
|
|
344
364
|
navigation: navigation,
|
|
345
365
|
onDemandCurrentPage: onDemandCurrentPage,
|
|
346
366
|
setOnDemandCurrentPage: setOnDemandCurrentPage,
|
|
347
|
-
isServerSidePagination: isServerSidePagination,
|
|
367
|
+
isServerSidePagination: isServerSidePagination(),
|
|
348
368
|
listener: listener,
|
|
349
369
|
name: name
|
|
350
370
|
});
|
|
351
371
|
|
|
352
|
-
// ==================== WIDGET METHODS ====================
|
|
353
|
-
var widgetMethods = (0, _listWidgetMethods.useListWidgetMethods)(items, listState, multiselect, onSelect, widgetInstance, listener, userInitiatedSelectionRef, name);
|
|
354
|
-
|
|
355
372
|
// ==================== STATE MANAGEMENT ====================
|
|
356
373
|
// Disable state management for On-Demand and Scroll navigation
|
|
357
374
|
var effectiveStateHandler = navigation === _constants.LIST_NAVIGATION_TYPES.ON_DEMAND || navigation === _constants.LIST_NAVIGATION_TYPES.SCROLL ? "none" : statehandler;
|
|
@@ -364,10 +381,37 @@ var WmList = function WmList(props) {
|
|
|
364
381
|
items: items,
|
|
365
382
|
initialActualPageSize: initialActualPageSize,
|
|
366
383
|
multiselect: multiselect,
|
|
367
|
-
isServerSidePagination: isServerSidePagination,
|
|
384
|
+
isServerSidePagination: isServerSidePagination(),
|
|
368
385
|
datasource: datasource
|
|
369
386
|
});
|
|
370
387
|
|
|
388
|
+
// ==================== EVENT HANDLER FUNCTIONS ====================
|
|
389
|
+
var handlePageSizeChange = function handlePageSizeChange(newPageSize) {
|
|
390
|
+
// Get the old page size BEFORE updating
|
|
391
|
+
var oldPageSize = paginationState.currentPageSize;
|
|
392
|
+
|
|
393
|
+
// Get current persisted state to access all selected items across pages
|
|
394
|
+
var currentPersistedState = (0, _listHelpers.getListState)(name, statehandler);
|
|
395
|
+
|
|
396
|
+
// Build the state for page size change
|
|
397
|
+
var newState = stateManager.getStateForPageSizeChange(newPageSize, currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.selectedItem, (currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.pagesize) || oldPageSize);
|
|
398
|
+
|
|
399
|
+
// Save the state BEFORE changing page size
|
|
400
|
+
(0, _listHelpers.saveListState)(name, statehandler, newState);
|
|
401
|
+
|
|
402
|
+
// Update datasource maxResults if datasource has paging capability (similar to Angular)
|
|
403
|
+
if (isServerSidePagination() && datasource && datasource.maxResults !== undefined) {
|
|
404
|
+
datasource.maxResults = newPageSize;
|
|
405
|
+
datasource.invoke({
|
|
406
|
+
page: 1,
|
|
407
|
+
size: newPageSize
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// ==================== WIDGET METHODS ====================
|
|
413
|
+
var widgetMethods = (0, _listWidgetMethods.useListWidgetMethods)(items, listState, multiselect, onSelect, widgetInstance, listener, userInitiatedSelectionRef, name, Widgets, paginationState.currentPageSize, setIsListCleared, handlePageSizeChange);
|
|
414
|
+
|
|
371
415
|
// ==================== ALL SIDE EFFECTS ====================
|
|
372
416
|
(0, _hooks.useListEffects)({
|
|
373
417
|
name: name,
|
|
@@ -411,36 +455,9 @@ var WmList = function WmList(props) {
|
|
|
411
455
|
|
|
412
456
|
// ==================== COMPUTED VALUES ====================
|
|
413
457
|
// Use datasource noDataFound if available, otherwise check safeDataset
|
|
414
|
-
var noDataFound = !safeDataset || safeDataset.length === 0;
|
|
458
|
+
var noDataFound = Boolean(listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 || (_listener$Widgets = _listener$Widgets[name]) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets.cleared) || !safeDataset || safeDataset.length === 0;
|
|
415
459
|
var itemsPerRowClass = (0, _listHelpers.getItemsPerRowClass)(itemsperrow, direction);
|
|
416
460
|
var textAlignClass = (0, _listHelpers.getTextAlignClass)(horizontalalign);
|
|
417
|
-
|
|
418
|
-
// ==================== EVENT HANDLER FUNCTIONS ====================
|
|
419
|
-
var handlePageSizeChange = function handlePageSizeChange(newPageSize) {
|
|
420
|
-
// Get the old page size BEFORE updating
|
|
421
|
-
var oldPageSize = paginationState.currentPageSize;
|
|
422
|
-
|
|
423
|
-
// Get current persisted state to access all selected items across pages
|
|
424
|
-
var currentPersistedState = (0, _listHelpers.getListState)(name, statehandler);
|
|
425
|
-
|
|
426
|
-
// Build the state for page size change
|
|
427
|
-
var newState = stateManager.getStateForPageSizeChange(newPageSize, currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.selectedItem, (currentPersistedState === null || currentPersistedState === void 0 ? void 0 : currentPersistedState.pagesize) || oldPageSize);
|
|
428
|
-
|
|
429
|
-
// Save the state BEFORE changing page size
|
|
430
|
-
(0, _listHelpers.saveListState)(name, statehandler, newState);
|
|
431
|
-
|
|
432
|
-
// Update datasource maxResults if datasource has paging capability (similar to Angular)
|
|
433
|
-
if (isServerSidePagination && datasource && datasource.maxResults !== undefined) {
|
|
434
|
-
datasource.maxResults = newPageSize;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// Update page size
|
|
438
|
-
paginationState.setCurrentPageSize(newPageSize);
|
|
439
|
-
|
|
440
|
-
// Reset to first page (similar to Angular behavior)
|
|
441
|
-
paginationState.setCurrentPage(1);
|
|
442
|
-
paginationState.setVisibleItems(newPageSize);
|
|
443
|
-
};
|
|
444
461
|
var showPaginationBasedOnVariableConfiguration = (0, _react.useMemo)(function () {
|
|
445
462
|
var _paginationState$pagi, _paginationState$pagi2, _paginationState$pagi3, _paginationState$pagi4;
|
|
446
463
|
// if dataset is from modal variable(means client side pagination, all records are loaded in the dataset on first load itself) then show pagination if records are greater than 5 records
|
|
@@ -457,7 +474,7 @@ var WmList = function WmList(props) {
|
|
|
457
474
|
if ((paginationState === null || paginationState === void 0 || (_paginationState$pagi = paginationState.paginationMeta) === null || _paginationState$pagi === void 0 ? void 0 : _paginationState$pagi.totalElements) === undefined || (paginationState === null || paginationState === void 0 || (_paginationState$pagi2 = paginationState.paginationMeta) === null || _paginationState$pagi2 === void 0 ? void 0 : _paginationState$pagi2.size) === undefined) {
|
|
458
475
|
return false;
|
|
459
476
|
}
|
|
460
|
-
return (paginationState === null || paginationState === void 0 || (_paginationState$pagi3 = paginationState.paginationMeta) === null || _paginationState$pagi3 === void 0 ? void 0 : _paginationState$pagi3.totalElements) > ((_paginationState$pagi4 = paginationState.paginationMeta) === null || _paginationState$pagi4 === void 0 ? void 0 : _paginationState$pagi4.size);
|
|
477
|
+
return (paginationState === null || paginationState === void 0 || (_paginationState$pagi3 = paginationState.paginationMeta) === null || _paginationState$pagi3 === void 0 ? void 0 : _paginationState$pagi3.totalElements) > ((_paginationState$pagi4 = paginationState.paginationMeta) === null || _paginationState$pagi4 === void 0 ? void 0 : _paginationState$pagi4.size) || !!allowpagesizechange;
|
|
461
478
|
}, [paginationState === null || paginationState === void 0 || (_paginationState$pagi5 = paginationState.paginationMeta) === null || _paginationState$pagi5 === void 0 ? void 0 : _paginationState$pagi5.totalElements, paginationState === null || paginationState === void 0 || (_paginationState$pagi6 = paginationState.paginationMeta) === null || _paginationState$pagi6 === void 0 ? void 0 : _paginationState$pagi6.size, isDatasetFromModalVariable, paginationState === null || paginationState === void 0 ? void 0 : paginationState.totalItems]);
|
|
462
479
|
|
|
463
480
|
// check if dataset is from modal variable
|
|
@@ -486,12 +503,14 @@ var WmList = function WmList(props) {
|
|
|
486
503
|
|
|
487
504
|
// ==================== RENDER ====================
|
|
488
505
|
return __jsx(_Box["default"], {
|
|
489
|
-
className: (0, _clsx["default"])(_constants.DEFAULT_CLS,
|
|
506
|
+
className: (0, _clsx["default"])(_constants.DEFAULT_CLS, className),
|
|
490
507
|
sx: _objectSpread(_objectSpread({}, styles), {}, {
|
|
491
508
|
height: "".concat(height, " !important"),
|
|
492
509
|
width: "".concat(width, " !important"),
|
|
493
510
|
overflow: "inherit !important",
|
|
494
511
|
position: "relative"
|
|
512
|
+
}, hidden && {
|
|
513
|
+
display: "none !important"
|
|
495
514
|
}),
|
|
496
515
|
component: "div",
|
|
497
516
|
"data-name": name,
|
|
@@ -578,7 +597,7 @@ var WmList = function WmList(props) {
|
|
|
578
597
|
rawDataset: safeDataset,
|
|
579
598
|
datasource: datasource,
|
|
580
599
|
totalItems: paginationState.totalItems,
|
|
581
|
-
isServerSidePagination: isServerSidePagination,
|
|
600
|
+
isServerSidePagination: isServerSidePagination(),
|
|
582
601
|
showNavigation: showNavigation
|
|
583
602
|
})), showPaginationBasedOnVariableConfiguration && showNavigation && navigation && navigation !== _constants.LIST_NAVIGATION_TYPES.INLINE && navigation !== _constants.LIST_NAVIGATION_TYPES.ON_DEMAND && navigation !== _constants.LIST_NAVIGATION_TYPES.NONE && __jsx(_Box["default"], {
|
|
584
603
|
component: "div",
|
|
@@ -606,7 +625,7 @@ var WmList = function WmList(props) {
|
|
|
606
625
|
datasource: datasource,
|
|
607
626
|
isLoadingMore: listState.isLoadingMore,
|
|
608
627
|
setIsLoadingMore: listState.setIsLoadingMore,
|
|
609
|
-
isServerSidePagination: isServerSidePagination
|
|
628
|
+
isServerSidePagination: isServerSidePagination()
|
|
610
629
|
}))));
|
|
611
630
|
};
|
|
612
631
|
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmList);
|
|
@@ -128,44 +128,82 @@ var getAllDescendants = function getAllDescendants(element) {
|
|
|
128
128
|
traverse(element);
|
|
129
129
|
return all;
|
|
130
130
|
};
|
|
131
|
-
var getSelectedItemWidgets = exports.getSelectedItemWidgets = function getSelectedItemWidgets(event, listener, name) {
|
|
131
|
+
var getSelectedItemWidgets = exports.getSelectedItemWidgets = function getSelectedItemWidgets(event, listener, name, item, Widgets) {
|
|
132
|
+
var _item$_wmListItemId, _item$_wmListItemId$t;
|
|
132
133
|
var listItem = null;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
var lastItemId = null;
|
|
135
|
+
var id = item === null || item === void 0 || (_item$_wmListItemId = item._wmListItemId) === null || _item$_wmListItemId === void 0 || (_item$_wmListItemId$t = _item$_wmListItemId.toString) === null || _item$_wmListItemId$t === void 0 ? void 0 : _item$_wmListItemId$t.call(_item$_wmListItemId).split("_").pop();
|
|
136
|
+
|
|
137
|
+
// if (event) {
|
|
138
|
+
// // Manual selection - get from event
|
|
139
|
+
// listItem = event.currentTarget;
|
|
140
|
+
// } else {
|
|
141
|
+
// // Programmatic selection - find active item in DOM
|
|
142
|
+
// const activeItems = document.querySelectorAll(`[data-name="${name}"] .app-list-item.active`);
|
|
143
|
+
// if (activeItems.length > 0) {
|
|
144
|
+
// // Get the last active item (most recently selected)
|
|
145
|
+
// listItem = activeItems[activeItems.length - 1];
|
|
146
|
+
// }
|
|
147
|
+
// }
|
|
148
|
+
|
|
149
|
+
// const componentElements = listItem ? getAllDescendants(listItem) : [];
|
|
150
|
+
|
|
151
|
+
// const currentItemWidgets = componentElements.reduce((result: any, comp: any) => {
|
|
152
|
+
// // Try different attributes to get widget name
|
|
153
|
+
|
|
154
|
+
// const itemId = comp.getAttribute("item-id");
|
|
155
|
+
// const widgetName = comp.getAttribute("name");
|
|
156
|
+
|
|
157
|
+
// if (itemId) {
|
|
158
|
+
// lastItemId = itemId;
|
|
159
|
+
// result[widgetName] = Widgets?.[itemId] || {};
|
|
160
|
+
// return result;
|
|
161
|
+
// } else if (lastItemId) {
|
|
162
|
+
// const extractIndexFromItemId = (itemId: string): number | null => {
|
|
163
|
+
// const match = itemId.match(/^repeat_item_(\d+)_/);
|
|
164
|
+
// return match ? parseInt(match[1], 10) : null;
|
|
165
|
+
// };
|
|
166
|
+
// const index = extractIndexFromItemId(lastItemId);
|
|
167
|
+
// if (index !== null) {
|
|
168
|
+
// result[widgetName] = Widgets?.[`repeat_item_${index}_${widgetName}`] || {};
|
|
169
|
+
// }
|
|
170
|
+
// return result;
|
|
171
|
+
// }
|
|
172
|
+
|
|
173
|
+
// if (widgetName) {
|
|
174
|
+
// // Try to get the widget instance from the component or create a reference
|
|
175
|
+
// let widgetInstance = comp.widget;
|
|
176
|
+
|
|
177
|
+
// if (!widgetInstance) {
|
|
178
|
+
// // Create a basic widget reference with properties from the DOM element
|
|
179
|
+
// widgetInstance = {
|
|
180
|
+
// name: widgetName,
|
|
181
|
+
// caption: comp.getAttribute("caption") || comp.textContent || "",
|
|
182
|
+
// value: comp.value || comp.getAttribute("value") || "",
|
|
183
|
+
// // Add other common properties
|
|
184
|
+
// show: comp.getAttribute("show") !== "false",
|
|
185
|
+
// element: comp,
|
|
186
|
+
// };
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// result[widgetName] = widgetInstance;
|
|
190
|
+
// }
|
|
191
|
+
// return result;
|
|
192
|
+
// }, {});
|
|
193
|
+
|
|
194
|
+
var currentItemWidgets = {};
|
|
195
|
+
if (id) {
|
|
196
|
+
Widgets && Object.keys(Widgets).filter(function (key) {
|
|
197
|
+
return key.startsWith("".concat(name, "_").concat(id, "_"));
|
|
198
|
+
}).forEach(function (key) {
|
|
199
|
+
currentItemWidgets[Widgets[key].name] = Widgets[key];
|
|
200
|
+
});
|
|
143
201
|
}
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
// Try different attributes to get widget name
|
|
147
|
-
var widgetName = comp.getAttribute("name");
|
|
148
|
-
if (widgetName) {
|
|
149
|
-
// Try to get the widget instance from the component or create a reference
|
|
150
|
-
var widgetInstance = comp.widget;
|
|
151
|
-
if (!widgetInstance) {
|
|
152
|
-
// Create a basic widget reference with properties from the DOM element
|
|
153
|
-
widgetInstance = {
|
|
154
|
-
name: widgetName,
|
|
155
|
-
caption: comp.getAttribute("caption") || comp.textContent || "",
|
|
156
|
-
value: comp.value || comp.getAttribute("value") || "",
|
|
157
|
-
// Add other common properties
|
|
158
|
-
show: comp.getAttribute("show") !== "false",
|
|
159
|
-
element: comp
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
result[widgetName] = widgetInstance;
|
|
163
|
-
}
|
|
164
|
-
return result;
|
|
165
|
-
}, {});
|
|
166
|
-
if (listener) {
|
|
202
|
+
var currentItem = currentItemWidgets;
|
|
203
|
+
if (listener && currentItem && Object.keys(currentItem).length > 0) {
|
|
167
204
|
listener.onChange(name, {
|
|
168
|
-
selectedItemWidgets:
|
|
205
|
+
selectedItemWidgets: currentItem,
|
|
206
|
+
selecteditem: item
|
|
169
207
|
});
|
|
170
208
|
}
|
|
171
209
|
};
|